Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec60716
commit 3ea95df
Showing
28 changed files
with
1,048 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Nightwatch Documentation | ||
|
||
Documentation sources for [nightwatchjs.org](http://nightwatchjs.org) website. | ||
|
||
Nightwatchjs is a UI automated testing framework powered by [Node.js](http://nodejs.org/). It uses the [Selenium WebDriver API](https://code.google.com/p/selenium/wiki/JsonWireProtocol). | ||
|
||
[![Build Status](https://travis-ci.org/beatfactor/nightwatch.png?branch=master)](https://travis-ci.org/beatfactor/nightwatch) [![NPM version](https://badge.fury.io/js/nightwatch.png)](http://badge.fury.io/js/nightwatch) [![Coverage Status](https://coveralls.io/repos/beatfactor/nightwatch/badge.png?branch=master)](https://coveralls.io/r/beatfactor/nightwatch?branch=master) | ||
|
||
*** | ||
|
||
#### [Homepage](http://nightwatchjs.org) | [Developer Guide](http://nightwatchjs.org/guide) | [API Reference](http://nightwatchjs.org/api) | ||
|
||
*** | ||
|
||
## Current structure | ||
|
||
``` | ||
Overview | ||
├── What is Nightwatch? | ||
├── Overview of Selenium | ||
├── Theory of Operation | ||
Getting started | ||
├── Install Node.js | ||
├── Install Nightwatch | ||
├── Selenium Server | ||
Using Nightwatch | ||
├── Writing Tests | ||
├── Using Xpath | ||
├── Nightwatch Runner | ||
├── Command-line Options | ||
├── Test Groups | ||
├── Test Tags | ||
├── Test Hooks | ||
├── AsynchronousTest Hooks | ||
Configuration | ||
├── Basic Settings | ||
├── Selenium Settings | ||
├── Test Settings | ||
├── External Globals | ||
├── Parallel Running | ||
Extending Nightwatch | ||
├── Custom commands | ||
├── Custom assertions | ||
└── Custom reporter | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
### Basic settings | ||
|
||
<table class="table table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th style="width: 100px;">Name</th> | ||
<th style="width: 100px;">type</th> | ||
<th style="width: 50px;">default</th> | ||
<th>description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>src_folders</td> | ||
<td>string|array</td> | ||
<td>none</td> | ||
<td>An array of folders (excluding subfolders) where the tests are located.</td> | ||
</tr> | ||
<tr> | ||
<td>output_folder <br><span class="optional">Optional</span></td> | ||
<td>string</td> | ||
<td>tests_output</td> | ||
<td>The location where the JUnit XML report files will be saved.</td> | ||
</tr> | ||
<tr> | ||
<td>custom_commands_path <span class="optional">Optional</span></td> | ||
<td>string|array</td> | ||
<td>none</td> | ||
<td>Location(s) where custom commands will be loaded from.</td> | ||
</tr> | ||
<tr> | ||
<td>custom_assertions_path <span class="optional">Optional</span></td> | ||
<td>string|array</td> | ||
<td>none</td> | ||
<td>Location(s) where custom assertions will be loaded from.</td> | ||
</tr> | ||
<tr> | ||
<td>globals_path <br><span class="optional">Optional</span> <span class="optional">since v0.4.8</span></td> | ||
<td>string</td> | ||
<td>none</td> | ||
<td>Location of an external globals module which will be loaded and made available to the test as a property <code>globals</code> on the main client instance. <br><br>Globals can also be defined/overwritten inside a <code>test_settings</code> environment.</td> | ||
</tr> | ||
<tr> | ||
<td>selenium <br><span class="optional">Optional</span></td> | ||
<td>object</td> | ||
<td></td> | ||
<td>An object containing Selenium Server related configuration options. See below for details.</td> | ||
</tr> | ||
<tr> | ||
<td>test_settings</td> | ||
<td>object</td> | ||
<td></td> | ||
<td>This object contains all the test related options. See below for details.</td> | ||
</tr> | ||
<tr> | ||
<td>live_output <br><span class="optional">Optional</span></td> | ||
<td>boolean</td> | ||
<td>false</td> | ||
<td>Whether or not to buffer the output in case of parallel running. See below for details.</td> | ||
</tr> | ||
<tr> | ||
<td>disable_colors <br><span class="optional">Optional</span></td> | ||
<td>boolean</td> | ||
<td>false</td> | ||
<td>Controls whether or not to disable coloring of the cli output globally.</td> | ||
</tr> | ||
<tr> | ||
<td>parallel_process_delay <br><span class="optional">Optional</span></td> | ||
<td>integer</td> | ||
<td>10</td> | ||
<td>Specifies the delay(in milliseconds) between starting the child processes when running in parallel mode.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
### External Globals | ||
|
||
In addition to having globals defined in your `nightwatch.json`, sometimes it's useful to have also an external globals file, specified in the`globals_path` property. | ||
|
||
You can overwrite globals per environment as needed. Say you have your tests running locally and also against a remote cloud selenium server. Most of the times you will need some different setting up. | ||
|
||
#### Example: | ||
<div class="sample-test"> | ||
<pre><code class="language-javascript"> | ||
module.exports = { | ||
'local-env' : { | ||
isLocal : true, | ||
}, | ||
|
||
'remote-env' : { | ||
isLocal : false | ||
}, | ||
|
||
before: function(done) { | ||
// run this only for the local-env | ||
if (this.isLocal) { | ||
// start the local server | ||
App.startServer(function() { | ||
// server listening | ||
done(); | ||
}); | ||
} else { | ||
done(); | ||
} | ||
}, | ||
|
||
after: function(done) { | ||
// run this only for the local-env | ||
if (this.isLocal) { | ||
// start the local server | ||
App.stopServer(function() { | ||
// shutting down | ||
done(); | ||
}); | ||
} else { | ||
done(); | ||
} | ||
} | ||
};</code></pre> | ||
</div> | ||
|
||
You can refer to the provided [globalsModule.js](https://github.com/beatfactor/nightwatch/blob/master/examples/globalsModule.js) for an example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
### Selenium settings | ||
|
||
Below are a number of options for the selenium server process. Nightwatch can start and stop the Selenium process automatically which is very convenient as you don't have to manage this yourself and focus only on the tests. | ||
|
||
If you'd like to enable this, set `start_process` to `true` and specify the location of the `jar` file inside `server_path`. | ||
|
||
<table class="table table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th style="width: 100px;">Name</th> | ||
<th style="width: 100px;">type</th> | ||
<th style="width: 50px;">default</th> | ||
<th>description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>start_process</td> | ||
<td>boolean</td> | ||
<td>false</td> | ||
<td>Whether or not to manage the selenium process automatically.</td> | ||
</tr> | ||
<tr> | ||
<td>server_path</td> | ||
<td>string</td> | ||
<td>none</td> | ||
<td>The location of the selenium <code>jar</code> file. This needs to be specified if <code>start_process</code> is enabled.<br>E.g.: <code>lib/selenium-server-standalone-2.43.0.jar</code></td> | ||
</tr> | ||
<tr> | ||
<td>log_path</td> | ||
<td>string|boolean</td> | ||
<td>none</td> | ||
<td>The location where the selenium <code>output.log</code> file will be placed. Defaults to current directory.<br>To disable Selenium logging, set this to <code>false</code></td> | ||
</tr> | ||
<tr> | ||
<td>host</td> | ||
<td>string</td> | ||
<td>127.0.0.1</td> | ||
<td>Usually not required and only used if <code>start_process</code> is <code>true</code>. Specify the IP address you wish Selenium to listen on.</td> | ||
</tr> | ||
<tr> | ||
<td>port</td> | ||
<td>integer</td> | ||
<td>4444</td> | ||
<td>The port number Selenium will listen on.</td> | ||
</tr> | ||
<tr> | ||
<td>cli_args<br><span class="optional">since v0.5.1</span></td> | ||
<td>object</td> | ||
<td>none</td> | ||
<td>List of cli arguments to be passed to the Selenium process. Here you can set various options for browser drivers, such as:<br><br> | ||
<ul> | ||
<li> | ||
<code>webdriver.firefox.profile</code>: Selenium will be default create a new Firefox profile for each session. If you wish to use an existing Firefox profile you can specify its name here.<br> | ||
Complete list of Firefox Driver arguments available <a href="https://code.google.com/p/selenium/wiki/FirefoxDriver" target="_blank">here</a>. | ||
</li> | ||
<li> | ||
<code>webdriver.chrome.driver</code>: Nightwatch can run the tests using <strong>Chrome</strong> browser also. To enable this you have to download the <a href="http://chromedriver.storage.googleapis.com/index.html" target="_blank">ChromeDriver binary</a> and specify it's location here. | ||
Also don't forget to specify chrome as the browser name in the <code>desiredCapabilities</code> object.<br> | ||
More information can be found on the <a href="https://sites.google.com/a/chromium.org/chromedriver/" target="_blank">ChromeDriver website</a>.<br> | ||
</li> | ||
<li> | ||
<code>webdriver.ie.driver</code>: | ||
Nightwatch has support for <strong>Internet Explorer</strong> also. To enable this you have to download the <a href="https://code.google.com/p/selenium/wiki/InternetExplorerDriver" target="_blank">IE Driver binary</a> and specify it's location here. | ||
Also don't forget to specify "internet explorer" as the browser name in the <code>desiredCapabilities</code> object. | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
Oops, something went wrong.