Skip to content

Commit

Permalink
feat: add headspin in the cloud config (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa authored Dec 27, 2023
1 parent c4f4472 commit aa8d226
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ CLOUD_KEY="apiKey" CLOUD_USERNAME="useremail" appium server -ka 800 --use-plugin
```
Make sure all `appiumVersion: 2.0` in your capabilities.
Refer on LambdaTest config [here](https://github.com/AppiumTestDistribution/appium-device-farm/blob/main/serverConfig/lt-config.json)


### HeadSpin

```
appium server -ka 800 --use-plugins=device-farm --config ./serverConfig/hs-config.json
```
Refer on HeadSpin config [here](https://github.com/AppiumTestDistribution/appium-device-farm/blob/main/serverConfig/hs-config.json).
21 changes: 21 additions & 0 deletions serverConfig/hs-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"server": {
"port": 31337,
"plugin": {
"device-farm": {
"platform": "android",
"cloud": {
"cloudName": "headspin",
"url": "https://appium-canary.headspin.io/v0/api-token/wd/hub",
"devices": [
{
"platformVersion": "12",
"deviceName": "android",
"platform": "android"
}
]
}
}
}
}
}
6 changes: 5 additions & 1 deletion src/device-managers/cloud/Devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class Devices {
udid: d.deviceName,
};
}
if (this.isSauceLabs() || this.isLambdaTest()) {
if (this.isSauceLabs() || this.isLambdaTest() || this.isHeadSpin()) {
this.validateSchema(sauceOrLambdaSchema);
cloudDeviceProperties = {
name: d.deviceName,
Expand Down Expand Up @@ -89,4 +89,8 @@ export default class Devices {
private isSauceLabs() {
return this.cloud.cloudName.toLowerCase() === Cloud.SAUCELABS;
}

private isHeadSpin() {
return this.cloud.cloudName.toLowerCase() === Cloud.HEADSPIN;
}
}
1 change: 1 addition & 0 deletions src/enums/Cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum Cloud {
PCLOUDY = 'pcloudy',
SAUCELABS = 'sauce',
LAMBDATEST = 'lambdatest',
HEADSPIN = 'headspin',
}

export default Cloud;
2 changes: 2 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export function nodeUrl(device: IDevice, basePath = ''): string {
if (device.hasOwnProperty('cloud')) {
if (device.cloud.toLowerCase() === Cloud.PCLOUDY) {
return `${host}/wd/hub`;
} else if (device.cloud.toLowerCase() === Cloud.HEADSPIN) {
return `${host}`;
} else {
return `https://${process.env.CLOUD_USERNAME}:${process.env.CLOUD_KEY}@${
new URL(device.host).host
Expand Down

0 comments on commit aa8d226

Please sign in to comment.