codeceptjs 3.1.1 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +120 -0
- package/README.md +2 -3
- package/bin/codecept.js +1 -0
- package/docs/advanced.md +94 -60
- package/docs/basics.md +1 -1
- package/docs/bdd.md +55 -1
- package/docs/build/Appium.js +22 -4
- package/docs/build/FileSystem.js +1 -0
- package/docs/build/Playwright.js +40 -42
- package/docs/build/Protractor.js +9 -24
- package/docs/build/Puppeteer.js +28 -30
- package/docs/build/REST.js +1 -0
- package/docs/build/WebDriver.js +2 -24
- package/docs/changelog.md +120 -0
- package/docs/commands.md +21 -7
- package/docs/configuration.md +15 -2
- package/docs/custom-helpers.md +1 -36
- package/docs/helpers/Appium.md +49 -50
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Playwright.md +16 -18
- package/docs/helpers/Puppeteer.md +18 -18
- package/docs/helpers/REST.md +3 -1
- package/docs/helpers/WebDriver.md +1 -17
- package/docs/mobile-react-native-locators.md +3 -0
- package/docs/playwright.md +40 -0
- package/docs/plugins.md +187 -70
- package/docs/reports.md +23 -5
- package/lib/actor.js +20 -2
- package/lib/codecept.js +15 -2
- package/lib/command/info.js +1 -1
- package/lib/config.js +13 -1
- package/lib/container.js +3 -1
- package/lib/data/dataTableArgument.js +35 -0
- package/lib/helper/Appium.js +22 -4
- package/lib/helper/FileSystem.js +1 -0
- package/lib/helper/Playwright.js +40 -32
- package/lib/helper/Protractor.js +2 -14
- package/lib/helper/Puppeteer.js +21 -20
- package/lib/helper/REST.js +1 -0
- package/lib/helper/WebDriver.js +2 -14
- package/lib/index.js +2 -0
- package/lib/interfaces/featureConfig.js +3 -0
- package/lib/interfaces/gherkin.js +7 -1
- package/lib/interfaces/scenarioConfig.js +4 -0
- package/lib/listener/helpers.js +1 -0
- package/lib/listener/steps.js +21 -3
- package/lib/listener/timeout.js +71 -0
- package/lib/locator.js +3 -0
- package/lib/mochaFactory.js +13 -9
- package/lib/plugin/allure.js +6 -1
- package/lib/plugin/{puppeteerCoverage.js → coverage.js} +10 -22
- package/lib/plugin/customLocator.js +2 -2
- package/lib/plugin/retryFailedStep.js +4 -3
- package/lib/plugin/retryTo.js +130 -0
- package/lib/plugin/screenshotOnFail.js +1 -0
- package/lib/plugin/stepByStepReport.js +7 -0
- package/lib/plugin/stepTimeout.js +90 -0
- package/lib/plugin/subtitles.js +88 -0
- package/lib/plugin/tryTo.js +1 -1
- package/lib/recorder.js +21 -8
- package/lib/step.js +7 -2
- package/lib/store.js +2 -0
- package/lib/ui.js +2 -2
- package/package.json +6 -7
- package/typings/index.d.ts +8 -1
- package/typings/types.d.ts +104 -71
- package/docs/angular.md +0 -325
- package/docs/helpers/Protractor.md +0 -1658
- package/docs/webapi/waitUntil.mustache +0 -11
- package/typings/Protractor.d.ts +0 -16
package/docs/helpers/Appium.md
CHANGED
|
@@ -245,10 +245,12 @@ Remove an app from the device.
|
|
|
245
245
|
I.removeApp('appName', 'com.example.android.apis');
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
+
Appium: support only Android
|
|
249
|
+
|
|
248
250
|
#### Parameters
|
|
249
251
|
|
|
250
252
|
- `appId` **[string][4]**
|
|
251
|
-
- `bundleId` **[string][4]
|
|
253
|
+
- `bundleId` **[string][4]?** ID of bundle
|
|
252
254
|
|
|
253
255
|
### seeCurrentActivityIs
|
|
254
256
|
|
|
@@ -473,10 +475,12 @@ I.hideDeviceKeyboard('tapOutside');
|
|
|
473
475
|
I.hideDeviceKeyboard('pressKey', 'Done');
|
|
474
476
|
```
|
|
475
477
|
|
|
478
|
+
Appium: support Android and iOS
|
|
479
|
+
|
|
476
480
|
#### Parameters
|
|
477
481
|
|
|
478
|
-
- `strategy` **(`"tapOutside"` \| `"pressKey"`)
|
|
479
|
-
- `key`
|
|
482
|
+
- `strategy` **(`"tapOutside"` \| `"pressKey"`)?** Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
|
|
483
|
+
- `key` **[string][4]?** Optional key
|
|
480
484
|
|
|
481
485
|
### sendDeviceKeyEvent
|
|
482
486
|
|
|
@@ -685,7 +689,7 @@ Appium: support Android and iOS
|
|
|
685
689
|
|
|
686
690
|
#### Parameters
|
|
687
691
|
|
|
688
|
-
- `actions`
|
|
692
|
+
- `actions` **[Array][11]** Array of touch actions
|
|
689
693
|
|
|
690
694
|
### pullFile
|
|
691
695
|
|
|
@@ -722,7 +726,7 @@ Perform a rotation gesture centered on the specified element.
|
|
|
722
726
|
I.rotate(120, 120)
|
|
723
727
|
```
|
|
724
728
|
|
|
725
|
-
See corresponding [webdriverio reference][
|
|
729
|
+
See corresponding [webdriverio reference][12].
|
|
726
730
|
|
|
727
731
|
Appium: support only iOS
|
|
728
732
|
|
|
@@ -739,7 +743,7 @@ Appium: support only iOS
|
|
|
739
743
|
|
|
740
744
|
Set immediate value in app.
|
|
741
745
|
|
|
742
|
-
See corresponding [webdriverio reference][
|
|
746
|
+
See corresponding [webdriverio reference][13].
|
|
743
747
|
|
|
744
748
|
Appium: support only iOS
|
|
745
749
|
|
|
@@ -926,7 +930,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
926
930
|
|
|
927
931
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
928
932
|
|
|
929
|
-
Returns **[Promise][
|
|
933
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** attribute value
|
|
930
934
|
|
|
931
935
|
### grabTextFrom
|
|
932
936
|
|
|
@@ -943,7 +947,7 @@ If multiple elements found returns first element.
|
|
|
943
947
|
|
|
944
948
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
945
949
|
|
|
946
|
-
Returns **[Promise][
|
|
950
|
+
Returns **[Promise][14]<[string][4]>** attribute value
|
|
947
951
|
|
|
948
952
|
### grabNumberOfVisibleElements
|
|
949
953
|
|
|
@@ -958,7 +962,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
958
962
|
|
|
959
963
|
- `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
960
964
|
|
|
961
|
-
Returns **[Promise][
|
|
965
|
+
Returns **[Promise][14]<[number][8]>** number of visible elements
|
|
962
966
|
|
|
963
967
|
### grabAttributeFrom
|
|
964
968
|
|
|
@@ -977,7 +981,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
977
981
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
978
982
|
- `attr` **[string][4]** attribute name.
|
|
979
983
|
|
|
980
|
-
Returns **[Promise][
|
|
984
|
+
Returns **[Promise][14]<[string][4]>** attribute value
|
|
981
985
|
|
|
982
986
|
### grabAttributeFromAll
|
|
983
987
|
|
|
@@ -994,7 +998,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
994
998
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
995
999
|
- `attr` **[string][4]** attribute name.
|
|
996
1000
|
|
|
997
|
-
Returns **[Promise][
|
|
1001
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** attribute value
|
|
998
1002
|
|
|
999
1003
|
### grabValueFromAll
|
|
1000
1004
|
|
|
@@ -1009,7 +1013,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1009
1013
|
|
|
1010
1014
|
- `locator` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1011
1015
|
|
|
1012
|
-
Returns **[Promise][
|
|
1016
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** attribute value
|
|
1013
1017
|
|
|
1014
1018
|
### grabValueFrom
|
|
1015
1019
|
|
|
@@ -1025,7 +1029,20 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1025
1029
|
|
|
1026
1030
|
- `locator` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1027
1031
|
|
|
1028
|
-
Returns **[Promise][
|
|
1032
|
+
Returns **[Promise][14]<[string][4]>** attribute value
|
|
1033
|
+
|
|
1034
|
+
### saveScreenshot
|
|
1035
|
+
|
|
1036
|
+
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
1037
|
+
Filename is relative to output folder.
|
|
1038
|
+
|
|
1039
|
+
```js
|
|
1040
|
+
I.saveScreenshot('debug.png');
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
#### Parameters
|
|
1044
|
+
|
|
1045
|
+
- `fileName` **[string][4]** file name to save.
|
|
1029
1046
|
|
|
1030
1047
|
### scrollIntoView
|
|
1031
1048
|
|
|
@@ -1126,7 +1143,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1126
1143
|
#### Parameters
|
|
1127
1144
|
|
|
1128
1145
|
- `select` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1129
|
-
- `option` **([string][4] \| [Array][
|
|
1146
|
+
- `option` **([string][4] \| [Array][11]<any>)** visible text or value of option.Supported only for web testing
|
|
1130
1147
|
|
|
1131
1148
|
### waitForElement
|
|
1132
1149
|
|
|
@@ -1298,7 +1315,7 @@ I.defineTimeout({ implicit: 10000, pageLoad: 10000, script: 5000 });
|
|
|
1298
1315
|
|
|
1299
1316
|
#### Parameters
|
|
1300
1317
|
|
|
1301
|
-
- `timeouts` **
|
|
1318
|
+
- `timeouts` **any** WebDriver timeouts object.
|
|
1302
1319
|
|
|
1303
1320
|
### amOnPage
|
|
1304
1321
|
|
|
@@ -1469,7 +1486,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1469
1486
|
- `locator`
|
|
1470
1487
|
- `element` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
1471
1488
|
|
|
1472
|
-
Returns **[Promise][
|
|
1489
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** HTML code for an element
|
|
1473
1490
|
|
|
1474
1491
|
### grabHTMLFrom
|
|
1475
1492
|
|
|
@@ -1486,7 +1503,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1486
1503
|
- `locator`
|
|
1487
1504
|
- `element` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
1488
1505
|
|
|
1489
|
-
Returns **[Promise][
|
|
1506
|
+
Returns **[Promise][14]<[string][4]>** HTML code for an element
|
|
1490
1507
|
|
|
1491
1508
|
### seeTextEquals
|
|
1492
1509
|
|
|
@@ -1547,7 +1564,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1547
1564
|
let pageSource = await I.grabSource();
|
|
1548
1565
|
```
|
|
1549
1566
|
|
|
1550
|
-
Returns **[Promise][
|
|
1567
|
+
Returns **[Promise][14]<[string][4]>** source code
|
|
1551
1568
|
|
|
1552
1569
|
### grabBrowserLogs
|
|
1553
1570
|
|
|
@@ -1559,7 +1576,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
1559
1576
|
console.log(JSON.stringify(logs))
|
|
1560
1577
|
```
|
|
1561
1578
|
|
|
1562
|
-
Returns **([Promise][
|
|
1579
|
+
Returns **([Promise][14]<[Array][11]<[object][6]>> | [undefined][19])** all browser logs
|
|
1563
1580
|
|
|
1564
1581
|
### dontSeeInSource
|
|
1565
1582
|
|
|
@@ -1663,27 +1680,11 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1663
1680
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
1664
1681
|
- `fileName` **[string][4]** file name to save.
|
|
1665
1682
|
|
|
1666
|
-
### saveScreenshot
|
|
1667
|
-
|
|
1668
|
-
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
1669
|
-
Filename is relative to output folder.
|
|
1670
|
-
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.
|
|
1671
|
-
|
|
1672
|
-
```js
|
|
1673
|
-
I.saveScreenshot('debug.png');
|
|
1674
|
-
I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot
|
|
1675
|
-
```
|
|
1676
|
-
|
|
1677
|
-
#### Parameters
|
|
1678
|
-
|
|
1679
|
-
- `fileName` **[string][4]** file name to save.
|
|
1680
|
-
- `fullPage` **[boolean][20]** (optional, `false` by default) flag to enable fullscreen screenshot mode. (optional, default `false`)
|
|
1681
|
-
|
|
1682
1683
|
### type
|
|
1683
1684
|
|
|
1684
1685
|
Types out the given text into an active field.
|
|
1685
1686
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1686
|
-
_Note:_ Should be used when [`fillField`][
|
|
1687
|
+
_Note:_ Should be used when [`fillField`][20] is not an option.
|
|
1687
1688
|
|
|
1688
1689
|
```js
|
|
1689
1690
|
// passing in a string
|
|
@@ -1700,7 +1701,7 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1700
1701
|
|
|
1701
1702
|
- `keys`
|
|
1702
1703
|
- `delay` **[number][8]?** (optional) delay in ms between key presses (optional, default `null`)
|
|
1703
|
-
- `key` **([string][4] \| [Array][
|
|
1704
|
+
- `key` **([string][4] \| [Array][11]<[string][4]>)** or array of keys to type.
|
|
1704
1705
|
|
|
1705
1706
|
### dragAndDrop
|
|
1706
1707
|
|
|
@@ -1739,7 +1740,7 @@ Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
|
|
|
1739
1740
|
const windows = await I.grabAllWindowHandles();
|
|
1740
1741
|
```
|
|
1741
1742
|
|
|
1742
|
-
Returns **[Promise][
|
|
1743
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>**
|
|
1743
1744
|
|
|
1744
1745
|
### grabCurrentWindowHandle
|
|
1745
1746
|
|
|
@@ -1750,7 +1751,7 @@ Useful for referencing it when calling `I.switchToWindow(handle)`
|
|
|
1750
1751
|
const window = await I.grabCurrentWindowHandle();
|
|
1751
1752
|
```
|
|
1752
1753
|
|
|
1753
|
-
Returns **[Promise][
|
|
1754
|
+
Returns **[Promise][14]<[string][4]>**
|
|
1754
1755
|
|
|
1755
1756
|
### switchToWindow
|
|
1756
1757
|
|
|
@@ -1800,7 +1801,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1800
1801
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1801
1802
|
```
|
|
1802
1803
|
|
|
1803
|
-
Returns **[Promise][
|
|
1804
|
+
Returns **[Promise][14]<[number][8]>** number of open tabs
|
|
1804
1805
|
|
|
1805
1806
|
### scrollPageToTop
|
|
1806
1807
|
|
|
@@ -1827,7 +1828,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1827
1828
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1828
1829
|
```
|
|
1829
1830
|
|
|
1830
|
-
Returns **[Promise][
|
|
1831
|
+
Returns **[Promise][14]<PageScrollPosition>** scroll position
|
|
1831
1832
|
|
|
1832
1833
|
### setGeoLocation
|
|
1833
1834
|
|
|
@@ -1853,7 +1854,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1853
1854
|
let geoLocation = await I.grabGeoLocation();
|
|
1854
1855
|
```
|
|
1855
1856
|
|
|
1856
|
-
Returns **[Promise][
|
|
1857
|
+
Returns **[Promise][14]<{latitude: [number][8], longitude: [number][8], altitude: [number][8]}>**
|
|
1857
1858
|
|
|
1858
1859
|
### grabElementBoundingRect
|
|
1859
1860
|
|
|
@@ -1881,7 +1882,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1881
1882
|
- `prop`
|
|
1882
1883
|
- `elementSize` **[string][4]?** x, y, width or height of the given element.
|
|
1883
1884
|
|
|
1884
|
-
Returns **([Promise][
|
|
1885
|
+
Returns **([Promise][14]<DOMRect> | [Promise][14]<[number][8]>)** Element bounding rectangle
|
|
1885
1886
|
|
|
1886
1887
|
[1]: http://codecept.io/helpers/WebDriver/
|
|
1887
1888
|
|
|
@@ -1903,13 +1904,13 @@ Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][8]>)** Element
|
|
|
1903
1904
|
|
|
1904
1905
|
[10]: http://webdriver.io/api/mobile/swipe.html
|
|
1905
1906
|
|
|
1906
|
-
[11]:
|
|
1907
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1907
1908
|
|
|
1908
|
-
[12]: http://webdriver.io/api/mobile/
|
|
1909
|
+
[12]: http://webdriver.io/api/mobile/rotate.html
|
|
1909
1910
|
|
|
1910
|
-
[13]:
|
|
1911
|
+
[13]: http://webdriver.io/api/mobile/setImmediateValue.html
|
|
1911
1912
|
|
|
1912
|
-
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
1913
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1913
1914
|
|
|
1914
1915
|
[15]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
1915
1916
|
|
|
@@ -1921,6 +1922,4 @@ Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][8]>)** Element
|
|
|
1921
1922
|
|
|
1922
1923
|
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
|
|
1923
1924
|
|
|
1924
|
-
[20]:
|
|
1925
|
-
|
|
1926
|
-
[21]: #fillfield
|
|
1925
|
+
[20]: #fillfield
|
|
@@ -47,6 +47,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
47
47
|
- `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
48
48
|
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
49
49
|
- `userAgent`: (optional) user-agent string.
|
|
50
|
+
- `locale`: (optional) locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
50
51
|
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
51
52
|
- `chromium`: (optional) pass additional chromium options
|
|
52
53
|
- `electron`: (optional) pass additional electron options
|
|
@@ -162,6 +163,19 @@ const { devices } = require('playwright');
|
|
|
162
163
|
}
|
|
163
164
|
```
|
|
164
165
|
|
|
166
|
+
#### Example #7: Launch test with a specifc user locale
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
{
|
|
170
|
+
helpers: {
|
|
171
|
+
Playwright : {
|
|
172
|
+
url: "http://localhost",
|
|
173
|
+
locale: "fr-FR",
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
165
179
|
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
166
180
|
|
|
167
181
|
## Access From Helpers
|
|
@@ -1821,11 +1835,11 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1821
1835
|
|
|
1822
1836
|
### waitForResponse
|
|
1823
1837
|
|
|
1824
|
-
Waits for a network
|
|
1838
|
+
Waits for a network response.
|
|
1825
1839
|
|
|
1826
1840
|
```js
|
|
1827
1841
|
I.waitForResponse('http://example.com/resource');
|
|
1828
|
-
I.waitForResponse(
|
|
1842
|
+
I.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200);
|
|
1829
1843
|
```
|
|
1830
1844
|
|
|
1831
1845
|
#### Parameters
|
|
@@ -1919,22 +1933,6 @@ I.waitToHide('#popup');
|
|
|
1919
1933
|
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1920
1934
|
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1921
1935
|
|
|
1922
|
-
### waitUntil
|
|
1923
|
-
|
|
1924
|
-
Waits for a function to return true (waits for 1sec by default).
|
|
1925
|
-
|
|
1926
|
-
```js
|
|
1927
|
-
I.waitUntil(() => window.requests == 0);
|
|
1928
|
-
I.waitUntil(() => window.requests == 0, 5);
|
|
1929
|
-
```
|
|
1930
|
-
|
|
1931
|
-
#### Parameters
|
|
1932
|
-
|
|
1933
|
-
- `fn` **([function][11] | [string][9])** function which is executed in browser context.
|
|
1934
|
-
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1935
|
-
- `timeoutMsg` **[string][9]** message to show in case of timeout fail.
|
|
1936
|
-
- `interval` **[number][10]?**
|
|
1937
|
-
|
|
1938
1936
|
### waitUrlEquals
|
|
1939
1937
|
|
|
1940
1938
|
Waits for the entire URL to match the expected
|
|
@@ -101,6 +101,8 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
101
101
|
}
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
> Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
105
|
+
|
|
104
106
|
#### Example #5: Target URL with provided basic authentication
|
|
105
107
|
|
|
106
108
|
```js
|
|
@@ -115,7 +117,21 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
115
117
|
}
|
|
116
118
|
```
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
#### Troubleshooting
|
|
121
|
+
|
|
122
|
+
Error Message: `No usable sandbox!`
|
|
123
|
+
|
|
124
|
+
When running Puppeteer on CI try to disable sandbox if you see that message
|
|
125
|
+
|
|
126
|
+
helpers: {
|
|
127
|
+
Puppeteer: {
|
|
128
|
+
url: 'http://localhost',
|
|
129
|
+
show: false,
|
|
130
|
+
chrome: {
|
|
131
|
+
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
}
|
|
119
135
|
|
|
120
136
|
## Access From Helpers
|
|
121
137
|
|
|
@@ -1598,7 +1614,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1598
1614
|
|
|
1599
1615
|
#### Parameters
|
|
1600
1616
|
|
|
1601
|
-
- `text`
|
|
1617
|
+
- `text` **[string][8]** value to check.
|
|
1602
1618
|
|
|
1603
1619
|
### selectOption
|
|
1604
1620
|
|
|
@@ -1982,22 +1998,6 @@ I.waitToHide('#popup');
|
|
|
1982
1998
|
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1983
1999
|
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1984
2000
|
|
|
1985
|
-
### waitUntil
|
|
1986
|
-
|
|
1987
|
-
Waits for a function to return true (waits for 1sec by default).
|
|
1988
|
-
|
|
1989
|
-
```js
|
|
1990
|
-
I.waitUntil(() => window.requests == 0);
|
|
1991
|
-
I.waitUntil(() => window.requests == 0, 5);
|
|
1992
|
-
```
|
|
1993
|
-
|
|
1994
|
-
#### Parameters
|
|
1995
|
-
|
|
1996
|
-
- `fn` **([function][12] | [string][8])** function which is executed in browser context.
|
|
1997
|
-
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1998
|
-
- `timeoutMsg` **[string][8]** message to show in case of timeout fail.
|
|
1999
|
-
- `interval` **[number][10]?**
|
|
2000
|
-
|
|
2001
2001
|
### waitUrlEquals
|
|
2002
2002
|
|
|
2003
2003
|
Waits for the entire URL to match the expected
|
package/docs/helpers/REST.md
CHANGED
|
@@ -168,7 +168,7 @@ I.setRequestTimeout(10000); // In milliseconds
|
|
|
168
168
|
|
|
169
169
|
#### Parameters
|
|
170
170
|
|
|
171
|
-
- `newTimeout`
|
|
171
|
+
- `newTimeout` **[number][5]** timeout in milliseconds
|
|
172
172
|
|
|
173
173
|
[1]: https://github.com/axios/axios
|
|
174
174
|
|
|
@@ -177,3 +177,5 @@ I.setRequestTimeout(10000); // In milliseconds
|
|
|
177
177
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
178
178
|
|
|
179
179
|
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
180
|
+
|
|
181
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
@@ -599,7 +599,7 @@ I.defineTimeout({ implicit: 10000, pageLoad: 10000, script: 5000 });
|
|
|
599
599
|
|
|
600
600
|
#### Parameters
|
|
601
601
|
|
|
602
|
-
- `timeouts` **
|
|
602
|
+
- `timeouts` **any** WebDriver timeouts object.
|
|
603
603
|
|
|
604
604
|
### dontSee
|
|
605
605
|
|
|
@@ -2155,22 +2155,6 @@ I.waitToHide('#popup');
|
|
|
2155
2155
|
- `locator` **([string][19] | [object][18])** element located by CSS|XPath|strict locator.
|
|
2156
2156
|
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2157
2157
|
|
|
2158
|
-
### waitUntil
|
|
2159
|
-
|
|
2160
|
-
Waits for a function to return true (waits for 1sec by default).
|
|
2161
|
-
|
|
2162
|
-
```js
|
|
2163
|
-
I.waitUntil(() => window.requests == 0);
|
|
2164
|
-
I.waitUntil(() => window.requests == 0, 5);
|
|
2165
|
-
```
|
|
2166
|
-
|
|
2167
|
-
#### Parameters
|
|
2168
|
-
|
|
2169
|
-
- `fn` **([function][24] | [string][19])** function which is executed in browser context.
|
|
2170
|
-
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2171
|
-
- `timeoutMsg` **[string][19]** message to show in case of timeout fail.
|
|
2172
|
-
- `interval` **[number][22]?**
|
|
2173
|
-
|
|
2174
2158
|
### waitUrlEquals
|
|
2175
2159
|
|
|
2176
2160
|
Waits for the entire URL to match the expected
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
## Automating React Native apps
|
|
2
2
|
|
|
3
3
|
### Problem
|
|
4
|
+
|
|
5
|
+
> ⚠️ **NOTE**: This problem is not actual starting from `react-native@0.65.x` [CHANGELOG](https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#android-specific-9), [#381fb3](https://github.com/facebook/react-native/commit/381fb395ad9d2d48717a5d082aaedbecdd804554)
|
|
6
|
+
|
|
4
7
|
Let's say we have a React Native app with component defined like this
|
|
5
8
|
```html
|
|
6
9
|
<Button testID='someButton'>My button</Button>
|
package/docs/playwright.md
CHANGED
|
@@ -406,6 +406,11 @@ When a test fails and video was enabled a video file is shown under the `artifac
|
|
|
406
406
|
|
|
407
407
|
Open video and use it to debug a failed test case. Video helps when running tests on CI. Configure your CI system to enable artifacts storage for `output/video` and review videos of failed test case to understand failures.
|
|
408
408
|
|
|
409
|
+
It is recommended to enable [subtitles](https://codecept.io/plugins/#subtitles) plugin which will generate subtitles from steps in `.srt` format. Subtitles file will be saved into after a video file so video player (like VLC) would load them automatically:
|
|
410
|
+
|
|
411
|
+

|
|
412
|
+
|
|
413
|
+
|
|
409
414
|
## Trace <Badge text="Since 3.1" type="warning"/>
|
|
410
415
|
|
|
411
416
|
If video is not enough to descover why a test failed a [trace](https://playwright.dev/docs/trace-viewer/) can be recorded.
|
|
@@ -456,6 +461,41 @@ For instance, this is how you can read a trace for a failed test from an example
|
|
|
456
461
|
npx playwright show-trace /home/davert/projects/codeceptjs/examples/output/trace/open.zip
|
|
457
462
|
```
|
|
458
463
|
|
|
464
|
+
## Capturing Code Coverage
|
|
465
|
+
|
|
466
|
+
Code coverage can be captured, by enabling the `coverage` plugin in `codecept.config.js`.
|
|
467
|
+
|
|
468
|
+
```js
|
|
469
|
+
{
|
|
470
|
+
plugins: {
|
|
471
|
+
coverage: {
|
|
472
|
+
enabled: true
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Once all the tests are completed, `codecept` will create and store coverage in `output/coverage` folder, as shown below.
|
|
479
|
+
|
|
480
|
+

|
|
481
|
+
|
|
482
|
+
Then you need to [convert code coverage from Playwright's format into Istanbul format](https://github.com/codeceptjs/CodeceptJS/wiki/Converting-Playwright-to-Istanbul-Coverage).
|
|
483
|
+
|
|
484
|
+
Once the istanbul compatible coverage is generated, use [`nyc`](https://www.npmjs.com/package/nyc) to generate your coverage report in your desired format.
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
npx nyc report --reporter html -t coverage
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
The above command will generate will generate coverage in an interactive html format. It should generate `html` files in the directory where your code coverage is present, something like shown below.
|
|
491
|
+
|
|
492
|
+

|
|
493
|
+
|
|
494
|
+
Open `index.html` in your browser to view the full interactive coverage report.
|
|
495
|
+
|
|
496
|
+

|
|
497
|
+
|
|
498
|
+

|
|
459
499
|
## Extending Helper
|
|
460
500
|
|
|
461
501
|
To create custom `I.*` commands using Playwright API you need to create a custom helper.
|