Skip to content
Open
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
21 changes: 9 additions & 12 deletions docs/guide/writing-tests/using-test-globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,19 @@ Here's an example definition using the `"globals"` property in `nightwatch.json`

<div class="sample-test"><i>nightwatch.conf.js</i>

<pre data-language="javascript"><code class="language-javascript">{
"src_folders": [],
<pre data-language="javascript"><code class="language-javascript">
myGlobal = 3000;
myGlobal2 = 'hello world';

"globals": {
"myGlobalVar" : "some value",
"otherGlobal" : "some other value"
},
// Refer to the online docs for more details:
// https://nightwatchjs.org/gettingstarted/configuration/
//

"test_settings": {
"default": {
"launch_url": "https://nightwatchjs.org",
}
}
}</code></pre>

</code></pre>

</div>
Note how the variables can be defined at the top of the config file.

Like the `launch_url` property, the `globals` object is made available directly on the Nightwatch api which is passed to the tests.

Expand Down