Skip to content

Commit 7feea6b

Browse files
authored
fix(browserstack): issue with vendor prefix (#3845)
1 parent 30fa1e9 commit 7feea6b

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

docs/helpers/Appium.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,43 @@ helpers: {
9999
}
100100
```
101101

102+
Example Android App using Appiumv2 on BrowserStack:
103+
104+
```js
105+
{
106+
helpers: {
107+
Appium: {
108+
appiumV2: true,
109+
host: "hub-cloud.browserstack.com",
110+
port: 4444,
111+
user: process.env.BROWSERSTACK_USER,
112+
key: process.env.BROWSERSTACK_KEY,
113+
app: `bs://c700ce60cf1gjhgjh3ae8ed9770ghjg5a55b8e022f13c5827cg`,
114+
browser: '',
115+
desiredCapabilities: {
116+
'appPackage': data.packageName,
117+
'deviceName': process.env.DEVICE || 'Google Pixel 3',
118+
'platformName': process.env.PLATFORM || 'android',
119+
'platformVersion': process.env.OS_VERSION || '10.0',
120+
'automationName': process.env.ENGINE || 'UIAutomator2',
121+
'newCommandTimeout': 300000,
122+
'androidDeviceReadyTimeout': 300000,
123+
'androidInstallTimeout': 90000,
124+
'appWaitDuration': 300000,
125+
'autoGrantPermissions': true,
126+
'gpsEnabled': true,
127+
'isHeadless': false,
128+
'noReset': false,
129+
'noSign': true,
130+
'bstack:options' : {
131+
"appiumVersion" : "2.0.1",
132+
},
133+
}
134+
}
135+
}
136+
}
137+
```
138+
102139
Additional configuration params can be used from [https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md][4]
103140

104141
## Access From Helpers

lib/helper/Appium.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,43 @@ const vendorPrefix = {
117117
* }
118118
* ```
119119
*
120+
* Example Android App using Appiumv2 on BrowserStack:
121+
*
122+
* ```js
123+
* {
124+
* helpers: {
125+
* Appium: {
126+
* appiumV2: true,
127+
* host: "hub-cloud.browserstack.com",
128+
* port: 4444,
129+
* user: process.env.BROWSERSTACK_USER,
130+
* key: process.env.BROWSERSTACK_KEY,
131+
* app: `bs://c700ce60cf1gjhgjh3ae8ed9770ghjg5a55b8e022f13c5827cg`,
132+
* browser: '',
133+
* desiredCapabilities: {
134+
* 'appPackage': data.packageName,
135+
* 'deviceName': process.env.DEVICE || 'Google Pixel 3',
136+
* 'platformName': process.env.PLATFORM || 'android',
137+
* 'platformVersion': process.env.OS_VERSION || '10.0',
138+
* 'automationName': process.env.ENGINE || 'UIAutomator2',
139+
* 'newCommandTimeout': 300000,
140+
* 'androidDeviceReadyTimeout': 300000,
141+
* 'androidInstallTimeout': 90000,
142+
* 'appWaitDuration': 300000,
143+
* 'autoGrantPermissions': true,
144+
* 'gpsEnabled': true,
145+
* 'isHeadless': false,
146+
* 'noReset': false,
147+
* 'noSign': true,
148+
* 'bstack:options' : {
149+
* "appiumVersion" : "2.0.1",
150+
* },
151+
* }
152+
* }
153+
* }
154+
* }
155+
* ```
156+
*
120157
* Additional configuration params can be used from <https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md>
121158
*
122159
* ## Access From Helpers
@@ -234,7 +271,9 @@ class Appium extends Webdriver {
234271
const _convertedCaps = {};
235272
for (const [key, value] of Object.entries(capabilities)) {
236273
if (!key.startsWith(vendorPrefix.appium)) {
237-
_convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
274+
if (key !== 'platformName') {
275+
_convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
276+
}
238277
} else {
239278
_convertedCaps[`${key}`] = value;
240279
}

0 commit comments

Comments
 (0)