diff --git a/docs/api/expect/_cookie.md b/docs/api/expect/_cookie.md deleted file mode 100644 index 29f435e6..00000000 --- a/docs/api/expect/_cookie.md +++ /dev/null @@ -1,43 +0,0 @@ - -
- -Expect assertions operating on a single cookie after retrieving the entire cookie string, using `.getCookies()`. - -
Syntax:
-
-
browser.expect.cookie('cookie-name', ['cookie-domain'])
-
- -
-
this.demoTest = function (browser) {
-  browser.expect.cookie('cookie-name').to.contain('cookie-value');
-  browser.expect.cookie('cookie-name').to.match(/regex/);
-  browser.expect.cookie('loginCookie', 'example.org').to.contain('cookie-value');
-};
-
- -
Parameters:
-
- - - - - - - - - - - - - - - - - - - - -
NameTypedescription
nameStringThe name of the cookie to be inspected.
domain
Optional
StringThe domain name on which the cookie is set to.
-
-
\ No newline at end of file diff --git a/docs/api/expect/_element.md b/docs/api/expect/_element.md deleted file mode 100644 index 5eb5844d..00000000 --- a/docs/api/expect/_element.md +++ /dev/null @@ -1,28 +0,0 @@ -## expect.element() - -Expect assertions operating on a single element, specified by its CSS/Xpath selector. - -##### Syntax: -
-
browser.element('#selector')
-
- -##### Parameters: -
- - - - - - - - - - - - - - - -
NameTypedescription
selectorStringThe CSS/XPath selector of the element to be inspected.
-
diff --git a/docs/api/expect/_elements.md b/docs/api/expect/_elements.md deleted file mode 100644 index 068ccf94..00000000 --- a/docs/api/expect/_elements.md +++ /dev/null @@ -1,42 +0,0 @@ -## expect.elements() - -Expect assertions operating on a collection of elements, specified by a CSS/Xpath selector. -So far only `.count` is available. - -##### Syntax: -
-
browser.elements('#selector')
-
- -##### Parameters: -
- - - - - - - - - - - - - - - -
NameTypedescription
selectorStringThe CSS/XPath selector of the collection of elements to be inspected.
-
- -
-

.elements().count

-

Checks if the number of elements specified by a selector is equal or not to a given value.

- -
Usage:
-
-
this.demoTest = function (browser) {
-  browser.expect.elements('div').count.to.equal(10);
-  browser.expect.elements('p').count.to.not.equal(1);
-}
-
-
diff --git a/docs/api/expect/_title.md b/docs/api/expect/_title.md deleted file mode 100644 index 82ed7a77..00000000 --- a/docs/api/expect/_title.md +++ /dev/null @@ -1,14 +0,0 @@ -

expect.title()

- -
- -Retrieves the page title value in order to be used for performing `equal`, `match` or `contains` assertions on it. - -
Usage:
-
-
this.demoTest = function (browser) {
-  browser.expect.title().to.contain('value');
-  browser.expect.title().to.match(/value/);
-};
-
-
\ No newline at end of file diff --git a/docs/api/expect/_url.md b/docs/api/expect/_url.md deleted file mode 100644 index e6e51b9b..00000000 --- a/docs/api/expect/_url.md +++ /dev/null @@ -1,13 +0,0 @@ -

expect.url()

-
- -Retrieves the page url value in order to be used for performing `equal`, `match` or `contains` assertions on it. - -
Usage:
-
-
this.demoTest = function (browser) {
-  browser.expect.url().to.contain('https://');
-  browser.expect.url().to.endWith('.org');
-};
-
-
\ No newline at end of file diff --git a/docs/api/expect/element/index.md b/docs/api/expect/element/index.md index 3d1abdb6..3beb9002 100644 --- a/docs/api/expect/element/index.md +++ b/docs/api/expect/element/index.md @@ -8,8 +8,8 @@ also adding new capabilities over the classic `assert` interface. It uses a chain-able language to construct assertions given an element specified by a css/xpath selector. A simple example looks like the following: -```javascript -describe('expect example', function() { + +
describe('expect example', function() {
   it('sample test', function (browser) {
     // start with identifying the element
     // and then assert the element is present
@@ -18,4 +18,4 @@ describe('expect example', function() {
     browser.expect.element('#main').to.be.visible;
   });
 }
-```
\ No newline at end of file
+
diff --git a/docs/api/expect/elements/index.md b/docs/api/expect/elements/index.md index 3d1abdb6..3beb9002 100644 --- a/docs/api/expect/elements/index.md +++ b/docs/api/expect/elements/index.md @@ -8,8 +8,8 @@ also adding new capabilities over the classic `assert` interface. It uses a chain-able language to construct assertions given an element specified by a css/xpath selector. A simple example looks like the following: -```javascript -describe('expect example', function() { + +
describe('expect example', function() {
   it('sample test', function (browser) {
     // start with identifying the element
     // and then assert the element is present
@@ -18,4 +18,4 @@ describe('expect example', function() {
     browser.expect.element('#main').to.be.visible;
   });
 }
-```
\ No newline at end of file
+
diff --git a/docs/api/expect/index.md b/docs/api/expect/index.md index a50bcfa5..622b423f 100644 --- a/docs/api/expect/index.md +++ b/docs/api/expect/index.md @@ -8,17 +8,19 @@ also adding new capabilities over the classic `assert` interface. It uses a chain-able language to construct assertions given an element specified by a css/xpath selector. A simple example looks like the following: -```javascript -describe('expect example', function() { - it('sample test', function (browser) { +
+
+describe('expect example', function() {
+    it('sample test', function (browser) {
     // start with identifying the element
     // and then assert the element is present
     browser.expect.element('#main').to.be.present;
     // or assert the element is visible
     browser.expect.element('#main').to.be.visible;
   });
-}
-```
+}
+    
+

Language Chains

@@ -43,13 +45,15 @@ The following are provided as chainable getters to improve the readability of yo These methods will perform assertions on the specified target on the current element. The targets can be an attribute value, the element's inner text and a css property. -```javascript -this.demoTest = function (browser) { +
+
+this.demoTest = function (browser) {
   browser.expect.element('#main').text.to.equal('The Night Watch');
   browser.expect.element('#main').text.to.contain('The Night Watch');
   browser.expect.element('#main').to.have.css('display').which.equals('block');
-};
-```
+};
+    
+

.startWith(value)/.endWith(value)

@@ -96,10 +100,80 @@ this.demoTest = function (browser) {
-<%- include('./_cookie.md') %> + +
+ +Expect assertions operating on a single cookie after retrieving the entire cookie string, using `.getCookies()`. + +
Syntax:
+
+
browser.expect.cookie('cookie-name', ['cookie-domain'])
+
+ +
+
this.demoTest = function (browser) {
+  browser.expect.cookie('cookie-name').to.contain('cookie-value');
+  browser.expect.cookie('cookie-name').to.match(/regex/);
+  browser.expect.cookie('loginCookie', 'example.org').to.contain('cookie-value');
+};
+
+ +
Parameters:
+
+ + + + + + + + + + + + + + + + + + + + +
NameTypedescription
nameStringThe name of the cookie to be inspected.
domain
Optional
StringThe domain name on which the cookie is set to.
+
+

expect.element()

+Expect assertions operating on a single element, specified by its CSS/Xpath selector. + +##### Syntax: +
+
browser.element('#selector')
+
+ +##### Parameters: +
+ + + + + + + + + + + + + + + +
NameTypedescription
selectorStringThe CSS/XPath selector of the element to be inspected.
+
+ + ### Assertions: - [to.be.active](/api/expect/element/active.html) - [to.have.attribute()](/api/expect/element/attribute.html) @@ -115,8 +189,76 @@ this.demoTest = function (browser) {

expect.elements()

+Expect assertions operating on a collection of elements, specified by a CSS/Xpath selector. +So far only `.count` is available. + +##### Syntax: +
+
browser.elements('#selector')
+
+ +##### Parameters: +
+ + + + + + + + + + + + + + + +
NameTypedescription
selectorStringThe CSS/XPath selector of the collection of elements to be inspected.
+
+ +
+

.elements().count

+

Checks if the number of elements specified by a selector is equal or not to a given value.

+ +
Usage:
+
+
this.demoTest = function (browser) {
+  browser.expect.elements('div').count.to.equal(10);
+  browser.expect.elements('p').count.to.not.equal(1);
+}
+
+
+ + ### Assertions: - [count()](/api/expect/elements/count.html) -<%- include('./_title.md') %> -<%- include('./_url.md') %> \ No newline at end of file +

expect.title()

+ +
+ +Retrieves the page title value in order to be used for performing `equal`, `match` or `contains` assertions on it. + +
Usage:
+
+
this.demoTest = function (browser) {
+  browser.expect.title().to.contain('value');
+  browser.expect.title().to.match(/value/);
+};
+
+
+ +

expect.url()

+
+ +Retrieves the page url value in order to be used for performing `equal`, `match` or `contains` assertions on it. + +
Usage:
+
+
this.demoTest = function (browser) {
+  browser.expect.url().to.contain('https://');
+  browser.expect.url().to.endWith('.org');
+};
+
+
diff --git a/postdoc.config.js b/postdoc.config.js index fb5aada3..4f75cff5 100644 --- a/postdoc.config.js +++ b/postdoc.config.js @@ -5,7 +5,7 @@ const { NIGHTWATCH_VERSION = '3.5.0', BASE_URL = 'https://nightwatchjs.org', MD_DOCS_FOLDER = './docs', - API_DOCS_FOLDER = resolve('../nightwatch/lib/api'), + API_DOCS_FOLDER = resolve('./nightwatch/lib/api'), EXAMPLES_FOLDER = 'node_modules/nightwatch-examples/tests', WEBDRIVER_SPEC_URL = 'https://w3c.github.io/webdriver' } = env;