codeceptjs 2.3.4 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +28 -6
- package/bin/codecept.js +42 -0
- package/docs/advanced.md +45 -1
- package/docs/angular.md +3 -3
- package/docs/basics.md +162 -118
- package/docs/bdd.md +30 -5
- package/docs/best.md +8 -6
- package/docs/books.md +6 -1
- package/docs/build/Appium.js +95 -85
- package/docs/build/FileSystem.js +48 -3
- package/docs/build/GraphQL.js +3 -2
- package/docs/build/GraphQLDataFactory.js +1 -0
- package/docs/build/Mochawesome.js +3 -2
- package/docs/build/MockRequest.js +23 -5
- package/docs/build/Nightmare.js +87 -128
- package/docs/build/Protractor.js +107 -155
- package/docs/build/Puppeteer.js +190 -174
- package/docs/build/REST.js +13 -9
- package/docs/build/SeleniumWebdriver.js +0 -17
- package/docs/build/TestCafe.js +164 -158
- package/docs/build/WebDriver.js +236 -211
- package/docs/build/WebDriverIO.js +218 -187
- package/docs/changelog.md +57 -1
- package/docs/commands.md +41 -2
- package/docs/community-helpers.md +12 -1
- package/docs/configuration.md +5 -2
- package/docs/continuous-integration.md +22 -0
- package/docs/{helpers.md → custom-helpers.md} +16 -10
- package/docs/data.md +7 -6
- package/docs/detox.md +6 -6
- package/docs/email.md +4 -2
- package/docs/examples.md +22 -3
- package/docs/helpers/ApiDataFactory.md +15 -13
- package/docs/helpers/Appium.md +1011 -468
- package/docs/helpers/Detox.md +33 -26
- package/docs/helpers/FileSystem.md +43 -13
- package/docs/helpers/GraphQL.md +17 -15
- package/docs/helpers/GraphQLDataFactory.md +15 -13
- package/docs/helpers/Mochawesome.md +3 -1
- package/docs/helpers/MockRequest.md +37 -19
- package/docs/helpers/Nightmare.md +129 -240
- package/docs/helpers/Polly.md +1 -1
- package/docs/helpers/Protractor.md +157 -298
- package/docs/helpers/Puppeteer.md +216 -335
- package/docs/helpers/REST.md +29 -24
- package/docs/helpers/TestCafe.md +137 -235
- package/docs/helpers/WebDriver.md +250 -347
- package/docs/hooks.md +14 -10
- package/docs/index.md +112 -0
- package/docs/installation.md +3 -1
- package/docs/locators.md +19 -8
- package/docs/mobile-react-native-locators.md +2 -2
- package/docs/mobile.md +5 -3
- package/docs/nightmare.md +2 -1
- package/docs/pageobjects.md +4 -2
- package/docs/parallel.md +4 -2
- package/docs/plugins.md +41 -15
- package/docs/puppeteer.md +8 -6
- package/docs/quickstart.md +130 -0
- package/docs/react.md +4 -2
- package/docs/reports.md +6 -4
- package/docs/testcafe.md +10 -8
- package/docs/translation.md +4 -2
- package/docs/ui.md +56 -0
- package/docs/videos.md +11 -2
- package/docs/visual.md +7 -5
- package/docs/vue.md +121 -0
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +2 -2
- package/docs/webapi/dontSee.mustache +1 -2
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +2 -1
- package/docs/webapi/executeScript.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/grabAttributeFrom.mustache +1 -1
- package/docs/webapi/grabBrowserLogs.mustache +1 -1
- package/docs/webapi/grabCookie.mustache +2 -2
- package/docs/webapi/grabCssPropertyFrom.mustache +1 -1
- package/docs/webapi/grabHTMLFrom.mustache +1 -1
- package/docs/webapi/grabNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/grabPageScrollPosition.mustache +1 -1
- package/docs/webapi/grabTextFrom.mustache +2 -2
- package/docs/webapi/grabValueFrom.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +10 -0
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +8 -0
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/waitForClickable.mustache +10 -0
- package/docs/webapi/waitForDetached.mustache +2 -2
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +2 -2
- package/docs/webapi/waitForFunction.mustache +2 -2
- package/docs/webapi/waitForInvisible.mustache +2 -2
- package/docs/webapi/waitForText.mustache +2 -2
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +2 -2
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/waitToHide.mustache +2 -2
- package/docs/webapi/waitUntil.mustache +3 -2
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/docs/webdriver.md +20 -18
- package/docs/wiki/.git/FETCH_HEAD +1 -0
- package/docs/wiki/.git/HEAD +1 -0
- package/docs/wiki/.git/ORIG_HEAD +1 -0
- package/docs/wiki/.git/config +11 -0
- package/docs/wiki/.git/description +1 -0
- package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
- package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
- package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +114 -0
- package/docs/wiki/.git/hooks/post-update.sample +8 -0
- package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
- package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
- package/docs/wiki/.git/hooks/pre-push.sample +53 -0
- package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
- package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
- package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
- package/docs/wiki/.git/hooks/update.sample +128 -0
- package/docs/wiki/.git/index +0 -0
- package/docs/wiki/.git/info/exclude +6 -0
- package/docs/wiki/.git/logs/HEAD +4 -0
- package/docs/wiki/.git/logs/refs/heads/master +4 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/master +3 -0
- package/docs/wiki/.git/objects/00/d216b0774d15db2d0a2a0d4ce249b5251acc55 +3 -0
- package/docs/wiki/.git/objects/09/01d87c5241905fdfe3493cfe8f04df4a2685ea +0 -0
- package/docs/wiki/.git/objects/0d/bdd0c20c4deb6a8cc81dbbf32ecf8c09238983 +2 -0
- package/docs/wiki/.git/objects/1a/c29e4fa82422c52392f22f0f2b8d1a759535bf +0 -0
- package/docs/wiki/.git/objects/27/12f92898d3e8f68e229b6cda76570d6c66d781 +0 -0
- package/docs/wiki/.git/objects/2d/dbe22c257166b648928eeb9460ecfb71ba702d +0 -0
- package/docs/wiki/.git/objects/2f/c942ec3773efd2678d9ff98035c61fcded81a1 +0 -0
- package/docs/wiki/.git/objects/40/a2856342c67796b48911a256b764fb06888b94 +5 -0
- package/docs/wiki/.git/objects/47/53181844fc4dc563cf3aa5e80462243cb58d38 +0 -0
- package/docs/wiki/.git/objects/4e/24a95fb2e4f8ffef51f19b694451a205c06f10 +3 -0
- package/docs/wiki/.git/objects/73/31ebd96f3c7e08a9f63f05a25f939afa0d4de1 +0 -0
- package/docs/wiki/.git/objects/86/19cbb2289caa502e33fccf0ed14eecf6ba2ba0 +0 -0
- package/docs/wiki/.git/objects/a4/72f797d9d74b87c9f71a2b1539d75bb07d1e35 +0 -0
- package/docs/wiki/.git/objects/c9/9f3e4bd227d6b050b2e416f9876df49583dbf6 +0 -0
- package/docs/wiki/.git/objects/ca/e609b4ef3e0ef85fcbe0d68d1a58246584b915 +0 -0
- package/docs/wiki/.git/objects/d5/8386ca72f6d550548f3d71d74e3ac73d5ad488 +0 -0
- package/docs/wiki/.git/objects/d9/c6874a6de524bdafeb563a20d847f4fdd59a86 +0 -0
- package/docs/wiki/.git/objects/f1/c944675bb38b40ae553b0be36c14674c79af54 +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.idx +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.pack +0 -0
- package/docs/wiki/.git/packed-refs +2 -0
- package/docs/wiki/.git/refs/heads/master +1 -0
- package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/refs/remotes/origin/master +1 -0
- package/docs/wiki/Books-&-Posts.md +27 -0
- package/docs/wiki/Community-Helpers.md +41 -0
- package/docs/wiki/Examples.md +138 -0
- package/docs/wiki/Home.md +11 -0
- package/docs/wiki/Release-process.md +25 -0
- package/docs/wiki/Roadmap.md +23 -0
- package/docs/wiki/Videos.md +19 -0
- package/lib/actor.js +18 -1
- package/lib/assert/error.js +3 -3
- package/lib/codecept.js +9 -6
- package/lib/command/configMigrate.js +7 -6
- package/lib/command/definitions.js +98 -350
- package/lib/command/generate.js +22 -17
- package/lib/command/gherkin/init.js +2 -1
- package/lib/command/gherkin/snippets.js +6 -6
- package/lib/command/gherkin/steps.js +0 -1
- package/lib/command/info.js +40 -0
- package/lib/command/init.js +54 -41
- package/lib/command/run-multiple.js +5 -4
- package/lib/command/run-rerun.js +39 -0
- package/lib/command/run-workers.js +4 -6
- package/lib/command/run.js +8 -18
- package/lib/command/utils.js +23 -2
- package/lib/command/workers/runTests.js +1 -2
- package/lib/config.js +10 -4
- package/lib/container.js +31 -6
- package/lib/data/dataTableArgument.js +31 -0
- package/lib/data/table.js +4 -0
- package/lib/event.js +65 -1
- package/lib/helper/Appium.js +52 -38
- package/lib/helper/FileSystem.js +48 -3
- package/lib/helper/GraphQL.js +3 -2
- package/lib/helper/GraphQLDataFactory.js +1 -0
- package/lib/helper/Mochawesome.js +3 -2
- package/lib/helper/MockRequest.js +23 -5
- package/lib/helper/Nightmare.js +5 -6
- package/lib/helper/Protractor.js +7 -8
- package/lib/helper/Puppeteer.js +76 -20
- package/lib/helper/REST.js +13 -9
- package/lib/helper/SeleniumWebdriver.js +0 -17
- package/lib/helper/TestCafe.js +84 -36
- package/lib/helper/WebDriver.js +113 -59
- package/lib/helper/WebDriverIO.js +43 -59
- package/lib/helper/clientscripts/nightmare.js +66 -4
- package/lib/helper/scripts/isElementClickable.js +24 -0
- package/lib/helper.js +34 -10
- package/lib/history.js +1 -1
- package/lib/hooks.js +2 -1
- package/lib/index.js +19 -0
- package/lib/interfaces/bdd.js +4 -0
- package/lib/interfaces/featureConfig.js +10 -3
- package/lib/interfaces/gherkin.js +6 -2
- package/lib/interfaces/scenarioConfig.js +17 -6
- package/lib/listener/config.js +1 -1
- package/lib/listener/exit.js +6 -0
- package/lib/listener/steps.js +0 -1
- package/lib/listener/trace.js +0 -1
- package/lib/locator.js +67 -2
- package/lib/output.js +53 -0
- package/lib/parser.js +2 -71
- package/lib/pause.js +3 -2
- package/lib/plugin/allure.js +41 -22
- package/lib/plugin/autoLogin.js +4 -1
- package/lib/plugin/pauseOnFail.js +38 -0
- package/lib/plugin/puppeteerCoverage.js +8 -7
- package/lib/plugin/screenshotOnFail.js +13 -8
- package/lib/plugin/stepByStepReport.js +7 -6
- package/lib/plugin/wdio.js +2 -1
- package/lib/recorder.js +85 -7
- package/lib/rerun.js +81 -0
- package/lib/secret.js +6 -0
- package/lib/session.js +9 -2
- package/lib/step.js +37 -2
- package/lib/store.js +5 -1
- package/lib/ui.js +34 -8
- package/lib/utils.js +6 -13
- package/lib/within.js +5 -0
- package/package.json +49 -29
- package/typings/Mocha.d.ts +21 -0
- package/typings/Protractor.d.ts +16 -0
- package/typings/index.d.ts +169 -0
- package/typings/jsdoc.conf.js +34 -0
- package/typings/jsdoc.namespace.js +29 -0
- package/typings/types.d.ts +9827 -0
- package/typings/utils.d.ts +7 -0
- package/docs/acceptance.md +0 -409
- package/docs/api/codecept.md +0 -75
- package/docs/api/config.md +0 -49
- package/docs/api/container.md +0 -66
- package/docs/api/helper.md +0 -116
- package/docs/api/output.md +0 -67
- package/docs/api/recorder.md +0 -63
- package/docs/helpers/SeleniumWebdriver.md +0 -92
- package/docs/helpers/WebDriverIO.md +0 -1671
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /helpers/Nightmare
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
3
5
|
title: Nightmare
|
|
4
6
|
---
|
|
5
7
|
|
|
@@ -7,7 +9,7 @@ title: Nightmare
|
|
|
7
9
|
|
|
8
10
|
## Nightmare
|
|
9
11
|
|
|
10
|
-
Extends Helper
|
|
12
|
+
**Extends Helper**
|
|
11
13
|
|
|
12
14
|
Nightmare helper wraps [Nightmare][1] library to provide
|
|
13
15
|
fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
|
|
@@ -28,7 +30,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
28
30
|
- `keepBrowserState` - keep browser state between tests when `restart` set to false.
|
|
29
31
|
- `keepCookies` - keep cookies between tests when `restart` set to false.
|
|
30
32
|
- `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 500.
|
|
31
|
-
- `waitForTimeout`: (optional) default wait
|
|
33
|
+
- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
|
|
32
34
|
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
33
35
|
|
|
34
36
|
|
|
@@ -40,7 +42,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
40
42
|
|
|
41
43
|
- `config`
|
|
42
44
|
|
|
43
|
-
###
|
|
45
|
+
### _locate
|
|
44
46
|
|
|
45
47
|
Locate elements by different locator types, including strict locator.
|
|
46
48
|
Should be used in custom helpers.
|
|
@@ -77,10 +79,8 @@ I.amOnPage('/login'); // opens a login page
|
|
|
77
79
|
|
|
78
80
|
#### Parameters
|
|
79
81
|
|
|
80
|
-
- `url` [string][3] url path or global url.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- `headers` {object} list of request headers can be passed
|
|
82
|
+
- `url` **[string][3]** url path or global url.
|
|
83
|
+
- `headers` **[object][4]?** list of request headers can be passed
|
|
84
84
|
|
|
85
85
|
### appendField
|
|
86
86
|
|
|
@@ -93,10 +93,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
93
93
|
|
|
94
94
|
#### Parameters
|
|
95
95
|
|
|
96
|
-
- `field` ([string][3]
|
|
97
|
-
- `value` [string][3] text value to append.
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator
|
|
97
|
+
- `value` **[string][3]** text value to append.
|
|
100
98
|
|
|
101
99
|
### attachFile
|
|
102
100
|
|
|
@@ -111,10 +109,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
111
109
|
|
|
112
110
|
#### Parameters
|
|
113
111
|
|
|
114
|
-
- `locator`
|
|
115
|
-
- `pathToFile` [string][3] local file path relative to codecept.json config file.
|
|
116
|
-
|
|
117
|
-
Doesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more][5])
|
|
112
|
+
- `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
113
|
+
- `pathToFile` **[string][3]** local file path relative to codecept.json config file.Doesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more][5])
|
|
118
114
|
|
|
119
115
|
### checkOption
|
|
120
116
|
|
|
@@ -131,10 +127,8 @@ I.checkOption('agree', '//form');
|
|
|
131
127
|
|
|
132
128
|
#### Parameters
|
|
133
129
|
|
|
134
|
-
- `field` ([string][3]
|
|
135
|
-
- `context` [string][3] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
- `field` **([string][3] | [object][4])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
131
|
+
- `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
138
132
|
|
|
139
133
|
### clearCookie
|
|
140
134
|
|
|
@@ -148,9 +142,7 @@ I.clearCookie('test');
|
|
|
148
142
|
|
|
149
143
|
#### Parameters
|
|
150
144
|
|
|
151
|
-
- `cookie` [string][3] (optional, `null` by default) cookie name
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
- `cookie` **[string][3]?** (optional, `null` by default) cookie name
|
|
154
146
|
|
|
155
147
|
### clearField
|
|
156
148
|
|
|
@@ -165,9 +157,7 @@ I.clearField('#email');
|
|
|
165
157
|
#### Parameters
|
|
166
158
|
|
|
167
159
|
- `field`
|
|
168
|
-
- `editable` ([string][3]
|
|
169
|
-
|
|
170
|
-
|
|
160
|
+
- `editable` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
171
161
|
|
|
172
162
|
### click
|
|
173
163
|
|
|
@@ -186,7 +176,7 @@ I.click('Submit');
|
|
|
186
176
|
// CSS button
|
|
187
177
|
I.click('#form input[type=submit]');
|
|
188
178
|
// XPath
|
|
189
|
-
I.click('//form
|
|
179
|
+
I.click('//form/*[@type=submit]');
|
|
190
180
|
// link in context
|
|
191
181
|
I.click('Logout', '#nav');
|
|
192
182
|
// using strict locator
|
|
@@ -195,10 +185,8 @@ I.click({css: 'nav a.login'});
|
|
|
195
185
|
|
|
196
186
|
#### Parameters
|
|
197
187
|
|
|
198
|
-
- `locator` ([string][3]
|
|
199
|
-
- `context` ([string][3]
|
|
200
|
-
|
|
201
|
-
|
|
188
|
+
- `locator` **([string][3] | [object][4])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
189
|
+
- `context` **([string][3]? | [object][4])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
202
190
|
|
|
203
191
|
### dontSee
|
|
204
192
|
|
|
@@ -212,9 +200,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
212
200
|
|
|
213
201
|
#### Parameters
|
|
214
202
|
|
|
215
|
-
- `text` [string][3] which is not present.
|
|
216
|
-
- `context` ([string][3]
|
|
217
|
-
|
|
203
|
+
- `text` **[string][3]** which is not present.
|
|
204
|
+
- `context` **([string][3] | [object][4])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
218
205
|
|
|
219
206
|
### dontSeeCheckboxIsChecked
|
|
220
207
|
|
|
@@ -228,9 +215,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
228
215
|
|
|
229
216
|
#### Parameters
|
|
230
217
|
|
|
231
|
-
- `field` ([string][3]
|
|
232
|
-
|
|
233
|
-
|
|
218
|
+
- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
234
219
|
|
|
235
220
|
### dontSeeCookie
|
|
236
221
|
|
|
@@ -242,9 +227,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
242
227
|
|
|
243
228
|
#### Parameters
|
|
244
229
|
|
|
245
|
-
- `name` [string][3] cookie name.
|
|
246
|
-
|
|
247
|
-
|
|
230
|
+
- `name` **[string][3]** cookie name.
|
|
248
231
|
|
|
249
232
|
### dontSeeCurrentUrlEquals
|
|
250
233
|
|
|
@@ -258,9 +241,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
258
241
|
|
|
259
242
|
#### Parameters
|
|
260
243
|
|
|
261
|
-
- `url` [string][3] value to check.
|
|
262
|
-
|
|
263
|
-
|
|
244
|
+
- `url` **[string][3]** value to check.
|
|
264
245
|
|
|
265
246
|
### dontSeeElement
|
|
266
247
|
|
|
@@ -272,9 +253,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
272
253
|
|
|
273
254
|
#### Parameters
|
|
274
255
|
|
|
275
|
-
- `locator` ([string][3]
|
|
276
|
-
|
|
277
|
-
|
|
256
|
+
- `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator.
|
|
278
257
|
|
|
279
258
|
### dontSeeElementInDOM
|
|
280
259
|
|
|
@@ -286,9 +265,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
286
265
|
|
|
287
266
|
#### Parameters
|
|
288
267
|
|
|
289
|
-
- `locator` ([string][3]
|
|
290
|
-
|
|
291
|
-
|
|
268
|
+
- `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator.
|
|
292
269
|
|
|
293
270
|
### dontSeeInCurrentUrl
|
|
294
271
|
|
|
@@ -296,9 +273,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
296
273
|
|
|
297
274
|
#### Parameters
|
|
298
275
|
|
|
299
|
-
- `url` [string][3] value to check.
|
|
300
|
-
|
|
301
|
-
|
|
276
|
+
- `url` **[string][3]** value to check.
|
|
302
277
|
|
|
303
278
|
### dontSeeInField
|
|
304
279
|
|
|
@@ -312,10 +287,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
312
287
|
|
|
313
288
|
#### Parameters
|
|
314
289
|
|
|
315
|
-
- `field` ([string][3]
|
|
316
|
-
- `value` [string][3] value to check.
|
|
317
|
-
|
|
318
|
-
|
|
290
|
+
- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
291
|
+
- `value` **[string][3]** value to check.
|
|
319
292
|
|
|
320
293
|
### dontSeeInSource
|
|
321
294
|
|
|
@@ -328,9 +301,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
328
301
|
#### Parameters
|
|
329
302
|
|
|
330
303
|
- `text`
|
|
331
|
-
- `value` [string][3] to check.
|
|
332
|
-
|
|
333
|
-
|
|
304
|
+
- `value` **[string][3]** to check.
|
|
334
305
|
|
|
335
306
|
### dontSeeInTitle
|
|
336
307
|
|
|
@@ -342,9 +313,7 @@ I.dontSeeInTitle('Error');
|
|
|
342
313
|
|
|
343
314
|
#### Parameters
|
|
344
315
|
|
|
345
|
-
- `text` [string][3] value to check.
|
|
346
|
-
|
|
347
|
-
|
|
316
|
+
- `text` **[string][3]** value to check.
|
|
348
317
|
|
|
349
318
|
### doubleClick
|
|
350
319
|
|
|
@@ -360,10 +329,8 @@ I.doubleClick('.btn.edit');
|
|
|
360
329
|
|
|
361
330
|
#### Parameters
|
|
362
331
|
|
|
363
|
-
- `locator` ([string][3]
|
|
364
|
-
- `context` ([string][3]
|
|
365
|
-
|
|
366
|
-
|
|
332
|
+
- `locator` **([string][3] | [object][4])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
333
|
+
- `context` **([string][3]? | [object][4])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
367
334
|
|
|
368
335
|
### executeAsyncScript
|
|
369
336
|
|
|
@@ -390,7 +357,11 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
390
357
|
|
|
391
358
|
#### Parameters
|
|
392
359
|
|
|
393
|
-
- `fn` ([string][3]
|
|
360
|
+
- `fn` **([string][3] | [function][7])** function to be executed in browser context.
|
|
361
|
+
- `args` **...any** to be passed to function.
|
|
362
|
+
|
|
363
|
+
Returns **[Promise][8]<any>** Wrapper for asynchronous [evaluate][9].
|
|
364
|
+
Unlike NightmareJS implementation calling `done` will return its first argument.
|
|
394
365
|
|
|
395
366
|
### executeScript
|
|
396
367
|
|
|
@@ -420,7 +391,10 @@ let date = await I.executeScript(function(el) {
|
|
|
420
391
|
|
|
421
392
|
#### Parameters
|
|
422
393
|
|
|
423
|
-
- `fn` ([string][3]
|
|
394
|
+
- `fn` **([string][3] | [function][7])** function to be executed in browser context.
|
|
395
|
+
- `args` **...any** to be passed to function.
|
|
396
|
+
|
|
397
|
+
Returns **[Promise][8]<any>** Wrapper for synchronous [evaluate][9]
|
|
424
398
|
|
|
425
399
|
### fillField
|
|
426
400
|
|
|
@@ -440,16 +414,14 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
440
414
|
|
|
441
415
|
#### Parameters
|
|
442
416
|
|
|
443
|
-
- `field` ([string][3]
|
|
444
|
-
- `value` [string][3] text value to fill.
|
|
445
|
-
|
|
446
|
-
|
|
417
|
+
- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
418
|
+
- `value` **[string][3]** text value to fill.
|
|
447
419
|
|
|
448
420
|
### grabAttributeFrom
|
|
449
421
|
|
|
450
422
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
451
423
|
An array as a result will be returned if there are more than one matched element.
|
|
452
|
-
Resumes test execution, so should be used inside async with `await
|
|
424
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
453
425
|
|
|
454
426
|
```js
|
|
455
427
|
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
@@ -457,19 +429,16 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
457
429
|
|
|
458
430
|
#### Parameters
|
|
459
431
|
|
|
460
|
-
- `locator` ([string][3]
|
|
461
|
-
- `attr` [string][3] attribute name.
|
|
462
|
-
|
|
463
|
-
Returns [Promise][8]<[string][3]> attribute value
|
|
464
|
-
|
|
432
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
433
|
+
- `attr` **[string][3]** attribute name.
|
|
465
434
|
|
|
435
|
+
Returns **[Promise][8]<[string][3]>** attribute value
|
|
466
436
|
|
|
467
437
|
### grabCookie
|
|
468
438
|
|
|
469
439
|
Gets a cookie object by name.
|
|
470
440
|
If none provided gets all cookies.
|
|
471
|
-
|
|
472
|
-
- Resumes test execution, so should be used inside async with `await` operator.
|
|
441
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
473
442
|
|
|
474
443
|
```js
|
|
475
444
|
let cookie = await I.grabCookie('auth');
|
|
@@ -478,13 +447,9 @@ assert(cookie.value, '123456');
|
|
|
478
447
|
|
|
479
448
|
#### Parameters
|
|
480
449
|
|
|
481
|
-
- `name`
|
|
482
|
-
|
|
483
|
-
Returns [Promise][8]<[string][3]> attribute value
|
|
484
|
-
|
|
450
|
+
- `name` **[string][3]?** cookie name.
|
|
485
451
|
|
|
486
|
-
|
|
487
|
-
Returns any Promise<object> Cookie in JSON format. If name not passed returns all cookies for this domain.Multiple cookies can be received by passing query object `I.grabCookie({ secure: true});`. If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
|
|
452
|
+
Returns **[Promise][8]<[string][3]>** attribute valueCookie in JSON format. If name not passed returns all cookies for this domain.Multiple cookies can be received by passing query object `I.grabCookie({ secure: true});`. If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
|
|
488
453
|
|
|
489
454
|
### grabCurrentUrl
|
|
490
455
|
|
|
@@ -496,9 +461,7 @@ let url = await I.grabCurrentUrl();
|
|
|
496
461
|
console.log(`Current URL is [${url}]`);
|
|
497
462
|
```
|
|
498
463
|
|
|
499
|
-
Returns [Promise][8]<[string][3]
|
|
500
|
-
|
|
501
|
-
|
|
464
|
+
Returns **[Promise][8]<[string][3]>** current URL
|
|
502
465
|
|
|
503
466
|
### grabHAR
|
|
504
467
|
|
|
@@ -512,7 +475,7 @@ fs.writeFileSync('sample.har', JSON.stringify({log: har}));
|
|
|
512
475
|
### grabHTMLFrom
|
|
513
476
|
|
|
514
477
|
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
515
|
-
Resumes test execution, so should be used inside async function with `await
|
|
478
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
516
479
|
If more than one element is found - an array of HTMLs returned.
|
|
517
480
|
|
|
518
481
|
```js
|
|
@@ -521,11 +484,10 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
521
484
|
|
|
522
485
|
#### Parameters
|
|
523
486
|
|
|
524
|
-
- `locator`
|
|
525
|
-
|
|
526
|
-
Returns [Promise][8]<[string][3]> HTML code for an element
|
|
527
|
-
|
|
487
|
+
- `locator`
|
|
488
|
+
- `element` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
528
489
|
|
|
490
|
+
Returns **[Promise][8]<[string][3]>** HTML code for an element
|
|
529
491
|
|
|
530
492
|
### grabNumberOfVisibleElements
|
|
531
493
|
|
|
@@ -537,29 +499,25 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
537
499
|
|
|
538
500
|
#### Parameters
|
|
539
501
|
|
|
540
|
-
- `locator` ([string][3]
|
|
541
|
-
|
|
542
|
-
Returns [Promise][8]<[number][9]> number of visible elements
|
|
543
|
-
|
|
502
|
+
- `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
544
503
|
|
|
504
|
+
Returns **[Promise][8]<[number][10]>** number of visible elements
|
|
545
505
|
|
|
546
506
|
### grabPageScrollPosition
|
|
547
507
|
|
|
548
508
|
Retrieves a page scroll position and returns it to test.
|
|
549
|
-
Resumes test execution, so should be used inside an async function with `await
|
|
509
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
550
510
|
|
|
551
511
|
```js
|
|
552
512
|
let { x, y } = await I.grabPageScrollPosition();
|
|
553
513
|
```
|
|
554
514
|
|
|
555
|
-
Returns [Promise][8]<[
|
|
556
|
-
|
|
557
|
-
|
|
515
|
+
Returns **[Promise][8]<[Object][4]<[string][3], any>>** scroll position
|
|
558
516
|
|
|
559
517
|
### grabTextFrom
|
|
560
518
|
|
|
561
519
|
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
562
|
-
Resumes test execution, so should be used inside async with `await
|
|
520
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
563
521
|
|
|
564
522
|
```js
|
|
565
523
|
let pin = await I.grabTextFrom('#pin');
|
|
@@ -569,29 +527,25 @@ If multiple elements found returns an array of texts.
|
|
|
569
527
|
|
|
570
528
|
#### Parameters
|
|
571
529
|
|
|
572
|
-
- `locator`
|
|
573
|
-
|
|
574
|
-
Returns [Promise][8]<[string][3]> attribute value
|
|
575
|
-
|
|
530
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
576
531
|
|
|
532
|
+
Returns **[Promise][8]<([string][3] | [Array][11]<[string][3]>)>** attribute value
|
|
577
533
|
|
|
578
534
|
### grabTitle
|
|
579
535
|
|
|
580
536
|
Retrieves a page title and returns it to test.
|
|
581
|
-
Resumes test execution, so should be used inside async with `await
|
|
537
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
582
538
|
|
|
583
539
|
```js
|
|
584
540
|
let title = await I.grabTitle();
|
|
585
541
|
```
|
|
586
542
|
|
|
587
|
-
Returns [Promise][8]<[string][3]
|
|
588
|
-
|
|
589
|
-
|
|
543
|
+
Returns **[Promise][8]<[string][3]>** title
|
|
590
544
|
|
|
591
545
|
### grabValueFrom
|
|
592
546
|
|
|
593
547
|
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
594
|
-
Resumes test execution, so should be used inside async function with `await
|
|
548
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
595
549
|
|
|
596
550
|
```js
|
|
597
551
|
let email = await I.grabValueFrom('input[name=email]');
|
|
@@ -599,11 +553,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
599
553
|
|
|
600
554
|
#### Parameters
|
|
601
555
|
|
|
602
|
-
- `locator` ([string][3]
|
|
603
|
-
|
|
604
|
-
Returns [Promise][8]<[string][3]> attribute value
|
|
605
|
-
|
|
556
|
+
- `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
606
557
|
|
|
558
|
+
Returns **[Promise][8]<[string][3]>** attribute value
|
|
607
559
|
|
|
608
560
|
### haveHeader
|
|
609
561
|
|
|
@@ -631,15 +583,13 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
631
583
|
|
|
632
584
|
#### Parameters
|
|
633
585
|
|
|
634
|
-
- `locator` ([string][3]
|
|
635
|
-
- `offsetX` [number][
|
|
636
|
-
- `offsetY` [number][
|
|
637
|
-
|
|
638
|
-
|
|
586
|
+
- `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
587
|
+
- `offsetX` **[number][10]** (optional, `0` by default) X-axis offset.
|
|
588
|
+
- `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset.
|
|
639
589
|
|
|
640
590
|
### pressKey
|
|
641
591
|
|
|
642
|
-
Sends [input event][
|
|
592
|
+
Sends [input event][12] on a page.
|
|
643
593
|
Can submit special keys like 'Enter', 'Backspace', etc
|
|
644
594
|
|
|
645
595
|
#### Parameters
|
|
@@ -658,9 +608,6 @@ Reload the current page.
|
|
|
658
608
|
I.refreshPage();
|
|
659
609
|
```
|
|
660
610
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
611
|
### resizeWindow
|
|
665
612
|
|
|
666
613
|
Resize the current window to provided width and height.
|
|
@@ -668,10 +615,8 @@ First parameter can be set to `maximize`.
|
|
|
668
615
|
|
|
669
616
|
#### Parameters
|
|
670
617
|
|
|
671
|
-
- `width` [number][
|
|
672
|
-
- `height` [number][
|
|
673
|
-
|
|
674
|
-
|
|
618
|
+
- `width` **[number][10]** width in pixels or `maximize`.
|
|
619
|
+
- `height` **[number][10]** height in pixels.
|
|
675
620
|
|
|
676
621
|
### rightClick
|
|
677
622
|
|
|
@@ -688,10 +633,8 @@ I.rightClick('Click me', '.context');
|
|
|
688
633
|
|
|
689
634
|
#### Parameters
|
|
690
635
|
|
|
691
|
-
- `locator` ([string][3]
|
|
692
|
-
- `context` ([string][3]
|
|
693
|
-
|
|
694
|
-
|
|
636
|
+
- `locator` **([string][3] | [object][4])** clickable element located by CSS|XPath|strict locator.
|
|
637
|
+
- `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
695
638
|
|
|
696
639
|
### saveScreenshot
|
|
697
640
|
|
|
@@ -706,10 +649,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
706
649
|
|
|
707
650
|
#### Parameters
|
|
708
651
|
|
|
709
|
-
- `fileName` [string][3] file name to save.
|
|
710
|
-
- `fullPage` [boolean][
|
|
711
|
-
|
|
712
|
-
|
|
652
|
+
- `fileName` **[string][3]** file name to save.
|
|
653
|
+
- `fullPage` **[boolean][13]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
713
654
|
|
|
714
655
|
### scrollPageToBottom
|
|
715
656
|
|
|
@@ -719,9 +660,6 @@ Scroll page to the bottom.
|
|
|
719
660
|
I.scrollPageToBottom();
|
|
720
661
|
```
|
|
721
662
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
663
|
### scrollPageToTop
|
|
726
664
|
|
|
727
665
|
Scroll page to the top.
|
|
@@ -730,9 +668,6 @@ Scroll page to the top.
|
|
|
730
668
|
I.scrollPageToTop();
|
|
731
669
|
```
|
|
732
670
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
671
|
### scrollTo
|
|
737
672
|
|
|
738
673
|
Scrolls to element matched by locator.
|
|
@@ -745,11 +680,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
745
680
|
|
|
746
681
|
#### Parameters
|
|
747
682
|
|
|
748
|
-
- `locator` ([string][3]
|
|
749
|
-
- `offsetX` [number][
|
|
750
|
-
- `offsetY` [number][
|
|
751
|
-
|
|
752
|
-
|
|
683
|
+
- `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
684
|
+
- `offsetX` **[number][10]** (optional, `0` by default) X-axis offset.
|
|
685
|
+
- `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset.
|
|
753
686
|
|
|
754
687
|
### see
|
|
755
688
|
|
|
@@ -764,10 +697,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
764
697
|
|
|
765
698
|
#### Parameters
|
|
766
699
|
|
|
767
|
-
- `text` [string][3] expected on page.
|
|
768
|
-
- `context` ([string][3]
|
|
769
|
-
|
|
770
|
-
|
|
700
|
+
- `text` **[string][3]** expected on page.
|
|
701
|
+
- `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
771
702
|
|
|
772
703
|
### seeCheckboxIsChecked
|
|
773
704
|
|
|
@@ -781,9 +712,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
781
712
|
|
|
782
713
|
#### Parameters
|
|
783
714
|
|
|
784
|
-
- `field` ([string][3]
|
|
785
|
-
|
|
786
|
-
|
|
715
|
+
- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
787
716
|
|
|
788
717
|
### seeCookie
|
|
789
718
|
|
|
@@ -795,9 +724,7 @@ I.seeCookie('Auth');
|
|
|
795
724
|
|
|
796
725
|
#### Parameters
|
|
797
726
|
|
|
798
|
-
- `name` [string][3] cookie name.
|
|
799
|
-
|
|
800
|
-
|
|
727
|
+
- `name` **[string][3]** cookie name.
|
|
801
728
|
|
|
802
729
|
### seeCurrentUrlEquals
|
|
803
730
|
|
|
@@ -812,9 +739,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
812
739
|
|
|
813
740
|
#### Parameters
|
|
814
741
|
|
|
815
|
-
- `url` [string][3] value to check.
|
|
816
|
-
|
|
817
|
-
|
|
742
|
+
- `url` **[string][3]** value to check.
|
|
818
743
|
|
|
819
744
|
### seeElement
|
|
820
745
|
|
|
@@ -827,9 +752,7 @@ I.seeElement('#modal');
|
|
|
827
752
|
|
|
828
753
|
#### Parameters
|
|
829
754
|
|
|
830
|
-
- `locator` ([string][3]
|
|
831
|
-
|
|
832
|
-
|
|
755
|
+
- `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
833
756
|
|
|
834
757
|
### seeElementInDOM
|
|
835
758
|
|
|
@@ -842,9 +765,7 @@ I.seeElementInDOM('#modal');
|
|
|
842
765
|
|
|
843
766
|
#### Parameters
|
|
844
767
|
|
|
845
|
-
- `locator` ([string][3]
|
|
846
|
-
|
|
847
|
-
|
|
768
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
848
769
|
|
|
849
770
|
### seeInCurrentUrl
|
|
850
771
|
|
|
@@ -856,9 +777,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
856
777
|
|
|
857
778
|
#### Parameters
|
|
858
779
|
|
|
859
|
-
- `url` [string][3] a fragment to check
|
|
860
|
-
|
|
861
|
-
|
|
780
|
+
- `url` **[string][3]** a fragment to check
|
|
862
781
|
|
|
863
782
|
### seeInField
|
|
864
783
|
|
|
@@ -874,10 +793,8 @@ I.seeInField('#searchform input','Search');
|
|
|
874
793
|
|
|
875
794
|
#### Parameters
|
|
876
795
|
|
|
877
|
-
- `field` ([string][3]
|
|
878
|
-
- `value` [string][3] value to check.
|
|
879
|
-
|
|
880
|
-
|
|
796
|
+
- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
797
|
+
- `value` **[string][3]** value to check.
|
|
881
798
|
|
|
882
799
|
### seeInSource
|
|
883
800
|
|
|
@@ -889,9 +806,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
889
806
|
|
|
890
807
|
#### Parameters
|
|
891
808
|
|
|
892
|
-
- `text` [string][3] value to check.
|
|
893
|
-
|
|
894
|
-
|
|
809
|
+
- `text` **[string][3]** value to check.
|
|
895
810
|
|
|
896
811
|
### seeInTitle
|
|
897
812
|
|
|
@@ -903,9 +818,7 @@ I.seeInTitle('Home Page');
|
|
|
903
818
|
|
|
904
819
|
#### Parameters
|
|
905
820
|
|
|
906
|
-
- `text` [string][3] text value to check.
|
|
907
|
-
|
|
908
|
-
|
|
821
|
+
- `text` **[string][3]** text value to check.
|
|
909
822
|
|
|
910
823
|
### seeNumberOfElements
|
|
911
824
|
|
|
@@ -918,10 +831,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
918
831
|
|
|
919
832
|
#### Parameters
|
|
920
833
|
|
|
921
|
-
- `locator` ([string][3]
|
|
922
|
-
- `num` [number][
|
|
923
|
-
|
|
924
|
-
|
|
834
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
835
|
+
- `num` **[number][10]** number of elements.
|
|
925
836
|
|
|
926
837
|
### seeNumberOfVisibleElements
|
|
927
838
|
|
|
@@ -934,10 +845,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
934
845
|
|
|
935
846
|
#### Parameters
|
|
936
847
|
|
|
937
|
-
- `locator` ([string][3]
|
|
938
|
-
- `num` [number][
|
|
939
|
-
|
|
940
|
-
|
|
848
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
849
|
+
- `num` **[number][10]** number of elements.
|
|
941
850
|
|
|
942
851
|
### selectOption
|
|
943
852
|
|
|
@@ -962,10 +871,8 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
962
871
|
|
|
963
872
|
#### Parameters
|
|
964
873
|
|
|
965
|
-
- `select` ([string][3]
|
|
966
|
-
- `option` ([string][3]
|
|
967
|
-
|
|
968
|
-
|
|
874
|
+
- `select` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
875
|
+
- `option` **([string][3] | [Array][11]<any>)** visible text or value of option.
|
|
969
876
|
|
|
970
877
|
### setCookie
|
|
971
878
|
|
|
@@ -977,14 +884,12 @@ I.setCookie({name: 'auth', value: true});
|
|
|
977
884
|
|
|
978
885
|
#### Parameters
|
|
979
886
|
|
|
980
|
-
- `cookie` [object][4] a cookie object.
|
|
981
|
-
|
|
982
|
-
Wrapper for `.cookies.set(cookie)`.
|
|
983
|
-
[See more][13]
|
|
887
|
+
- `cookie` **[object][4]** a cookie object.Wrapper for `.cookies.set(cookie)`.
|
|
888
|
+
[See more][14]
|
|
984
889
|
|
|
985
890
|
### triggerMouseEvent
|
|
986
891
|
|
|
987
|
-
Sends [input event][
|
|
892
|
+
Sends [input event][15] on a page.
|
|
988
893
|
Should be a mouse event like:
|
|
989
894
|
{
|
|
990
895
|
type: 'mouseDown',
|
|
@@ -1012,10 +917,8 @@ I.uncheckOption('agree', '//form');
|
|
|
1012
917
|
|
|
1013
918
|
#### Parameters
|
|
1014
919
|
|
|
1015
|
-
- `field` ([string][3]
|
|
1016
|
-
- `context` [string][3] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1017
|
-
|
|
1018
|
-
|
|
920
|
+
- `field` **([string][3] | [object][4])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
921
|
+
- `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1019
922
|
|
|
1020
923
|
### wait
|
|
1021
924
|
|
|
@@ -1027,9 +930,7 @@ I.wait(2); // wait 2 secs
|
|
|
1027
930
|
|
|
1028
931
|
#### Parameters
|
|
1029
932
|
|
|
1030
|
-
- `sec` [number][
|
|
1031
|
-
|
|
1032
|
-
|
|
933
|
+
- `sec` **[number][10]** number of second to wait.
|
|
1033
934
|
|
|
1034
935
|
### waitForDetached
|
|
1035
936
|
|
|
@@ -1042,10 +943,8 @@ I.waitForDetached('#popup');
|
|
|
1042
943
|
|
|
1043
944
|
#### Parameters
|
|
1044
945
|
|
|
1045
|
-
- `locator` ([string][3]
|
|
1046
|
-
- `sec` [number][
|
|
1047
|
-
|
|
1048
|
-
|
|
946
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
947
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1049
948
|
|
|
1050
949
|
### waitForElement
|
|
1051
950
|
|
|
@@ -1059,10 +958,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1059
958
|
|
|
1060
959
|
#### Parameters
|
|
1061
960
|
|
|
1062
|
-
- `locator` ([string][3]
|
|
1063
|
-
- `sec` [number][
|
|
1064
|
-
|
|
1065
|
-
|
|
961
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
962
|
+
- `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
|
|
1066
963
|
|
|
1067
964
|
### waitForFunction
|
|
1068
965
|
|
|
@@ -1081,11 +978,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1081
978
|
|
|
1082
979
|
#### Parameters
|
|
1083
980
|
|
|
1084
|
-
- `fn` ([string][3]
|
|
1085
|
-
- `argsOrSec` ([
|
|
1086
|
-
- `sec` [number][
|
|
1087
|
-
|
|
1088
|
-
|
|
981
|
+
- `fn` **([string][3] | [function][7])** to be executed in browser context.
|
|
982
|
+
- `argsOrSec` **([Array][11]<any> | [number][10])?** (optional, `1` by default) arguments for function or seconds.
|
|
983
|
+
- `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
|
|
1089
984
|
|
|
1090
985
|
### waitForInvisible
|
|
1091
986
|
|
|
@@ -1098,10 +993,8 @@ I.waitForInvisible('#popup');
|
|
|
1098
993
|
|
|
1099
994
|
#### Parameters
|
|
1100
995
|
|
|
1101
|
-
- `locator` ([string][3]
|
|
1102
|
-
- `sec` [number][
|
|
1103
|
-
|
|
1104
|
-
|
|
996
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
997
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1105
998
|
|
|
1106
999
|
### waitForText
|
|
1107
1000
|
|
|
@@ -1116,11 +1009,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1116
1009
|
|
|
1117
1010
|
#### Parameters
|
|
1118
1011
|
|
|
1119
|
-
- `text` [string][3] to wait for.
|
|
1120
|
-
- `sec` [number][
|
|
1121
|
-
- `context` ([string][3]
|
|
1122
|
-
|
|
1123
|
-
|
|
1012
|
+
- `text` **[string][3]** to wait for.
|
|
1013
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1014
|
+
- `context` **([string][3] | [object][4])?** (optional) element located by CSS|XPath|strict locator.
|
|
1124
1015
|
|
|
1125
1016
|
### waitForVisible
|
|
1126
1017
|
|
|
@@ -1133,10 +1024,8 @@ I.waitForVisible('#popup');
|
|
|
1133
1024
|
|
|
1134
1025
|
#### Parameters
|
|
1135
1026
|
|
|
1136
|
-
- `locator` ([string][3]
|
|
1137
|
-
- `sec` [number][
|
|
1138
|
-
|
|
1139
|
-
|
|
1027
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1028
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1140
1029
|
|
|
1141
1030
|
### waitToHide
|
|
1142
1031
|
|
|
@@ -1149,10 +1038,8 @@ I.waitToHide('#popup');
|
|
|
1149
1038
|
|
|
1150
1039
|
#### Parameters
|
|
1151
1040
|
|
|
1152
|
-
- `locator` ([string][3]
|
|
1153
|
-
- `sec` [number][
|
|
1154
|
-
|
|
1155
|
-
|
|
1041
|
+
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1042
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1156
1043
|
|
|
1157
1044
|
[1]: https://github.com/segmentio/nightmare
|
|
1158
1045
|
|
|
@@ -1170,14 +1057,16 @@ I.waitToHide('#popup');
|
|
|
1170
1057
|
|
|
1171
1058
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1172
1059
|
|
|
1173
|
-
[9]: https://
|
|
1060
|
+
[9]: https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2
|
|
1061
|
+
|
|
1062
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1174
1063
|
|
|
1175
|
-
[
|
|
1064
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1176
1065
|
|
|
1177
|
-
[
|
|
1066
|
+
[12]: http://electron.atom.io/docs/api/web-contents/#webcontentssendinputeventevent
|
|
1178
1067
|
|
|
1179
|
-
[
|
|
1068
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1180
1069
|
|
|
1181
|
-
[
|
|
1070
|
+
[14]: https://github.com/segmentio/nightmare/blob/master/Readme.md#cookiessetcookie
|
|
1182
1071
|
|
|
1183
|
-
[
|
|
1072
|
+
[15]: http://electron.atom.io/docs/api/web-contents/#contentssendinputeventevent
|