Skip to content

Commit 95bc56d

Browse files
committed
adding nemo/browserstack example
1 parent 3c08ca8 commit 95bc56d

File tree

5 files changed

+103
-0
lines changed

5 files changed

+103
-0
lines changed

nemo/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Example usage of nemo automation framework + browserstack
2+
3+
Install dependencies from within this directory `npm install`
4+
5+
## Run against a local browser
6+
7+
```shell
8+
$ node nemo.js
9+
```
10+
11+
## Run in the browserstack cloud
12+
13+
Set browserstack environment variables as in the below shell example
14+
15+
```shell
16+
$ export BSTK_USER=myusername1
17+
$ export BSTK_KEY=aa4235ssdda
18+
$ export BSTK_BROWSER=chrome
19+
$ export BSTK_VERSION=22.0
20+
```
21+
22+
Run node command with NODE_ENV=browserstack to engage the `browserstack.json` override
23+
24+
```shell
25+
$ NODE_ENV=browserstack node nemo.js
26+
```
27+
28+
## For more information on nemo
29+
30+
Go to https://nemo.js.org

nemo/config/browserstack.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"driver": {
3+
"builders": {
4+
"usingServer": ["http://hub.browserstack.com/wd/hub"],
5+
"withCapabilities": [{
6+
"browserName": "env:BSTK_BROWSER",
7+
"browserstack.user": "env:BSTK_USER",
8+
"browserstack.key": "env:BSTK_KEY",
9+
"version": "env:BSTK_VERSION"
10+
}]
11+
}
12+
}
13+
}

nemo/config/config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"driver": {
3+
"builders": {
4+
"withCapabilities": [{
5+
"browserName": "firefox"
6+
}]
7+
}
8+
},
9+
"plugins": {
10+
"view": {
11+
"module": "nemo-view",
12+
"arguments": ["path:locator"]
13+
}
14+
},
15+
"data": {
16+
"baseUrl": "https://www.paypal.com"
17+
}
18+
}

nemo/nemo.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
var Nemo = require('nemo');
2+
var nemo = Nemo(__dirname, function (err) {
3+
//always check for errors!
4+
if (!!err) {
5+
return console.error('Error during Nemo setup', err);
6+
}
7+
nemo.driver.getCapabilities().
8+
then(function (caps) {
9+
console.log("Nemo successfully launched", caps.caps_.browserName);
10+
});
11+
nemo.driver.get(nemo.data.baseUrl);
12+
nemo.view._waitVisible('#header-buttons #ul-btn').click();
13+
nemo.view._waitVisible('#createAccount').click();
14+
nemo.view._waitVisible('#personalSignUpForm').click();
15+
nemo.view._waitVisible('#email').then(function () {
16+
console.log('loaded the signup form');
17+
nemo.driver.quit();
18+
}, function (err) {
19+
console.log('a funny thing happened on the way to the signup form');
20+
console.error(err);
21+
nemo.driver.quit();
22+
});
23+
});

nemo/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "nemo-browserstack-example",
3+
"version": "1.0.0",
4+
"description": "Nemo and Browserstack integration example",
5+
"main": "nemo.js",
6+
"scripts": {
7+
"test": "node nemo.js"
8+
},
9+
"keywords": [
10+
"Nemo",
11+
"selenium-webdriver",
12+
"browserstack"
13+
],
14+
"author": "Matt Edelman <[email protected]>",
15+
"dependencies": {
16+
"nemo": "^1.0.6",
17+
"nemo-view": "^1.2.0"
18+
}
19+
}

0 commit comments

Comments
 (0)