@bbc/nightwatch-commands
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "@bbc/nightwatch-commands", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Basic Nightwatch Commands", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
# Keywords | ||
* [dontRunOn](#dontrunon) | ||
* [elementCount](#elementcount) | ||
@@ -9,2 +10,45 @@ * [getVersionNumbers](#getversionnumbers) | ||
## dontRunOn | ||
### Purpose | ||
Add the ability to exit a test early if we do not want to run on a specific environment | ||
### Parameters | ||
The ```dontRunOn(['environment'])``` keyword accepts an array of environments such as ```int```,```test``` or ```live```. | ||
### How it works | ||
It compares the array to the current environment it is testing against (Usually provided by the ```ENV``` variable in the ```.env``` file) | ||
### Example | ||
``` | ||
browser.page.<page>.dontRunOn(['live']); | ||
``` | ||
## elementCount | ||
### Purpose | ||
Read the number of elements that match a certain criteria | ||
### Parameters | ||
* The ```elementCount(locateStrategy, selector, count)``` keyword has three required parameters: | ||
* ```locateStrategy``` - can be something like ```css selector``` or ```xpath``` and is based on the selector | ||
* ```selector``` - is way in which we identify the element | ||
* ```count``` - is the number of items that we are expecting there to be | ||
### How it works | ||
It checks the number of elements which match the selector and if it does not match the count given then it will fail the assertion. | ||
### Example | ||
``` | ||
browser.page.<page>.assert.elementCount('css selector', 'ol li', 7); | ||
``` | ||
## getVersionNumbers | ||
@@ -11,0 +55,0 @@ |
7252
8
86
140