File tree 6 files changed +145
-0
lines changed
6 files changed +145
-0
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ reports
Original file line number Diff line number Diff line change
1
+ .PHONY : install selenium.PID selenium-stop test
2
+
3
+ install :
4
+ npm install
5
+ node_modules/selenium-standalone/bin/selenium-standalone install --drivers.chrome.version=2.29 --drivers.chrome.baseURL=https://chromedriver.storage.googleapis.com
6
+
7
+ selenium.PID :
8
+ @node_modules/selenium-standalone/bin/selenium-standalone start 2> /dev/null & echo " $$ !" > selenium.PID
9
+
10
+ selenium-stop :
11
+ @kill ` cat selenium.PID` && rm selenium.PID
12
+ @echo " selenium server stopped"
13
+
14
+ test : selenium.PID
15
+ sleep 5
16
+ npm test
17
+ @make selenium-stop
18
+
Original file line number Diff line number Diff line change
1
+ # Nightwatch Example Project #
2
+
3
+ < https://github.com/stinebean3/nightwatch-examples >
4
+
5
+ ## About ##
6
+
7
+ This is an example repo to help you get started with testing using [ Nightwatch.js] .
8
+
9
+ Included is a "test.js" file containing a set of example tests against
10
+ google.com as well as a "Makefile" to set everything up and run the test for you.
11
+
12
+ In order to create your own Nightwatch project, feel free to "fork" or copy
13
+ these files to get you started and adjust "test.js" to write tests for your
14
+ own projects.
15
+
16
+ ## Set-up ##
17
+
18
+ 1 . Clone repo
19
+ ```
20
+ git clone https://github.com/stinethebean3/nightwatch-examples
21
+ cd nightwatch-examples
22
+ ```
23
+
24
+ 2 . Install dependencies
25
+ ```
26
+ make install
27
+ ```
28
+
29
+ ## Testing ##
30
+
31
+ 1 . View/edit test.js
32
+ ```
33
+ vim test.js
34
+ ```
35
+
36
+ 2 . Run the tests
37
+ ```
38
+ make test
39
+ ```
40
+
41
+ [ Nightwatch.js ] : http://nightwatchjs.org
42
+
43
+
Original file line number Diff line number Diff line change
1
+ {
2
+ "src_folders" : [" tests" ],
3
+ "output_folder" : " reports" ,
4
+ "custom_commands_path" : " " ,
5
+ "custom_assertions_path" : " " ,
6
+ "page_objects_path" : " " ,
7
+ "globals_path" : " " ,
8
+
9
+ "selenium" : {
10
+ "start_process" : false ,
11
+ "server_path" : " " ,
12
+ "log_path" : " " ,
13
+ "port" : 4444 ,
14
+ "cli_args" : {
15
+ "webdriver.chrome.driver" : " " ,
16
+ "webdriver.gecko.driver" : " " ,
17
+ "webdriver.edge.driver" : " "
18
+ }
19
+ },
20
+
21
+ "test_settings" : {
22
+ "default" : {
23
+ "launch_url" : " http://localhost" ,
24
+ "selenium_port" : 4444 ,
25
+ "selenium_host" : " localhost" ,
26
+ "silent" : true ,
27
+ "screenshots" : {
28
+ "enabled" : false ,
29
+ "path" : " "
30
+ },
31
+ "desiredCapabilities" : {
32
+ "browserName" : " firefox" ,
33
+ "marionette" : true
34
+ }
35
+ },
36
+
37
+ "chrome" : {
38
+ "desiredCapabilities" : {
39
+ "browserName" : " chrome"
40
+ }
41
+ }
42
+ }
43
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " nightwatch-examples" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Examples of using Nightwatch.js" ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test" : " node_modules/nightwatch/bin/nightwatch -t test.js"
8
+ },
9
+ "repository" : {
10
+ "type" : " git" ,
11
+ "url" : " git+https://github.com/stinethebean3/nightwatch-examples.git"
12
+ },
13
+ "author" : " Christine Vick" ,
14
+ "license" : " MIT" ,
15
+ "bugs" : {
16
+ "url" : " https://github.com/stinethebean3/nightwatch-examples/issues"
17
+ },
18
+ "homepage" : " https://github.com/stinethebean3/nightwatch-examples#readme" ,
19
+ "dependencies" : {
20
+ "nightwatch" : " ^0.9.15" ,
21
+ "selenium-standalone" : " ^6.4.1"
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ 'Demo test Google' : function ( client ) {
3
+ client
4
+ . url ( 'http://www.google.com' )
5
+ . waitForElementVisible ( 'body' , 1000 )
6
+ . assert . title ( 'Google' )
7
+ . assert . visible ( 'input[type=text]' )
8
+ . setValue ( 'input[type=text]' , 'rembrandt van rijn' )
9
+ . waitForElementVisible ( 'button[name=btnG]' , 1000 )
10
+ . click ( 'button[name=btnG]' )
11
+ . pause ( 1000 )
12
+ . assert . containsText ( 'div#rso h3:first-child' ,
13
+ 'Rembrandt - Wikipedia' )
14
+ . end ( ) ;
15
+ }
16
+ } ;
You can’t perform that action at this time.
0 commit comments