Skip to content

Commit d424651

Browse files
committed
First commit
0 parents  commit d424651

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
reports/*

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Install
2+
3+
## Drivers
4+
5+
- `brew install geckodriver`
6+
- `brew tap homebrew/cask; brew cask install chromedriver`
7+
8+
## Nightwatch
9+
10+
- `yarn global add nightwatch`
11+
12+
### Run
13+
14+
**Driver**
15+
`chromedriver`
16+
17+
**Nightwatch**
18+
`nightwatch test.js`

nightwatch.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"src_folders" : ["."],
3+
"output_folder" : "./reports",
4+
"disable_colors": false,
5+
"test_workers" : false,
6+
7+
"webdriver" : {
8+
"start_process": false,
9+
"host": "localhost",
10+
"port": 4444
11+
},
12+
13+
"test_settings" : {
14+
"default" : {
15+
"webdriver": {
16+
"server_path": "./bin/geckodriver-0.20",
17+
"cli_args": [
18+
"--log", "debug"
19+
]
20+
},
21+
"disable_colors": false,
22+
"screenshots" : {
23+
"enabled" : false,
24+
"path" : ""
25+
},
26+
"request_timeout_options": {
27+
"timeout": 60000,
28+
"retry_attempts": 5
29+
},
30+
"filter": ["./examples/tests"],
31+
"desiredCapabilities" : {
32+
"browserName" : "firefox",
33+
"acceptInsecureCerts" : true
34+
}
35+
},
36+
37+
"chrome" : {
38+
"webdriver": {
39+
"port": 9515,
40+
"default_path_prefix": "",
41+
"server_path": "./bin/chromedriver-2.32",
42+
"cli_args": [
43+
"--verbose"
44+
]
45+
},
46+
"desiredCapabilities" : {
47+
"browserName" : "chrome",
48+
"loggingPrefs": {"driver": "INFO", "server": "OFF", "browser": "INFO"}
49+
}
50+
},
51+
52+
"unit_tests" : {
53+
"unit_tests_mode" : true,
54+
"filter" : "./examples/unittests/*",
55+
"exclude" : ""
56+
},
57+
58+
"mocha" : {
59+
"webdriver" : {
60+
"default_path_prefix": "",
61+
"server_path": "./bin/chromedriver-2.32",
62+
"cli_args": [
63+
"--verbose"
64+
]
65+
},
66+
"desiredCapabilities" : {
67+
"browserName" : "chrome"
68+
},
69+
"test_runner" : {
70+
"type" : "mocha"
71+
}
72+
},
73+
74+
"selenium_server" : {
75+
"selenium" : {
76+
"start_process": true,
77+
"host": "localhost",
78+
"port": 4444,
79+
"server_path": "./bin/selenium-server-standalone-3.10.0.jar",
80+
"cli_args": {
81+
"webdriver.gecko.driver": "./bin/geckodriver-0.19",
82+
"webdriver.chrome.driver": "./bin/chromedriver-2.32"
83+
}
84+
},
85+
86+
"desiredCapabilities" : {
87+
"browserName" : "firefox",
88+
"acceptSslCerts": true
89+
}
90+
}
91+
}
92+
}

test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
'Demo test Google' : function (client) {
3+
const button = 'input[value="Google Search"]'
4+
5+
client
6+
.url('http://www.google.com')
7+
.waitForElementVisible('body', 1000)
8+
.assert.title('Google')
9+
.assert.visible('input[type=text]')
10+
.setValue('input[type=text]', 'Hello there!')
11+
.waitForElementVisible(button, 1000)
12+
.click(button)
13+
.pause(1000)
14+
// .assert.containsText('ol#rso li:first-child', 'Rembrandt - Wikipedia')
15+
.end();
16+
}
17+
};

0 commit comments

Comments
 (0)