codeceptjs 3.3.1 → 3.3.4
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 +49 -0
- package/README.md +4 -25
- package/docs/api.md +4 -0
- package/docs/basics.md +2 -0
- package/docs/build/Appium.js +18 -28
- package/docs/build/JSONResponse.js +44 -3
- package/docs/build/Nightmare.js +53 -53
- package/docs/build/Playwright.js +95 -103
- package/docs/build/Protractor.js +66 -66
- package/docs/build/Puppeteer.js +74 -74
- package/docs/build/REST.js +8 -4
- package/docs/build/TestCafe.js +53 -53
- package/docs/build/WebDriver.js +84 -86
- package/docs/changelog.md +49 -0
- package/docs/helpers/Appium.md +212 -268
- package/docs/helpers/JSONResponse.md +24 -0
- package/docs/helpers/Nightmare.md +92 -141
- package/docs/helpers/Playwright.md +302 -413
- package/docs/helpers/Puppeteer.md +171 -231
- package/docs/helpers/REST.md +2 -0
- package/docs/helpers/TestCafe.md +125 -174
- package/docs/helpers/WebDriver.md +184 -247
- package/docs/plugins.md +41 -1
- package/docs/secrets.md +30 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/checkOption.mustache +1 -1
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +1 -1
- package/docs/webapi/clickLink.mustache +1 -1
- package/docs/webapi/closeCurrentTab.mustache +1 -1
- package/docs/webapi/closeOtherTabs.mustache +1 -1
- package/docs/webapi/dontSee.mustache +1 -1
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeCookie.mustache +1 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -1
- package/docs/webapi/dontSeeInTitle.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +1 -1
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragAndDrop.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/forceClick.mustache +1 -1
- package/docs/webapi/forceRightClick.mustache +1 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +1 -1
- package/docs/webapi/openNewTab.mustache +1 -1
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyDown.mustache +1 -1
- package/docs/webapi/pressKeyUp.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/refreshPage.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +1 -1
- package/docs/webapi/rightClick.mustache +1 -1
- package/docs/webapi/saveElementScreenshot.mustache +1 -1
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/say.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +1 -1
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- 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 +1 -1
- package/docs/webapi/seeInPopup.mustache +1 -1
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +1 -1
- package/docs/webapi/seeTitleEquals.mustache +1 -1
- package/docs/webapi/selectOption.mustache +1 -1
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/setGeoLocation.mustache +1 -1
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/switchToNextTab.mustache +1 -1
- package/docs/webapi/switchToPreviousTab.mustache +1 -1
- package/docs/webapi/type.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +1 -1
- package/docs/webapi/wait.mustache +1 -1
- package/docs/webapi/waitForClickable.mustache +1 -1
- package/docs/webapi/waitForDetached.mustache +1 -1
- package/docs/webapi/waitForElement.mustache +1 -1
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +1 -1
- package/docs/webapi/waitForInvisible.mustache +1 -1
- package/docs/webapi/waitForText.mustache +1 -1
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +1 -1
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/waitToHide.mustache +1 -1
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/lib/cli.js +1 -1
- package/lib/command/interactive.js +1 -1
- package/lib/command/run-workers.js +1 -1
- package/lib/command/workers/runTests.js +15 -0
- package/lib/helper/Appium.js +0 -10
- package/lib/helper/JSONResponse.js +44 -3
- package/lib/helper/Playwright.js +24 -32
- package/lib/helper/REST.js +8 -4
- package/lib/helper/WebDriver.js +5 -7
- package/lib/output.js +4 -0
- package/lib/plugin/customLocator.js +50 -3
- package/lib/plugin/retryFailedStep.js +1 -1
- package/lib/plugin/retryTo.js +1 -8
- package/lib/secret.js +30 -0
- package/lib/step.js +1 -1
- package/package.json +4 -4
- package/typings/types.d.ts +1016 -520
|
@@ -131,7 +131,8 @@ Traces will be saved to `output/trace`
|
|
|
131
131
|
Playwright: {
|
|
132
132
|
url: "http://localhost",
|
|
133
133
|
chromium: {
|
|
134
|
-
browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a'
|
|
134
|
+
browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a',
|
|
135
|
+
cdpConnection: false // default is false
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
}
|
|
@@ -233,9 +234,6 @@ Add the 'dialog' event listener to a page
|
|
|
233
234
|
|
|
234
235
|
- `page`
|
|
235
236
|
|
|
236
|
-
Returns **[Promise][10]<any>** The popup listener handles the dialog with the predefined action when it appears on the page.
|
|
237
|
-
It also saves a reference to the object which is used in seeInPopup.
|
|
238
|
-
|
|
239
237
|
### _contextLocator
|
|
240
238
|
|
|
241
239
|
Grab Locator if called within Context
|
|
@@ -248,8 +246,6 @@ Grab Locator if called within Context
|
|
|
248
246
|
|
|
249
247
|
Gets page URL including hash.
|
|
250
248
|
|
|
251
|
-
Returns **[Promise][10]<any>**
|
|
252
|
-
|
|
253
249
|
### _locate
|
|
254
250
|
|
|
255
251
|
Get elements by different locator types, including strict locator
|
|
@@ -263,8 +259,6 @@ const elements = await this.helpers['Playwright']._locate({name: 'password'});
|
|
|
263
259
|
|
|
264
260
|
- `locator`
|
|
265
261
|
|
|
266
|
-
Returns **[Promise][10]<any>**
|
|
267
|
-
|
|
268
262
|
### _locateCheckable
|
|
269
263
|
|
|
270
264
|
Find a checkbox by providing human readable text:
|
|
@@ -279,8 +273,6 @@ this.helpers['Playwright']._locateCheckable('I agree with terms and conditions')
|
|
|
279
273
|
- `locator`
|
|
280
274
|
- `providedContext`
|
|
281
275
|
|
|
282
|
-
Returns **[Promise][10]<any>**
|
|
283
|
-
|
|
284
276
|
### _locateClickable
|
|
285
277
|
|
|
286
278
|
Find a clickable element by providing human readable text:
|
|
@@ -293,8 +285,6 @@ this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
|
293
285
|
|
|
294
286
|
- `locator`
|
|
295
287
|
|
|
296
|
-
Returns **[Promise][10]<any>**
|
|
297
|
-
|
|
298
288
|
### _locateFields
|
|
299
289
|
|
|
300
290
|
Find field elements by providing human readable text:
|
|
@@ -307,25 +297,19 @@ this.helpers['Playwright']._locateFields('Your email').then // ...
|
|
|
307
297
|
|
|
308
298
|
- `locator`
|
|
309
299
|
|
|
310
|
-
Returns **[Promise][10]<any>**
|
|
311
|
-
|
|
312
300
|
### _setPage
|
|
313
301
|
|
|
314
302
|
Set current page
|
|
315
303
|
|
|
316
304
|
#### Parameters
|
|
317
305
|
|
|
318
|
-
- `page` **[object][
|
|
319
|
-
|
|
320
|
-
Returns **[Promise][10]<any>**
|
|
306
|
+
- `page` **[object][10]** page to set
|
|
321
307
|
|
|
322
308
|
### acceptPopup
|
|
323
309
|
|
|
324
310
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
325
311
|
Don't confuse popups with modal windows, as created by [various
|
|
326
|
-
libraries][
|
|
327
|
-
|
|
328
|
-
Returns **[Promise][10]<any>**
|
|
312
|
+
libraries][11].
|
|
329
313
|
|
|
330
314
|
### amAcceptingPopups
|
|
331
315
|
|
|
@@ -338,8 +322,6 @@ I.click('#triggerPopup');
|
|
|
338
322
|
I.acceptPopup();
|
|
339
323
|
```
|
|
340
324
|
|
|
341
|
-
Returns **[Promise][10]<any>**
|
|
342
|
-
|
|
343
325
|
### amCancellingPopups
|
|
344
326
|
|
|
345
327
|
Set the automatic popup response to Cancel/Dismiss.
|
|
@@ -351,8 +333,6 @@ I.click('#triggerPopup');
|
|
|
351
333
|
I.cancelPopup();
|
|
352
334
|
```
|
|
353
335
|
|
|
354
|
-
Returns **[Promise][10]<any>**
|
|
355
|
-
|
|
356
336
|
### amOnPage
|
|
357
337
|
|
|
358
338
|
Opens a web page in a browser. Requires relative or absolute url.
|
|
@@ -366,9 +346,9 @@ I.amOnPage('/login'); // opens a login page
|
|
|
366
346
|
|
|
367
347
|
#### Parameters
|
|
368
348
|
|
|
369
|
-
- `url` **[string][
|
|
349
|
+
- `url` **[string][12]** url path or global url.
|
|
370
350
|
|
|
371
|
-
Returns **
|
|
351
|
+
Returns **void** automatically synchronized promise with recorder #!
|
|
372
352
|
|
|
373
353
|
### appendField
|
|
374
354
|
|
|
@@ -381,10 +361,9 @@ I.appendField('#myTextField', 'appended');
|
|
|
381
361
|
|
|
382
362
|
#### Parameters
|
|
383
363
|
|
|
384
|
-
- `field` **([string][
|
|
385
|
-
- `value` **[string][
|
|
386
|
-
|
|
387
|
-
Returns **[Promise][10]<any>**
|
|
364
|
+
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator
|
|
365
|
+
- `value` **[string][12]** text value to append.
|
|
366
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
388
367
|
|
|
389
368
|
### attachFile
|
|
390
369
|
|
|
@@ -399,17 +378,14 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
399
378
|
|
|
400
379
|
#### Parameters
|
|
401
380
|
|
|
402
|
-
- `locator` **([string][
|
|
403
|
-
- `pathToFile` **[string][
|
|
404
|
-
|
|
405
|
-
Returns **[Promise][10]<any>**
|
|
381
|
+
- `locator` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
382
|
+
- `pathToFile` **[string][12]** local file path relative to codecept.json config file.
|
|
383
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
406
384
|
|
|
407
385
|
### cancelPopup
|
|
408
386
|
|
|
409
387
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
410
388
|
|
|
411
|
-
Returns **[Promise][10]<any>**
|
|
412
|
-
|
|
413
389
|
### checkOption
|
|
414
390
|
|
|
415
391
|
Selects a checkbox or radio button.
|
|
@@ -425,15 +401,14 @@ I.checkOption('agree', '//form');
|
|
|
425
401
|
|
|
426
402
|
#### Parameters
|
|
427
403
|
|
|
428
|
-
- `field` **([string][
|
|
429
|
-
- `context` **([string][
|
|
404
|
+
- `field` **([string][12] | [object][10])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
405
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
406
|
+
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][13] for check available as 3rd argument.Examples:```js
|
|
407
|
+
// click on element at position
|
|
408
|
+
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
409
|
+
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
430
410
|
- `options`
|
|
431
411
|
|
|
432
|
-
Returns **[Promise][10]<any>** [Additional options][14] for check available as 3rd argument.Examples:```js
|
|
433
|
-
// click on element at position
|
|
434
|
-
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
435
|
-
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
436
|
-
|
|
437
412
|
### clearCookie
|
|
438
413
|
|
|
439
414
|
Clears a cookie by name,
|
|
@@ -446,9 +421,8 @@ I.clearCookie('test');
|
|
|
446
421
|
|
|
447
422
|
#### Parameters
|
|
448
423
|
|
|
449
|
-
- `cookie` **[string][
|
|
450
|
-
|
|
451
|
-
Returns **[Promise][10]<any>**
|
|
424
|
+
- `cookie` **[string][12]?** (optional, `null` by default) cookie name
|
|
425
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
452
426
|
|
|
453
427
|
### clearField
|
|
454
428
|
|
|
@@ -463,9 +437,8 @@ I.clearField('#email');
|
|
|
463
437
|
#### Parameters
|
|
464
438
|
|
|
465
439
|
- `field`
|
|
466
|
-
- `editable` **([string][
|
|
467
|
-
|
|
468
|
-
Returns **[Promise][10]<any>**
|
|
440
|
+
- `editable` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
441
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
469
442
|
|
|
470
443
|
### click
|
|
471
444
|
|
|
@@ -493,9 +466,10 @@ I.click({css: 'nav a.login'});
|
|
|
493
466
|
|
|
494
467
|
#### Parameters
|
|
495
468
|
|
|
496
|
-
- `locator` **([string][
|
|
497
|
-
- `context` **([string][
|
|
498
|
-
|
|
469
|
+
- `locator` **([string][12] | [object][10])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
470
|
+
- `context` **([string][12]? | [object][10] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
471
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
472
|
+
- `opts` **any?** [Additional options][14] for click available as 3rd argument.Examples:```js
|
|
499
473
|
// click on element at position
|
|
500
474
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
501
475
|
|
|
@@ -503,8 +477,6 @@ I.click({css: 'nav a.login'});
|
|
|
503
477
|
I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
504
478
|
```
|
|
505
479
|
|
|
506
|
-
Returns **[Promise][10]<any>**
|
|
507
|
-
|
|
508
480
|
### clickLink
|
|
509
481
|
|
|
510
482
|
Clicks link and waits for navigation (deprecated)
|
|
@@ -514,8 +486,6 @@ Clicks link and waits for navigation (deprecated)
|
|
|
514
486
|
- `locator`
|
|
515
487
|
- `context`
|
|
516
488
|
|
|
517
|
-
Returns **[Promise][10]<any>**
|
|
518
|
-
|
|
519
489
|
### closeCurrentTab
|
|
520
490
|
|
|
521
491
|
Close current tab and switches to previous.
|
|
@@ -524,8 +494,6 @@ Close current tab and switches to previous.
|
|
|
524
494
|
I.closeCurrentTab();
|
|
525
495
|
```
|
|
526
496
|
|
|
527
|
-
Returns **[Promise][10]<any>**
|
|
528
|
-
|
|
529
497
|
### closeOtherTabs
|
|
530
498
|
|
|
531
499
|
Close all tabs except for the current one.
|
|
@@ -534,8 +502,6 @@ Close all tabs except for the current one.
|
|
|
534
502
|
I.closeOtherTabs();
|
|
535
503
|
```
|
|
536
504
|
|
|
537
|
-
Returns **[Promise][10]<any>**
|
|
538
|
-
|
|
539
505
|
### dontSee
|
|
540
506
|
|
|
541
507
|
Opposite to `see`. Checks that a text is not present on a page.
|
|
@@ -548,10 +514,9 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
548
514
|
|
|
549
515
|
#### Parameters
|
|
550
516
|
|
|
551
|
-
- `text` **[string][
|
|
552
|
-
- `context` **([string][
|
|
553
|
-
|
|
554
|
-
Returns **[Promise][10]<any>**
|
|
517
|
+
- `text` **[string][12]** which is not present.
|
|
518
|
+
- `context` **([string][12] | [object][10])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
519
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
555
520
|
|
|
556
521
|
### dontSeeCheckboxIsChecked
|
|
557
522
|
|
|
@@ -565,9 +530,8 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
565
530
|
|
|
566
531
|
#### Parameters
|
|
567
532
|
|
|
568
|
-
- `field` **([string][
|
|
569
|
-
|
|
570
|
-
Returns **[Promise][10]<any>**
|
|
533
|
+
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
534
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
571
535
|
|
|
572
536
|
### dontSeeCookie
|
|
573
537
|
|
|
@@ -579,9 +543,8 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
579
543
|
|
|
580
544
|
#### Parameters
|
|
581
545
|
|
|
582
|
-
- `name` **[string][
|
|
583
|
-
|
|
584
|
-
Returns **[Promise][10]<any>**
|
|
546
|
+
- `name` **[string][12]** cookie name.
|
|
547
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
585
548
|
|
|
586
549
|
### dontSeeCurrentUrlEquals
|
|
587
550
|
|
|
@@ -595,9 +558,8 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
595
558
|
|
|
596
559
|
#### Parameters
|
|
597
560
|
|
|
598
|
-
- `url` **[string][
|
|
599
|
-
|
|
600
|
-
Returns **[Promise][10]<any>**
|
|
561
|
+
- `url` **[string][12]** value to check.
|
|
562
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
601
563
|
|
|
602
564
|
### dontSeeElement
|
|
603
565
|
|
|
@@ -609,9 +571,8 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
609
571
|
|
|
610
572
|
#### Parameters
|
|
611
573
|
|
|
612
|
-
- `locator` **([string][
|
|
613
|
-
|
|
614
|
-
Returns **[Promise][10]<any>**
|
|
574
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|Strict locator.
|
|
575
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
615
576
|
|
|
616
577
|
### dontSeeElementInDOM
|
|
617
578
|
|
|
@@ -623,9 +584,8 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
623
584
|
|
|
624
585
|
#### Parameters
|
|
625
586
|
|
|
626
|
-
- `locator` **([string][
|
|
627
|
-
|
|
628
|
-
Returns **[Promise][10]<any>**
|
|
587
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|Strict locator.
|
|
588
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
629
589
|
|
|
630
590
|
### dontSeeInCurrentUrl
|
|
631
591
|
|
|
@@ -633,9 +593,8 @@ Checks that current url does not contain a provided fragment.
|
|
|
633
593
|
|
|
634
594
|
#### Parameters
|
|
635
595
|
|
|
636
|
-
- `url` **[string][
|
|
637
|
-
|
|
638
|
-
Returns **[Promise][10]<any>**
|
|
596
|
+
- `url` **[string][12]** value to check.
|
|
597
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
639
598
|
|
|
640
599
|
### dontSeeInField
|
|
641
600
|
|
|
@@ -649,10 +608,9 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
649
608
|
|
|
650
609
|
#### Parameters
|
|
651
610
|
|
|
652
|
-
- `field` **([string][
|
|
653
|
-
- `value` **[string][
|
|
654
|
-
|
|
655
|
-
Returns **[Promise][10]<any>**
|
|
611
|
+
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
612
|
+
- `value` **[string][12]** value to check.
|
|
613
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
656
614
|
|
|
657
615
|
### dontSeeInSource
|
|
658
616
|
|
|
@@ -665,9 +623,8 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
665
623
|
#### Parameters
|
|
666
624
|
|
|
667
625
|
- `text`
|
|
668
|
-
- `value` **[string][
|
|
669
|
-
|
|
670
|
-
Returns **[Promise][10]<any>**
|
|
626
|
+
- `value` **[string][12]** to check.
|
|
627
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
671
628
|
|
|
672
629
|
### dontSeeInTitle
|
|
673
630
|
|
|
@@ -679,9 +636,8 @@ I.dontSeeInTitle('Error');
|
|
|
679
636
|
|
|
680
637
|
#### Parameters
|
|
681
638
|
|
|
682
|
-
- `text` **[string][
|
|
683
|
-
|
|
684
|
-
Returns **[Promise][10]<any>**
|
|
639
|
+
- `text` **[string][12]** value to check.
|
|
640
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
685
641
|
|
|
686
642
|
### doubleClick
|
|
687
643
|
|
|
@@ -697,10 +653,9 @@ I.doubleClick('.btn.edit');
|
|
|
697
653
|
|
|
698
654
|
#### Parameters
|
|
699
655
|
|
|
700
|
-
- `locator` **([string][
|
|
701
|
-
- `context` **([string][
|
|
702
|
-
|
|
703
|
-
Returns **[Promise][10]<any>**
|
|
656
|
+
- `locator` **([string][12] | [object][10])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
657
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
658
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
704
659
|
|
|
705
660
|
### dragAndDrop
|
|
706
661
|
|
|
@@ -712,15 +667,14 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
712
667
|
|
|
713
668
|
#### Parameters
|
|
714
669
|
|
|
715
|
-
- `srcElement` **([string][
|
|
716
|
-
- `destElement` **([string][
|
|
717
|
-
|
|
670
|
+
- `srcElement` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
671
|
+
- `destElement` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
672
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
673
|
+
- `options` **any?** [Additional options][15] can be passed as 3rd argument.```js
|
|
718
674
|
// specify coordinates for source position
|
|
719
675
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
720
676
|
```> By default option `force: true` is set
|
|
721
677
|
|
|
722
|
-
Returns **[Promise][10]<any>**
|
|
723
|
-
|
|
724
678
|
### dragSlider
|
|
725
679
|
|
|
726
680
|
Drag the scrubber of a slider to a given position
|
|
@@ -733,10 +687,9 @@ I.dragSlider('#slider', -70);
|
|
|
733
687
|
|
|
734
688
|
#### Parameters
|
|
735
689
|
|
|
736
|
-
- `locator` **([string][
|
|
737
|
-
- `offsetX` **[number][
|
|
738
|
-
|
|
739
|
-
Returns **[Promise][10]<any>**
|
|
690
|
+
- `locator` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
691
|
+
- `offsetX` **[number][16]** position to drag.
|
|
692
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
740
693
|
|
|
741
694
|
### executeScript
|
|
742
695
|
|
|
@@ -763,11 +716,9 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
763
716
|
|
|
764
717
|
#### Parameters
|
|
765
718
|
|
|
766
|
-
- `fn` **([string][
|
|
719
|
+
- `fn` **([string][12] | [function][17])** function to be executed in browser context.
|
|
767
720
|
- `arg` **any?** optional argument to pass to the function
|
|
768
721
|
|
|
769
|
-
Returns **[Promise][10]<any>**
|
|
770
|
-
|
|
771
722
|
### fillField
|
|
772
723
|
|
|
773
724
|
Fills a text field or textarea, after clearing its value, with the given string.
|
|
@@ -786,10 +737,9 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
786
737
|
|
|
787
738
|
#### Parameters
|
|
788
739
|
|
|
789
|
-
- `field` **([string][
|
|
790
|
-
- `value` **([string][
|
|
791
|
-
|
|
792
|
-
Returns **[Promise][10]<any>**
|
|
740
|
+
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
741
|
+
- `value` **([string][12] | [object][10])** text value to fill.
|
|
742
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
793
743
|
|
|
794
744
|
### forceClick
|
|
795
745
|
|
|
@@ -820,10 +770,9 @@ I.forceClick({css: 'nav a.login'});
|
|
|
820
770
|
|
|
821
771
|
#### Parameters
|
|
822
772
|
|
|
823
|
-
- `locator` **([string][
|
|
824
|
-
- `context` **([string][
|
|
825
|
-
|
|
826
|
-
Returns **[Promise][10]<any>**
|
|
773
|
+
- `locator` **([string][12] | [object][10])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
774
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
775
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
827
776
|
|
|
828
777
|
### grabAttributeFrom
|
|
829
778
|
|
|
@@ -837,10 +786,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
837
786
|
|
|
838
787
|
#### Parameters
|
|
839
788
|
|
|
840
|
-
- `locator` **([string][
|
|
841
|
-
- `attr` **[string][
|
|
789
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
790
|
+
- `attr` **[string][12]** attribute name.
|
|
842
791
|
|
|
843
|
-
Returns **[Promise][
|
|
792
|
+
Returns **[Promise][18]<[string][12]>** attribute value
|
|
844
793
|
|
|
845
794
|
### grabAttributeFromAll
|
|
846
795
|
|
|
@@ -853,21 +802,24 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
853
802
|
|
|
854
803
|
#### Parameters
|
|
855
804
|
|
|
856
|
-
- `locator` **([string][
|
|
857
|
-
- `attr` **[string][
|
|
805
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
806
|
+
- `attr` **[string][12]** attribute name.
|
|
858
807
|
|
|
859
|
-
Returns **[Promise][
|
|
808
|
+
Returns **[Promise][18]<[Array][19]<[string][12]>>** attribute value
|
|
860
809
|
|
|
861
810
|
### grabBrowserLogs
|
|
862
811
|
|
|
863
812
|
Get JS log from browser.
|
|
864
813
|
|
|
865
814
|
```js
|
|
866
|
-
|
|
867
|
-
|
|
815
|
+
const logs = await I.grabBrowserLogs();
|
|
816
|
+
const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l.type === 'error');
|
|
817
|
+
console.log(JSON.stringify(errors));
|
|
868
818
|
```
|
|
869
819
|
|
|
870
|
-
|
|
820
|
+
[Learn more about console messages][20]
|
|
821
|
+
|
|
822
|
+
Returns **[Promise][18]<[Array][19]<any>>**
|
|
871
823
|
|
|
872
824
|
### grabCookie
|
|
873
825
|
|
|
@@ -882,9 +834,9 @@ assert(cookie.value, '123456');
|
|
|
882
834
|
|
|
883
835
|
#### Parameters
|
|
884
836
|
|
|
885
|
-
- `name` **[string][
|
|
837
|
+
- `name` **[string][12]?** cookie name.
|
|
886
838
|
|
|
887
|
-
Returns **([Promise][
|
|
839
|
+
Returns **([Promise][18]<[string][12]> | [Promise][18]<[Array][19]<[string][12]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
888
840
|
|
|
889
841
|
### grabCssPropertyFrom
|
|
890
842
|
|
|
@@ -898,10 +850,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
898
850
|
|
|
899
851
|
#### Parameters
|
|
900
852
|
|
|
901
|
-
- `locator` **([string][
|
|
902
|
-
- `cssProperty` **[string][
|
|
853
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
854
|
+
- `cssProperty` **[string][12]** CSS property name.
|
|
903
855
|
|
|
904
|
-
Returns **[Promise][
|
|
856
|
+
Returns **[Promise][18]<[string][12]>** CSS value
|
|
905
857
|
|
|
906
858
|
### grabCssPropertyFromAll
|
|
907
859
|
|
|
@@ -914,10 +866,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
914
866
|
|
|
915
867
|
#### Parameters
|
|
916
868
|
|
|
917
|
-
- `locator` **([string][
|
|
918
|
-
- `cssProperty` **[string][
|
|
869
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
870
|
+
- `cssProperty` **[string][12]** CSS property name.
|
|
919
871
|
|
|
920
|
-
Returns **[Promise][
|
|
872
|
+
Returns **[Promise][18]<[Array][19]<[string][12]>>** CSS value
|
|
921
873
|
|
|
922
874
|
### grabCurrentUrl
|
|
923
875
|
|
|
@@ -929,7 +881,7 @@ let url = await I.grabCurrentUrl();
|
|
|
929
881
|
console.log(`Current URL is [${url}]`);
|
|
930
882
|
```
|
|
931
883
|
|
|
932
|
-
Returns **[Promise][
|
|
884
|
+
Returns **[Promise][18]<[string][12]>** current URL
|
|
933
885
|
|
|
934
886
|
### grabDataFromPerformanceTiming
|
|
935
887
|
|
|
@@ -954,7 +906,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
954
906
|
}
|
|
955
907
|
```
|
|
956
908
|
|
|
957
|
-
Returns **[Promise][
|
|
909
|
+
Returns **[Promise][18]<any>** automatically synchronized promise through #recorder
|
|
958
910
|
|
|
959
911
|
### grabElementBoundingRect
|
|
960
912
|
|
|
@@ -978,11 +930,11 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
978
930
|
|
|
979
931
|
#### Parameters
|
|
980
932
|
|
|
981
|
-
- `locator` **([string][
|
|
933
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
982
934
|
- `prop`
|
|
983
|
-
- `elementSize` **[string][
|
|
935
|
+
- `elementSize` **[string][12]?** x, y, width or height of the given element.
|
|
984
936
|
|
|
985
|
-
Returns **([Promise][
|
|
937
|
+
Returns **([Promise][18]<DOMRect> | [Promise][18]<[number][16]>)** Element bounding rectangle
|
|
986
938
|
|
|
987
939
|
### grabHTMLFrom
|
|
988
940
|
|
|
@@ -997,9 +949,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
997
949
|
#### Parameters
|
|
998
950
|
|
|
999
951
|
- `locator`
|
|
1000
|
-
- `element` **([string][
|
|
952
|
+
- `element` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1001
953
|
|
|
1002
|
-
Returns **[Promise][
|
|
954
|
+
Returns **[Promise][18]<[string][12]>** HTML code for an element
|
|
1003
955
|
|
|
1004
956
|
### grabHTMLFromAll
|
|
1005
957
|
|
|
@@ -1013,9 +965,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1013
965
|
#### Parameters
|
|
1014
966
|
|
|
1015
967
|
- `locator`
|
|
1016
|
-
- `element` **([string][
|
|
968
|
+
- `element` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1017
969
|
|
|
1018
|
-
Returns **[Promise][
|
|
970
|
+
Returns **[Promise][18]<[Array][19]<[string][12]>>** HTML code for an element
|
|
1019
971
|
|
|
1020
972
|
### grabNumberOfOpenTabs
|
|
1021
973
|
|
|
@@ -1026,7 +978,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1026
978
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1027
979
|
```
|
|
1028
980
|
|
|
1029
|
-
Returns **[Promise][
|
|
981
|
+
Returns **[Promise][18]<[number][16]>** number of open tabs
|
|
1030
982
|
|
|
1031
983
|
### grabNumberOfVisibleElements
|
|
1032
984
|
|
|
@@ -1039,9 +991,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1039
991
|
|
|
1040
992
|
#### Parameters
|
|
1041
993
|
|
|
1042
|
-
- `locator` **([string][
|
|
994
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1043
995
|
|
|
1044
|
-
Returns **[Promise][
|
|
996
|
+
Returns **[Promise][18]<[number][16]>** number of visible elements
|
|
1045
997
|
|
|
1046
998
|
### grabPageScrollPosition
|
|
1047
999
|
|
|
@@ -1052,7 +1004,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1052
1004
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1053
1005
|
```
|
|
1054
1006
|
|
|
1055
|
-
Returns **[Promise][
|
|
1007
|
+
Returns **[Promise][18]<PageScrollPosition>** scroll position
|
|
1056
1008
|
|
|
1057
1009
|
### grabPopupText
|
|
1058
1010
|
|
|
@@ -1062,7 +1014,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1062
1014
|
await I.grabPopupText();
|
|
1063
1015
|
```
|
|
1064
1016
|
|
|
1065
|
-
Returns **[Promise][
|
|
1017
|
+
Returns **[Promise][18]<([string][12] | null)>**
|
|
1066
1018
|
|
|
1067
1019
|
### grabSource
|
|
1068
1020
|
|
|
@@ -1073,7 +1025,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1073
1025
|
let pageSource = await I.grabSource();
|
|
1074
1026
|
```
|
|
1075
1027
|
|
|
1076
|
-
Returns **[Promise][
|
|
1028
|
+
Returns **[Promise][18]<[string][12]>** source code
|
|
1077
1029
|
|
|
1078
1030
|
### grabTextFrom
|
|
1079
1031
|
|
|
@@ -1088,9 +1040,9 @@ If multiple elements found returns first element.
|
|
|
1088
1040
|
|
|
1089
1041
|
#### Parameters
|
|
1090
1042
|
|
|
1091
|
-
- `locator` **([string][
|
|
1043
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1092
1044
|
|
|
1093
|
-
Returns **[Promise][
|
|
1045
|
+
Returns **[Promise][18]<[string][12]>** attribute value
|
|
1094
1046
|
|
|
1095
1047
|
### grabTextFromAll
|
|
1096
1048
|
|
|
@@ -1103,9 +1055,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1103
1055
|
|
|
1104
1056
|
#### Parameters
|
|
1105
1057
|
|
|
1106
|
-
- `locator` **([string][
|
|
1058
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1107
1059
|
|
|
1108
|
-
Returns **[Promise][
|
|
1060
|
+
Returns **[Promise][18]<[Array][19]<[string][12]>>** attribute value
|
|
1109
1061
|
|
|
1110
1062
|
### grabTitle
|
|
1111
1063
|
|
|
@@ -1116,7 +1068,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1116
1068
|
let title = await I.grabTitle();
|
|
1117
1069
|
```
|
|
1118
1070
|
|
|
1119
|
-
Returns **[Promise][
|
|
1071
|
+
Returns **[Promise][18]<[string][12]>** title
|
|
1120
1072
|
|
|
1121
1073
|
### grabValueFrom
|
|
1122
1074
|
|
|
@@ -1130,9 +1082,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1130
1082
|
|
|
1131
1083
|
#### Parameters
|
|
1132
1084
|
|
|
1133
|
-
- `locator` **([string][
|
|
1085
|
+
- `locator` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
1134
1086
|
|
|
1135
|
-
Returns **[Promise][
|
|
1087
|
+
Returns **[Promise][18]<[string][12]>** attribute value
|
|
1136
1088
|
|
|
1137
1089
|
### grabValueFromAll
|
|
1138
1090
|
|
|
@@ -1145,16 +1097,16 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1145
1097
|
|
|
1146
1098
|
#### Parameters
|
|
1147
1099
|
|
|
1148
|
-
- `locator` **([string][
|
|
1100
|
+
- `locator` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
1149
1101
|
|
|
1150
|
-
Returns **[Promise][
|
|
1102
|
+
Returns **[Promise][18]<[Array][19]<[string][12]>>** attribute value
|
|
1151
1103
|
|
|
1152
1104
|
### handleDownloads
|
|
1153
1105
|
|
|
1154
1106
|
Handles a file download.Aa file name is required to save the file on disk.
|
|
1155
1107
|
Files are saved to "output" directory.
|
|
1156
1108
|
|
|
1157
|
-
Should be used with [FileSystem helper][
|
|
1109
|
+
Should be used with [FileSystem helper][21] to check that file were downloaded correctly.
|
|
1158
1110
|
|
|
1159
1111
|
```js
|
|
1160
1112
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1165,9 +1117,9 @@ I.waitForFile('downloads/avatar.jpg', 5);
|
|
|
1165
1117
|
|
|
1166
1118
|
#### Parameters
|
|
1167
1119
|
|
|
1168
|
-
- `fileName` **[string][
|
|
1120
|
+
- `fileName` **[string][12]?** set filename for downloaded file
|
|
1169
1121
|
|
|
1170
|
-
Returns **[Promise][
|
|
1122
|
+
Returns **[Promise][18]<void>**
|
|
1171
1123
|
|
|
1172
1124
|
### haveRequestHeaders
|
|
1173
1125
|
|
|
@@ -1181,13 +1133,11 @@ I.haveRequestHeaders({
|
|
|
1181
1133
|
|
|
1182
1134
|
#### Parameters
|
|
1183
1135
|
|
|
1184
|
-
- `customHeaders` **[object][
|
|
1185
|
-
|
|
1186
|
-
Returns **[Promise][10]<any>**
|
|
1136
|
+
- `customHeaders` **[object][10]** headers to set
|
|
1187
1137
|
|
|
1188
1138
|
### makeApiRequest
|
|
1189
1139
|
|
|
1190
|
-
Performs [api request][
|
|
1140
|
+
Performs [api request][22] using
|
|
1191
1141
|
the cookies from the current browser session.
|
|
1192
1142
|
|
|
1193
1143
|
```js
|
|
@@ -1200,28 +1150,26 @@ I.makeApiRequest('PATCH', )
|
|
|
1200
1150
|
|
|
1201
1151
|
#### Parameters
|
|
1202
1152
|
|
|
1203
|
-
- `method` **[string][
|
|
1204
|
-
- `url` **[string][
|
|
1205
|
-
- `options` **[object][
|
|
1153
|
+
- `method` **[string][12]** HTTP method
|
|
1154
|
+
- `url` **[string][12]** endpoint
|
|
1155
|
+
- `options` **[object][10]** request options depending on method used
|
|
1206
1156
|
|
|
1207
|
-
Returns **[Promise][
|
|
1157
|
+
Returns **[Promise][18]<[object][10]>** response
|
|
1208
1158
|
|
|
1209
1159
|
### mockRoute
|
|
1210
1160
|
|
|
1211
|
-
Mocks network request using [`browserContext.route`][
|
|
1161
|
+
Mocks network request using [`browserContext.route`][23] of Playwright
|
|
1212
1162
|
|
|
1213
1163
|
```js
|
|
1214
1164
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1215
1165
|
```
|
|
1216
1166
|
|
|
1217
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1167
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][24]
|
|
1218
1168
|
|
|
1219
1169
|
#### Parameters
|
|
1220
1170
|
|
|
1221
|
-
- `url` **([string][
|
|
1222
|
-
- `handler` **[function][
|
|
1223
|
-
|
|
1224
|
-
Returns **[Promise][10]<any>**
|
|
1171
|
+
- `url` **([string][12] | [RegExp][25])?** URL, regex or pattern for to match URL
|
|
1172
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1225
1173
|
|
|
1226
1174
|
### moveCursorTo
|
|
1227
1175
|
|
|
@@ -1235,11 +1183,10 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1235
1183
|
|
|
1236
1184
|
#### Parameters
|
|
1237
1185
|
|
|
1238
|
-
- `locator` **([string][
|
|
1239
|
-
- `offsetX` **[number][
|
|
1240
|
-
- `offsetY` **[number][
|
|
1241
|
-
|
|
1242
|
-
Returns **[Promise][10]<any>**
|
|
1186
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1187
|
+
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1188
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1189
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1243
1190
|
|
|
1244
1191
|
### openNewTab
|
|
1245
1192
|
|
|
@@ -1249,7 +1196,7 @@ Open new tab and automatically switched to new tab
|
|
|
1249
1196
|
I.openNewTab();
|
|
1250
1197
|
```
|
|
1251
1198
|
|
|
1252
|
-
You can pass in [page options][
|
|
1199
|
+
You can pass in [page options][26] to emulate device on this page
|
|
1253
1200
|
|
|
1254
1201
|
```js
|
|
1255
1202
|
// enable mobile
|
|
@@ -1260,13 +1207,11 @@ I.openNewTab({ isMobile: true });
|
|
|
1260
1207
|
|
|
1261
1208
|
- `options`
|
|
1262
1209
|
|
|
1263
|
-
Returns **[Promise][10]<any>**
|
|
1264
|
-
|
|
1265
1210
|
### pressKey
|
|
1266
1211
|
|
|
1267
1212
|
Presses a key in the browser (on a focused element).
|
|
1268
1213
|
|
|
1269
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1214
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][27].
|
|
1270
1215
|
|
|
1271
1216
|
```js
|
|
1272
1217
|
I.pressKey('Backspace');
|
|
@@ -1325,15 +1270,14 @@ Some of the supported key names are:
|
|
|
1325
1270
|
|
|
1326
1271
|
#### Parameters
|
|
1327
1272
|
|
|
1328
|
-
- `key` **([string][
|
|
1329
|
-
|
|
1330
|
-
Returns **[Promise][10]<any>** _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][27]).
|
|
1273
|
+
- `key` **([string][12] | [Array][19]<[string][12]>)** key or array of keys to press.
|
|
1274
|
+
[!] returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][28]).
|
|
1331
1275
|
|
|
1332
1276
|
### pressKeyDown
|
|
1333
1277
|
|
|
1334
1278
|
Presses a key in the browser and leaves it in a down state.
|
|
1335
1279
|
|
|
1336
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1280
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][29]).
|
|
1337
1281
|
|
|
1338
1282
|
```js
|
|
1339
1283
|
I.pressKeyDown('Control');
|
|
@@ -1343,15 +1287,14 @@ I.pressKeyUp('Control');
|
|
|
1343
1287
|
|
|
1344
1288
|
#### Parameters
|
|
1345
1289
|
|
|
1346
|
-
- `key` **[string][
|
|
1347
|
-
|
|
1348
|
-
Returns **[Promise][10]<any>**
|
|
1290
|
+
- `key` **[string][12]** name of key to press down.
|
|
1291
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1349
1292
|
|
|
1350
1293
|
### pressKeyUp
|
|
1351
1294
|
|
|
1352
1295
|
Releases a key in the browser which was previously set to a down state.
|
|
1353
1296
|
|
|
1354
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1297
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][29]).
|
|
1355
1298
|
|
|
1356
1299
|
```js
|
|
1357
1300
|
I.pressKeyDown('Control');
|
|
@@ -1361,9 +1304,8 @@ I.pressKeyUp('Control');
|
|
|
1361
1304
|
|
|
1362
1305
|
#### Parameters
|
|
1363
1306
|
|
|
1364
|
-
- `key` **[string][
|
|
1365
|
-
|
|
1366
|
-
Returns **[Promise][10]<any>**
|
|
1307
|
+
- `key` **[string][12]** name of key to release.
|
|
1308
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1367
1309
|
|
|
1368
1310
|
### refreshPage
|
|
1369
1311
|
|
|
@@ -1373,7 +1315,7 @@ Reload the current page.
|
|
|
1373
1315
|
I.refreshPage();
|
|
1374
1316
|
```
|
|
1375
1317
|
|
|
1376
|
-
|
|
1318
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1377
1319
|
|
|
1378
1320
|
### resizeWindow
|
|
1379
1321
|
|
|
@@ -1382,16 +1324,15 @@ First parameter can be set to `maximize`.
|
|
|
1382
1324
|
|
|
1383
1325
|
#### Parameters
|
|
1384
1326
|
|
|
1385
|
-
- `width` **[number][
|
|
1386
|
-
- `height` **[number][
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
//
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
```
|
|
1327
|
+
- `width` **[number][16]** width in pixels or `maximize`.
|
|
1328
|
+
- `height` **[number][16]** height in pixels.
|
|
1329
|
+
[!] returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1330
|
+
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1331
|
+
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
1332
|
+
// inside codecept.conf.js
|
|
1333
|
+
// @codeceptjs/configure package must be installed
|
|
1334
|
+
{ setWindowSize } = require('@codeceptjs/configure');
|
|
1335
|
+
```
|
|
1395
1336
|
|
|
1396
1337
|
### rightClick
|
|
1397
1338
|
|
|
@@ -1408,10 +1349,9 @@ I.rightClick('Click me', '.context');
|
|
|
1408
1349
|
|
|
1409
1350
|
#### Parameters
|
|
1410
1351
|
|
|
1411
|
-
- `locator` **([string][
|
|
1412
|
-
- `context` **([string][
|
|
1413
|
-
|
|
1414
|
-
Returns **[Promise][10]<any>**
|
|
1352
|
+
- `locator` **([string][12] | [object][10])** clickable element located by CSS|XPath|strict locator.
|
|
1353
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1354
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1415
1355
|
|
|
1416
1356
|
### saveElementScreenshot
|
|
1417
1357
|
|
|
@@ -1424,10 +1364,9 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1424
1364
|
|
|
1425
1365
|
#### Parameters
|
|
1426
1366
|
|
|
1427
|
-
- `locator` **([string][
|
|
1428
|
-
- `fileName` **[string][
|
|
1429
|
-
|
|
1430
|
-
Returns **[Promise][10]<any>**
|
|
1367
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1368
|
+
- `fileName` **[string][12]** file name to save.
|
|
1369
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1431
1370
|
|
|
1432
1371
|
### saveScreenshot
|
|
1433
1372
|
|
|
@@ -1442,10 +1381,9 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1442
1381
|
|
|
1443
1382
|
#### Parameters
|
|
1444
1383
|
|
|
1445
|
-
- `fileName` **[string][
|
|
1446
|
-
- `fullPage` **[boolean][
|
|
1447
|
-
|
|
1448
|
-
Returns **[Promise][10]<any>**
|
|
1384
|
+
- `fileName` **[string][12]** file name to save.
|
|
1385
|
+
- `fullPage` **[boolean][30]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1386
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1449
1387
|
|
|
1450
1388
|
### scrollPageToBottom
|
|
1451
1389
|
|
|
@@ -1455,7 +1393,7 @@ Scroll page to the bottom.
|
|
|
1455
1393
|
I.scrollPageToBottom();
|
|
1456
1394
|
```
|
|
1457
1395
|
|
|
1458
|
-
|
|
1396
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1459
1397
|
|
|
1460
1398
|
### scrollPageToTop
|
|
1461
1399
|
|
|
@@ -1465,7 +1403,7 @@ Scroll page to the top.
|
|
|
1465
1403
|
I.scrollPageToTop();
|
|
1466
1404
|
```
|
|
1467
1405
|
|
|
1468
|
-
|
|
1406
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1469
1407
|
|
|
1470
1408
|
### scrollTo
|
|
1471
1409
|
|
|
@@ -1479,11 +1417,10 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1479
1417
|
|
|
1480
1418
|
#### Parameters
|
|
1481
1419
|
|
|
1482
|
-
- `locator` **([string][
|
|
1483
|
-
- `offsetX` **[number][
|
|
1484
|
-
- `offsetY` **[number][
|
|
1485
|
-
|
|
1486
|
-
Returns **[Promise][10]<any>**
|
|
1420
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1421
|
+
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1422
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1423
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1487
1424
|
|
|
1488
1425
|
### see
|
|
1489
1426
|
|
|
@@ -1498,10 +1435,9 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1498
1435
|
|
|
1499
1436
|
#### Parameters
|
|
1500
1437
|
|
|
1501
|
-
- `text` **[string][
|
|
1502
|
-
- `context` **([string][
|
|
1503
|
-
|
|
1504
|
-
Returns **[Promise][10]<any>**
|
|
1438
|
+
- `text` **[string][12]** expected on page.
|
|
1439
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1440
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1505
1441
|
|
|
1506
1442
|
### seeAttributesOnElements
|
|
1507
1443
|
|
|
@@ -1513,10 +1449,9 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1513
1449
|
|
|
1514
1450
|
#### Parameters
|
|
1515
1451
|
|
|
1516
|
-
- `locator` **([string][
|
|
1517
|
-
- `attributes` **[object][
|
|
1518
|
-
|
|
1519
|
-
Returns **[Promise][10]<any>**
|
|
1452
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1453
|
+
- `attributes` **[object][10]** attributes and their values to check.
|
|
1454
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1520
1455
|
|
|
1521
1456
|
### seeCheckboxIsChecked
|
|
1522
1457
|
|
|
@@ -1530,9 +1465,8 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1530
1465
|
|
|
1531
1466
|
#### Parameters
|
|
1532
1467
|
|
|
1533
|
-
- `field` **([string][
|
|
1534
|
-
|
|
1535
|
-
Returns **[Promise][10]<any>**
|
|
1468
|
+
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
1469
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1536
1470
|
|
|
1537
1471
|
### seeCookie
|
|
1538
1472
|
|
|
@@ -1544,9 +1478,8 @@ I.seeCookie('Auth');
|
|
|
1544
1478
|
|
|
1545
1479
|
#### Parameters
|
|
1546
1480
|
|
|
1547
|
-
- `name` **[string][
|
|
1548
|
-
|
|
1549
|
-
Returns **[Promise][10]<any>**
|
|
1481
|
+
- `name` **[string][12]** cookie name.
|
|
1482
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1550
1483
|
|
|
1551
1484
|
### seeCssPropertiesOnElements
|
|
1552
1485
|
|
|
@@ -1558,10 +1491,9 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1558
1491
|
|
|
1559
1492
|
#### Parameters
|
|
1560
1493
|
|
|
1561
|
-
- `locator` **([string][
|
|
1562
|
-
- `cssProperties` **[object][
|
|
1563
|
-
|
|
1564
|
-
Returns **[Promise][10]<any>**
|
|
1494
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1495
|
+
- `cssProperties` **[object][10]** object with CSS properties and their values to check.
|
|
1496
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1565
1497
|
|
|
1566
1498
|
### seeCurrentUrlEquals
|
|
1567
1499
|
|
|
@@ -1576,9 +1508,8 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1576
1508
|
|
|
1577
1509
|
#### Parameters
|
|
1578
1510
|
|
|
1579
|
-
- `url` **[string][
|
|
1580
|
-
|
|
1581
|
-
Returns **[Promise][10]<any>**
|
|
1511
|
+
- `url` **[string][12]** value to check.
|
|
1512
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1582
1513
|
|
|
1583
1514
|
### seeElement
|
|
1584
1515
|
|
|
@@ -1591,9 +1522,8 @@ I.seeElement('#modal');
|
|
|
1591
1522
|
|
|
1592
1523
|
#### Parameters
|
|
1593
1524
|
|
|
1594
|
-
- `locator` **([string][
|
|
1595
|
-
|
|
1596
|
-
Returns **[Promise][10]<any>**
|
|
1525
|
+
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1526
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1597
1527
|
|
|
1598
1528
|
### seeElementInDOM
|
|
1599
1529
|
|
|
@@ -1606,9 +1536,8 @@ I.seeElementInDOM('#modal');
|
|
|
1606
1536
|
|
|
1607
1537
|
#### Parameters
|
|
1608
1538
|
|
|
1609
|
-
- `locator` **([string][
|
|
1610
|
-
|
|
1611
|
-
Returns **[Promise][10]<any>**
|
|
1539
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1540
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1612
1541
|
|
|
1613
1542
|
### seeInCurrentUrl
|
|
1614
1543
|
|
|
@@ -1620,9 +1549,8 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1620
1549
|
|
|
1621
1550
|
#### Parameters
|
|
1622
1551
|
|
|
1623
|
-
- `url` **[string][
|
|
1624
|
-
|
|
1625
|
-
Returns **[Promise][10]<any>**
|
|
1552
|
+
- `url` **[string][12]** a fragment to check
|
|
1553
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1626
1554
|
|
|
1627
1555
|
### seeInField
|
|
1628
1556
|
|
|
@@ -1638,10 +1566,9 @@ I.seeInField('#searchform input','Search');
|
|
|
1638
1566
|
|
|
1639
1567
|
#### Parameters
|
|
1640
1568
|
|
|
1641
|
-
- `field` **([string][
|
|
1642
|
-
- `value` **[string][
|
|
1643
|
-
|
|
1644
|
-
Returns **[Promise][10]<any>**
|
|
1569
|
+
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
1570
|
+
- `value` **[string][12]** value to check.
|
|
1571
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1645
1572
|
|
|
1646
1573
|
### seeInPopup
|
|
1647
1574
|
|
|
@@ -1654,9 +1581,8 @@ I.seeInPopup('Popup text');
|
|
|
1654
1581
|
|
|
1655
1582
|
#### Parameters
|
|
1656
1583
|
|
|
1657
|
-
- `text` **[string][
|
|
1658
|
-
|
|
1659
|
-
Returns **[Promise][10]<any>**
|
|
1584
|
+
- `text` **[string][12]** value to check.
|
|
1585
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1660
1586
|
|
|
1661
1587
|
### seeInSource
|
|
1662
1588
|
|
|
@@ -1668,9 +1594,8 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1668
1594
|
|
|
1669
1595
|
#### Parameters
|
|
1670
1596
|
|
|
1671
|
-
- `text` **[string][
|
|
1672
|
-
|
|
1673
|
-
Returns **[Promise][10]<any>**
|
|
1597
|
+
- `text` **[string][12]** value to check.
|
|
1598
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1674
1599
|
|
|
1675
1600
|
### seeInTitle
|
|
1676
1601
|
|
|
@@ -1682,9 +1607,8 @@ I.seeInTitle('Home Page');
|
|
|
1682
1607
|
|
|
1683
1608
|
#### Parameters
|
|
1684
1609
|
|
|
1685
|
-
- `text` **[string][
|
|
1686
|
-
|
|
1687
|
-
Returns **[Promise][10]<any>**
|
|
1610
|
+
- `text` **[string][12]** text value to check.
|
|
1611
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1688
1612
|
|
|
1689
1613
|
### seeNumberOfElements
|
|
1690
1614
|
|
|
@@ -1697,10 +1621,9 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1697
1621
|
|
|
1698
1622
|
#### Parameters
|
|
1699
1623
|
|
|
1700
|
-
- `locator` **([string][
|
|
1701
|
-
- `num` **[number][
|
|
1702
|
-
|
|
1703
|
-
Returns **[Promise][10]<any>**
|
|
1624
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1625
|
+
- `num` **[number][16]** number of elements.
|
|
1626
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1704
1627
|
|
|
1705
1628
|
### seeNumberOfVisibleElements
|
|
1706
1629
|
|
|
@@ -1713,10 +1636,9 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1713
1636
|
|
|
1714
1637
|
#### Parameters
|
|
1715
1638
|
|
|
1716
|
-
- `locator` **([string][
|
|
1717
|
-
- `num` **[number][
|
|
1718
|
-
|
|
1719
|
-
Returns **[Promise][10]<any>**
|
|
1639
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1640
|
+
- `num` **[number][16]** number of elements.
|
|
1641
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1720
1642
|
|
|
1721
1643
|
### seeTextEquals
|
|
1722
1644
|
|
|
@@ -1728,10 +1650,9 @@ I.seeTextEquals('text', 'h1');
|
|
|
1728
1650
|
|
|
1729
1651
|
#### Parameters
|
|
1730
1652
|
|
|
1731
|
-
- `text` **[string][
|
|
1732
|
-
- `context` **([string][
|
|
1733
|
-
|
|
1734
|
-
Returns **[Promise][10]<any>**
|
|
1653
|
+
- `text` **[string][12]** element value to check.
|
|
1654
|
+
- `context` **([string][12] | [object][10])?** element located by CSS|XPath|strict locator.
|
|
1655
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1735
1656
|
|
|
1736
1657
|
### seeTitleEquals
|
|
1737
1658
|
|
|
@@ -1743,9 +1664,8 @@ I.seeTitleEquals('Test title.');
|
|
|
1743
1664
|
|
|
1744
1665
|
#### Parameters
|
|
1745
1666
|
|
|
1746
|
-
- `text` **[string][
|
|
1747
|
-
|
|
1748
|
-
Returns **[Promise][10]<any>**
|
|
1667
|
+
- `text` **[string][12]** value to check.
|
|
1668
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1749
1669
|
|
|
1750
1670
|
### selectOption
|
|
1751
1671
|
|
|
@@ -1770,10 +1690,9 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1770
1690
|
|
|
1771
1691
|
#### Parameters
|
|
1772
1692
|
|
|
1773
|
-
- `select` **([string][
|
|
1774
|
-
- `option` **([string][
|
|
1775
|
-
|
|
1776
|
-
Returns **[Promise][10]<any>**
|
|
1693
|
+
- `select` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
1694
|
+
- `option` **([string][12] | [Array][19]<any>)** visible text or value of option.
|
|
1695
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1777
1696
|
|
|
1778
1697
|
### setCookie
|
|
1779
1698
|
|
|
@@ -1794,8 +1713,7 @@ I.setCookie([
|
|
|
1794
1713
|
#### Parameters
|
|
1795
1714
|
|
|
1796
1715
|
- `cookie` **(Cookie | [Array][19]<Cookie>)** a cookie object or array of cookie objects.
|
|
1797
|
-
|
|
1798
|
-
Returns **[Promise][10]<any>**
|
|
1716
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1799
1717
|
|
|
1800
1718
|
### stopMockingRoute
|
|
1801
1719
|
|
|
@@ -1810,10 +1728,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1810
1728
|
|
|
1811
1729
|
#### Parameters
|
|
1812
1730
|
|
|
1813
|
-
- `url` **([string][
|
|
1814
|
-
- `handler` **[function][
|
|
1815
|
-
|
|
1816
|
-
Returns **[Promise][10]<any>**
|
|
1731
|
+
- `url` **([string][12] | [RegExp][25])?** URL, regex or pattern for to match URL
|
|
1732
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1817
1733
|
|
|
1818
1734
|
### switchTo
|
|
1819
1735
|
|
|
@@ -1826,9 +1742,8 @@ I.switchTo(); // switch back to main page
|
|
|
1826
1742
|
|
|
1827
1743
|
#### Parameters
|
|
1828
1744
|
|
|
1829
|
-
- `locator` **([string][
|
|
1830
|
-
|
|
1831
|
-
Returns **[Promise][10]<any>**
|
|
1745
|
+
- `locator` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1746
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1832
1747
|
|
|
1833
1748
|
### switchToNextTab
|
|
1834
1749
|
|
|
@@ -1841,9 +1756,7 @@ I.switchToNextTab(2);
|
|
|
1841
1756
|
|
|
1842
1757
|
#### Parameters
|
|
1843
1758
|
|
|
1844
|
-
- `num` **[number][
|
|
1845
|
-
|
|
1846
|
-
Returns **[Promise][10]<any>**
|
|
1759
|
+
- `num` **[number][16]**
|
|
1847
1760
|
|
|
1848
1761
|
### switchToPreviousTab
|
|
1849
1762
|
|
|
@@ -1856,15 +1769,13 @@ I.switchToPreviousTab(2);
|
|
|
1856
1769
|
|
|
1857
1770
|
#### Parameters
|
|
1858
1771
|
|
|
1859
|
-
- `num` **[number][
|
|
1860
|
-
|
|
1861
|
-
Returns **[Promise][10]<any>**
|
|
1772
|
+
- `num` **[number][16]**
|
|
1862
1773
|
|
|
1863
1774
|
### type
|
|
1864
1775
|
|
|
1865
1776
|
Types out the given text into an active field.
|
|
1866
1777
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1867
|
-
_Note:_ Should be used when [`fillField`][
|
|
1778
|
+
_Note:_ Should be used when [`fillField`][27] is not an option.
|
|
1868
1779
|
|
|
1869
1780
|
```js
|
|
1870
1781
|
// passing in a string
|
|
@@ -1880,10 +1791,9 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1880
1791
|
#### Parameters
|
|
1881
1792
|
|
|
1882
1793
|
- `keys`
|
|
1883
|
-
- `delay` **[number][
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
Returns **[Promise][10]<any>**
|
|
1794
|
+
- `delay` **[number][16]?** (optional) delay in ms between key presses
|
|
1795
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1796
|
+
- `key` **([string][12] | [Array][19]<[string][12]>)** or array of keys to type.
|
|
1887
1797
|
|
|
1888
1798
|
### uncheckOption
|
|
1889
1799
|
|
|
@@ -1900,15 +1810,14 @@ I.uncheckOption('agree', '//form');
|
|
|
1900
1810
|
|
|
1901
1811
|
#### Parameters
|
|
1902
1812
|
|
|
1903
|
-
- `field` **([string][
|
|
1904
|
-
- `context` **([string][
|
|
1813
|
+
- `field` **([string][12] | [object][10])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1814
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1815
|
+
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][31] for uncheck available as 3rd argument.Examples:```js
|
|
1816
|
+
// click on element at position
|
|
1817
|
+
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1818
|
+
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
1905
1819
|
- `options`
|
|
1906
1820
|
|
|
1907
|
-
Returns **[Promise][10]<any>** [Additional options][30] for uncheck available as 3rd argument.Examples:```js
|
|
1908
|
-
// click on element at position
|
|
1909
|
-
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1910
|
-
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
1911
|
-
|
|
1912
1821
|
### usePlaywrightTo
|
|
1913
1822
|
|
|
1914
1823
|
Use Playwright API inside a test.
|
|
@@ -1916,7 +1825,7 @@ Use Playwright API inside a test.
|
|
|
1916
1825
|
First argument is a description of an action.
|
|
1917
1826
|
Second argument is async function that gets this helper as parameter.
|
|
1918
1827
|
|
|
1919
|
-
{ [`page`][
|
|
1828
|
+
{ [`page`][32], [`browserContext`][33] [`browser`][34] } objects from Playwright API are available.
|
|
1920
1829
|
|
|
1921
1830
|
```js
|
|
1922
1831
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -1926,10 +1835,8 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
1926
1835
|
|
|
1927
1836
|
#### Parameters
|
|
1928
1837
|
|
|
1929
|
-
- `description` **[string][
|
|
1930
|
-
- `fn` **[function][
|
|
1931
|
-
|
|
1932
|
-
Returns **[Promise][10]<any>**
|
|
1838
|
+
- `description` **[string][12]** used to show in logs.
|
|
1839
|
+
- `fn` **[function][17]** async function that executed with Playwright helper as argumen
|
|
1933
1840
|
|
|
1934
1841
|
### wait
|
|
1935
1842
|
|
|
@@ -1941,9 +1848,8 @@ I.wait(2); // wait 2 secs
|
|
|
1941
1848
|
|
|
1942
1849
|
#### Parameters
|
|
1943
1850
|
|
|
1944
|
-
- `sec` **[number][
|
|
1945
|
-
|
|
1946
|
-
Returns **[Promise][10]<any>**
|
|
1851
|
+
- `sec` **[number][16]** number of second to wait.
|
|
1852
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1947
1853
|
|
|
1948
1854
|
### waitForClickable
|
|
1949
1855
|
|
|
@@ -1957,11 +1863,10 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1957
1863
|
|
|
1958
1864
|
#### Parameters
|
|
1959
1865
|
|
|
1960
|
-
- `locator` **([string][
|
|
1866
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1961
1867
|
- `waitTimeout`
|
|
1962
|
-
- `sec` **[number][
|
|
1963
|
-
|
|
1964
|
-
Returns **[Promise][10]<any>**
|
|
1868
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1869
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1965
1870
|
|
|
1966
1871
|
### waitForDetached
|
|
1967
1872
|
|
|
@@ -1974,10 +1879,9 @@ I.waitForDetached('#popup');
|
|
|
1974
1879
|
|
|
1975
1880
|
#### Parameters
|
|
1976
1881
|
|
|
1977
|
-
- `locator` **([string][
|
|
1978
|
-
- `sec` **[number][
|
|
1979
|
-
|
|
1980
|
-
Returns **[Promise][10]<any>**
|
|
1882
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1883
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1884
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1981
1885
|
|
|
1982
1886
|
### waitForElement
|
|
1983
1887
|
|
|
@@ -1991,10 +1895,9 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1991
1895
|
|
|
1992
1896
|
#### Parameters
|
|
1993
1897
|
|
|
1994
|
-
- `locator` **([string][
|
|
1995
|
-
- `sec` **[number][
|
|
1996
|
-
|
|
1997
|
-
Returns **[Promise][10]<any>**
|
|
1898
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1899
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1900
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1998
1901
|
|
|
1999
1902
|
### waitForEnabled
|
|
2000
1903
|
|
|
@@ -2003,10 +1906,9 @@ Element can be located by CSS or XPath.
|
|
|
2003
1906
|
|
|
2004
1907
|
#### Parameters
|
|
2005
1908
|
|
|
2006
|
-
- `locator` **([string][
|
|
2007
|
-
- `sec` **[number][
|
|
2008
|
-
|
|
2009
|
-
Returns **[Promise][10]<any>**
|
|
1909
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1910
|
+
- `sec` **[number][16]** (optional) time in seconds to wait, 1 by default.
|
|
1911
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2010
1912
|
|
|
2011
1913
|
### waitForFunction
|
|
2012
1914
|
|
|
@@ -2025,11 +1927,10 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2025
1927
|
|
|
2026
1928
|
#### Parameters
|
|
2027
1929
|
|
|
2028
|
-
- `fn` **([string][
|
|
2029
|
-
- `argsOrSec` **([Array][19]<any> | [number][
|
|
2030
|
-
- `sec` **[number][
|
|
2031
|
-
|
|
2032
|
-
Returns **[Promise][10]<any>**
|
|
1930
|
+
- `fn` **([string][12] | [function][17])** to be executed in browser context.
|
|
1931
|
+
- `argsOrSec` **([Array][19]<any> | [number][16])?** (optional, `1` by default) arguments for function or seconds.
|
|
1932
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1933
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2033
1934
|
|
|
2034
1935
|
### waitForInvisible
|
|
2035
1936
|
|
|
@@ -2042,23 +1943,20 @@ I.waitForInvisible('#popup');
|
|
|
2042
1943
|
|
|
2043
1944
|
#### Parameters
|
|
2044
1945
|
|
|
2045
|
-
- `locator` **([string][
|
|
2046
|
-
- `sec` **[number][
|
|
2047
|
-
|
|
2048
|
-
Returns **[Promise][10]<any>**
|
|
1946
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1947
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1948
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2049
1949
|
|
|
2050
1950
|
### waitForNavigation
|
|
2051
1951
|
|
|
2052
1952
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
2053
1953
|
|
|
2054
|
-
See [Playwright's reference][
|
|
1954
|
+
See [Playwright's reference][35]
|
|
2055
1955
|
|
|
2056
1956
|
#### Parameters
|
|
2057
1957
|
|
|
2058
1958
|
- `opts` **any**
|
|
2059
1959
|
|
|
2060
|
-
Returns **[Promise][10]<any>**
|
|
2061
|
-
|
|
2062
1960
|
### waitForRequest
|
|
2063
1961
|
|
|
2064
1962
|
Waits for a network request.
|
|
@@ -2070,10 +1968,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2070
1968
|
|
|
2071
1969
|
#### Parameters
|
|
2072
1970
|
|
|
2073
|
-
- `urlOrPredicate` **([string][
|
|
2074
|
-
- `sec` **[number][
|
|
2075
|
-
|
|
2076
|
-
Returns **[Promise][10]<any>**
|
|
1971
|
+
- `urlOrPredicate` **([string][12] | [function][17])**
|
|
1972
|
+
- `sec` **[number][16]?** seconds to wait
|
|
2077
1973
|
|
|
2078
1974
|
### waitForResponse
|
|
2079
1975
|
|
|
@@ -2086,10 +1982,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2086
1982
|
|
|
2087
1983
|
#### Parameters
|
|
2088
1984
|
|
|
2089
|
-
- `urlOrPredicate` **([string][
|
|
2090
|
-
- `sec` **[number][
|
|
2091
|
-
|
|
2092
|
-
Returns **[Promise][10]<any>**
|
|
1985
|
+
- `urlOrPredicate` **([string][12] | [function][17])**
|
|
1986
|
+
- `sec` **[number][16]?** number of seconds to wait
|
|
2093
1987
|
|
|
2094
1988
|
### waitForText
|
|
2095
1989
|
|
|
@@ -2104,11 +1998,10 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2104
1998
|
|
|
2105
1999
|
#### Parameters
|
|
2106
2000
|
|
|
2107
|
-
- `text` **[string][
|
|
2108
|
-
- `sec` **[number][
|
|
2109
|
-
- `context` **([string][
|
|
2110
|
-
|
|
2111
|
-
Returns **[Promise][10]<any>**
|
|
2001
|
+
- `text` **[string][12]** to wait for.
|
|
2002
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2003
|
+
- `context` **([string][12] | [object][10])?** (optional) element located by CSS|XPath|strict locator.
|
|
2004
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2112
2005
|
|
|
2113
2006
|
### waitForValue
|
|
2114
2007
|
|
|
@@ -2120,11 +2013,10 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2120
2013
|
|
|
2121
2014
|
#### Parameters
|
|
2122
2015
|
|
|
2123
|
-
- `field` **([string][
|
|
2124
|
-
- `value` **[string][
|
|
2125
|
-
- `sec` **[number][
|
|
2126
|
-
|
|
2127
|
-
Returns **[Promise][10]<any>**
|
|
2016
|
+
- `field` **([string][12] | [object][10])** input field.
|
|
2017
|
+
- `value` **[string][12]** expected value.
|
|
2018
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2019
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2128
2020
|
|
|
2129
2021
|
### waitForVisible
|
|
2130
2022
|
|
|
@@ -2137,10 +2029,9 @@ I.waitForVisible('#popup');
|
|
|
2137
2029
|
|
|
2138
2030
|
#### Parameters
|
|
2139
2031
|
|
|
2140
|
-
- `locator` **([string][
|
|
2141
|
-
- `sec` **[number][
|
|
2142
|
-
|
|
2143
|
-
Returns **[Promise][10]<any>** This method accepts [React selectors][35].
|
|
2032
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
2033
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2034
|
+
[!] returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][36].
|
|
2144
2035
|
|
|
2145
2036
|
### waitInUrl
|
|
2146
2037
|
|
|
@@ -2152,10 +2043,9 @@ I.waitInUrl('/info', 2);
|
|
|
2152
2043
|
|
|
2153
2044
|
#### Parameters
|
|
2154
2045
|
|
|
2155
|
-
- `urlPart` **[string][
|
|
2156
|
-
- `sec` **[number][
|
|
2157
|
-
|
|
2158
|
-
Returns **[Promise][10]<any>**
|
|
2046
|
+
- `urlPart` **[string][12]** value to check.
|
|
2047
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2048
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2159
2049
|
|
|
2160
2050
|
### waitNumberOfVisibleElements
|
|
2161
2051
|
|
|
@@ -2167,11 +2057,10 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2167
2057
|
|
|
2168
2058
|
#### Parameters
|
|
2169
2059
|
|
|
2170
|
-
- `locator` **([string][
|
|
2171
|
-
- `num` **[number][
|
|
2172
|
-
- `sec` **[number][
|
|
2173
|
-
|
|
2174
|
-
Returns **[Promise][10]<any>**
|
|
2060
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
2061
|
+
- `num` **[number][16]** number of elements.
|
|
2062
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2063
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2175
2064
|
|
|
2176
2065
|
### waitToHide
|
|
2177
2066
|
|
|
@@ -2184,10 +2073,9 @@ I.waitToHide('#popup');
|
|
|
2184
2073
|
|
|
2185
2074
|
#### Parameters
|
|
2186
2075
|
|
|
2187
|
-
- `locator` **([string][
|
|
2188
|
-
- `sec` **[number][
|
|
2189
|
-
|
|
2190
|
-
Returns **[Promise][10]<any>**
|
|
2076
|
+
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
2077
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2078
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2191
2079
|
|
|
2192
2080
|
### waitUrlEquals
|
|
2193
2081
|
|
|
@@ -2200,10 +2088,9 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2200
2088
|
|
|
2201
2089
|
#### Parameters
|
|
2202
2090
|
|
|
2203
|
-
- `urlPart` **[string][
|
|
2204
|
-
- `sec` **[number][
|
|
2205
|
-
|
|
2206
|
-
Returns **[Promise][10]<any>**
|
|
2091
|
+
- `urlPart` **[string][12]** value to check.
|
|
2092
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2093
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2207
2094
|
|
|
2208
2095
|
[1]: https://github.com/microsoft/playwright
|
|
2209
2096
|
|
|
@@ -2223,54 +2110,56 @@ Returns **[Promise][10]<any>**
|
|
|
2223
2110
|
|
|
2224
2111
|
[9]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
2225
2112
|
|
|
2226
|
-
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2113
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
2227
2114
|
|
|
2228
|
-
[11]:
|
|
2115
|
+
[11]: http://jster.net/category/windows-modals-popups
|
|
2229
2116
|
|
|
2230
|
-
[12]:
|
|
2117
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2231
2118
|
|
|
2232
|
-
[13]: https://
|
|
2119
|
+
[13]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2233
2120
|
|
|
2234
|
-
[14]: https://playwright.dev/docs/api/class-
|
|
2121
|
+
[14]: https://playwright.dev/docs/api/class-page#page-click
|
|
2235
2122
|
|
|
2236
|
-
[15]: https://playwright.dev/docs/api/class-page#page-
|
|
2123
|
+
[15]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2237
2124
|
|
|
2238
|
-
[16]: https://
|
|
2125
|
+
[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2239
2126
|
|
|
2240
|
-
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2127
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2241
2128
|
|
|
2242
|
-
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2129
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2243
2130
|
|
|
2244
2131
|
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2245
2132
|
|
|
2246
|
-
[20]: https://
|
|
2133
|
+
[20]: https://playwright.dev/docs/api/class-consolemessage
|
|
2134
|
+
|
|
2135
|
+
[21]: https://codecept.io/helpers/FileSystem
|
|
2247
2136
|
|
|
2248
|
-
[
|
|
2137
|
+
[22]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2249
2138
|
|
|
2250
|
-
[
|
|
2139
|
+
[23]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2251
2140
|
|
|
2252
|
-
[
|
|
2141
|
+
[24]: https://playwright.dev/docs/network#handle-requests
|
|
2253
2142
|
|
|
2254
|
-
[
|
|
2143
|
+
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2255
2144
|
|
|
2256
|
-
[
|
|
2145
|
+
[26]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2257
2146
|
|
|
2258
|
-
[
|
|
2147
|
+
[27]: #fillfield
|
|
2259
2148
|
|
|
2260
|
-
[
|
|
2149
|
+
[28]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2261
2150
|
|
|
2262
|
-
[
|
|
2151
|
+
[29]: #click
|
|
2263
2152
|
|
|
2264
|
-
[
|
|
2153
|
+
[30]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2265
2154
|
|
|
2266
|
-
[
|
|
2155
|
+
[31]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2267
2156
|
|
|
2268
|
-
[
|
|
2157
|
+
[32]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2269
2158
|
|
|
2270
|
-
[
|
|
2159
|
+
[33]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2271
2160
|
|
|
2272
|
-
[
|
|
2161
|
+
[34]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2273
2162
|
|
|
2274
|
-
[
|
|
2163
|
+
[35]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2275
2164
|
|
|
2276
|
-
[
|
|
2165
|
+
[36]: https://codecept.io/react
|