Skip to content

Commit

Permalink
Merge pull request #2 from garg3133/bs-app-upload
Browse files Browse the repository at this point in the history
Use inbuilt functionality to upload app to BrowserStack.
  • Loading branch information
Yatin2108 committed Apr 19, 2023
2 parents 3dc6a56 + f6c2308 commit e60c140
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 33 deletions.
16 changes: 3 additions & 13 deletions README.md
Expand Up @@ -15,27 +15,17 @@
export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
```

- Upload the apps provided in resources folder using this command
```
curl -u "<username>:<access-key>" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/app/file/application-debug.apk"
```
- Please note the value of app_url in the API response and set the app capbility in the `nightwatch.conf.js`, `nightwatch-local.conf.js` and `nightwatch-suite.conf.js` in conf folder for the respective apps.
* android_app_url in `browserstack.android_01` and `browserstack.android_02` capability set in nightwatch-suite.conf.js
* android_app_url in `browserstack.android_01` capability set in nightwatch.conf.js
* ios_app_url in `browserstack.ios_01` capability set in nightwatch.conf.js
* android_local_app_url in `browserstack.local_01` and `browserstack.local_02` capability set in nightwatch-local.conf.js
- Please go through [this](https://www.browserstack.com/docs/app-automate/appium/upload-app-from-filesystem) documentation for better understanding.

## Running your tests

- To run a single android test, run `npm run single-android`
- To run a single ios test, run `npm run single-ios`
- To run local tests, run `npm run local`

Please run the above tests once before running parallel tests, so that the apps can be uploaded on the respective [custom id](https://www.browserstack.com/docs/app-automate/appium/upload-app-define-custom-id).
- To run parallel tests, run `npm run parallel`
- To run parallel tests on different devices, run `npm run parallel-devices`
- To run test suite, run `npm run suite`
- To run local tests, run `npm run local`
- To run parallel local tests, run `npm run parallel-local`


Expand Down
27 changes: 15 additions & 12 deletions resources/config/nightwatch-local.conf.js
Expand Up @@ -48,24 +48,27 @@ const nightwatchConfigs = {
browserName: null,
'appium:options': {
automationName: 'UiAutomator2',
app: 'bs://<android_local_app_url>',
// custom id for the uploaded app: https://www.browserstack.com/docs/app-automate/appium/upload-app-define-custom-id
app: 'bs_sample_android_local_app',
platformVersion: '9.0',
deviceName: 'Google Pixel 3'
}
},
appUploadPath: 'apps/android_local_app.apk'
}
},
"browserstack.local_02": {
extends: 'browserstack',
'desiredCapabilities': {
browserName: null,
'appium:options': {
automationName: 'UiAutomator2',
app: 'bs://<android_local_app_url>',
platformVersion: '9.0',
deviceName: 'Samsung Galaxy S10'
}
extends: 'browserstack',
'desiredCapabilities': {
browserName: null,
'appium:options': {
automationName: 'UiAutomator2',
// custom id for the uploaded app: https://www.browserstack.com/docs/app-automate/appium/upload-app-define-custom-id
app: 'bs_sample_android_local_app',
platformVersion: '9.0',
deviceName: 'Samsung Galaxy S10'
}
},
}
},
}
}

Expand Down
6 changes: 4 additions & 2 deletions resources/config/nightwatch-suite.conf.js
Expand Up @@ -46,7 +46,8 @@ const nightwatchConfigs = {
browserName: null,
'appium:options': {
automationName: 'UiAutomator2',
app: 'bs://<android_app_url>',
// custom id for the uploaded app: https://www.browserstack.com/docs/app-automate/appium/upload-app-define-custom-id
app: 'bs_sample_android_app',
platformVersion: '11.0',
deviceName: 'Google Pixel 5'
}
Expand All @@ -58,7 +59,8 @@ const nightwatchConfigs = {
browserName: null,
'appium:options': {
automationName: 'UiAutomator2',
app: 'bs://<android_app_url>',
// custom id for the uploaded app: https://www.browserstack.com/docs/app-automate/appium/upload-app-define-custom-id
app: 'bs_sample_android_app',
platformVersion: '11.0',
deviceName: 'Google Pixel 4'
}
Expand Down
14 changes: 8 additions & 6 deletions resources/config/nightwatch.conf.js
Expand Up @@ -33,19 +33,19 @@ const nightwatchConfigs = {
browserstack: {
...browserStack
},



"browserstack.android_01": {
extends: 'browserstack',
'desiredCapabilities': {
browserName: null,
'appium:options': {
automationName: 'UiAutomator2',
app: 'bs://<android_app_url>',
// custom id for the uploaded app: https://www.browserstack.com/docs/app-automate/appium/upload-app-define-custom-id
app: 'bs_sample_android_app',
platformVersion: '11.0',
deviceName: 'Google Pixel 5'
}
},
appUploadPath: 'apps/android_app.apk'
}
},

Expand All @@ -55,10 +55,12 @@ const nightwatchConfigs = {
browserName: null,
'appium:options': {
automationName: 'XCUITest',
app: 'bs://<ios_app_url>',
// custom id for the uploaded app: https://www.browserstack.com/docs/app-automate/appium/upload-app-define-custom-id
app: 'bs_sample_ios_app',
platformVersion: '16',
deviceName: 'iPhone 14'
}
},
appUploadPath: 'apps/ios_app.ipa'
}
},
}
Expand Down

0 comments on commit e60c140

Please sign in to comment.