Skip to content

Commit

Permalink
fix(browserstack): issue with vendor prefix (#3845)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent authored Sep 15, 2023
1 parent 30fa1e9 commit 7feea6b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
37 changes: 37 additions & 0 deletions docs/helpers/Appium.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,43 @@ helpers: {
}
```

Example Android App using Appiumv2 on BrowserStack:

```js
{
helpers: {
Appium: {
appiumV2: true,
host: "hub-cloud.browserstack.com",
port: 4444,
user: process.env.BROWSERSTACK_USER,
key: process.env.BROWSERSTACK_KEY,
app: `bs://c700ce60cf1gjhgjh3ae8ed9770ghjg5a55b8e022f13c5827cg`,
browser: '',
desiredCapabilities: {
'appPackage': data.packageName,
'deviceName': process.env.DEVICE || 'Google Pixel 3',
'platformName': process.env.PLATFORM || 'android',
'platformVersion': process.env.OS_VERSION || '10.0',
'automationName': process.env.ENGINE || 'UIAutomator2',
'newCommandTimeout': 300000,
'androidDeviceReadyTimeout': 300000,
'androidInstallTimeout': 90000,
'appWaitDuration': 300000,
'autoGrantPermissions': true,
'gpsEnabled': true,
'isHeadless': false,
'noReset': false,
'noSign': true,
'bstack:options' : {
"appiumVersion" : "2.0.1",
},
}
}
}
}
```

Additional configuration params can be used from [https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md][4]

## Access From Helpers
Expand Down
41 changes: 40 additions & 1 deletion lib/helper/Appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,43 @@ const vendorPrefix = {
* }
* ```
*
* Example Android App using Appiumv2 on BrowserStack:
*
* ```js
* {
* helpers: {
* Appium: {
* appiumV2: true,
* host: "hub-cloud.browserstack.com",
* port: 4444,
* user: process.env.BROWSERSTACK_USER,
* key: process.env.BROWSERSTACK_KEY,
* app: `bs://c700ce60cf1gjhgjh3ae8ed9770ghjg5a55b8e022f13c5827cg`,
* browser: '',
* desiredCapabilities: {
* 'appPackage': data.packageName,
* 'deviceName': process.env.DEVICE || 'Google Pixel 3',
* 'platformName': process.env.PLATFORM || 'android',
* 'platformVersion': process.env.OS_VERSION || '10.0',
* 'automationName': process.env.ENGINE || 'UIAutomator2',
* 'newCommandTimeout': 300000,
* 'androidDeviceReadyTimeout': 300000,
* 'androidInstallTimeout': 90000,
* 'appWaitDuration': 300000,
* 'autoGrantPermissions': true,
* 'gpsEnabled': true,
* 'isHeadless': false,
* 'noReset': false,
* 'noSign': true,
* 'bstack:options' : {
* "appiumVersion" : "2.0.1",
* },
* }
* }
* }
* }
* ```
*
* Additional configuration params can be used from <https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md>
*
* ## Access From Helpers
Expand Down Expand Up @@ -234,7 +271,9 @@ class Appium extends Webdriver {
const _convertedCaps = {};
for (const [key, value] of Object.entries(capabilities)) {
if (!key.startsWith(vendorPrefix.appium)) {
_convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
if (key !== 'platformName') {
_convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
}
} else {
_convertedCaps[`${key}`] = value;
}
Expand Down

0 comments on commit 7feea6b

Please sign in to comment.