codeceptjs 2.1.3 → 2.2.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 +125 -37
- package/README.md +15 -22
- package/bin/codecept.js +4 -1
- package/docs/acceptance.md +44 -1
- package/docs/advanced.md +1 -1
- package/docs/angular.md +6 -9
- package/docs/basics.md +388 -75
- package/docs/bdd.md +4 -3
- package/docs/best.md +1 -1
- package/docs/books.md +31 -0
- package/docs/build/Appium.js +215 -176
- package/docs/build/Nightmare.js +618 -489
- package/docs/build/Polly.js +189 -0
- package/docs/build/Protractor.js +747 -608
- package/docs/build/Puppeteer.js +914 -633
- package/docs/build/REST.js +1 -1
- package/docs/build/TestCafe.js +1835 -0
- package/docs/build/WebDriver.js +861 -805
- package/docs/build/WebDriverIO.js +616 -617
- package/docs/changelog.md +410 -316
- package/docs/commands.md +6 -6
- package/docs/community-helpers.md +2 -0
- package/docs/detox.md +235 -0
- package/docs/examples.md +23 -0
- package/docs/helpers/ApiDataFactory.md +11 -10
- package/docs/helpers/Appium.md +130 -61
- package/docs/helpers/Detox.md +579 -0
- package/docs/helpers/FileSystem.md +2 -1
- package/docs/helpers/Mochawesome.md +1 -0
- package/docs/helpers/Nightmare.md +348 -128
- package/docs/helpers/Polly.md +85 -0
- package/docs/helpers/Protractor.md +451 -184
- package/docs/helpers/Puppeteer-firefox.md +55 -0
- package/docs/helpers/Puppeteer.md +619 -183
- package/docs/helpers/REST.md +17 -16
- package/docs/helpers/SeleniumWebdriver.md +9 -8
- package/docs/helpers/TestCafe.md +1168 -0
- package/docs/helpers/WebDriver.md +600 -291
- package/docs/helpers/WebDriverIO.md +393 -278
- package/docs/helpers.md +37 -18
- package/docs/locators.md +2 -0
- package/docs/mobile-react-native-locators.md +64 -0
- package/docs/mobile.md +5 -0
- package/docs/plugins.md +54 -13
- package/docs/puppeteer.md +74 -26
- package/docs/quickstart.md +47 -12
- package/docs/react.md +67 -0
- package/docs/reports.md +1 -1
- package/docs/{webapi/_keys.mustache → shared/keys.mustache} +0 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +157 -0
- package/docs/videos.md +19 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +2 -2
- package/docs/webapi/attachFile.mustache +2 -2
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +3 -3
- package/docs/webapi/dontSee.mustache +6 -3
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +7 -1
- package/docs/webapi/dontSeeCookie.mustache +5 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +6 -1
- package/docs/webapi/dontSeeElement.mustache +5 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +5 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +7 -2
- package/docs/webapi/dontSeeInSource.mustache +5 -1
- package/docs/webapi/dontSeeInTitle.mustache +5 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +2 -2
- package/docs/webapi/dragAndDrop.mustache +2 -2
- package/docs/webapi/dragSlider.mustache +2 -2
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +2 -2
- package/docs/webapi/grabAttributeFrom.mustache +3 -2
- package/docs/webapi/grabBrowserLogs.mustache +3 -1
- package/docs/webapi/grabCookie.mustache +2 -1
- package/docs/webapi/grabCssPropertyFrom.mustache +3 -2
- package/docs/webapi/grabCurrentUrl.mustache +3 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +19 -0
- package/docs/webapi/grabHTMLFrom.mustache +2 -1
- package/docs/webapi/grabNumberOfOpenTabs.mustache +4 -2
- package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -2
- package/docs/webapi/grabPageScrollPosition.mustache +3 -1
- package/docs/webapi/grabSource.mustache +3 -1
- package/docs/webapi/grabTextFrom.mustache +2 -1
- package/docs/webapi/grabTitle.mustache +3 -1
- package/docs/webapi/grabValueFrom.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +2 -2
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +3 -3
- package/docs/webapi/say.mustache +2 -2
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +2 -2
- package/docs/webapi/seeAttributesOnElements.mustache +3 -3
- package/docs/webapi/seeCheckboxIsChecked.mustache +2 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -2
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +2 -2
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +5 -1
- package/docs/webapi/seeNumberOfElements.mustache +10 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/switchTo.mustache +6 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/wait.mustache +1 -2
- package/docs/webapi/waitForDetached.mustache +3 -3
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +3 -3
- package/docs/webapi/waitForInvisible.mustache +3 -3
- package/docs/webapi/waitForText.mustache +3 -3
- package/docs/webapi/waitForValue.mustache +3 -3
- package/docs/webapi/waitForVisible.mustache +3 -3
- package/docs/webapi/waitInUrl.mustache +2 -2
- package/docs/webapi/waitNumberOfVisibleElements.mustache +3 -3
- package/docs/webapi/waitToHide.mustache +3 -3
- package/docs/webapi/waitUntil.mustache +3 -3
- package/docs/webapi/waitUrlEquals.mustache +2 -2
- package/docs/webdriver.md +453 -0
- package/lib/codecept.js +11 -9
- package/lib/command/definitions.js +183 -30
- package/lib/command/gherkin/snippets.js +29 -9
- package/lib/command/init.js +31 -9
- package/lib/command/run-multiple.js +46 -59
- package/lib/command/utils.js +1 -1
- package/lib/container.js +30 -4
- package/lib/data/dataScenarioConfig.js +18 -0
- package/lib/helper/Appium.js +24 -24
- package/lib/helper/Nightmare.js +81 -84
- package/lib/helper/Polly.js +189 -0
- package/lib/helper/Protractor.js +96 -86
- package/lib/helper/Puppeteer.js +238 -113
- package/lib/helper/REST.js +1 -1
- package/lib/helper/TestCafe.js +1257 -0
- package/lib/helper/WebDriver.js +217 -277
- package/lib/helper/WebDriverIO.js +75 -75
- package/lib/helper/clientscripts/nightmare.js +8 -0
- package/lib/helper/extras/React.js +55 -0
- package/lib/helper/testcafe/testControllerHolder.js +42 -0
- package/lib/helper/testcafe/testcafe-utils.js +63 -0
- package/lib/history.js +39 -0
- package/lib/hooks.js +25 -1
- package/lib/interfaces/gherkin.js +17 -1
- package/lib/interfaces/scenarioConfig.js +2 -2
- package/lib/listener/config.js +3 -3
- package/lib/locator.js +6 -0
- package/lib/pause.js +22 -1
- package/lib/plugin/allure.js +63 -0
- package/lib/plugin/autoLogin.js +65 -16
- package/lib/plugin/puppeteerCoverage.js +6 -1
- package/lib/plugin/stepByStepReport.js +4 -3
- package/lib/scenario.js +23 -17
- package/lib/step.js +5 -2
- package/lib/ui.js +1 -1
- package/lib/utils.js +70 -20
- package/package.json +20 -19
- package/translations/de-DE.js +69 -0
- package/translations/index.js +1 -0
- package/docs/video.md +0 -26
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
id: Protractor
|
|
3
3
|
title: Protractor
|
|
4
4
|
---
|
|
5
|
+
|
|
5
6
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
6
7
|
|
|
7
8
|
## Protractor
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Extends Helper
|
|
10
11
|
|
|
11
12
|
Protractor helper is based on [Protractor library][1] and used for testing web applications.
|
|
12
13
|
|
|
@@ -19,21 +20,21 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
19
20
|
|
|
20
21
|
- `url` - base url of website to be tested
|
|
21
22
|
- `browser` - browser in which perform testing
|
|
22
|
-
- `angular`
|
|
23
|
+
- `angular` : disable this option to run tests for non-Angular applications.
|
|
23
24
|
- `driver` - which protractor driver to use (local, direct, session, hosted, sauce, browserstack). By default set to 'hosted' which requires selenium server to be started.
|
|
24
|
-
- `restart`
|
|
25
|
-
- `smartWait`: (optional)
|
|
26
|
-
- `disableScreenshots`
|
|
27
|
-
- `fullPageScreenshots`
|
|
28
|
-
- `uniqueScreenshotNames`
|
|
29
|
-
- `keepBrowserState`
|
|
25
|
+
- `restart` - restart browser between tests.
|
|
26
|
+
- `smartWait`: (optional) enables [SmartWait][3]; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000
|
|
27
|
+
- `disableScreenshots` - don't save screenshot on failure
|
|
28
|
+
- `fullPageScreenshots` - make full page screenshots on failure.
|
|
29
|
+
- `uniqueScreenshotNames` - option to prevent screenshot override if you have scenarios with the same name in different suites
|
|
30
|
+
- `keepBrowserState` - keep browser state between tests when `restart` set to false.
|
|
30
31
|
- `seleniumAddress` - Selenium address to connect (default: [http://localhost:4444/wd/hub][4])
|
|
31
32
|
- `rootElement` - Root element of AngularJS application (default: body)
|
|
32
33
|
- `getPageTimeout` (optional) sets default timeout for a page to be loaded. 10000 by default.
|
|
33
|
-
- `waitForTimeout`: (optional) sets default wait time in _ms_ for all `wait
|
|
34
|
+
- `waitForTimeout`: (optional) sets default wait time in _ms_ for all `wait` functions. 1000 by default.
|
|
34
35
|
- `scriptsTimeout`: (optional) timeout in milliseconds for each script run on the browser, 10000 by default.
|
|
35
36
|
- `windowSize`: (optional) default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
36
|
-
- `manualStart`
|
|
37
|
+
- `manualStart` - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriverIO"]._startBrowser()`
|
|
37
38
|
- `capabilities`: {} - list of [Desired Capabilities][5]
|
|
38
39
|
- `proxy`: set proxy settings
|
|
39
40
|
|
|
@@ -106,7 +107,7 @@ Get the window handle relative to the current handle. i.e. the next handle or th
|
|
|
106
107
|
|
|
107
108
|
#### Parameters
|
|
108
109
|
|
|
109
|
-
- `offset`
|
|
110
|
+
- `offset` [Number][7] Offset from current handle index. i.e. offset < 0 will go to the previous handle and positive number will go to the next window handle in sequence.
|
|
110
111
|
|
|
111
112
|
### \_locate
|
|
112
113
|
|
|
@@ -126,7 +127,7 @@ this.helpers['Protractor']._locate({name: 'password'}, true).then //...
|
|
|
126
127
|
#### Parameters
|
|
127
128
|
|
|
128
129
|
- `locator`
|
|
129
|
-
- `smartWait`
|
|
130
|
+
- `smartWait`
|
|
130
131
|
|
|
131
132
|
### \_locateCheckable
|
|
132
133
|
|
|
@@ -188,7 +189,9 @@ I.amOnPage('/login'); // opens a login page
|
|
|
188
189
|
|
|
189
190
|
#### Parameters
|
|
190
191
|
|
|
191
|
-
- `url`
|
|
192
|
+
- `url` [string][9] url path or global url.
|
|
193
|
+
|
|
194
|
+
|
|
192
195
|
|
|
193
196
|
### amOutsideAngularApp
|
|
194
197
|
|
|
@@ -206,8 +209,10 @@ I.appendField('#myTextField', 'appended');
|
|
|
206
209
|
|
|
207
210
|
#### Parameters
|
|
208
211
|
|
|
209
|
-
- `field`
|
|
210
|
-
- `value`
|
|
212
|
+
- `field` ([string][9] \| [object][10]) located by label|name|CSS|XPath|strict locator
|
|
213
|
+
- `value` [string][9] text value to append.
|
|
214
|
+
|
|
215
|
+
|
|
211
216
|
|
|
212
217
|
### attachFile
|
|
213
218
|
|
|
@@ -222,8 +227,10 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
222
227
|
|
|
223
228
|
#### Parameters
|
|
224
229
|
|
|
225
|
-
- `locator`
|
|
226
|
-
- `pathToFile`
|
|
230
|
+
- `locator` ([string][9] \| [object][10]) field located by label|name|CSS|XPath|strict locator.
|
|
231
|
+
- `pathToFile` [string][9] local file path relative to codecept.json config file.
|
|
232
|
+
|
|
233
|
+
|
|
227
234
|
|
|
228
235
|
### cancelPopup
|
|
229
236
|
|
|
@@ -244,8 +251,10 @@ I.checkOption('agree', '//form');
|
|
|
244
251
|
|
|
245
252
|
#### Parameters
|
|
246
253
|
|
|
247
|
-
- `field`
|
|
248
|
-
- `context`
|
|
254
|
+
- `field` ([string][9] \| [object][10]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
255
|
+
- `context` [string][9] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
256
|
+
|
|
257
|
+
|
|
249
258
|
|
|
250
259
|
### clearCookie
|
|
251
260
|
|
|
@@ -259,7 +268,9 @@ I.clearCookie('test');
|
|
|
259
268
|
|
|
260
269
|
#### Parameters
|
|
261
270
|
|
|
262
|
-
- `cookie`
|
|
271
|
+
- `cookie` [string][9] (optional, `null` by default) cookie name
|
|
272
|
+
|
|
273
|
+
|
|
263
274
|
|
|
264
275
|
### clearField
|
|
265
276
|
|
|
@@ -273,7 +284,10 @@ I.clearField('#email');
|
|
|
273
284
|
|
|
274
285
|
#### Parameters
|
|
275
286
|
|
|
276
|
-
- `field`
|
|
287
|
+
- `field`
|
|
288
|
+
- `editable` ([string][9] \| [object][10]) field located by label|name|CSS|XPath|strict locator.
|
|
289
|
+
|
|
290
|
+
|
|
277
291
|
|
|
278
292
|
### click
|
|
279
293
|
|
|
@@ -292,7 +306,7 @@ I.click('Submit');
|
|
|
292
306
|
// CSS button
|
|
293
307
|
I.click('#form input[type=submit]');
|
|
294
308
|
// XPath
|
|
295
|
-
I.click('//form
|
|
309
|
+
I.click('//form/[@type=submit]');
|
|
296
310
|
// link in context
|
|
297
311
|
I.click('Logout', '#nav');
|
|
298
312
|
// using strict locator
|
|
@@ -301,8 +315,10 @@ I.click({css: 'nav a.login'});
|
|
|
301
315
|
|
|
302
316
|
#### Parameters
|
|
303
317
|
|
|
304
|
-
- `locator`
|
|
305
|
-
- `context`
|
|
318
|
+
- `locator` ([string][9] \| [object][10]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
319
|
+
- `context` ([string][9] \| [object][10]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
320
|
+
|
|
321
|
+
|
|
306
322
|
|
|
307
323
|
### closeCurrentTab
|
|
308
324
|
|
|
@@ -326,54 +342,89 @@ Opposite to `see`. Checks that a text is not present on a page.
|
|
|
326
342
|
Use context parameter to narrow down the search.
|
|
327
343
|
|
|
328
344
|
```js
|
|
329
|
-
I.dontSee('Login'); // assume we are already logged in
|
|
345
|
+
I.dontSee('Login'); // assume we are already logged in.
|
|
346
|
+
I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
330
347
|
```
|
|
331
348
|
|
|
332
349
|
#### Parameters
|
|
333
350
|
|
|
334
|
-
- `text`
|
|
335
|
-
- `context`
|
|
351
|
+
- `text` [string][9] which is not present.
|
|
352
|
+
- `context` ([string][9] \| [object][10]) (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
353
|
+
|
|
336
354
|
|
|
337
355
|
### dontSeeCheckboxIsChecked
|
|
338
356
|
|
|
339
357
|
Verifies that the specified checkbox is not checked.
|
|
340
358
|
|
|
359
|
+
```js
|
|
360
|
+
I.dontSeeeCheckboxIsChedcked('#agree'); // located by ID
|
|
361
|
+
I.dontSeeeCheckboxIsChedcked('I agree to terms'); // located by label
|
|
362
|
+
I.dontSeeeCheckboxIsChedcked('agree'); // located by name
|
|
363
|
+
```
|
|
364
|
+
|
|
341
365
|
#### Parameters
|
|
342
366
|
|
|
343
|
-
- `field`
|
|
367
|
+
- `field` ([string][9] \| [object][10]) located by label|name|CSS|XPath|strict locator.
|
|
368
|
+
|
|
369
|
+
|
|
344
370
|
|
|
345
371
|
### dontSeeCookie
|
|
346
372
|
|
|
347
373
|
Checks that cookie with given name does not exist.
|
|
348
374
|
|
|
375
|
+
```js
|
|
376
|
+
I.dontSeeCookie('auth'); // no auth cookie
|
|
377
|
+
```
|
|
378
|
+
|
|
349
379
|
#### Parameters
|
|
350
380
|
|
|
351
|
-
- `name`
|
|
381
|
+
- `name` [string][9] cookie name.
|
|
382
|
+
|
|
383
|
+
|
|
352
384
|
|
|
353
385
|
### dontSeeCurrentUrlEquals
|
|
354
386
|
|
|
355
387
|
Checks that current url is not equal to provided one.
|
|
356
388
|
If a relative url provided, a configured url will be prepended to it.
|
|
357
389
|
|
|
390
|
+
```js
|
|
391
|
+
I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
|
|
392
|
+
I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
|
|
393
|
+
```
|
|
394
|
+
|
|
358
395
|
#### Parameters
|
|
359
396
|
|
|
360
|
-
- `url`
|
|
397
|
+
- `url` [string][9] value to check.
|
|
398
|
+
|
|
399
|
+
|
|
361
400
|
|
|
362
401
|
### dontSeeElement
|
|
363
402
|
|
|
364
403
|
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
365
404
|
|
|
405
|
+
```js
|
|
406
|
+
I.dontSeeElement('.modal'); // modal is not shown
|
|
407
|
+
```
|
|
408
|
+
|
|
366
409
|
#### Parameters
|
|
367
410
|
|
|
368
|
-
- `locator`
|
|
411
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|Strict locator.
|
|
412
|
+
|
|
413
|
+
|
|
369
414
|
|
|
370
415
|
### dontSeeElementInDOM
|
|
371
416
|
|
|
372
417
|
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
373
418
|
|
|
419
|
+
```js
|
|
420
|
+
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
421
|
+
```
|
|
422
|
+
|
|
374
423
|
#### Parameters
|
|
375
424
|
|
|
376
|
-
- `locator`
|
|
425
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|Strict locator.
|
|
426
|
+
|
|
427
|
+
|
|
377
428
|
|
|
378
429
|
### dontSeeInCurrentUrl
|
|
379
430
|
|
|
@@ -381,33 +432,55 @@ Checks that current url does not contain a provided fragment.
|
|
|
381
432
|
|
|
382
433
|
#### Parameters
|
|
383
434
|
|
|
384
|
-
- `url`
|
|
435
|
+
- `url` [string][9] value to check.
|
|
436
|
+
|
|
437
|
+
|
|
385
438
|
|
|
386
439
|
### dontSeeInField
|
|
387
440
|
|
|
388
441
|
Checks that value of input field or textare doesn't equal to given value
|
|
389
442
|
Opposite to `seeInField`.
|
|
390
443
|
|
|
444
|
+
```js
|
|
445
|
+
I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
446
|
+
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
447
|
+
```
|
|
448
|
+
|
|
391
449
|
#### Parameters
|
|
392
450
|
|
|
393
|
-
- `field`
|
|
394
|
-
- `value`
|
|
451
|
+
- `field` ([string][9] \| [object][10]) located by label|name|CSS|XPath|strict locator.
|
|
452
|
+
- `value` [string][9] value to check.
|
|
453
|
+
|
|
454
|
+
|
|
395
455
|
|
|
396
456
|
### dontSeeInSource
|
|
397
457
|
|
|
398
458
|
Checks that the current page does not contains the given string in its raw source code.
|
|
399
459
|
|
|
460
|
+
```js
|
|
461
|
+
I.dontSeeInSource('<!--'); // no comments in source
|
|
462
|
+
```
|
|
463
|
+
|
|
400
464
|
#### Parameters
|
|
401
465
|
|
|
402
|
-
- `text`
|
|
466
|
+
- `text`
|
|
467
|
+
- `value` [string][9] to check.
|
|
468
|
+
|
|
469
|
+
|
|
403
470
|
|
|
404
471
|
### dontSeeInTitle
|
|
405
472
|
|
|
406
473
|
Checks that title does not contain text.
|
|
407
474
|
|
|
475
|
+
```js
|
|
476
|
+
I.dontSeeInTitle('Error');
|
|
477
|
+
```
|
|
478
|
+
|
|
408
479
|
#### Parameters
|
|
409
480
|
|
|
410
|
-
- `text`
|
|
481
|
+
- `text` [string][9] value to check.
|
|
482
|
+
|
|
483
|
+
|
|
411
484
|
|
|
412
485
|
### doubleClick
|
|
413
486
|
|
|
@@ -423,8 +496,10 @@ I.doubleClick('.btn.edit');
|
|
|
423
496
|
|
|
424
497
|
#### Parameters
|
|
425
498
|
|
|
426
|
-
- `locator`
|
|
427
|
-
- `context`
|
|
499
|
+
- `locator` ([string][9] \| [object][10]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
500
|
+
- `context` ([string][9] \| [object][10]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
501
|
+
|
|
502
|
+
|
|
428
503
|
|
|
429
504
|
### dragAndDrop
|
|
430
505
|
|
|
@@ -436,19 +511,21 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
436
511
|
|
|
437
512
|
#### Parameters
|
|
438
513
|
|
|
439
|
-
- `srcElement`
|
|
440
|
-
- `destElement`
|
|
514
|
+
- `srcElement` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
515
|
+
- `destElement` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
516
|
+
|
|
517
|
+
|
|
441
518
|
|
|
442
519
|
### executeAsyncScript
|
|
443
520
|
|
|
444
521
|
Executes async script on page.
|
|
445
522
|
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
446
523
|
|
|
447
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][
|
|
524
|
+
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][11].
|
|
448
525
|
|
|
449
526
|
```js
|
|
450
527
|
I.executeAsyncScript(function(done) {
|
|
451
|
-
Vue.nextTick(done); // waiting for next tick
|
|
528
|
+
Vue.nextTick(done); // waiting for next tick
|
|
452
529
|
});
|
|
453
530
|
```
|
|
454
531
|
|
|
@@ -457,14 +534,14 @@ Additional arguments can be passed as well, while `done` function is always last
|
|
|
457
534
|
|
|
458
535
|
```js
|
|
459
536
|
let val = await I.executeAsyncScript(function(url, done) {
|
|
460
|
-
// in browser context
|
|
461
|
-
$.ajax(url, { success: (data) => done(data); }
|
|
537
|
+
// in browser context
|
|
538
|
+
$.ajax(url, { success: (data) => done(data); }
|
|
462
539
|
}, 'http://ajax.callback.url/');
|
|
463
540
|
```
|
|
464
541
|
|
|
465
542
|
#### Parameters
|
|
466
543
|
|
|
467
|
-
- `fn`
|
|
544
|
+
- `fn` ([string][9] \| [function][12]) function to be executed in browser context.
|
|
468
545
|
|
|
469
546
|
### executeScript
|
|
470
547
|
|
|
@@ -478,8 +555,8 @@ Example with jQuery DatePicker:
|
|
|
478
555
|
```js
|
|
479
556
|
// change date of jQuery DatePicker
|
|
480
557
|
I.executeScript(function() {
|
|
481
|
-
// now we are inside browser context
|
|
482
|
-
$('date').datetimepicker('setDate', new Date());
|
|
558
|
+
// now we are inside browser context
|
|
559
|
+
$('date').datetimepicker('setDate', new Date());
|
|
483
560
|
});
|
|
484
561
|
```
|
|
485
562
|
|
|
@@ -487,14 +564,14 @@ Can return values. Don't forget to use `await` to get them.
|
|
|
487
564
|
|
|
488
565
|
```js
|
|
489
566
|
let date = await I.executeScript(function(el) {
|
|
490
|
-
// only basic types can be returned
|
|
491
|
-
return $(el).datetimepicker('getDate').toString();
|
|
567
|
+
// only basic types can be returned
|
|
568
|
+
return $(el).datetimepicker('getDate').toString();
|
|
492
569
|
}, '#date'); // passing jquery selector
|
|
493
570
|
```
|
|
494
571
|
|
|
495
572
|
#### Parameters
|
|
496
573
|
|
|
497
|
-
- `fn`
|
|
574
|
+
- `fn` ([string][9] \| [function][12]) function to be executed in browser context.
|
|
498
575
|
|
|
499
576
|
### fillField
|
|
500
577
|
|
|
@@ -514,14 +591,16 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
514
591
|
|
|
515
592
|
#### Parameters
|
|
516
593
|
|
|
517
|
-
- `field`
|
|
518
|
-
- `value`
|
|
594
|
+
- `field` ([string][9] \| [object][10]) located by label|name|CSS|XPath|strict locator.
|
|
595
|
+
- `value` [string][9] text value to fill.
|
|
596
|
+
|
|
597
|
+
|
|
519
598
|
|
|
520
599
|
### grabAttributeFrom
|
|
521
600
|
|
|
522
601
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
523
602
|
An array as a result will be returned if there are more than one matched element.
|
|
524
|
-
Resumes test execution, so
|
|
603
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
525
604
|
|
|
526
605
|
```js
|
|
527
606
|
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
@@ -529,24 +608,33 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
529
608
|
|
|
530
609
|
#### Parameters
|
|
531
610
|
|
|
532
|
-
- `locator`
|
|
533
|
-
- `attr`
|
|
611
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
612
|
+
- `attr` [string][9] attribute name.
|
|
613
|
+
|
|
614
|
+
Returns [Promise][13]<[string][9]> attribute value
|
|
615
|
+
|
|
616
|
+
|
|
534
617
|
|
|
535
618
|
### grabBrowserLogs
|
|
536
619
|
|
|
537
620
|
Get JS log from browser. Log buffer is reset after each request.
|
|
538
|
-
Resumes test execution, so
|
|
621
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
539
622
|
|
|
540
623
|
```js
|
|
541
624
|
let logs = await I.grabBrowserLogs();
|
|
542
625
|
console.log(JSON.stringify(logs))
|
|
543
626
|
```
|
|
544
627
|
|
|
628
|
+
Returns [Promise][13]<[Array][14]> all browser logs
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
545
632
|
### grabCookie
|
|
546
633
|
|
|
547
634
|
Gets a cookie object by name.
|
|
548
635
|
If none provided gets all cookies.
|
|
549
|
-
|
|
636
|
+
|
|
637
|
+
- Resumes test execution, so should be used inside async with `await` operator.
|
|
550
638
|
|
|
551
639
|
```js
|
|
552
640
|
let cookie = await I.grabCookie('auth');
|
|
@@ -555,12 +643,16 @@ assert(cookie.value, '123456');
|
|
|
555
643
|
|
|
556
644
|
#### Parameters
|
|
557
645
|
|
|
558
|
-
- `name`
|
|
646
|
+
- `name` cookie name.
|
|
647
|
+
|
|
648
|
+
Returns [Promise][13]<[string][9]> attribute value
|
|
649
|
+
|
|
650
|
+
Returns cookie in JSON [format][15].
|
|
559
651
|
|
|
560
652
|
### grabCssPropertyFrom
|
|
561
653
|
|
|
562
654
|
Grab CSS property for given locator
|
|
563
|
-
Resumes test execution, so
|
|
655
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
564
656
|
|
|
565
657
|
```js
|
|
566
658
|
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
@@ -568,8 +660,12 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
568
660
|
|
|
569
661
|
#### Parameters
|
|
570
662
|
|
|
571
|
-
- `locator`
|
|
572
|
-
- `cssProperty`
|
|
663
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
664
|
+
- `cssProperty` [string][9] CSS property name.
|
|
665
|
+
|
|
666
|
+
Returns [Promise][13]<[string][9]> CSS value
|
|
667
|
+
|
|
668
|
+
|
|
573
669
|
|
|
574
670
|
### grabCurrentUrl
|
|
575
671
|
|
|
@@ -581,10 +677,14 @@ let url = await I.grabCurrentUrl();
|
|
|
581
677
|
console.log(`Current URL is [${url}]`);
|
|
582
678
|
```
|
|
583
679
|
|
|
680
|
+
Returns [Promise][13]<[string][9]> current URL
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
584
684
|
### grabHTMLFrom
|
|
585
685
|
|
|
586
686
|
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
587
|
-
Resumes test execution, so
|
|
687
|
+
Resumes test execution, so should be used inside async function with `await` operator.
|
|
588
688
|
If more than one element is found - an array of HTMLs returned.
|
|
589
689
|
|
|
590
690
|
```js
|
|
@@ -595,35 +695,51 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
595
695
|
|
|
596
696
|
- `locator` element located by CSS|XPath|strict locator.
|
|
597
697
|
|
|
698
|
+
Returns [Promise][13]<[string][9]> HTML code for an element
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
598
702
|
### grabNumberOfOpenTabs
|
|
599
703
|
|
|
600
704
|
Grab number of open tabs.
|
|
601
705
|
|
|
602
706
|
```js
|
|
603
|
-
I.grabNumberOfOpenTabs();
|
|
707
|
+
let tabs = await I.grabNumberOfOpenTabs();
|
|
604
708
|
```
|
|
605
709
|
|
|
710
|
+
Returns [Promise][13]<[number][7]> number of open tabs
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
606
714
|
### grabNumberOfVisibleElements
|
|
607
715
|
|
|
608
716
|
Grab number of visible elements by locator.
|
|
609
717
|
|
|
610
718
|
```js
|
|
611
|
-
I.grabNumberOfVisibleElements('p');
|
|
719
|
+
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
612
720
|
```
|
|
613
721
|
|
|
614
722
|
#### Parameters
|
|
615
723
|
|
|
616
|
-
- `locator`
|
|
724
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
725
|
+
|
|
726
|
+
Returns [Promise][13]<[number][7]> number of visible elements
|
|
727
|
+
|
|
728
|
+
|
|
617
729
|
|
|
618
730
|
### grabPageScrollPosition
|
|
619
731
|
|
|
620
732
|
Retrieves a page scroll position and returns it to test.
|
|
621
|
-
Resumes test execution, so
|
|
733
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
622
734
|
|
|
623
735
|
```js
|
|
624
736
|
let { x, y } = await I.grabPageScrollPosition();
|
|
625
737
|
```
|
|
626
738
|
|
|
739
|
+
Returns [Promise][13]<[object][10]> scroll position
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
627
743
|
### grabPopupText
|
|
628
744
|
|
|
629
745
|
Grab the text within the popup. If no popup is visible then it will return null
|
|
@@ -641,10 +757,14 @@ Resumes test execution, so should be used inside an async function.
|
|
|
641
757
|
let pageSource = await I.grabSource();
|
|
642
758
|
```
|
|
643
759
|
|
|
760
|
+
Returns [Promise][13]<[string][9]> source code
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
644
764
|
### grabTextFrom
|
|
645
765
|
|
|
646
766
|
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
647
|
-
Resumes test execution, so
|
|
767
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
648
768
|
|
|
649
769
|
```js
|
|
650
770
|
let pin = await I.grabTextFrom('#pin');
|
|
@@ -656,19 +776,27 @@ If multiple elements found returns an array of texts.
|
|
|
656
776
|
|
|
657
777
|
- `locator` element located by CSS|XPath|strict locator.
|
|
658
778
|
|
|
779
|
+
Returns [Promise][13]<[string][9]> attribute value
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
|
|
659
783
|
### grabTitle
|
|
660
784
|
|
|
661
785
|
Retrieves a page title and returns it to test.
|
|
662
|
-
Resumes test execution, so
|
|
786
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
663
787
|
|
|
664
788
|
```js
|
|
665
789
|
let title = await I.grabTitle();
|
|
666
790
|
```
|
|
667
791
|
|
|
792
|
+
Returns [Promise][13]<[string][9]> title
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
668
796
|
### grabValueFrom
|
|
669
797
|
|
|
670
798
|
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
671
|
-
Resumes test execution, so
|
|
799
|
+
Resumes test execution, so should be used inside async function with `await` operator.
|
|
672
800
|
|
|
673
801
|
```js
|
|
674
802
|
let email = await I.grabValueFrom('input[name=email]');
|
|
@@ -676,7 +804,11 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
676
804
|
|
|
677
805
|
#### Parameters
|
|
678
806
|
|
|
679
|
-
- `locator`
|
|
807
|
+
- `locator` ([string][9] \| [object][10]) field located by label|name|CSS|XPath|strict locator.
|
|
808
|
+
|
|
809
|
+
Returns [Promise][13]<[string][9]> attribute value
|
|
810
|
+
|
|
811
|
+
|
|
680
812
|
|
|
681
813
|
### haveModule
|
|
682
814
|
|
|
@@ -705,9 +837,11 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
705
837
|
|
|
706
838
|
#### Parameters
|
|
707
839
|
|
|
708
|
-
- `locator`
|
|
709
|
-
- `offsetX`
|
|
710
|
-
- `offsetY`
|
|
840
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
841
|
+
- `offsetX` [number][7] (optional, `0` by default) X-axis offset.
|
|
842
|
+
- `offsetY` [number][7] (optional, `0` by default) Y-axis offset.
|
|
843
|
+
|
|
844
|
+
|
|
711
845
|
|
|
712
846
|
### moveTo
|
|
713
847
|
|
|
@@ -728,7 +862,7 @@ I.openNewTab();
|
|
|
728
862
|
### pressKey
|
|
729
863
|
|
|
730
864
|
Presses a key on a focused element.
|
|
731
|
-
Special keys like 'Enter', 'Control', [etc][
|
|
865
|
+
Special keys like 'Enter', 'Control', [etc][16]
|
|
732
866
|
will be replaced with corresponding unicode.
|
|
733
867
|
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
|
|
734
868
|
|
|
@@ -739,36 +873,43 @@ I.pressKey(['Control','a']);
|
|
|
739
873
|
|
|
740
874
|
#### Parameters
|
|
741
875
|
|
|
742
|
-
- `key`
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
876
|
+
- `key` ([string][9] \| [array][14]) key or array of keys to press.
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
[Valid key names](https://w3c.github.io/webdriver/#keyboard-actions) are:
|
|
883
|
+
|
|
884
|
+
- `'Add'`,
|
|
885
|
+
- `'Alt'`,
|
|
886
|
+
- `'ArrowDown'` or `'Down arrow'`,
|
|
887
|
+
- `'ArrowLeft'` or `'Left arrow'`,
|
|
888
|
+
- `'ArrowRight'` or `'Right arrow'`,
|
|
889
|
+
- `'ArrowUp'` or `'Up arrow'`,
|
|
890
|
+
- `'Backspace'`,
|
|
891
|
+
- `'Command'`,
|
|
892
|
+
- `'Control'`,
|
|
893
|
+
- `'Del'`,
|
|
894
|
+
- `'Divide'`,
|
|
895
|
+
- `'End'`,
|
|
896
|
+
- `'Enter'`,
|
|
897
|
+
- `'Equals'`,
|
|
898
|
+
- `'Escape'`,
|
|
899
|
+
- `'F1 to F12'`,
|
|
900
|
+
- `'Home'`,
|
|
901
|
+
- `'Insert'`,
|
|
902
|
+
- `'Meta'`,
|
|
903
|
+
- `'Multiply'`,
|
|
904
|
+
- `'Numpad 0'` to `'Numpad 9'`,
|
|
905
|
+
- `'Pagedown'` or `'PageDown'`,
|
|
906
|
+
- `'Pageup'` or `'PageUp'`,
|
|
907
|
+
- `'Pause'`,
|
|
908
|
+
- `'Semicolon'`,
|
|
909
|
+
- `'Shift'`,
|
|
910
|
+
- `'Space'`,
|
|
911
|
+
- `'Subtract'`,
|
|
912
|
+
- `'Tab'`.
|
|
772
913
|
|
|
773
914
|
### refresh
|
|
774
915
|
|
|
@@ -782,6 +923,9 @@ Reload the current page.
|
|
|
782
923
|
I.refreshPage();
|
|
783
924
|
```
|
|
784
925
|
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
785
929
|
### resetModule
|
|
786
930
|
|
|
787
931
|
Removes mocked Angular module. If modName not specified - clears all mock modules.
|
|
@@ -802,8 +946,10 @@ First parameter can be set to `maximize`.
|
|
|
802
946
|
|
|
803
947
|
#### Parameters
|
|
804
948
|
|
|
805
|
-
- `width`
|
|
806
|
-
- `height`
|
|
949
|
+
- `width` [number][7] width in pixels or `maximize`.
|
|
950
|
+
- `height` [number][7] height in pixels.
|
|
951
|
+
|
|
952
|
+
|
|
807
953
|
|
|
808
954
|
### rightClick
|
|
809
955
|
|
|
@@ -820,13 +966,15 @@ I.rightClick('Click me', '.context');
|
|
|
820
966
|
|
|
821
967
|
#### Parameters
|
|
822
968
|
|
|
823
|
-
- `locator`
|
|
824
|
-
- `context`
|
|
969
|
+
- `locator` ([string][9] \| [object][10]) clickable element located by CSS|XPath|strict locator.
|
|
970
|
+
- `context` ([string][9] \| [object][10]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
971
|
+
|
|
972
|
+
|
|
825
973
|
|
|
826
974
|
### saveScreenshot
|
|
827
975
|
|
|
828
976
|
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
829
|
-
Filename is relative to output folder.
|
|
977
|
+
Filename is relative to output folder.
|
|
830
978
|
Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
|
|
831
979
|
|
|
832
980
|
```js
|
|
@@ -836,8 +984,10 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
836
984
|
|
|
837
985
|
#### Parameters
|
|
838
986
|
|
|
839
|
-
- `fileName`
|
|
840
|
-
- `fullPage`
|
|
987
|
+
- `fileName` [string][9] file name to save.
|
|
988
|
+
- `fullPage` [boolean][17] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
989
|
+
|
|
990
|
+
|
|
841
991
|
|
|
842
992
|
### scrollPageToBottom
|
|
843
993
|
|
|
@@ -847,6 +997,9 @@ Scroll page to the bottom.
|
|
|
847
997
|
I.scrollPageToBottom();
|
|
848
998
|
```
|
|
849
999
|
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
850
1003
|
### scrollPageToTop
|
|
851
1004
|
|
|
852
1005
|
Scroll page to the top.
|
|
@@ -855,6 +1008,9 @@ Scroll page to the top.
|
|
|
855
1008
|
I.scrollPageToTop();
|
|
856
1009
|
```
|
|
857
1010
|
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
858
1014
|
### scrollTo
|
|
859
1015
|
|
|
860
1016
|
Scrolls to element matched by locator.
|
|
@@ -867,9 +1023,11 @@ I.scrollTo('#submit', 5, 5);
|
|
|
867
1023
|
|
|
868
1024
|
#### Parameters
|
|
869
1025
|
|
|
870
|
-
- `locator`
|
|
871
|
-
- `offsetX`
|
|
872
|
-
- `offsetY`
|
|
1026
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
1027
|
+
- `offsetX` [number][7] (optional, `0` by default) X-axis offset.
|
|
1028
|
+
- `offsetY` [number][7] (optional, `0` by default) Y-axis offset.
|
|
1029
|
+
|
|
1030
|
+
|
|
873
1031
|
|
|
874
1032
|
### see
|
|
875
1033
|
|
|
@@ -884,21 +1042,25 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
884
1042
|
|
|
885
1043
|
#### Parameters
|
|
886
1044
|
|
|
887
|
-
- `text`
|
|
888
|
-
- `context`
|
|
1045
|
+
- `text` [string][9] expected on page.
|
|
1046
|
+
- `context` ([string][9] \| [object][10]) (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1047
|
+
|
|
1048
|
+
|
|
889
1049
|
|
|
890
1050
|
### seeAttributesOnElements
|
|
891
1051
|
|
|
892
1052
|
Checks that all elements with given locator have given attributes.
|
|
893
1053
|
|
|
894
1054
|
```js
|
|
895
|
-
I.seeAttributesOnElements('//form', {
|
|
1055
|
+
I.seeAttributesOnElements('//form', { method: "post"});
|
|
896
1056
|
```
|
|
897
1057
|
|
|
898
1058
|
#### Parameters
|
|
899
1059
|
|
|
900
|
-
- `locator`
|
|
901
|
-
- `attributes`
|
|
1060
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
1061
|
+
- `attributes` [object][10] attributes and their values to check.
|
|
1062
|
+
|
|
1063
|
+
|
|
902
1064
|
|
|
903
1065
|
### seeCheckboxIsChecked
|
|
904
1066
|
|
|
@@ -912,7 +1074,9 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
912
1074
|
|
|
913
1075
|
#### Parameters
|
|
914
1076
|
|
|
915
|
-
- `field`
|
|
1077
|
+
- `field` ([string][9] \| [object][10]) located by label|name|CSS|XPath|strict locator.
|
|
1078
|
+
|
|
1079
|
+
|
|
916
1080
|
|
|
917
1081
|
### seeCookie
|
|
918
1082
|
|
|
@@ -924,7 +1088,9 @@ I.seeCookie('Auth');
|
|
|
924
1088
|
|
|
925
1089
|
#### Parameters
|
|
926
1090
|
|
|
927
|
-
- `name`
|
|
1091
|
+
- `name` [string][9] cookie name.
|
|
1092
|
+
|
|
1093
|
+
|
|
928
1094
|
|
|
929
1095
|
### seeCssPropertiesOnElements
|
|
930
1096
|
|
|
@@ -936,8 +1102,10 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
936
1102
|
|
|
937
1103
|
#### Parameters
|
|
938
1104
|
|
|
939
|
-
- `locator`
|
|
940
|
-
- `cssProperties`
|
|
1105
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
1106
|
+
- `cssProperties` [object][10] object with CSS properties and their values to check.
|
|
1107
|
+
|
|
1108
|
+
|
|
941
1109
|
|
|
942
1110
|
### seeCurrentUrlEquals
|
|
943
1111
|
|
|
@@ -952,7 +1120,9 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
952
1120
|
|
|
953
1121
|
#### Parameters
|
|
954
1122
|
|
|
955
|
-
- `url`
|
|
1123
|
+
- `url` [string][9] value to check.
|
|
1124
|
+
|
|
1125
|
+
|
|
956
1126
|
|
|
957
1127
|
### seeElement
|
|
958
1128
|
|
|
@@ -965,7 +1135,9 @@ I.seeElement('#modal');
|
|
|
965
1135
|
|
|
966
1136
|
#### Parameters
|
|
967
1137
|
|
|
968
|
-
- `locator`
|
|
1138
|
+
- `locator` ([string][9] \| [object][10]) located by CSS|XPath|strict locator.
|
|
1139
|
+
|
|
1140
|
+
|
|
969
1141
|
|
|
970
1142
|
### seeElementInDOM
|
|
971
1143
|
|
|
@@ -978,7 +1150,9 @@ I.seeElementInDOM('#modal');
|
|
|
978
1150
|
|
|
979
1151
|
#### Parameters
|
|
980
1152
|
|
|
981
|
-
- `locator`
|
|
1153
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1154
|
+
|
|
1155
|
+
|
|
982
1156
|
|
|
983
1157
|
### seeInCurrentUrl
|
|
984
1158
|
|
|
@@ -990,7 +1164,9 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
990
1164
|
|
|
991
1165
|
#### Parameters
|
|
992
1166
|
|
|
993
|
-
- `url`
|
|
1167
|
+
- `url` [string][9] a fragment to check
|
|
1168
|
+
|
|
1169
|
+
|
|
994
1170
|
|
|
995
1171
|
### seeInField
|
|
996
1172
|
|
|
@@ -1006,8 +1182,10 @@ I.seeInField('#searchform input','Search');
|
|
|
1006
1182
|
|
|
1007
1183
|
#### Parameters
|
|
1008
1184
|
|
|
1009
|
-
- `field`
|
|
1010
|
-
- `value`
|
|
1185
|
+
- `field` ([string][9] \| [object][10]) located by label|name|CSS|XPath|strict locator.
|
|
1186
|
+
- `value` [string][9] value to check.
|
|
1187
|
+
|
|
1188
|
+
|
|
1011
1189
|
|
|
1012
1190
|
### seeInPopup
|
|
1013
1191
|
|
|
@@ -1028,19 +1206,27 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1028
1206
|
|
|
1029
1207
|
#### Parameters
|
|
1030
1208
|
|
|
1031
|
-
- `text`
|
|
1209
|
+
- `text` [string][9] value to check.
|
|
1210
|
+
|
|
1211
|
+
|
|
1032
1212
|
|
|
1033
1213
|
### seeInTitle
|
|
1034
1214
|
|
|
1035
1215
|
Checks that title contains text.
|
|
1036
1216
|
|
|
1217
|
+
```js
|
|
1218
|
+
I.seeInTitle('Home Page');
|
|
1219
|
+
```
|
|
1220
|
+
|
|
1037
1221
|
#### Parameters
|
|
1038
1222
|
|
|
1039
|
-
- `text`
|
|
1223
|
+
- `text` [string][9] text value to check.
|
|
1224
|
+
|
|
1225
|
+
|
|
1040
1226
|
|
|
1041
1227
|
### seeNumberOfElements
|
|
1042
1228
|
|
|
1043
|
-
|
|
1229
|
+
Asserts that an element appears a given number of times in the DOM.
|
|
1044
1230
|
Element is located by label or name or CSS or XPath.
|
|
1045
1231
|
|
|
1046
1232
|
```js
|
|
@@ -1049,8 +1235,10 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1049
1235
|
|
|
1050
1236
|
#### Parameters
|
|
1051
1237
|
|
|
1052
|
-
- `
|
|
1053
|
-
- `num`
|
|
1238
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1239
|
+
- `num` [number][7] number of elements.
|
|
1240
|
+
|
|
1241
|
+
|
|
1054
1242
|
|
|
1055
1243
|
### seeNumberOfVisibleElements
|
|
1056
1244
|
|
|
@@ -1063,8 +1251,10 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1063
1251
|
|
|
1064
1252
|
#### Parameters
|
|
1065
1253
|
|
|
1066
|
-
- `locator`
|
|
1067
|
-
- `num`
|
|
1254
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1255
|
+
- `num` [number][7] number of elements.
|
|
1256
|
+
|
|
1257
|
+
|
|
1068
1258
|
|
|
1069
1259
|
### seeTextEquals
|
|
1070
1260
|
|
|
@@ -1077,7 +1267,7 @@ I.seeTextEquals('text', 'h1');
|
|
|
1077
1267
|
#### Parameters
|
|
1078
1268
|
|
|
1079
1269
|
- `text`
|
|
1080
|
-
- `context`
|
|
1270
|
+
- `context`
|
|
1081
1271
|
|
|
1082
1272
|
### seeTitleEquals
|
|
1083
1273
|
|
|
@@ -1114,8 +1304,10 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1114
1304
|
|
|
1115
1305
|
#### Parameters
|
|
1116
1306
|
|
|
1117
|
-
- `select`
|
|
1118
|
-
- `option`
|
|
1307
|
+
- `select` ([string][9] \| [object][10]) field located by label|name|CSS|XPath|strict locator.
|
|
1308
|
+
- `option` ([string][9] \| [array][14]) visible text or value of option.
|
|
1309
|
+
|
|
1310
|
+
|
|
1119
1311
|
|
|
1120
1312
|
### setCookie
|
|
1121
1313
|
|
|
@@ -1127,15 +1319,24 @@ I.setCookie({name: 'auth', value: true});
|
|
|
1127
1319
|
|
|
1128
1320
|
#### Parameters
|
|
1129
1321
|
|
|
1130
|
-
- `cookie`
|
|
1322
|
+
- `cookie` [object][10] a cookie object.
|
|
1323
|
+
|
|
1324
|
+
|
|
1131
1325
|
|
|
1132
1326
|
### switchTo
|
|
1133
1327
|
|
|
1134
1328
|
Switches frame or in case of null locator reverts to parent.
|
|
1135
1329
|
|
|
1330
|
+
```js
|
|
1331
|
+
I.switchTo('iframe'); // switch to first iframe
|
|
1332
|
+
I.switchTo(); // switch back to main page
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1136
1335
|
#### Parameters
|
|
1137
1336
|
|
|
1138
|
-
- `locator`
|
|
1337
|
+
- `locator` ([string][9] \| [object][10]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1338
|
+
|
|
1339
|
+
|
|
1139
1340
|
|
|
1140
1341
|
### switchToNextTab
|
|
1141
1342
|
|
|
@@ -1148,7 +1349,7 @@ I.switchToNextTab(2);
|
|
|
1148
1349
|
|
|
1149
1350
|
#### Parameters
|
|
1150
1351
|
|
|
1151
|
-
- `num`
|
|
1352
|
+
- `num`
|
|
1152
1353
|
|
|
1153
1354
|
### switchToPreviousTab
|
|
1154
1355
|
|
|
@@ -1161,7 +1362,27 @@ I.switchToPreviousTab(2);
|
|
|
1161
1362
|
|
|
1162
1363
|
#### Parameters
|
|
1163
1364
|
|
|
1164
|
-
- `num`
|
|
1365
|
+
- `num`
|
|
1366
|
+
|
|
1367
|
+
### uncheckOption
|
|
1368
|
+
|
|
1369
|
+
Unselects a checkbox or radio button.
|
|
1370
|
+
Element is located by label or name or CSS or XPath.
|
|
1371
|
+
|
|
1372
|
+
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
1373
|
+
|
|
1374
|
+
```js
|
|
1375
|
+
I.uncheckOption('#agree');
|
|
1376
|
+
I.uncheckOption('I Agree to Terms and Conditions');
|
|
1377
|
+
I.uncheckOption('agree', '//form');
|
|
1378
|
+
```
|
|
1379
|
+
|
|
1380
|
+
#### Parameters
|
|
1381
|
+
|
|
1382
|
+
- `field` ([string][9] \| [object][10]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
1383
|
+
- `context` [string][9] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1384
|
+
|
|
1385
|
+
|
|
1165
1386
|
|
|
1166
1387
|
### wait
|
|
1167
1388
|
|
|
@@ -1173,7 +1394,9 @@ I.wait(2); // wait 2 secs
|
|
|
1173
1394
|
|
|
1174
1395
|
#### Parameters
|
|
1175
1396
|
|
|
1176
|
-
- `sec`
|
|
1397
|
+
- `sec` [number][7] number of second to wait.
|
|
1398
|
+
|
|
1399
|
+
|
|
1177
1400
|
|
|
1178
1401
|
### waitForClickable
|
|
1179
1402
|
|
|
@@ -1186,19 +1409,23 @@ I.waitForClickable('#link');
|
|
|
1186
1409
|
#### Parameters
|
|
1187
1410
|
|
|
1188
1411
|
- `locator`
|
|
1189
|
-
- `sec`
|
|
1412
|
+
- `sec`
|
|
1190
1413
|
|
|
1191
1414
|
### waitForDetached
|
|
1192
1415
|
|
|
1193
1416
|
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
1194
1417
|
Element can be located by CSS or XPath.
|
|
1195
1418
|
|
|
1196
|
-
|
|
1419
|
+
```js
|
|
1420
|
+
I.waitForDetached('#popup');
|
|
1421
|
+
```
|
|
1197
1422
|
|
|
1198
1423
|
#### Parameters
|
|
1199
1424
|
|
|
1200
|
-
- `locator`
|
|
1201
|
-
- `sec`
|
|
1425
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1426
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1427
|
+
|
|
1428
|
+
|
|
1202
1429
|
|
|
1203
1430
|
### waitForElement
|
|
1204
1431
|
|
|
@@ -1212,8 +1439,10 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1212
1439
|
|
|
1213
1440
|
#### Parameters
|
|
1214
1441
|
|
|
1215
|
-
- `locator`
|
|
1216
|
-
- `sec`
|
|
1442
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1443
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1444
|
+
|
|
1445
|
+
|
|
1217
1446
|
|
|
1218
1447
|
### waitForEnabled
|
|
1219
1448
|
|
|
@@ -1222,8 +1451,10 @@ Element can be located by CSS or XPath.
|
|
|
1222
1451
|
|
|
1223
1452
|
#### Parameters
|
|
1224
1453
|
|
|
1225
|
-
- `locator`
|
|
1454
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1226
1455
|
- `sec` (optional) time in seconds to wait, 1 by default.
|
|
1456
|
+
|
|
1457
|
+
|
|
1227
1458
|
|
|
1228
1459
|
### waitForFunction
|
|
1229
1460
|
|
|
@@ -1242,21 +1473,27 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1242
1473
|
|
|
1243
1474
|
#### Parameters
|
|
1244
1475
|
|
|
1245
|
-
- `fn`
|
|
1246
|
-
- `argsOrSec`
|
|
1247
|
-
- `sec`
|
|
1476
|
+
- `fn` ([string][9] \| [function][12]) to be executed in browser context.
|
|
1477
|
+
- `argsOrSec` ([array][14] \| [number][7]) (optional, `1` by default) arguments for function or seconds.
|
|
1478
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1479
|
+
|
|
1480
|
+
|
|
1248
1481
|
|
|
1249
1482
|
### waitForInvisible
|
|
1250
1483
|
|
|
1251
1484
|
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
1252
1485
|
Element can be located by CSS or XPath.
|
|
1253
1486
|
|
|
1254
|
-
|
|
1487
|
+
```js
|
|
1488
|
+
I.waitForInvisible('#popup');
|
|
1489
|
+
```
|
|
1255
1490
|
|
|
1256
1491
|
#### Parameters
|
|
1257
1492
|
|
|
1258
|
-
- `locator`
|
|
1259
|
-
- `sec`
|
|
1493
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1494
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1495
|
+
|
|
1496
|
+
|
|
1260
1497
|
|
|
1261
1498
|
### waitForText
|
|
1262
1499
|
|
|
@@ -1271,9 +1508,11 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1271
1508
|
|
|
1272
1509
|
#### Parameters
|
|
1273
1510
|
|
|
1274
|
-
- `text`
|
|
1275
|
-
- `sec`
|
|
1276
|
-
- `context`
|
|
1511
|
+
- `text` [string][9] to wait for.
|
|
1512
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1513
|
+
- `context` ([string][9] \| [object][10]) (optional) element located by CSS|XPath|strict locator.
|
|
1514
|
+
|
|
1515
|
+
|
|
1277
1516
|
|
|
1278
1517
|
### waitForValue
|
|
1279
1518
|
|
|
@@ -1285,21 +1524,27 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1285
1524
|
|
|
1286
1525
|
#### Parameters
|
|
1287
1526
|
|
|
1288
|
-
- `field`
|
|
1289
|
-
- `value`
|
|
1290
|
-
- `sec`
|
|
1527
|
+
- `field` ([string][9] \| [object][10]) input field.
|
|
1528
|
+
- `value` [string][9] expected value.
|
|
1529
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1530
|
+
|
|
1531
|
+
|
|
1291
1532
|
|
|
1292
1533
|
### waitForVisible
|
|
1293
1534
|
|
|
1294
1535
|
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
1295
1536
|
Element can be located by CSS or XPath.
|
|
1296
1537
|
|
|
1297
|
-
|
|
1538
|
+
```js
|
|
1539
|
+
I.waitForVisible('#popup');
|
|
1540
|
+
```
|
|
1298
1541
|
|
|
1299
1542
|
#### Parameters
|
|
1300
1543
|
|
|
1301
|
-
- `locator`
|
|
1302
|
-
- `sec`
|
|
1544
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1545
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1546
|
+
|
|
1547
|
+
|
|
1303
1548
|
|
|
1304
1549
|
### waitInUrl
|
|
1305
1550
|
|
|
@@ -1311,8 +1556,10 @@ I.waitInUrl('/info', 2);
|
|
|
1311
1556
|
|
|
1312
1557
|
#### Parameters
|
|
1313
1558
|
|
|
1314
|
-
- `urlPart`
|
|
1315
|
-
- `sec`
|
|
1559
|
+
- `urlPart` [string][9] value to check.
|
|
1560
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1561
|
+
|
|
1562
|
+
|
|
1316
1563
|
|
|
1317
1564
|
### waitNumberOfVisibleElements
|
|
1318
1565
|
|
|
@@ -1324,21 +1571,27 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1324
1571
|
|
|
1325
1572
|
#### Parameters
|
|
1326
1573
|
|
|
1327
|
-
- `locator`
|
|
1328
|
-
- `num`
|
|
1329
|
-
- `sec`
|
|
1574
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1575
|
+
- `num` [number][7] number of elements.
|
|
1576
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1577
|
+
|
|
1578
|
+
|
|
1330
1579
|
|
|
1331
1580
|
### waitToHide
|
|
1332
1581
|
|
|
1333
1582
|
Waits for an element to hide (by default waits for 1sec).
|
|
1334
1583
|
Element can be located by CSS or XPath.
|
|
1335
1584
|
|
|
1336
|
-
|
|
1585
|
+
```js
|
|
1586
|
+
I.waitToHide('#popup');
|
|
1587
|
+
```
|
|
1337
1588
|
|
|
1338
1589
|
#### Parameters
|
|
1339
1590
|
|
|
1340
|
-
- `locator`
|
|
1341
|
-
- `sec`
|
|
1591
|
+
- `locator` ([string][9] \| [object][10]) element located by CSS|XPath|strict locator.
|
|
1592
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1593
|
+
|
|
1594
|
+
|
|
1342
1595
|
|
|
1343
1596
|
### waitUntil
|
|
1344
1597
|
|
|
@@ -1351,9 +1604,11 @@ I.waitUntil(() => window.requests == 0, 5);
|
|
|
1351
1604
|
|
|
1352
1605
|
#### Parameters
|
|
1353
1606
|
|
|
1354
|
-
- `fn`
|
|
1355
|
-
- `sec`
|
|
1356
|
-
- `timeoutMsg`
|
|
1607
|
+
- `fn` ([function][12] \| [string][9]) function which is executed in browser context.
|
|
1608
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1609
|
+
- `timeoutMsg` [string][9] message to show in case of timeout fail.
|
|
1610
|
+
|
|
1611
|
+
|
|
1357
1612
|
|
|
1358
1613
|
### waitUrlEquals
|
|
1359
1614
|
|
|
@@ -1366,8 +1621,10 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1366
1621
|
|
|
1367
1622
|
#### Parameters
|
|
1368
1623
|
|
|
1369
|
-
- `urlPart`
|
|
1370
|
-
- `sec`
|
|
1624
|
+
- `urlPart` [string][9] value to check.
|
|
1625
|
+
- `sec` [number][7] (optional, `1` by default) time in seconds to wait
|
|
1626
|
+
|
|
1627
|
+
|
|
1371
1628
|
|
|
1372
1629
|
## perform
|
|
1373
1630
|
|
|
@@ -1389,10 +1646,20 @@ just press button if no selector is given
|
|
|
1389
1646
|
|
|
1390
1647
|
[8]: http://jster.net/category/windows-modals-popups
|
|
1391
1648
|
|
|
1392
|
-
[9]: https://
|
|
1649
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1650
|
+
|
|
1651
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1652
|
+
|
|
1653
|
+
[11]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
1654
|
+
|
|
1655
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1656
|
+
|
|
1657
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1658
|
+
|
|
1659
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1393
1660
|
|
|
1394
|
-
[
|
|
1661
|
+
[15]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
|
|
1395
1662
|
|
|
1396
|
-
[
|
|
1663
|
+
[16]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
|
|
1397
1664
|
|
|
1398
|
-
[
|
|
1665
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|