codeceptjs 3.3.5 → 3.3.7-beta.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 +37 -7
- package/bin/codecept.js +40 -3
- package/docs/basics.md +24 -1
- package/docs/build/Appium.js +41 -22
- package/docs/build/FileSystem.js +1 -1
- package/docs/build/Nightmare.js +106 -57
- package/docs/build/Playwright.js +187 -111
- package/docs/build/Protractor.js +132 -70
- package/docs/build/Puppeteer.js +143 -76
- package/docs/build/REST.js +2 -2
- package/docs/build/TestCafe.js +107 -57
- package/docs/build/WebDriver.js +162 -89
- package/docs/changelog.md +37 -7
- package/docs/commands.md +5 -3
- package/docs/configuration.md +5 -5
- package/docs/helpers/Appium.md +25 -23
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Nightmare.md +57 -57
- package/docs/helpers/Playwright.md +76 -75
- package/docs/helpers/Puppeteer.md +76 -85
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +57 -57
- package/docs/helpers/WebDriver.md +84 -97
- package/docs/quickstart.md +1 -1
- package/docs/reports.md +1 -1
- package/docs/secrets.md +1 -1
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +3 -3
- 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/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 +2 -2
- package/docs/webapi/saveScreenshot.mustache +2 -2
- 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/command/configMigrate.js +1 -1
- package/lib/command/dryRun.js +2 -1
- package/lib/command/generate.js +35 -18
- package/lib/command/run-rerun.js +38 -0
- package/lib/command/utils.js +13 -3
- package/lib/config.js +2 -2
- package/lib/data/context.js +7 -0
- package/lib/helper/Appium.js +6 -4
- package/lib/helper/FileSystem.js +1 -1
- package/lib/helper/Nightmare.js +1 -1
- package/lib/helper/Playwright.js +50 -38
- package/lib/helper/Protractor.js +1 -1
- package/lib/helper/REST.js +2 -2
- package/lib/helper/TestCafe.js +1 -1
- package/lib/helper/WebDriver.js +7 -7
- package/lib/plugin/wdio.js +11 -2
- package/lib/utils.js +3 -0
- package/package.json +2 -2
- package/typings/index.d.ts +46 -46
- package/typings/types.d.ts +497 -443
package/docs/build/Playwright.js
CHANGED
|
@@ -62,13 +62,14 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
|
|
|
62
62
|
* @prop {boolean} [disableScreenshots=false] - don't save screenshot on failure.
|
|
63
63
|
* @prop {any} [emulate] - browser in device emulation mode.
|
|
64
64
|
* @prop {boolean} [video=false] - enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
65
|
+
* @prop {boolean} [keepVideoForPassedTests=false] - save videos for passed tests; videos are saved into `output/videos` folder
|
|
65
66
|
* @prop {boolean} [trace=false] - record [tracing information](https://playwright.dev/docs/trace-viewer) with screenshots and snapshots.
|
|
66
67
|
* @prop {boolean} [fullPageScreenshots=false] - make full page screenshots on failure.
|
|
67
68
|
* @prop {boolean} [uniqueScreenshotNames=false] - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
68
69
|
* @prop {boolean} [keepBrowserState=false] - keep browser state between tests when `restart` is set to 'session'.
|
|
69
70
|
* @prop {boolean} [keepCookies=false] - keep cookies between tests when `restart` is set to 'session'.
|
|
70
71
|
* @prop {number} [waitForAction] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
71
|
-
* @prop {
|
|
72
|
+
* @prop {string} [waitForNavigation] - When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API](https://playwright.dev/docs/api/class-page#page-wait-for-navigation).
|
|
72
73
|
* @prop {number} [pressKeyDelay=10] - Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
73
74
|
* @prop {number} [getPageTimeout] - config option to set maximum navigation time in milliseconds.
|
|
74
75
|
* @prop {number} [waitForTimeout] - default wait* timeout in ms. Default: 1000.
|
|
@@ -548,22 +549,22 @@ class Playwright extends Helper {
|
|
|
548
549
|
}
|
|
549
550
|
|
|
550
551
|
/**
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
552
|
+
* Use Playwright API inside a test.
|
|
553
|
+
*
|
|
554
|
+
* First argument is a description of an action.
|
|
555
|
+
* Second argument is async function that gets this helper as parameter.
|
|
556
|
+
*
|
|
557
|
+
* { [`page`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md), [`browserContext`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md) [`browser`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md) } objects from Playwright API are available.
|
|
558
|
+
*
|
|
559
|
+
* ```js
|
|
560
|
+
* I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
561
|
+
* await browserContext.setOffline(true);
|
|
562
|
+
* });
|
|
563
|
+
* ```
|
|
564
|
+
*
|
|
565
|
+
* @param {string} description used to show in logs.
|
|
566
|
+
* @param {function} fn async function that executed with Playwright helper as argumen
|
|
567
|
+
*/
|
|
567
568
|
usePlaywrightTo(description, fn) {
|
|
568
569
|
return this._useTo(...arguments);
|
|
569
570
|
}
|
|
@@ -620,7 +621,8 @@ class Playwright extends Helper {
|
|
|
620
621
|
* I.seeInPopup('Popup text');
|
|
621
622
|
* ```
|
|
622
623
|
* @param {string} text value to check.
|
|
623
|
-
*
|
|
624
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
625
|
+
*
|
|
624
626
|
*/
|
|
625
627
|
async seeInPopup(text) {
|
|
626
628
|
popupStore.assertPopupVisible();
|
|
@@ -848,7 +850,8 @@ class Playwright extends Helper {
|
|
|
848
850
|
*
|
|
849
851
|
* @param {number} width width in pixels or `maximize`.
|
|
850
852
|
* @param {number} height height in pixels.
|
|
851
|
-
*
|
|
853
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
854
|
+
*
|
|
852
855
|
*
|
|
853
856
|
* Unlike other drivers Playwright changes the size of a viewport, not the window!
|
|
854
857
|
* Playwright does not control the window of a browser so it can't adjust its real size.
|
|
@@ -901,7 +904,8 @@ class Playwright extends Helper {
|
|
|
901
904
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
902
905
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
903
906
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
904
|
-
*
|
|
907
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
908
|
+
*
|
|
905
909
|
*
|
|
906
910
|
*/
|
|
907
911
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -923,7 +927,8 @@ class Playwright extends Helper {
|
|
|
923
927
|
*
|
|
924
928
|
* @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
|
|
925
929
|
* @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
|
|
926
|
-
*
|
|
930
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
931
|
+
*
|
|
927
932
|
*
|
|
928
933
|
* @param {any} [options] [Additional options](https://playwright.dev/docs/api/class-page#page-drag-and-drop) can be passed as 3rd argument.
|
|
929
934
|
*
|
|
@@ -947,7 +952,8 @@ class Playwright extends Helper {
|
|
|
947
952
|
* ```js
|
|
948
953
|
* I.refreshPage();
|
|
949
954
|
* ```
|
|
950
|
-
*
|
|
955
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
956
|
+
*
|
|
951
957
|
*/
|
|
952
958
|
async refreshPage() {
|
|
953
959
|
return this.page.reload({ timeout: this.options.getPageTimeout, waitUntil: this.options.waitForNavigation });
|
|
@@ -959,7 +965,8 @@ class Playwright extends Helper {
|
|
|
959
965
|
* ```js
|
|
960
966
|
* I.scrollPageToTop();
|
|
961
967
|
* ```
|
|
962
|
-
*
|
|
968
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
969
|
+
*
|
|
963
970
|
*/
|
|
964
971
|
scrollPageToTop() {
|
|
965
972
|
return this.executeScript(() => {
|
|
@@ -973,7 +980,8 @@ class Playwright extends Helper {
|
|
|
973
980
|
* ```js
|
|
974
981
|
* I.scrollPageToBottom();
|
|
975
982
|
* ```
|
|
976
|
-
*
|
|
983
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
984
|
+
*
|
|
977
985
|
*/
|
|
978
986
|
async scrollPageToBottom() {
|
|
979
987
|
return this.executeScript(() => {
|
|
@@ -998,7 +1006,8 @@ class Playwright extends Helper {
|
|
|
998
1006
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
999
1007
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
1000
1008
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
1001
|
-
*
|
|
1009
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1010
|
+
*
|
|
1002
1011
|
*/
|
|
1003
1012
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
1004
1013
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1027,7 +1036,8 @@ class Playwright extends Helper {
|
|
|
1027
1036
|
* ```
|
|
1028
1037
|
*
|
|
1029
1038
|
* @param {string} text text value to check.
|
|
1030
|
-
*
|
|
1039
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1040
|
+
*
|
|
1031
1041
|
*/
|
|
1032
1042
|
async seeInTitle(text) {
|
|
1033
1043
|
const title = await this.page.title();
|
|
@@ -1065,7 +1075,8 @@ class Playwright extends Helper {
|
|
|
1065
1075
|
* ```
|
|
1066
1076
|
*
|
|
1067
1077
|
* @param {string} text value to check.
|
|
1068
|
-
*
|
|
1078
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1079
|
+
*
|
|
1069
1080
|
*/
|
|
1070
1081
|
async seeTitleEquals(text) {
|
|
1071
1082
|
const title = await this.page.title();
|
|
@@ -1080,7 +1091,8 @@ class Playwright extends Helper {
|
|
|
1080
1091
|
* ```
|
|
1081
1092
|
*
|
|
1082
1093
|
* @param {string} text value to check.
|
|
1083
|
-
*
|
|
1094
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1095
|
+
*
|
|
1084
1096
|
*/
|
|
1085
1097
|
async dontSeeInTitle(text) {
|
|
1086
1098
|
const title = await this.page.title();
|
|
@@ -1288,7 +1300,8 @@ class Playwright extends Helper {
|
|
|
1288
1300
|
* I.seeElement('#modal');
|
|
1289
1301
|
* ```
|
|
1290
1302
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1291
|
-
*
|
|
1303
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1304
|
+
*
|
|
1292
1305
|
*
|
|
1293
1306
|
*/
|
|
1294
1307
|
async seeElement(locator) {
|
|
@@ -1305,7 +1318,8 @@ class Playwright extends Helper {
|
|
|
1305
1318
|
* ```
|
|
1306
1319
|
*
|
|
1307
1320
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1308
|
-
*
|
|
1321
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1322
|
+
*
|
|
1309
1323
|
*
|
|
1310
1324
|
*/
|
|
1311
1325
|
async dontSeeElement(locator) {
|
|
@@ -1322,7 +1336,8 @@ class Playwright extends Helper {
|
|
|
1322
1336
|
* I.seeElementInDOM('#modal');
|
|
1323
1337
|
* ```
|
|
1324
1338
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1325
|
-
*
|
|
1339
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1340
|
+
*
|
|
1326
1341
|
*/
|
|
1327
1342
|
async seeElementInDOM(locator) {
|
|
1328
1343
|
const els = await this._locate(locator);
|
|
@@ -1337,7 +1352,8 @@ class Playwright extends Helper {
|
|
|
1337
1352
|
* ```
|
|
1338
1353
|
*
|
|
1339
1354
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1340
|
-
*
|
|
1355
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1356
|
+
*
|
|
1341
1357
|
*/
|
|
1342
1358
|
async dontSeeElementInDOM(locator) {
|
|
1343
1359
|
const els = await this._locate(locator);
|
|
@@ -1400,7 +1416,7 @@ class Playwright extends Helper {
|
|
|
1400
1416
|
*
|
|
1401
1417
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1402
1418
|
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1403
|
-
*
|
|
1419
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1404
1420
|
*
|
|
1405
1421
|
*
|
|
1406
1422
|
* @param {any} [opts] [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
|
|
@@ -1457,7 +1473,7 @@ class Playwright extends Helper {
|
|
|
1457
1473
|
*
|
|
1458
1474
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1459
1475
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1460
|
-
*
|
|
1476
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1461
1477
|
*
|
|
1462
1478
|
*/
|
|
1463
1479
|
async forceClick(locator, context = null) {
|
|
@@ -1477,7 +1493,8 @@ class Playwright extends Helper {
|
|
|
1477
1493
|
*
|
|
1478
1494
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1479
1495
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1480
|
-
*
|
|
1496
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1497
|
+
*
|
|
1481
1498
|
*
|
|
1482
1499
|
*
|
|
1483
1500
|
*/
|
|
@@ -1499,7 +1516,8 @@ class Playwright extends Helper {
|
|
|
1499
1516
|
*
|
|
1500
1517
|
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
1501
1518
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1502
|
-
*
|
|
1519
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1520
|
+
*
|
|
1503
1521
|
*
|
|
1504
1522
|
*
|
|
1505
1523
|
*/
|
|
@@ -1520,7 +1538,8 @@ class Playwright extends Helper {
|
|
|
1520
1538
|
* ```
|
|
1521
1539
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1522
1540
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1523
|
-
*
|
|
1541
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1542
|
+
*
|
|
1524
1543
|
*
|
|
1525
1544
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
|
|
1526
1545
|
*
|
|
@@ -1551,7 +1570,8 @@ class Playwright extends Helper {
|
|
|
1551
1570
|
* ```
|
|
1552
1571
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1553
1572
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1554
|
-
*
|
|
1573
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1574
|
+
*
|
|
1555
1575
|
*
|
|
1556
1576
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck) for uncheck available as 3rd argument.
|
|
1557
1577
|
*
|
|
@@ -1579,7 +1599,8 @@ class Playwright extends Helper {
|
|
|
1579
1599
|
* ```
|
|
1580
1600
|
*
|
|
1581
1601
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1582
|
-
*
|
|
1602
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1603
|
+
*
|
|
1583
1604
|
*/
|
|
1584
1605
|
async seeCheckboxIsChecked(field) {
|
|
1585
1606
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -1595,7 +1616,8 @@ class Playwright extends Helper {
|
|
|
1595
1616
|
* ```
|
|
1596
1617
|
*
|
|
1597
1618
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1598
|
-
*
|
|
1619
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1620
|
+
*
|
|
1599
1621
|
*/
|
|
1600
1622
|
async dontSeeCheckboxIsChecked(field) {
|
|
1601
1623
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -1613,7 +1635,8 @@ class Playwright extends Helper {
|
|
|
1613
1635
|
* ```
|
|
1614
1636
|
*
|
|
1615
1637
|
* @param {string} key name of key to press down.
|
|
1616
|
-
*
|
|
1638
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1639
|
+
*
|
|
1617
1640
|
*/
|
|
1618
1641
|
async pressKeyDown(key) {
|
|
1619
1642
|
key = getNormalizedKey.call(this, key);
|
|
@@ -1633,7 +1656,8 @@ class Playwright extends Helper {
|
|
|
1633
1656
|
* ```
|
|
1634
1657
|
*
|
|
1635
1658
|
* @param {string} key name of key to release.
|
|
1636
|
-
*
|
|
1659
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1660
|
+
*
|
|
1637
1661
|
*/
|
|
1638
1662
|
async pressKeyUp(key) {
|
|
1639
1663
|
key = getNormalizedKey.call(this, key);
|
|
@@ -1701,7 +1725,7 @@ class Playwright extends Helper {
|
|
|
1701
1725
|
* - `'Tab'`
|
|
1702
1726
|
*
|
|
1703
1727
|
* @param {string|string[]} key key or array of keys to press.
|
|
1704
|
-
*
|
|
1728
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1705
1729
|
*
|
|
1706
1730
|
*
|
|
1707
1731
|
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
|
|
@@ -1749,7 +1773,8 @@ class Playwright extends Helper {
|
|
|
1749
1773
|
*
|
|
1750
1774
|
* @param {string|string[]} key or array of keys to type.
|
|
1751
1775
|
* @param {?number} [delay=null] (optional) delay in ms between key presses
|
|
1752
|
-
*
|
|
1776
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1777
|
+
*
|
|
1753
1778
|
*/
|
|
1754
1779
|
async type(keys, delay = null) {
|
|
1755
1780
|
if (!Array.isArray(keys)) {
|
|
@@ -1778,7 +1803,8 @@ class Playwright extends Helper {
|
|
|
1778
1803
|
* ```
|
|
1779
1804
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1780
1805
|
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
1781
|
-
*
|
|
1806
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1807
|
+
*
|
|
1782
1808
|
*
|
|
1783
1809
|
*/
|
|
1784
1810
|
async fillField(field, value) {
|
|
@@ -1805,7 +1831,8 @@ class Playwright extends Helper {
|
|
|
1805
1831
|
* I.clearField('#email');
|
|
1806
1832
|
* ```
|
|
1807
1833
|
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
1808
|
-
*
|
|
1834
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder.
|
|
1835
|
+
*
|
|
1809
1836
|
*/
|
|
1810
1837
|
async clearField(field) {
|
|
1811
1838
|
return this.fillField(field, '');
|
|
@@ -1820,7 +1847,8 @@ class Playwright extends Helper {
|
|
|
1820
1847
|
* ```
|
|
1821
1848
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
1822
1849
|
* @param {string} value text value to append.
|
|
1823
|
-
*
|
|
1850
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1851
|
+
*
|
|
1824
1852
|
*
|
|
1825
1853
|
*
|
|
1826
1854
|
*/
|
|
@@ -1844,7 +1872,8 @@ class Playwright extends Helper {
|
|
|
1844
1872
|
* ```
|
|
1845
1873
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1846
1874
|
* @param {string} value value to check.
|
|
1847
|
-
*
|
|
1875
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1876
|
+
*
|
|
1848
1877
|
*/
|
|
1849
1878
|
async seeInField(field, value) {
|
|
1850
1879
|
return proceedSeeInField.call(this, 'assert', field, value);
|
|
@@ -1861,7 +1890,8 @@ class Playwright extends Helper {
|
|
|
1861
1890
|
*
|
|
1862
1891
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1863
1892
|
* @param {string} value value to check.
|
|
1864
|
-
*
|
|
1893
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1894
|
+
*
|
|
1865
1895
|
*/
|
|
1866
1896
|
async dontSeeInField(field, value) {
|
|
1867
1897
|
return proceedSeeInField.call(this, 'negate', field, value);
|
|
@@ -1869,7 +1899,7 @@ class Playwright extends Helper {
|
|
|
1869
1899
|
|
|
1870
1900
|
/**
|
|
1871
1901
|
* Attaches a file to element located by label, name, CSS or XPath
|
|
1872
|
-
* Path to file is relative current codecept directory (where codecept.
|
|
1902
|
+
* Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
1873
1903
|
* File will be uploaded to remote system (if tests are running remotely).
|
|
1874
1904
|
*
|
|
1875
1905
|
* ```js
|
|
@@ -1878,8 +1908,9 @@ class Playwright extends Helper {
|
|
|
1878
1908
|
* ```
|
|
1879
1909
|
*
|
|
1880
1910
|
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1881
|
-
* @param {string} pathToFile local file path relative to codecept.
|
|
1882
|
-
*
|
|
1911
|
+
* @param {string} pathToFile local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
1912
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1913
|
+
*
|
|
1883
1914
|
*
|
|
1884
1915
|
*/
|
|
1885
1916
|
async attachFile(locator, pathToFile) {
|
|
@@ -1915,7 +1946,8 @@ class Playwright extends Helper {
|
|
|
1915
1946
|
* ```
|
|
1916
1947
|
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
1917
1948
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1918
|
-
*
|
|
1949
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1950
|
+
*
|
|
1919
1951
|
*/
|
|
1920
1952
|
async selectOption(select, option) {
|
|
1921
1953
|
const els = await findFields.call(this, select);
|
|
@@ -1972,7 +2004,8 @@ class Playwright extends Helper {
|
|
|
1972
2004
|
* ```
|
|
1973
2005
|
*
|
|
1974
2006
|
* @param {string} url a fragment to check
|
|
1975
|
-
*
|
|
2007
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2008
|
+
*
|
|
1976
2009
|
*/
|
|
1977
2010
|
async seeInCurrentUrl(url) {
|
|
1978
2011
|
stringIncludes('url').assert(url, await this._getPageUrl());
|
|
@@ -1982,7 +2015,8 @@ class Playwright extends Helper {
|
|
|
1982
2015
|
* Checks that current url does not contain a provided fragment.
|
|
1983
2016
|
*
|
|
1984
2017
|
* @param {string} url value to check.
|
|
1985
|
-
*
|
|
2018
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2019
|
+
*
|
|
1986
2020
|
*/
|
|
1987
2021
|
async dontSeeInCurrentUrl(url) {
|
|
1988
2022
|
stringIncludes('url').negate(url, await this._getPageUrl());
|
|
@@ -1999,7 +2033,8 @@ class Playwright extends Helper {
|
|
|
1999
2033
|
* ```
|
|
2000
2034
|
*
|
|
2001
2035
|
* @param {string} url value to check.
|
|
2002
|
-
*
|
|
2036
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2037
|
+
*
|
|
2003
2038
|
*/
|
|
2004
2039
|
async seeCurrentUrlEquals(url) {
|
|
2005
2040
|
urlEquals(this.options.url).assert(url, await this._getPageUrl());
|
|
@@ -2015,7 +2050,8 @@ class Playwright extends Helper {
|
|
|
2015
2050
|
* ```
|
|
2016
2051
|
*
|
|
2017
2052
|
* @param {string} url value to check.
|
|
2018
|
-
*
|
|
2053
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2054
|
+
*
|
|
2019
2055
|
*/
|
|
2020
2056
|
async dontSeeCurrentUrlEquals(url) {
|
|
2021
2057
|
urlEquals(this.options.url).negate(url, await this._getPageUrl());
|
|
@@ -2032,7 +2068,8 @@ class Playwright extends Helper {
|
|
|
2032
2068
|
* ```
|
|
2033
2069
|
* @param {string} text expected on page.
|
|
2034
2070
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
2035
|
-
*
|
|
2071
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2072
|
+
*
|
|
2036
2073
|
*
|
|
2037
2074
|
*
|
|
2038
2075
|
*/
|
|
@@ -2049,7 +2086,8 @@ class Playwright extends Helper {
|
|
|
2049
2086
|
*
|
|
2050
2087
|
* @param {string} text element value to check.
|
|
2051
2088
|
* @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
|
|
2052
|
-
*
|
|
2089
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2090
|
+
*
|
|
2053
2091
|
*/
|
|
2054
2092
|
async seeTextEquals(text, context = null) {
|
|
2055
2093
|
return proceedSee.call(this, 'assert', text, context, true);
|
|
@@ -2066,7 +2104,8 @@ class Playwright extends Helper {
|
|
|
2066
2104
|
*
|
|
2067
2105
|
* @param {string} text which is not present.
|
|
2068
2106
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
2069
|
-
*
|
|
2107
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2108
|
+
*
|
|
2070
2109
|
*
|
|
2071
2110
|
*
|
|
2072
2111
|
*/
|
|
@@ -2127,7 +2166,8 @@ class Playwright extends Helper {
|
|
|
2127
2166
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
2128
2167
|
* ```
|
|
2129
2168
|
* @param {string} text value to check.
|
|
2130
|
-
*
|
|
2169
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2170
|
+
*
|
|
2131
2171
|
*/
|
|
2132
2172
|
async seeInSource(text) {
|
|
2133
2173
|
const source = await this.page.content();
|
|
@@ -2142,7 +2182,8 @@ class Playwright extends Helper {
|
|
|
2142
2182
|
* ```
|
|
2143
2183
|
*
|
|
2144
2184
|
* @param {string} value to check.
|
|
2145
|
-
*
|
|
2185
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2186
|
+
*
|
|
2146
2187
|
*/
|
|
2147
2188
|
async dontSeeInSource(text) {
|
|
2148
2189
|
const source = await this.page.content();
|
|
@@ -2160,7 +2201,8 @@ class Playwright extends Helper {
|
|
|
2160
2201
|
*
|
|
2161
2202
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2162
2203
|
* @param {number} num number of elements.
|
|
2163
|
-
*
|
|
2204
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2205
|
+
*
|
|
2164
2206
|
*
|
|
2165
2207
|
*
|
|
2166
2208
|
*/
|
|
@@ -2179,7 +2221,8 @@ class Playwright extends Helper {
|
|
|
2179
2221
|
*
|
|
2180
2222
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2181
2223
|
* @param {number} num number of elements.
|
|
2182
|
-
*
|
|
2224
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2225
|
+
*
|
|
2183
2226
|
*
|
|
2184
2227
|
*
|
|
2185
2228
|
*/
|
|
@@ -2204,7 +2247,8 @@ class Playwright extends Helper {
|
|
|
2204
2247
|
* ```
|
|
2205
2248
|
*
|
|
2206
2249
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
2207
|
-
*
|
|
2250
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2251
|
+
*
|
|
2208
2252
|
*/
|
|
2209
2253
|
async setCookie(cookie) {
|
|
2210
2254
|
if (Array.isArray(cookie)) {
|
|
@@ -2221,7 +2265,8 @@ class Playwright extends Helper {
|
|
|
2221
2265
|
* ```
|
|
2222
2266
|
*
|
|
2223
2267
|
* @param {string} name cookie name.
|
|
2224
|
-
*
|
|
2268
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2269
|
+
*
|
|
2225
2270
|
*
|
|
2226
2271
|
*/
|
|
2227
2272
|
async seeCookie(name) {
|
|
@@ -2237,7 +2282,8 @@ class Playwright extends Helper {
|
|
|
2237
2282
|
* ```
|
|
2238
2283
|
*
|
|
2239
2284
|
* @param {string} name cookie name.
|
|
2240
|
-
*
|
|
2285
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2286
|
+
*
|
|
2241
2287
|
*/
|
|
2242
2288
|
async dontSeeCookie(name) {
|
|
2243
2289
|
const cookies = await this.browserContext.cookies();
|
|
@@ -2277,7 +2323,8 @@ class Playwright extends Helper {
|
|
|
2277
2323
|
* ```
|
|
2278
2324
|
*
|
|
2279
2325
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
2280
|
-
*
|
|
2326
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2327
|
+
*
|
|
2281
2328
|
*/
|
|
2282
2329
|
async clearCookie() {
|
|
2283
2330
|
// Playwright currently doesn't support to delete a certain cookie
|
|
@@ -2505,7 +2552,8 @@ class Playwright extends Helper {
|
|
|
2505
2552
|
*
|
|
2506
2553
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2507
2554
|
* @param {object} cssProperties object with CSS properties and their values to check.
|
|
2508
|
-
*
|
|
2555
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2556
|
+
*
|
|
2509
2557
|
*
|
|
2510
2558
|
*/
|
|
2511
2559
|
async seeCssPropertiesOnElements(locator, cssProperties) {
|
|
@@ -2551,7 +2599,8 @@ class Playwright extends Helper {
|
|
|
2551
2599
|
*
|
|
2552
2600
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2553
2601
|
* @param {object} attributes attributes and their values to check.
|
|
2554
|
-
*
|
|
2602
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2603
|
+
*
|
|
2555
2604
|
*
|
|
2556
2605
|
*/
|
|
2557
2606
|
async seeAttributesOnElements(locator, attributes) {
|
|
@@ -2590,7 +2639,8 @@ class Playwright extends Helper {
|
|
|
2590
2639
|
*
|
|
2591
2640
|
* @param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
|
|
2592
2641
|
* @param {number} offsetX position to drag.
|
|
2593
|
-
*
|
|
2642
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2643
|
+
*
|
|
2594
2644
|
*
|
|
2595
2645
|
*/
|
|
2596
2646
|
async dragSlider(locator, offsetX = 0) {
|
|
@@ -2659,7 +2709,7 @@ class Playwright extends Helper {
|
|
|
2659
2709
|
}
|
|
2660
2710
|
|
|
2661
2711
|
/**
|
|
2662
|
-
* Saves screenshot of the specified locator to ouput folder (set in codecept.
|
|
2712
|
+
* Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
2663
2713
|
* Filename is relative to output folder.
|
|
2664
2714
|
*
|
|
2665
2715
|
* ```js
|
|
@@ -2668,7 +2718,8 @@ class Playwright extends Helper {
|
|
|
2668
2718
|
*
|
|
2669
2719
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2670
2720
|
* @param {string} fileName file name to save.
|
|
2671
|
-
*
|
|
2721
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2722
|
+
*
|
|
2672
2723
|
*
|
|
2673
2724
|
*/
|
|
2674
2725
|
async saveElementScreenshot(locator, fileName) {
|
|
@@ -2683,7 +2734,7 @@ class Playwright extends Helper {
|
|
|
2683
2734
|
}
|
|
2684
2735
|
|
|
2685
2736
|
/**
|
|
2686
|
-
* Saves a screenshot to ouput folder (set in codecept.
|
|
2737
|
+
* Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
2687
2738
|
* Filename is relative to output folder.
|
|
2688
2739
|
* 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.
|
|
2689
2740
|
*
|
|
@@ -2694,7 +2745,8 @@ class Playwright extends Helper {
|
|
|
2694
2745
|
*
|
|
2695
2746
|
* @param {string} fileName file name to save.
|
|
2696
2747
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
2697
|
-
*
|
|
2748
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2749
|
+
*
|
|
2698
2750
|
*/
|
|
2699
2751
|
async saveScreenshot(fileName, fullPage) {
|
|
2700
2752
|
const fullPageOption = fullPage || this.options.fullPageScreenshots;
|
|
@@ -2772,7 +2824,11 @@ class Playwright extends Helper {
|
|
|
2772
2824
|
}
|
|
2773
2825
|
|
|
2774
2826
|
if (this.options.recordVideo && this.page && this.page.video()) {
|
|
2827
|
+
const videoPath = `${global.output_dir}/videos/${clearString(test.title)}.failed.webm`;
|
|
2775
2828
|
test.artifacts.video = await this.page.video().path();
|
|
2829
|
+
fs.rename(test.artifacts.video, videoPath, (() => {
|
|
2830
|
+
test.artifacts.video = videoPath;
|
|
2831
|
+
}));
|
|
2776
2832
|
}
|
|
2777
2833
|
|
|
2778
2834
|
if (this.options.trace) {
|
|
@@ -2784,8 +2840,13 @@ class Playwright extends Helper {
|
|
|
2784
2840
|
|
|
2785
2841
|
async _passed(test) {
|
|
2786
2842
|
if (this.options.recordVideo && this.page && this.page.video()) {
|
|
2843
|
+
const videoPath = `${global.output_dir}/videos/${clearString(test.title)}.passed.webm`;
|
|
2844
|
+
|
|
2787
2845
|
if (this.options.keepVideoForPassedTests) {
|
|
2788
2846
|
test.artifacts.video = await this.page.video().path();
|
|
2847
|
+
fs.rename(test.artifacts.video, videoPath, (() => {
|
|
2848
|
+
test.artifacts.video = videoPath;
|
|
2849
|
+
}));
|
|
2789
2850
|
} else {
|
|
2790
2851
|
this.page.video().delete().catch(e => {});
|
|
2791
2852
|
}
|
|
@@ -2810,7 +2871,8 @@ class Playwright extends Helper {
|
|
|
2810
2871
|
* ```
|
|
2811
2872
|
*
|
|
2812
2873
|
* @param {number} sec number of second to wait.
|
|
2813
|
-
*
|
|
2874
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2875
|
+
*
|
|
2814
2876
|
*/
|
|
2815
2877
|
async wait(sec) {
|
|
2816
2878
|
return new Promise(((done) => {
|
|
@@ -2824,7 +2886,8 @@ class Playwright extends Helper {
|
|
|
2824
2886
|
*
|
|
2825
2887
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2826
2888
|
* @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
2827
|
-
*
|
|
2889
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2890
|
+
*
|
|
2828
2891
|
*/
|
|
2829
2892
|
async waitForEnabled(locator, sec) {
|
|
2830
2893
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2859,7 +2922,8 @@ class Playwright extends Helper {
|
|
|
2859
2922
|
* @param {LocatorOrString} field input field.
|
|
2860
2923
|
* @param {string }value expected value.
|
|
2861
2924
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2862
|
-
*
|
|
2925
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2926
|
+
*
|
|
2863
2927
|
*/
|
|
2864
2928
|
async waitForValue(field, value, sec) {
|
|
2865
2929
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2895,7 +2959,8 @@ class Playwright extends Helper {
|
|
|
2895
2959
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2896
2960
|
* @param {number} num number of elements.
|
|
2897
2961
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2898
|
-
*
|
|
2962
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2963
|
+
*
|
|
2899
2964
|
*
|
|
2900
2965
|
*/
|
|
2901
2966
|
async waitNumberOfVisibleElements(locator, num, sec) {
|
|
@@ -2936,7 +3001,8 @@ class Playwright extends Helper {
|
|
|
2936
3001
|
*
|
|
2937
3002
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2938
3003
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2939
|
-
*
|
|
3004
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3005
|
+
*
|
|
2940
3006
|
*/
|
|
2941
3007
|
async waitForClickable(locator, waitTimeout) {
|
|
2942
3008
|
console.log('I.waitForClickable is DEPRECATED: This is no longer needed, Playwright automatically waits for element to be clickable');
|
|
@@ -2954,7 +3020,8 @@ class Playwright extends Helper {
|
|
|
2954
3020
|
*
|
|
2955
3021
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2956
3022
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2957
|
-
*
|
|
3023
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3024
|
+
*
|
|
2958
3025
|
*
|
|
2959
3026
|
*/
|
|
2960
3027
|
async waitForElement(locator, sec) {
|
|
@@ -2978,7 +3045,8 @@ class Playwright extends Helper {
|
|
|
2978
3045
|
*
|
|
2979
3046
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2980
3047
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2981
|
-
*
|
|
3048
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3049
|
+
*
|
|
2982
3050
|
*
|
|
2983
3051
|
* This method accepts [React selectors](https://codecept.io/react).
|
|
2984
3052
|
*/
|
|
@@ -3002,7 +3070,8 @@ class Playwright extends Helper {
|
|
|
3002
3070
|
*
|
|
3003
3071
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3004
3072
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3005
|
-
*
|
|
3073
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3074
|
+
*
|
|
3006
3075
|
*/
|
|
3007
3076
|
async waitForInvisible(locator, sec) {
|
|
3008
3077
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3024,7 +3093,8 @@ class Playwright extends Helper {
|
|
|
3024
3093
|
*
|
|
3025
3094
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3026
3095
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3027
|
-
*
|
|
3096
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3097
|
+
*
|
|
3028
3098
|
*/
|
|
3029
3099
|
async waitToHide(locator, sec) {
|
|
3030
3100
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3051,7 +3121,8 @@ class Playwright extends Helper {
|
|
|
3051
3121
|
*
|
|
3052
3122
|
* @param {string} urlPart value to check.
|
|
3053
3123
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3054
|
-
*
|
|
3124
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3125
|
+
*
|
|
3055
3126
|
*/
|
|
3056
3127
|
async waitInUrl(urlPart, sec = null) {
|
|
3057
3128
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3079,7 +3150,8 @@ class Playwright extends Helper {
|
|
|
3079
3150
|
*
|
|
3080
3151
|
* @param {string} urlPart value to check.
|
|
3081
3152
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3082
|
-
*
|
|
3153
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3154
|
+
*
|
|
3083
3155
|
*/
|
|
3084
3156
|
async waitUrlEquals(urlPart, sec = null) {
|
|
3085
3157
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3115,7 +3187,8 @@ class Playwright extends Helper {
|
|
|
3115
3187
|
* @param {string }text to wait for.
|
|
3116
3188
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3117
3189
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
3118
|
-
*
|
|
3190
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3191
|
+
*
|
|
3119
3192
|
*/
|
|
3120
3193
|
async waitForText(text, sec = null, context = null) {
|
|
3121
3194
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3186,7 +3259,8 @@ class Playwright extends Helper {
|
|
|
3186
3259
|
* ```
|
|
3187
3260
|
*
|
|
3188
3261
|
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
3189
|
-
*
|
|
3262
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3263
|
+
*
|
|
3190
3264
|
*/
|
|
3191
3265
|
async switchTo(locator) {
|
|
3192
3266
|
if (Number.isInteger(locator)) {
|
|
@@ -3244,7 +3318,8 @@ class Playwright extends Helper {
|
|
|
3244
3318
|
* @param {string|function} fn to be executed in browser context.
|
|
3245
3319
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
3246
3320
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
3247
|
-
*
|
|
3321
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3322
|
+
*
|
|
3248
3323
|
*/
|
|
3249
3324
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
3250
3325
|
let args = [];
|
|
@@ -3293,7 +3368,8 @@ class Playwright extends Helper {
|
|
|
3293
3368
|
*
|
|
3294
3369
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3295
3370
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3296
|
-
*
|
|
3371
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3372
|
+
*
|
|
3297
3373
|
*/
|
|
3298
3374
|
async waitForDetached(locator, sec) {
|
|
3299
3375
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3377,32 +3453,32 @@ class Playwright extends Helper {
|
|
|
3377
3453
|
}
|
|
3378
3454
|
|
|
3379
3455
|
/**
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3456
|
+
* Mocks network request using [`browserContext.route`](https://playwright.dev/docs/api/class-browsercontext#browser-context-route) of Playwright
|
|
3457
|
+
*
|
|
3458
|
+
* ```js
|
|
3459
|
+
* I.mockRoute(/(\.png$)|(\.jpg$)/, route => route.abort());
|
|
3460
|
+
* ```
|
|
3461
|
+
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://playwright.dev/docs/network#handle-requests)
|
|
3462
|
+
*
|
|
3463
|
+
* @param {string|RegExp} [url] URL, regex or pattern for to match URL
|
|
3464
|
+
* @param {function} [handler] a function to process reques
|
|
3465
|
+
*/
|
|
3390
3466
|
async mockRoute(url, handler) {
|
|
3391
3467
|
return this.browserContext.route(...arguments);
|
|
3392
3468
|
}
|
|
3393
3469
|
|
|
3394
3470
|
/**
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3471
|
+
* Stops network mocking created by `mockRoute`.
|
|
3472
|
+
*
|
|
3473
|
+
* ```js
|
|
3474
|
+
* I.stopMockingRoute(/(\.png$)|(\.jpg$)/);
|
|
3475
|
+
* I.stopMockingRoute(/(\.png$)|(\.jpg$)/, previouslySetHandler);
|
|
3476
|
+
* ```
|
|
3477
|
+
* If no handler is passed, all mock requests for the rote are disabled.
|
|
3478
|
+
*
|
|
3479
|
+
* @param {string|RegExp} [url] URL, regex or pattern for to match URL
|
|
3480
|
+
* @param {function} [handler] a function to process reques
|
|
3481
|
+
*/
|
|
3406
3482
|
async stopMockingRoute(url, handler) {
|
|
3407
3483
|
return this.browserContext.unroute(...arguments);
|
|
3408
3484
|
}
|