codeceptjs 3.5.11 → 3.5.12-beta.2
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/README.md +3 -3
- package/docs/build/Appium.js +35 -35
- package/docs/build/Nightmare.js +50 -50
- package/docs/build/Playwright.js +100 -72
- package/docs/build/Protractor.js +59 -59
- package/docs/build/Puppeteer.js +96 -69
- package/docs/build/TestCafe.js +48 -48
- package/docs/build/WebDriver.js +223 -105
- package/docs/helpers/Playwright.md +15 -0
- package/docs/helpers/Puppeteer.md +15 -0
- package/docs/helpers/WebDriver.md +340 -266
- package/docs/locators.md +9 -1
- package/docs/webapi/waitForNumberOfTabs.mustache +9 -0
- package/docs/webdriver.md +52 -6
- package/lib/command/run-multiple.js +3 -1
- package/lib/command/run-workers.js +32 -1
- package/lib/command/workers/runTests.js +2 -2
- package/lib/css2xpath/js/css_to_xpath.js +20 -0
- package/lib/css2xpath/js/expression.js +23 -0
- package/lib/css2xpath/js/renderer.js +239 -0
- package/lib/helper/Playwright.js +21 -2
- package/lib/helper/Puppeteer.js +18 -0
- package/lib/helper/WebDriver.js +140 -31
- package/lib/locator.js +31 -4
- package/lib/plugin/retryFailedStep.js +5 -1
- package/lib/plugin/retryTo.js +2 -2
- package/package.json +24 -18
- package/typings/index.d.ts +9 -6
- package/typings/promiseBasedTypes.d.ts +84 -1
- package/typings/types.d.ts +102 -2
package/docs/build/Puppeteer.js
CHANGED
|
@@ -754,7 +754,7 @@ class Puppeteer extends Helper {
|
|
|
754
754
|
* I.moveCursorTo('#submit', 5,5);
|
|
755
755
|
* ```
|
|
756
756
|
*
|
|
757
|
-
* @param {
|
|
757
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
758
758
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
759
759
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
760
760
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -782,7 +782,7 @@ class Puppeteer extends Helper {
|
|
|
782
782
|
* I.see('#add-to-cart-bnt');
|
|
783
783
|
* ```
|
|
784
784
|
*
|
|
785
|
-
* @param {
|
|
785
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
786
786
|
* @param {any} [options] Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
|
|
787
787
|
* @returns {void} automatically synchronized promise through #recorder
|
|
788
788
|
*
|
|
@@ -814,7 +814,7 @@ class Puppeteer extends Helper {
|
|
|
814
814
|
* I.dontSee('#add-to-cart-btn');
|
|
815
815
|
* ```
|
|
816
816
|
*
|
|
817
|
-
* @param {
|
|
817
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
818
818
|
* @param {any} [options] Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
|
|
819
819
|
* @returns {void} automatically synchronized promise through #recorder
|
|
820
820
|
*
|
|
@@ -835,8 +835,8 @@ class Puppeteer extends Helper {
|
|
|
835
835
|
* I.dragAndDrop('#dragHandle', '#container');
|
|
836
836
|
* ```
|
|
837
837
|
*
|
|
838
|
-
* @param {
|
|
839
|
-
* @param {
|
|
838
|
+
* @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
|
|
839
|
+
* @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
|
|
840
840
|
* @returns {void} automatically synchronized promise through #recorder
|
|
841
841
|
*
|
|
842
842
|
*/
|
|
@@ -904,7 +904,7 @@ class Puppeteer extends Helper {
|
|
|
904
904
|
* I.scrollTo('#submit', 5, 5);
|
|
905
905
|
* ```
|
|
906
906
|
*
|
|
907
|
-
* @param {
|
|
907
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
908
908
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
909
909
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
910
910
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -1075,7 +1075,7 @@ class Puppeteer extends Helper {
|
|
|
1075
1075
|
* const webElements = await I.grabWebElements('#button');
|
|
1076
1076
|
* ```
|
|
1077
1077
|
*
|
|
1078
|
-
* @param {
|
|
1078
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1079
1079
|
* @returns {Promise<*>} WebElement of being used Web helper
|
|
1080
1080
|
*
|
|
1081
1081
|
*
|
|
@@ -1199,7 +1199,7 @@ class Puppeteer extends Helper {
|
|
|
1199
1199
|
* ```js
|
|
1200
1200
|
* I.seeElement('#modal');
|
|
1201
1201
|
* ```
|
|
1202
|
-
* @param {
|
|
1202
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1203
1203
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1204
1204
|
*
|
|
1205
1205
|
* {{ react }}
|
|
@@ -1220,7 +1220,7 @@ class Puppeteer extends Helper {
|
|
|
1220
1220
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
1221
1221
|
* ```
|
|
1222
1222
|
*
|
|
1223
|
-
* @param {
|
|
1223
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1224
1224
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1225
1225
|
*
|
|
1226
1226
|
* {{ react }}
|
|
@@ -1241,7 +1241,7 @@ class Puppeteer extends Helper {
|
|
|
1241
1241
|
* ```js
|
|
1242
1242
|
* I.seeElementInDOM('#modal');
|
|
1243
1243
|
* ```
|
|
1244
|
-
* @param {
|
|
1244
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1245
1245
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1246
1246
|
*
|
|
1247
1247
|
*/
|
|
@@ -1257,7 +1257,7 @@ class Puppeteer extends Helper {
|
|
|
1257
1257
|
* I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
1258
1258
|
* ```
|
|
1259
1259
|
*
|
|
1260
|
-
* @param {
|
|
1260
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1261
1261
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1262
1262
|
*
|
|
1263
1263
|
*/
|
|
@@ -1289,8 +1289,8 @@ class Puppeteer extends Helper {
|
|
|
1289
1289
|
* I.click({css: 'nav a.login'});
|
|
1290
1290
|
* ```
|
|
1291
1291
|
*
|
|
1292
|
-
* @param {
|
|
1293
|
-
* @param {?
|
|
1292
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1293
|
+
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1294
1294
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1295
1295
|
*
|
|
1296
1296
|
*
|
|
@@ -1326,8 +1326,8 @@ class Puppeteer extends Helper {
|
|
|
1326
1326
|
* I.forceClick({css: 'nav a.login'});
|
|
1327
1327
|
* ```
|
|
1328
1328
|
*
|
|
1329
|
-
* @param {
|
|
1330
|
-
* @param {?
|
|
1329
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1330
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1331
1331
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1332
1332
|
*
|
|
1333
1333
|
*
|
|
@@ -1364,8 +1364,8 @@ class Puppeteer extends Helper {
|
|
|
1364
1364
|
* ```js
|
|
1365
1365
|
* I.clickLink('Logout', '#nav');
|
|
1366
1366
|
* ```
|
|
1367
|
-
* @param {
|
|
1368
|
-
* @param {?
|
|
1367
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
1368
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
1369
1369
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1370
1370
|
*
|
|
1371
1371
|
*
|
|
@@ -1483,8 +1483,8 @@ class Puppeteer extends Helper {
|
|
|
1483
1483
|
* I.doubleClick('.btn.edit');
|
|
1484
1484
|
* ```
|
|
1485
1485
|
*
|
|
1486
|
-
* @param {
|
|
1487
|
-
* @param {?
|
|
1486
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1487
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1488
1488
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1489
1489
|
*
|
|
1490
1490
|
*
|
|
@@ -1506,8 +1506,8 @@ class Puppeteer extends Helper {
|
|
|
1506
1506
|
* I.rightClick('Click me', '.context');
|
|
1507
1507
|
* ```
|
|
1508
1508
|
*
|
|
1509
|
-
* @param {
|
|
1510
|
-
* @param {?
|
|
1509
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
1510
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1511
1511
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1512
1512
|
*
|
|
1513
1513
|
*
|
|
@@ -1528,8 +1528,8 @@ class Puppeteer extends Helper {
|
|
|
1528
1528
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
1529
1529
|
* I.checkOption('agree', '//form');
|
|
1530
1530
|
* ```
|
|
1531
|
-
* @param {
|
|
1532
|
-
* @param {?
|
|
1531
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1532
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1533
1533
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1534
1534
|
*
|
|
1535
1535
|
*/
|
|
@@ -1555,8 +1555,8 @@ class Puppeteer extends Helper {
|
|
|
1555
1555
|
* I.uncheckOption('I Agree to Terms and Conditions');
|
|
1556
1556
|
* I.uncheckOption('agree', '//form');
|
|
1557
1557
|
* ```
|
|
1558
|
-
* @param {
|
|
1559
|
-
* @param {?
|
|
1558
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1559
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1560
1560
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1561
1561
|
*
|
|
1562
1562
|
*/
|
|
@@ -1580,7 +1580,7 @@ class Puppeteer extends Helper {
|
|
|
1580
1580
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1581
1581
|
* ```
|
|
1582
1582
|
*
|
|
1583
|
-
* @param {
|
|
1583
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1584
1584
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1585
1585
|
*
|
|
1586
1586
|
*/
|
|
@@ -1597,7 +1597,7 @@ class Puppeteer extends Helper {
|
|
|
1597
1597
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
1598
1598
|
* ```
|
|
1599
1599
|
*
|
|
1600
|
-
* @param {
|
|
1600
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1601
1601
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1602
1602
|
*
|
|
1603
1603
|
*/
|
|
@@ -1787,8 +1787,8 @@ class Puppeteer extends Helper {
|
|
|
1787
1787
|
* // or by strict locator
|
|
1788
1788
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
1789
1789
|
* ```
|
|
1790
|
-
* @param {
|
|
1791
|
-
* @param {
|
|
1790
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1791
|
+
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
1792
1792
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1793
1793
|
*
|
|
1794
1794
|
* {{ react }}
|
|
@@ -1819,7 +1819,7 @@ class Puppeteer extends Helper {
|
|
|
1819
1819
|
* I.clearField('user[email]');
|
|
1820
1820
|
* I.clearField('#email');
|
|
1821
1821
|
* ```
|
|
1822
|
-
* @param {
|
|
1822
|
+
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
1823
1823
|
* @returns {void} automatically synchronized promise through #recorder.
|
|
1824
1824
|
*
|
|
1825
1825
|
*/
|
|
@@ -1836,7 +1836,7 @@ class Puppeteer extends Helper {
|
|
|
1836
1836
|
* // typing secret
|
|
1837
1837
|
* I.appendField('password', secret('123456'));
|
|
1838
1838
|
* ```
|
|
1839
|
-
* @param {
|
|
1839
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
1840
1840
|
* @param {string} value text value to append.
|
|
1841
1841
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1842
1842
|
*
|
|
@@ -1862,8 +1862,8 @@ class Puppeteer extends Helper {
|
|
|
1862
1862
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
1863
1863
|
* I.seeInField('#searchform input','Search');
|
|
1864
1864
|
* ```
|
|
1865
|
-
* @param {
|
|
1866
|
-
* @param {
|
|
1865
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1866
|
+
* @param {CodeceptJS.StringOrSecret} value value to check.
|
|
1867
1867
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1868
1868
|
*
|
|
1869
1869
|
*/
|
|
@@ -1881,8 +1881,8 @@ class Puppeteer extends Helper {
|
|
|
1881
1881
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
1882
1882
|
* ```
|
|
1883
1883
|
*
|
|
1884
|
-
* @param {
|
|
1885
|
-
* @param {
|
|
1884
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1885
|
+
* @param {CodeceptJS.StringOrSecret} value value to check.
|
|
1886
1886
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1887
1887
|
*
|
|
1888
1888
|
*/
|
|
@@ -1903,7 +1903,7 @@ class Puppeteer extends Helper {
|
|
|
1903
1903
|
* I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
1904
1904
|
* ```
|
|
1905
1905
|
*
|
|
1906
|
-
* @param {
|
|
1906
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1907
1907
|
* @param {string} pathToFile local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
1908
1908
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1909
1909
|
*
|
|
@@ -1939,7 +1939,7 @@ class Puppeteer extends Helper {
|
|
|
1939
1939
|
* ```js
|
|
1940
1940
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
1941
1941
|
* ```
|
|
1942
|
-
* @param {
|
|
1942
|
+
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
1943
1943
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1944
1944
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1945
1945
|
*
|
|
@@ -1982,7 +1982,7 @@ class Puppeteer extends Helper {
|
|
|
1982
1982
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1983
1983
|
* ```
|
|
1984
1984
|
*
|
|
1985
|
-
* @param {
|
|
1985
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1986
1986
|
* @returns {Promise<number>} number of visible elements
|
|
1987
1987
|
* {{ react }}
|
|
1988
1988
|
*/
|
|
@@ -2066,7 +2066,7 @@ class Puppeteer extends Helper {
|
|
|
2066
2066
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
2067
2067
|
* ```
|
|
2068
2068
|
* @param {string} text expected on page.
|
|
2069
|
-
* @param {?
|
|
2069
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
2070
2070
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2071
2071
|
*
|
|
2072
2072
|
*
|
|
@@ -2084,7 +2084,7 @@ class Puppeteer extends Helper {
|
|
|
2084
2084
|
* ```
|
|
2085
2085
|
*
|
|
2086
2086
|
* @param {string} text element value to check.
|
|
2087
|
-
* @param {
|
|
2087
|
+
* @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
|
|
2088
2088
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2089
2089
|
*
|
|
2090
2090
|
*/
|
|
@@ -2102,7 +2102,7 @@ class Puppeteer extends Helper {
|
|
|
2102
2102
|
* ```
|
|
2103
2103
|
*
|
|
2104
2104
|
* @param {string} text which is not present.
|
|
2105
|
-
* @param {
|
|
2105
|
+
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
2106
2106
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2107
2107
|
*
|
|
2108
2108
|
*
|
|
@@ -2196,7 +2196,7 @@ class Puppeteer extends Helper {
|
|
|
2196
2196
|
* I.seeNumberOfElements('#submitBtn', 1);
|
|
2197
2197
|
* ```
|
|
2198
2198
|
*
|
|
2199
|
-
* @param {
|
|
2199
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2200
2200
|
* @param {number} num number of elements.
|
|
2201
2201
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2202
2202
|
*
|
|
@@ -2216,7 +2216,7 @@ class Puppeteer extends Helper {
|
|
|
2216
2216
|
* I.seeNumberOfVisibleElements('.buttons', 3);
|
|
2217
2217
|
* ```
|
|
2218
2218
|
*
|
|
2219
|
-
* @param {
|
|
2219
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2220
2220
|
* @param {number} num number of elements.
|
|
2221
2221
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2222
2222
|
*
|
|
@@ -2421,7 +2421,7 @@ class Puppeteer extends Helper {
|
|
|
2421
2421
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
2422
2422
|
* ```
|
|
2423
2423
|
*
|
|
2424
|
-
* @param {
|
|
2424
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2425
2425
|
* @returns {Promise<string[]>} attribute value
|
|
2426
2426
|
*
|
|
2427
2427
|
* {{ react }}
|
|
@@ -2444,7 +2444,7 @@ class Puppeteer extends Helper {
|
|
|
2444
2444
|
* ```
|
|
2445
2445
|
* If multiple elements found returns first element.
|
|
2446
2446
|
*
|
|
2447
|
-
* @param {
|
|
2447
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2448
2448
|
* @returns {Promise<string>} attribute value
|
|
2449
2449
|
*
|
|
2450
2450
|
* {{ react }}
|
|
@@ -2466,7 +2466,7 @@ class Puppeteer extends Helper {
|
|
|
2466
2466
|
* ```js
|
|
2467
2467
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
2468
2468
|
* ```
|
|
2469
|
-
* @param {
|
|
2469
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
2470
2470
|
* @returns {Promise<string[]>} attribute value
|
|
2471
2471
|
*
|
|
2472
2472
|
*/
|
|
@@ -2487,7 +2487,7 @@ class Puppeteer extends Helper {
|
|
|
2487
2487
|
* ```js
|
|
2488
2488
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
2489
2489
|
* ```
|
|
2490
|
-
* @param {
|
|
2490
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
2491
2491
|
* @returns {Promise<string>} attribute value
|
|
2492
2492
|
*
|
|
2493
2493
|
*/
|
|
@@ -2509,7 +2509,7 @@ class Puppeteer extends Helper {
|
|
|
2509
2509
|
* let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
2510
2510
|
* ```
|
|
2511
2511
|
*
|
|
2512
|
-
* @param {
|
|
2512
|
+
* @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
|
|
2513
2513
|
* @returns {Promise<string[]>} HTML code for an element
|
|
2514
2514
|
*
|
|
2515
2515
|
*/
|
|
@@ -2528,7 +2528,7 @@ class Puppeteer extends Helper {
|
|
|
2528
2528
|
* let postHTML = await I.grabHTMLFrom('#post');
|
|
2529
2529
|
* ```
|
|
2530
2530
|
*
|
|
2531
|
-
* @param {
|
|
2531
|
+
* @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
|
|
2532
2532
|
* @returns {Promise<string>} HTML code for an element
|
|
2533
2533
|
*
|
|
2534
2534
|
*/
|
|
@@ -2550,7 +2550,7 @@ class Puppeteer extends Helper {
|
|
|
2550
2550
|
* const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
2551
2551
|
* ```
|
|
2552
2552
|
*
|
|
2553
|
-
* @param {
|
|
2553
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2554
2554
|
* @param {string} cssProperty CSS property name.
|
|
2555
2555
|
* @returns {Promise<string[]>} CSS value
|
|
2556
2556
|
*
|
|
@@ -2573,7 +2573,7 @@ class Puppeteer extends Helper {
|
|
|
2573
2573
|
* const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
2574
2574
|
* ```
|
|
2575
2575
|
*
|
|
2576
|
-
* @param {
|
|
2576
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2577
2577
|
* @param {string} cssProperty CSS property name.
|
|
2578
2578
|
* @returns {Promise<string>} CSS value
|
|
2579
2579
|
*
|
|
@@ -2597,7 +2597,7 @@ class Puppeteer extends Helper {
|
|
|
2597
2597
|
* I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
2598
2598
|
* ```
|
|
2599
2599
|
*
|
|
2600
|
-
* @param {
|
|
2600
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2601
2601
|
* @param {object} cssProperties object with CSS properties and their values to check.
|
|
2602
2602
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2603
2603
|
*
|
|
@@ -2642,7 +2642,7 @@ class Puppeteer extends Helper {
|
|
|
2642
2642
|
* I.seeAttributesOnElements('//form', { method: "post"});
|
|
2643
2643
|
* ```
|
|
2644
2644
|
*
|
|
2645
|
-
* @param {
|
|
2645
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2646
2646
|
* @param {object} attributes attributes and their values to check.
|
|
2647
2647
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2648
2648
|
*
|
|
@@ -2687,7 +2687,7 @@ class Puppeteer extends Helper {
|
|
|
2687
2687
|
* I.dragSlider('#slider', -70);
|
|
2688
2688
|
* ```
|
|
2689
2689
|
*
|
|
2690
|
-
* @param {
|
|
2690
|
+
* @param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
|
|
2691
2691
|
* @param {number} offsetX position to drag.
|
|
2692
2692
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2693
2693
|
*
|
|
@@ -2718,7 +2718,7 @@ class Puppeteer extends Helper {
|
|
|
2718
2718
|
* ```js
|
|
2719
2719
|
* let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
2720
2720
|
* ```
|
|
2721
|
-
* @param {
|
|
2721
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2722
2722
|
* @param {string} attr attribute name.
|
|
2723
2723
|
* @returns {Promise<string[]>} attribute value
|
|
2724
2724
|
*
|
|
@@ -2742,7 +2742,7 @@ class Puppeteer extends Helper {
|
|
|
2742
2742
|
* ```js
|
|
2743
2743
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
2744
2744
|
* ```
|
|
2745
|
-
* @param {
|
|
2745
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2746
2746
|
* @param {string} attr attribute name.
|
|
2747
2747
|
* @returns {Promise<string>} attribute value
|
|
2748
2748
|
*
|
|
@@ -2766,7 +2766,7 @@ class Puppeteer extends Helper {
|
|
|
2766
2766
|
* I.saveElementScreenshot(`#submit`,'debug.png');
|
|
2767
2767
|
* ```
|
|
2768
2768
|
*
|
|
2769
|
-
* @param {
|
|
2769
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2770
2770
|
* @param {string} fileName file name to save.
|
|
2771
2771
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2772
2772
|
*
|
|
@@ -2874,7 +2874,7 @@ class Puppeteer extends Helper {
|
|
|
2874
2874
|
* Waits for element to become enabled (by default waits for 1sec).
|
|
2875
2875
|
* Element can be located by CSS or XPath.
|
|
2876
2876
|
*
|
|
2877
|
-
* @param {
|
|
2877
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2878
2878
|
* @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
2879
2879
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2880
2880
|
*
|
|
@@ -2913,7 +2913,7 @@ class Puppeteer extends Helper {
|
|
|
2913
2913
|
* I.waitForValue('//input', "GoodValue");
|
|
2914
2914
|
* ```
|
|
2915
2915
|
*
|
|
2916
|
-
* @param {
|
|
2916
|
+
* @param {LocatorOrString} field input field.
|
|
2917
2917
|
* @param {string }value expected value.
|
|
2918
2918
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2919
2919
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -2954,7 +2954,7 @@ class Puppeteer extends Helper {
|
|
|
2954
2954
|
* I.waitNumberOfVisibleElements('a', 3);
|
|
2955
2955
|
* ```
|
|
2956
2956
|
*
|
|
2957
|
-
* @param {
|
|
2957
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2958
2958
|
* @param {number} num number of elements.
|
|
2959
2959
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2960
2960
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -2997,7 +2997,7 @@ class Puppeteer extends Helper {
|
|
|
2997
2997
|
* I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
2998
2998
|
* ```
|
|
2999
2999
|
*
|
|
3000
|
-
* @param {
|
|
3000
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3001
3001
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
3002
3002
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3003
3003
|
*
|
|
@@ -3024,7 +3024,7 @@ class Puppeteer extends Helper {
|
|
|
3024
3024
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
3025
3025
|
* ```
|
|
3026
3026
|
*
|
|
3027
|
-
* @param {
|
|
3027
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3028
3028
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
3029
3029
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3030
3030
|
*
|
|
@@ -3054,7 +3054,7 @@ class Puppeteer extends Helper {
|
|
|
3054
3054
|
* I.waitForVisible('#popup');
|
|
3055
3055
|
* ```
|
|
3056
3056
|
*
|
|
3057
|
-
* @param {
|
|
3057
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3058
3058
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3059
3059
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3060
3060
|
*
|
|
@@ -3085,7 +3085,7 @@ class Puppeteer extends Helper {
|
|
|
3085
3085
|
* I.waitForInvisible('#popup');
|
|
3086
3086
|
* ```
|
|
3087
3087
|
*
|
|
3088
|
-
* @param {
|
|
3088
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3089
3089
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3090
3090
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3091
3091
|
*
|
|
@@ -3114,7 +3114,7 @@ class Puppeteer extends Helper {
|
|
|
3114
3114
|
* I.waitToHide('#popup');
|
|
3115
3115
|
* ```
|
|
3116
3116
|
*
|
|
3117
|
-
* @param {
|
|
3117
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3118
3118
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3119
3119
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3120
3120
|
*
|
|
@@ -3134,6 +3134,33 @@ class Puppeteer extends Helper {
|
|
|
3134
3134
|
});
|
|
3135
3135
|
}
|
|
3136
3136
|
|
|
3137
|
+
/**
|
|
3138
|
+
* Waits for number of tabs.
|
|
3139
|
+
*
|
|
3140
|
+
* ```js
|
|
3141
|
+
* I.waitForNumberOfTabs(2);
|
|
3142
|
+
* ```
|
|
3143
|
+
*
|
|
3144
|
+
* @param {number} expectedTabs expecting the number of tabs.
|
|
3145
|
+
* @param {number} sec number of secs to wait.
|
|
3146
|
+
* @returns {void} automatically synchronized promise through #recorder
|
|
3147
|
+
*
|
|
3148
|
+
*/
|
|
3149
|
+
async waitForNumberOfTabs(expectedTabs, sec) {
|
|
3150
|
+
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
3151
|
+
let currentTabs;
|
|
3152
|
+
let count = 0;
|
|
3153
|
+
|
|
3154
|
+
do {
|
|
3155
|
+
currentTabs = await this.grabNumberOfOpenTabs();
|
|
3156
|
+
await this.wait(1);
|
|
3157
|
+
count += 1000;
|
|
3158
|
+
if (currentTabs >= expectedTabs) return;
|
|
3159
|
+
} while (count <= waitTimeout);
|
|
3160
|
+
|
|
3161
|
+
throw new Error(`Expected ${expectedTabs} tabs are not met after ${waitTimeout / 1000} sec.`);
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3137
3164
|
async _getContext() {
|
|
3138
3165
|
if (this.context && this.context.constructor.name === 'Frame') {
|
|
3139
3166
|
return this.context;
|
|
@@ -3215,7 +3242,7 @@ class Puppeteer extends Helper {
|
|
|
3215
3242
|
*
|
|
3216
3243
|
* @param {string }text to wait for.
|
|
3217
3244
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3218
|
-
* @param {
|
|
3245
|
+
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
3219
3246
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3220
3247
|
*
|
|
3221
3248
|
*/
|
|
@@ -3292,7 +3319,7 @@ class Puppeteer extends Helper {
|
|
|
3292
3319
|
* I.switchTo(); // switch back to main page
|
|
3293
3320
|
* ```
|
|
3294
3321
|
*
|
|
3295
|
-
* @param {?
|
|
3322
|
+
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
3296
3323
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3297
3324
|
*
|
|
3298
3325
|
*/
|
|
@@ -3396,7 +3423,7 @@ class Puppeteer extends Helper {
|
|
|
3396
3423
|
* I.waitForDetached('#popup');
|
|
3397
3424
|
* ```
|
|
3398
3425
|
*
|
|
3399
|
-
* @param {
|
|
3426
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3400
3427
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3401
3428
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3402
3429
|
*
|
|
@@ -3473,7 +3500,7 @@ class Puppeteer extends Helper {
|
|
|
3473
3500
|
* const width = await I.grabElementBoundingRect('h3', 'width');
|
|
3474
3501
|
* // width == 527
|
|
3475
3502
|
* ```
|
|
3476
|
-
* @param {
|
|
3503
|
+
* @param {LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3477
3504
|
* @param {string=} elementSize x, y, width or height of the given element.
|
|
3478
3505
|
* @returns {Promise<DOMRect>|Promise<number>} Element bounding rectangle
|
|
3479
3506
|
*
|