Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/browserstack.err
/local.log
/node_modules
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# node-js-selenium-browserstack

## prerequisite
Nodejs installed on your system <br>
https://nodejs.org/en/

## Steps
<b>Step-1</b><br>
Clone the repo, go to the cloned directory and install the dependencies with commands: <br/>
```
git clone -b selenium-4 https://github.com/browserstack/node-js-selenium-browserstack.git
cd node-js-selenium-browserstack
npm install
```

<b>Step-2</b><br>
Configure the capabilities and swap your credentials. <br/>
1. navigate to `/conf.js`
2. Change the OS or browser if you want.
3. Use your BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY from the dashboard.

<b>Step-3</b><br>
Run the test and see the session on the browserstack dashboard. <br/>
Follow step-2 then,

To run a single test session:
```
npm run single
```
---
To run a local test session:
also provide the access key to bs_local_args
```javascript
// replace <browserstack-accesskey> with your key.
var bs_local_args = { 'key': ACCESS_KEY };
```

```
npm run local
```
---
To run a parallel test session:
```
npm run parallel
```
74 changes: 74 additions & 0 deletions conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
exports.hubURL = "https://hub.browserstack.com/wd/hub"

const userCredentials = {
"userName": process.env["BROWSERSTACK_USERNAME"] || "YOUR_USERNAME",
"accessKey": process.env["BROWSERSTACK_ACCESS_KEY"] || "YOUR_ACCESS_KEY"
}

exports.singleTestCapabilities = {
'bstack:options': {
"os": "OS X",
"osVersion": "Sierra",
"buildName": "browserstack-build-1",
"sessionName": "Selenium-4 Nodejs snippet test",
"local": "false",
"seleniumVersion": "4.0.0",
...userCredentials,
},
"browserName": "Chrome",
"browserVersion": "latest",
}

exports.localTestCapabilities = {
'bstack:options': {
"os": "OS X",
"osVersion": "Sierra",
"buildName": "browserstack-build-1",
"sessionName": "Selenium-4 Nodejs snippet test",
"local": "true",
"seleniumVersion": "4.0.0",
...userCredentials
},
"browserName": "Chrome",
"browserVersion": "latest",
}

const parallelTestBaseCapability = {
"buildName": "browserstack-build-1",
"local": "false",
"seleniumVersion": "4.0.0",
...userCredentials
};

exports.parallelTestCapabilities = [
{
'bstack:options': {
"os": "OS X",
"osVersion": "Sierra",
"sessionName": "Selenium-4 Nodejs snippet test",
...parallelTestBaseCapability
},
"browserName": "Chrome",
"browserVersion": "latest",
},
{
'bstack:options': {
"os": "OS X",
"osVersion": "Sierra",
"sessionName": "Selenium-4 Nodejs snippet test",
...parallelTestBaseCapability
},
"browserName": "Safari",
"browserVersion": "latest",
},
{
'bstack:options': {
"os": "windows",
"osVersion": "11",
"sessionName": "Selenium-4 Nodejs snippet test",
...parallelTestBaseCapability
},
"browserName": "Chrome",
"browserVersion": "latest",
},
];
Loading