Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add w3c support #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This repository demonstrates how to run Appium NodeJS tests on BrowserStack App Automate.

## Based on

These code samples are currently based on:

- **Wd:** `1.14.0`
- **Protocol:** `W3C`
## Setup

### Requirements
Expand Down Expand Up @@ -84,7 +90,7 @@ Open `BrowserStackSampleLocal.js` file in `Android` or in `ios` folder

- Set the device and OS version

- Ensure that `browserstack.local` capability is set to `true`. Within the test script, there is code snippet that automatically establishes Local Testing connection to BrowserStack servers using Javascript binding for BrowserStack Local.
- Ensure that `local` capability is set to `true`. Within the test script, there is code snippet that automatically establishes Local Testing connection to BrowserStack servers using Javascript binding for BrowserStack Local.

- If you have uploaded your own app update the test case

Expand Down
27 changes: 15 additions & 12 deletions android/BrowserStackSample.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,29 @@ let assert = require('assert');
let asserters = wd.asserters;

desiredCaps = {
// Set your BrowserStack access credentials
'browserstack.user' : 'YOUR_USERNAME',
'browserstack.key' : 'YOUR_ACCESS_KEY',

// Set URL of the application under test
'app' : 'bs://<app-id>',
"forceW3C": true,

// Specify device and os_version for testing
'device' : 'Google Pixel 3',
'os_version' : '9.0',
"platformName": "Android",
"appium:platformVersion": "9.0",
"appium:deviceName": 'Google Pixel 3',

// Set URL of the application under test
"appium:app": 'bs://<app-id>',
// Set other BrowserStack capabilities
'project' : 'First NodeJS project',
'build' : 'Node Android',
'name': 'first_test'
'bstack:options' : {
"projectName" : "First NodeJS Android Project",
"buildName" : "browserstack-build-1",
"sessionName" : "BStack first_test",
"debug" : "true",
"userName" : "YOUR_USERNAME",
"accessKey" : "YOUR_ACCESS_KEY"
}
};

// Initialize the remote Webdriver using BrowserStack remote URL
// and desired capabilities defined above
driver = wd.promiseRemote("http://hub-cloud.browserstack.com/wd/hub");
driver = wd.promiseRemote("http://hub.browserstack.com/wd/hub");

// Test case for the BrowserStack sample Android app.
// If you have uploaded your app, update the test case here.
Expand Down
37 changes: 19 additions & 18 deletions android/BrowserStackSampleLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@ let Q = wd.Q;
let browserstack = require('browserstack-local');

// Set your BrowserStack access credentials
let userName = 'YOUR_USERNAME'
let userName = "YOUR_USERNAME"
let accessKey = "YOUR_ACCESS_KEY"

desiredCaps = {
'browserstack.user' : userName,
'browserstack.key' : accessKey,
"forceW3C": true,

// Set URL of the application under test
'app' : 'bs://<app-id>',
// Specify device and os_version for testing
"platformName": "Android",
"appium:platformVersion": "9.0",
"appium:deviceName": 'Google Pixel 3',

// Specify device and os_version for testing
'device' : 'Google Pixel 3',
'os_version' : '9.0',

//Set browserstack.local capability as true
'browserstack.local' : true,

// Set other BrowserStack capabilities
'project' : 'First NodeJS project',
'build' : 'Node Android Local',
'name': 'local_test',
'browserstack.debug' : true,
// Set URL of the application under test
"appium:app": 'bs://<app-id>',
// Set other BrowserStack capabilities
'bstack:options' : {
"projectName" : "First NodeJS Android Project",
"buildName" : "browserstack-build-1",
"sessionName" : "BStack local_test",
"debug" : "true",
"local" : "true",
"userName" : userName,
"accessKey" : accessKey
}
};

let promise = new Promise(function(resolve, reject) {
Expand All @@ -42,7 +43,7 @@ let promise = new Promise(function(resolve, reject) {
promise.then(function() {
// Initialize the remote Webdriver using BrowserStack remote URL
// and desired capabilities defined above
driver = wd.promiseRemote("http://hub-cloud.browserstack.com/wd/hub");
driver = wd.promiseRemote("http://hub.browserstack.com/wd/hub");

// Test case for the BrowserStack sample Android Local app.
// If you have uploaded your app, update the test case here.
Expand Down
31 changes: 17 additions & 14 deletions ios/BrowserStackSample.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@ let asserters = wd.asserters;
let Q = wd.Q;

desiredCaps = {
// Set your BrowserStack access credentials
'browserstack.user' : 'YOUR_USERNAME',
'browserstack.key' : 'YOUR_ACCESS_KEY',
"forceW3C": true,

// Set URL of the application under test
'app' : 'bs://<app-id>',

// Specify device and os_version for testing
'device' : 'iPhone 11 Pro',
'os_version' : '13',
// Specify device and os_version for testing
"platformName": "ios",
"appium:platformVersion": "13",
"appium:deviceName": 'iPhone 11 Pro',

// Set other BrowserStack capabilities
'project' : 'First NodeJS project',
'build' : 'Node iOS',
'name': 'first_test'
// Set URL of the application under test
"appium:app": 'bs://<app-id>',
// Set other BrowserStack capabilities
'bstack:options' : {
"projectName" : "First NodeJS iOS Project",
"buildName" : "browserstack-build-1",
"sessionName" : "BStack first_test",
"debug" : "true",
"userName" : "YOUR_USERNAME",
"accessKey" : "YOUR_ACCESS_KEY"
}
};

// Initialize the remote Webdriver using BrowserStack remote URL
// and desired capabilities defined above
driver = wd.promiseRemote("http://hub-cloud.browserstack.com/wd/hub");
driver = wd.promiseRemote("http://hub.browserstack.com/wd/hub");

// Test case for the BrowserStack sample iOS app.
// If you have uploaded your app, update the test case here.
Expand Down
37 changes: 19 additions & 18 deletions ios/BrowserStackSampleLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@ let userName = 'YOUR_USERNAME'
let accessKey = "YOUR_ACCESS_KEY"

desiredCaps = {
'browserstack.user' : userName,
'browserstack.key' : accessKey,

// Set URL of the application under test
'app' : 'bs://<app-id>',

// Specify device and os_version for testingg
'device' : 'iPhone 11 Pro',
'os_version' : '13',

//Set browserstack.local capability as true
'browserstack.local' : true,

"forceW3C": true,

// Specify device and os_version for testing
"platformName": "ios",
"appium:platformVersion": "12",
"appium:deviceName": 'iPhone XS',

// Set URL of the application under test
"appium:app": 'bs://<app-id>',
// Set other BrowserStack capabilities
'project' : 'First NodeJS project',
'build' : 'Node iOS Local',
'name': 'local_test',
'browserstack.debug' : true,
'bstack:options' : {
"projectName" : "First NodeJS iOS Project",
"buildName" : "browserstack-build-1",
"sessionName" : "BStack local_test",
"debug" : "true",
"local" : "true",
"userName" : userName,
"accessKey" : accessKey
}
};

let promise = new Promise(function(resolve, reject) {
Expand All @@ -48,7 +49,7 @@ let promise = new Promise(function(resolve, reject) {
promise.then(function() {
// Initialize the remote Webdriver using BrowserStack remote URL
// and desired capabilities defined above
driver = wd.promiseRemote("http://hub-cloud.browserstack.com/wd/hub");
driver = wd.promiseRemote("http://hub.browserstack.com/wd/hub");

// Test case for the BrowserStack sample iOS Local app.
// If you have uploaded your app, update the test case here.
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "node-appium-app-browserstack",
"version": "0.1.0",
"readme": "NodeJS Integration with [BrowserStack](https://www.browserstack.com)",
"description": "Appium iOS examples for NodeJS and BrowserStack App Automate",
"description": "Appium iOS and Android examples for NodeJS and BrowserStack App Automate",
"repository": {
"type": "git",
"url": "git+https://github.com/browserstack/node-appium-app-browserstack.git"
Expand All @@ -17,9 +17,9 @@
},
"homepage": "https://github.com/browserstack/node-appium-app-browserstack#readme",
"dependencies": {
"browserstack-local": "^1.0.2",
"wd": "^1.13.0",
"chai": "^4.2.0",
"browserstack-local": "^1.1.1",
"wd": "^1.14.0",
"chai": "^4.3.6",
"chai-as-promised": "7.1.1"
},
"engines": {
Expand Down