codeceptjs 2.6.7 → 2.6.11

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +33 -6
  2. package/README.md +11 -11
  3. package/docs/advanced.md +21 -0
  4. package/docs/basics.md +6 -5
  5. package/docs/bdd.md +1 -2
  6. package/docs/books.md +1 -1
  7. package/docs/build/Appium.js +1 -2
  8. package/docs/build/FileSystem.js +3 -3
  9. package/docs/build/Mochawesome.js +1 -1
  10. package/docs/build/Nightmare.js +81 -5
  11. package/docs/build/Playwright.js +100 -17
  12. package/docs/build/Protractor.js +34 -2
  13. package/docs/build/Puppeteer.js +59 -2
  14. package/docs/build/TestCafe.js +23 -0
  15. package/docs/build/WebDriver.js +62 -16
  16. package/docs/changelog.md +152 -125
  17. package/docs/community-helpers.md +7 -3
  18. package/docs/configuration.md +1 -1
  19. package/docs/custom-helpers.md +2 -2
  20. package/docs/data.md +1 -1
  21. package/docs/detox.md +2 -2
  22. package/docs/email.md +1 -1
  23. package/docs/examples.md +12 -2
  24. package/docs/helpers/Appium.md +24 -5
  25. package/docs/helpers/Nightmare.md +42 -0
  26. package/docs/helpers/Playwright.md +41 -4
  27. package/docs/helpers/Protractor.md +14 -0
  28. package/docs/helpers/Puppeteer.md +38 -1
  29. package/docs/helpers/TestCafe.md +14 -0
  30. package/docs/helpers/WebDriver.md +24 -5
  31. package/docs/hooks.md +14 -14
  32. package/docs/locators.md +1 -1
  33. package/docs/playwright.md +13 -0
  34. package/docs/translation.md +21 -1
  35. package/docs/ui.md +2 -2
  36. package/docs/videos.md +4 -4
  37. package/docs/webapi/saveElementScreenshot.mustache +9 -0
  38. package/docs/webapi/type.mustache +11 -6
  39. package/docs/wiki/{Community-Helpers.md → Community-Helpers-&-Plugins.md} +6 -2
  40. package/docs/wiki/Examples.md +11 -1
  41. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +68 -0
  42. package/docs/wiki/Home.md +9 -4
  43. package/docs/wiki/Release-Process.md +24 -0
  44. package/docs/wiki/Tests.md +1391 -0
  45. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +153 -0
  46. package/docs/wiki/Videos.md +3 -3
  47. package/lib/actor.js +1 -1
  48. package/lib/assert/empty.js +1 -1
  49. package/lib/assert/equal.js +1 -1
  50. package/lib/assert/include.js +1 -1
  51. package/lib/assert/truth.js +1 -1
  52. package/lib/codecept.js +2 -3
  53. package/lib/command/configMigrate.js +3 -5
  54. package/lib/command/definitions.js +1 -2
  55. package/lib/command/dryRun.js +1 -2
  56. package/lib/command/gherkin/init.js +1 -1
  57. package/lib/command/gherkin/snippets.js +3 -3
  58. package/lib/command/gherkin/steps.js +2 -3
  59. package/lib/command/info.js +1 -2
  60. package/lib/command/init.js +2 -2
  61. package/lib/command/interactive.js +1 -2
  62. package/lib/command/list.js +3 -4
  63. package/lib/command/run-multiple.js +2 -3
  64. package/lib/command/run-rerun.js +2 -4
  65. package/lib/command/run.js +1 -2
  66. package/lib/container.js +2 -2
  67. package/lib/data/context.js +1 -1
  68. package/lib/event.js +1 -1
  69. package/lib/helper/Appium.js +1 -2
  70. package/lib/helper/FileSystem.js +3 -3
  71. package/lib/helper/Mochawesome.js +1 -1
  72. package/lib/helper/Nightmare.js +54 -5
  73. package/lib/helper/Playwright.js +75 -17
  74. package/lib/helper/Protractor.js +26 -2
  75. package/lib/helper/Puppeteer.js +34 -2
  76. package/lib/helper/TestCafe.js +15 -0
  77. package/lib/helper/WebDriver.js +43 -11
  78. package/lib/helper/clientscripts/PollyWebDriverExt.js +1 -1
  79. package/lib/hooks.js +1 -2
  80. package/lib/interfaces/gherkin.js +0 -1
  81. package/lib/listener/helpers.js +1 -2
  82. package/lib/listener/mocha.js +0 -1
  83. package/lib/locator.js +2 -2
  84. package/lib/pause.js +1 -1
  85. package/lib/plugin/allure.js +1 -1
  86. package/lib/plugin/autoDelay.js +3 -3
  87. package/lib/plugin/autoLogin.js +1 -1
  88. package/lib/plugin/screenshotOnFail.js +2 -1
  89. package/lib/plugin/standardActingHelpers.js +0 -3
  90. package/lib/recorder.js +1 -1
  91. package/lib/step.js +3 -0
  92. package/lib/ui.js +1 -0
  93. package/package.json +3 -2
  94. package/translations/fr-FR.js +63 -0
  95. package/translations/index.js +5 -4
  96. package/typings/types.d.ts +140 -8
  97. package/docs/wiki/Release-process.md +0 -25
@@ -5,7 +5,7 @@ editLink: false
5
5
  ---
6
6
 
7
7
  # Community Helpers
8
- > Share your helpers at our [Wiki Page](https://github.com/Codeception/CodeceptJS/wiki/Community-Helpers)
8
+ > Share your helpers at our [Wiki Page](https://github.com/codeceptjs/CodeceptJS/wiki/Community-Helpers)
9
9
 
10
10
  Here is the list of helpers created by our community.
11
11
  Please **add your own** by editing this page.
@@ -13,12 +13,13 @@ Please **add your own** by editing this page.
13
13
  ## Email Checking
14
14
 
15
15
  * [MailCatcher](https://gist.github.com/schmkr/026732dfa1627b927ff3a08dc31ee884) - to check emails via Mailcatcher locally.
16
+ * [codeceptjs-mailhog-helper](https://github.com/tsuemura/codeceptjs-mailhog-helper) - to check emails via Mailhog locally.
16
17
 
17
18
  ## Data Sources
18
19
 
19
20
  * [codeceptjs-httpmock](https://github.com/testphony/codeceptjs-httpMock) - a helper which wraps mockttp library to manage http mock in tests.
20
21
  * [codeceptjs-http](https://github.com/testphony/codeceptjs-http) - a helper which wraps then-request library to process HTTP requests. It's alternative helper that provides more flexible request management.
21
- * [codeceptjs-dbhelper](https://www.npmjs.com/package/codeceptjs-dbhelper) - allows you to execute queries or commands to databases using database-js.
22
+ * [codeceptjs-dbhelper](https://github.com/thiagodp/codeceptjs-dbhelper) - allows you to execute queries or commands to databases using database-js.
22
23
 
23
24
  ## Cloud Providers
24
25
  * [codeceptjs-saucehelper](https://github.com/puneet0191/codeceptjs-saucehelper/) - a helper which updates `Test Names` & `Test Results` on Saucelabs
@@ -33,7 +34,9 @@ Please **add your own** by editing this page.
33
34
  * [codeceptjs-applitoolshelper](https://www.npmjs.com/package/codeceptjs-applitoolshelper) - a helper which helps interaction with [Applitools](https://applitools.com)
34
35
 
35
36
  ## Reporters
36
- * [codeceptjs-rphelper](https://www.npmjs.com/package/codeceptjs-rphelper) is a CodeceptJS helper which can publish tests results on ReportPortal after execution.
37
+ * [codeceptjs-rphelper](https://github.com/reportportal/agent-js-codecept) is a CodeceptJS helper which can publish tests results on ReportPortal after execution.
38
+ * [codeceptjs-xray-helper](https://www.npmjs.com/package/codeceptjs-xray-helper) is a CodeceptJS helper which can publish tests results on [XRAY](https://confluence.xpand-it.com/display/XRAYCLOUD/Import+Execution+Results+-+REST).
39
+ * [codeceptjs-slack-reporter](https://www.npmjs.com/package/codeceptjs-slack-reporter) Get a Slack notification when one or more scenarios fail.
37
40
 
38
41
  ## Page Object Code Generator
39
42
  * [codeceptjs-CodeGenerator](https://github.com/senthillkumar/CodeCeptJS-PageObject) is a CodeceptJS custom wrapper which can create page class with action methods from the page object file(JSON) and project setup(Folder Structure).
@@ -47,4 +50,5 @@ Please **add your own** by editing this page.
47
50
 
48
51
  ## Other
49
52
 
53
+ * [codeceptjs-cmdhelper](https://github.com/thiagodp/codeceptjs-cmdhelper) allows you to run commands in the terminal/console
50
54
  * [eslint-plugin-codeceptjs](https://www.npmjs.com/package/eslint-plugin-codeceptjs) Eslint rules for CodeceptJS.
@@ -101,7 +101,7 @@ codeceptjs run --config=./path/to/my/config.js
101
101
 
102
102
  > 📺 [Watch this material](https://www.youtube.com/watch?v=onBnfo_rJa4&t=4s) on YouTube
103
103
 
104
- [`@codeceptjs/configure` package](https://github.com/codecept-js/configure) contains shared recipes for common configuration patterns. This allows to set meta-configuration, independent from a current helper enabled.
104
+ [`@codeceptjs/configure` package](https://github.com/codeceptjs/configure) contains shared recipes for common configuration patterns. This allows to set meta-configuration, independent from a current helper enabled.
105
105
 
106
106
  Install it and enable to easily switch to headless/window mode, change window size, etc.
107
107
 
@@ -23,7 +23,7 @@ Helpers can be created by running a generator command:
23
23
  npx codeceptjs gh
24
24
  ```
25
25
 
26
- *(or `generate helper`)*
26
+ *(or `npx codeceptjs generate:helper`)*
27
27
 
28
28
  This command generates a basic helper and appends it to `helpers` section of config file:
29
29
 
@@ -36,7 +36,7 @@ helpers: {
36
36
  }
37
37
  ```
38
38
 
39
- Helpers are ES6 classes inherited from [corresponding abstract class](https://github.com/codecept-js/CodeceptJS/blob/master/lib/helper.js).
39
+ Helpers are ES6 classes inherited from [corresponding abstract class](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/helper.js).
40
40
  Generated Helper will be added to `codecept.conf.js` config file. It should look like this:
41
41
 
42
42
  ```js
package/docs/data.md CHANGED
@@ -314,7 +314,7 @@ By doing this we can make requests within the current browser session without a
314
314
  > Sharing browser session with ApiDataFactory or GraphQLDataFactory can be especially useful when you test Single Page Applications
315
315
 
316
316
  Since CodeceptJS 2.3.3 there is a simple way to enable shared session for browser and data helpers.
317
- Install [`@codeceptjs/configure`](https://github.com/codecept-js/configure) package:
317
+ Install [`@codeceptjs/configure`](https://github.com/codeceptjs/configure) package:
318
318
 
319
319
  ```
320
320
  npm i @codeceptjs/configure --save
package/docs/detox.md CHANGED
@@ -3,7 +3,7 @@ permalink: /detox
3
3
  title: Testing React Native with Detox
4
4
  ---
5
5
 
6
- > Warning! Detox support in CodeceptJS is experimental. Please try it and help us to test it and improve it. [See Detox helper repository](https://github.com/Codeception/detox-helper).
6
+ > Warning! Detox support in CodeceptJS is experimental. Please try it and help us to test it and improve it. [See Detox helper repository](https://github.com/codeceptjs/detox-helper).
7
7
 
8
8
  Automated mobile testing can be slow, hard, and ineffective. The price of it goes high, if we take into account fragility of applications, slowness of emulators, and the complexity of debug. [Appium](/mobile) helps writing mobile tests but not all apps can be tested effectively with it. That's why you should consider using an alternative approach.
9
9
 
@@ -119,7 +119,7 @@ There are also common assertions:
119
119
  * `seeElement` - to check visibility of element
120
120
  * `seeElementExists` - to check that element exists
121
121
 
122
- > For more details on actions refer to the [API reference of Detox helper](https://github.com/Codeception/detox-helper#api).
122
+ > For more details on actions refer to the [API reference of Detox helper](https://github.com/codeceptjs/detox-helper#api).
123
123
 
124
124
  ## Locators
125
125
 
package/docs/email.md CHANGED
@@ -155,7 +155,7 @@ I.seeInEmailSubject('Awesome Proposal!');
155
155
  I.seeInEmailBody('To unsubscribe click here');
156
156
  ```
157
157
 
158
- > More methods are listed in [helper's API reference](https://github.com/codecept-js/mailslurp-helper/blob/master/README.md#api)
158
+ > More methods are listed in [helper's API reference](https://github.com/codeceptjs/mailslurp-helper/blob/master/README.md#api)
159
159
 
160
160
  ## Listing All Emails
161
161
 
package/docs/examples.md CHANGED
@@ -7,7 +7,7 @@ editLink: false
7
7
  ---
8
8
 
9
9
  # Examples
10
- > Add your own examples to our [Wiki Page](https://github.com/Codeception/CodeceptJS/wiki/Examples)
10
+ > Add your own examples to our [Wiki Page](https://github.com/codeceptjs/CodeceptJS/wiki/Examples)
11
11
  ## [TodoMVC Examples](https://github.com/codecept-js/examples)
12
12
 
13
13
  ![](https://github.com/codecept-js/examples/raw/master/todo.png)
@@ -145,4 +145,14 @@ This is a ready to use example that shows how to integrate CodeceptJS with Puppe
145
145
  * puppeteer helper example
146
146
  * test steps, pages, fragments
147
147
  * examples for sequential and parallel execution
148
- * generation of allure test results
148
+ * generation of allure test results
149
+
150
+ ## [Framework with UI and API test support : CodeceptJS , Puppeteer , REST , ESLint](https://github.com/avighub/CodeceptJS-puppeteer)
151
+ This is a basic framework with Puppeteer , REST helpers which can support both UI and API actions within same test.
152
+ More improvements and features will be added and will be updated.
153
+ Suggestions and improvements are welcome , please raise a ticket in Issue tab.
154
+
155
+ * Step by step setup in README
156
+ * Two helpers are added. UI - Puppeteer , API - REST and chai-codeceptJS for assetion
157
+ * ESLint for code check
158
+ * Upcoming : API generic functions , Adaptor design pattern , More utilities
@@ -1563,6 +1563,20 @@ I.moveCursorTo('#submit', 5,5);
1563
1563
  - `offsetX` **[number][8]** (optional, `0` by default) X-axis offset. (optional, default `0`)
1564
1564
  - `offsetY` **[number][8]** (optional, `0` by default) Y-axis offset. (optional, default `0`)
1565
1565
 
1566
+ ### saveElementScreenshot
1567
+
1568
+ Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
1569
+ Filename is relative to output folder.
1570
+
1571
+ ```js
1572
+ I.saveElementScreenshot(`#submit`,'debug.png');
1573
+ ```
1574
+
1575
+ #### Parameters
1576
+
1577
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1578
+ - `fileName` **[string][4]** file name to save.
1579
+
1566
1580
  ### saveScreenshot
1567
1581
 
1568
1582
  Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
@@ -1581,21 +1595,26 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
1581
1595
 
1582
1596
  ### type
1583
1597
 
1584
- Types out the given string or the array of keys provided.
1585
- _Note:_ Should only be used when using [`fillField`][19] is not an option.
1598
+ Types out the given text into an active field.
1599
+ To slow down typing use a second parameter, to set interval between key presses.
1600
+ _Note:_ Should be used when [`fillField`][19] is not an option.
1586
1601
 
1587
1602
  ```js
1588
- // When passing in a string
1603
+ // passing in a string
1589
1604
  I.type('Type this out.');
1590
- // When passing in an array
1605
+
1606
+ // typing values with a 100ms interval
1607
+ I.type('4141555311111111', 100);
1608
+
1609
+ // passing in an array
1591
1610
  I.type(['T', 'E', 'X', 'T']);
1592
1611
  ```
1593
1612
 
1594
1613
  #### Parameters
1595
1614
 
1596
1615
  - `keys`
1616
+ - `delay` **[number][8]?** (optional) delay in ms between key presses (optional, default `null`)
1597
1617
  - `key` **([string][4] \| [Array][14]<[string][4]>)** or array of keys to type.
1598
- Type out given array of keys or a string of text
1599
1618
 
1600
1619
  ### dragAndDrop
1601
1620
 
@@ -463,6 +463,34 @@ console.log(`Current URL is [${url}]`);
463
463
 
464
464
  Returns **[Promise][8]<[string][3]>** current URL
465
465
 
466
+ ### grabElementBoundingRect
467
+
468
+ Grab the width, height, location of given locator.
469
+ Provide `width` or `height`as second param to get your desired prop.
470
+ Resumes test execution, so **should be used inside an async function with `await`** operator.
471
+
472
+ Returns an object with `x`, `y`, `width`, `height` keys.
473
+
474
+ ```js
475
+ const value = await I.grabElementBoundingRect('h3');
476
+ // value is like { x: 226.5, y: 89, width: 527, height: 220 }
477
+ ```
478
+
479
+ To get only one metric use second parameter:
480
+
481
+ ```js
482
+ const width = await I.grabElementBoundingRect('h3', 'width');
483
+ // width == 527
484
+ ```
485
+
486
+ #### Parameters
487
+
488
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
489
+ - `prop`
490
+ - `elementSize` **[string][3]** x, y, width or height of the given element.
491
+
492
+ Returns **[object][4]** Element bounding rectangle
493
+
466
494
  ### grabHAR
467
495
 
468
496
  Get HAR
@@ -637,6 +665,20 @@ I.rightClick('Click me', '.context');
637
665
  - `locator` **([string][3] | [object][4])** clickable element located by CSS|XPath|strict locator.
638
666
  - `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS|XPath|strict locator.
639
667
 
668
+ ### saveElementScreenshot
669
+
670
+ Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
671
+ Filename is relative to output folder.
672
+
673
+ ```js
674
+ I.saveElementScreenshot(`#submit`,'debug.png');
675
+ ```
676
+
677
+ #### Parameters
678
+
679
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
680
+ - `fileName` **[string][3]** file name to save.
681
+
640
682
  ### saveScreenshot
641
683
 
642
684
  Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
@@ -127,7 +127,7 @@ This helper should be configured in codecept.json or codecept.conf.js
127
127
  }
128
128
  ```
129
129
 
130
- #### Example #6: Lunach tests emulating iPhone 6
130
+ #### Example #6: Launch tests emulating iPhone 6
131
131
 
132
132
  ```js
133
133
  const { devices } = require('playwright');
@@ -1022,7 +1022,7 @@ Some of the supported key names are:
1022
1022
 
1023
1023
  #### Parameters
1024
1024
 
1025
- - `key` **([string][7] | [Array][10]<[string][7]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Playwright#1313][14]).
1025
+ - `key` **([string][7] | [Array][10]<[string][7]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][14]).
1026
1026
 
1027
1027
  ### pressKeyDown
1028
1028
 
@@ -1098,6 +1098,20 @@ I.rightClick('Click me', '.context');
1098
1098
  - `locator` **([string][7] | [object][5])** clickable element located by CSS|XPath|strict locator.
1099
1099
  - `context` **([string][7]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
1100
1100
 
1101
+ ### saveElementScreenshot
1102
+
1103
+ Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
1104
+ Filename is relative to output folder.
1105
+
1106
+ ```js
1107
+ I.saveElementScreenshot(`#submit`,'debug.png');
1108
+ ```
1109
+
1110
+ #### Parameters
1111
+
1112
+ - `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
1113
+ - `fileName` **[string][7]** file name to save.
1114
+
1101
1115
  ### saveScreenshot
1102
1116
 
1103
1117
  Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
@@ -1459,6 +1473,29 @@ I.switchToPreviousTab(2);
1459
1473
 
1460
1474
  - `num` **[number][8]**
1461
1475
 
1476
+ ### type
1477
+
1478
+ Types out the given text into an active field.
1479
+ To slow down typing use a second parameter, to set interval between key presses.
1480
+ _Note:_ Should be used when [`fillField`][13] is not an option.
1481
+
1482
+ ```js
1483
+ // passing in a string
1484
+ I.type('Type this out.');
1485
+
1486
+ // typing values with a 100ms interval
1487
+ I.type('4141555311111111', 100);
1488
+
1489
+ // passing in an array
1490
+ I.type(['T', 'E', 'X', 'T']);
1491
+ ```
1492
+
1493
+ #### Parameters
1494
+
1495
+ - `keys`
1496
+ - `delay` **[number][8]?** (optional) delay in ms between key presses
1497
+ - `key` **([string][7] | [Array][10]<[string][7]>)** or array of keys to type.
1498
+
1462
1499
  ### uncheckOption
1463
1500
 
1464
1501
  Unselects a checkbox or radio button.
@@ -1759,7 +1796,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
1759
1796
 
1760
1797
  [13]: #fillfield
1761
1798
 
1762
- [14]: https://github.com/GoogleChrome/Playwright/issues/1313
1799
+ [14]: https://github.com/GoogleChrome/puppeteer/issues/1313
1763
1800
 
1764
1801
  [15]: #click
1765
1802
 
@@ -1767,6 +1804,6 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
1767
1804
 
1768
1805
  [17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
1769
1806
 
1770
- [18]: https://github.com/GoogleChrome/Playwright/blob/master/docs/api.md#pagewaitfornavigationoptions
1807
+ [18]: https://github.com/microsoft/Playwright/blob/master/docs/api.md#pagewaitfornavigationoptions
1771
1808
 
1772
1809
  [19]: https://codecept.io/react
@@ -905,6 +905,20 @@ I.rightClick('Click me', '.context');
905
905
  - `locator` **([string][9] | [object][10])** clickable element located by CSS|XPath|strict locator.
906
906
  - `context` **([string][9]? | [object][10])** (optional, `null` by default) element located by CSS|XPath|strict locator.
907
907
 
908
+ ### saveElementScreenshot
909
+
910
+ Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
911
+ Filename is relative to output folder.
912
+
913
+ ```js
914
+ I.saveElementScreenshot(`#submit`,'debug.png');
915
+ ```
916
+
917
+ #### Parameters
918
+
919
+ - `locator` **([string][9] | [object][10])** element located by CSS|XPath|strict locator.
920
+ - `fileName` **[string][9]** file name to save.
921
+
908
922
  ### saveScreenshot
909
923
 
910
924
  Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
@@ -35,7 +35,7 @@ This helper should be configured in codecept.json or codecept.conf.js
35
35
  - `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
36
36
  - `waitForNavigation`: . When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API][3]. Array values are accepted as well.
37
37
  - `pressKeyDelay`: . Delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
38
- - `getPageTimeout` config option to set maximum navigation time in milliseconds.
38
+ - `getPageTimeout` config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
39
39
  - `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
40
40
  - `windowSize`: (optional) default window size. Set a dimension like `640x480`.
41
41
  - `userAgent`: (optional) user-agent string.
@@ -1194,6 +1194,20 @@ I.rightClick('Click me', '.context');
1194
1194
  This action supports [React locators](https://codecept.io/react#locators)
1195
1195
 
1196
1196
 
1197
+ ### saveElementScreenshot
1198
+
1199
+ Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
1200
+ Filename is relative to output folder.
1201
+
1202
+ ```js
1203
+ I.saveElementScreenshot(`#submit`,'debug.png');
1204
+ ```
1205
+
1206
+ #### Parameters
1207
+
1208
+ - `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
1209
+ - `fileName` **[string][8]** file name to save.
1210
+
1197
1211
  ### saveScreenshot
1198
1212
 
1199
1213
  Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
@@ -1582,6 +1596,29 @@ I.switchToPreviousTab(2);
1582
1596
 
1583
1597
  - `num` **[number][10]**
1584
1598
 
1599
+ ### type
1600
+
1601
+ Types out the given text into an active field.
1602
+ To slow down typing use a second parameter, to set interval between key presses.
1603
+ _Note:_ Should be used when [`fillField`][16] is not an option.
1604
+
1605
+ ```js
1606
+ // passing in a string
1607
+ I.type('Type this out.');
1608
+
1609
+ // typing values with a 100ms interval
1610
+ I.type('4141555311111111', 100);
1611
+
1612
+ // passing in an array
1613
+ I.type(['T', 'E', 'X', 'T']);
1614
+ ```
1615
+
1616
+ #### Parameters
1617
+
1618
+ - `keys`
1619
+ - `delay` **[number][10]?** (optional) delay in ms between key presses
1620
+ - `key` **([string][8] | [Array][14]<[string][8]>)** or array of keys to type.
1621
+
1585
1622
  ### uncheckOption
1586
1623
 
1587
1624
  Unselects a checkbox or radio button.
@@ -626,6 +626,20 @@ I.rightClick('Click me', '.context');
626
626
  - `locator` **([string][4] | [object][5])** clickable element located by CSS|XPath|strict locator.
627
627
  - `context` **([string][4]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
628
628
 
629
+ ### saveElementScreenshot
630
+
631
+ Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
632
+ Filename is relative to output folder.
633
+
634
+ ```js
635
+ I.saveElementScreenshot(`#submit`,'debug.png');
636
+ ```
637
+
638
+ #### Parameters
639
+
640
+ - `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
641
+ - `fileName` **[string][4]** file name to save.
642
+
629
643
  ### saveScreenshot
630
644
 
631
645
  Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
@@ -1379,6 +1379,20 @@ Placeholder for ~ locator only test case write once run on both Appium and WebDr
1379
1379
  - `caps`
1380
1380
  - `fn`
1381
1381
 
1382
+ ### saveElementScreenshot
1383
+
1384
+ Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
1385
+ Filename is relative to output folder.
1386
+
1387
+ ```js
1388
+ I.saveElementScreenshot(`#submit`,'debug.png');
1389
+ ```
1390
+
1391
+ #### Parameters
1392
+
1393
+ - `locator` **([string][19] | [object][18])** element located by CSS|XPath|strict locator.
1394
+ - `fileName` **[string][19]** file name to save.
1395
+
1382
1396
  ### saveScreenshot
1383
1397
 
1384
1398
  Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
@@ -1807,21 +1821,26 @@ await I.switchToWindow( window );
1807
1821
 
1808
1822
  ### type
1809
1823
 
1810
- Types out the given string or the array of keys provided.
1811
- _Note:_ Should only be used when using [`fillField`][29] is not an option.
1824
+ Types out the given text into an active field.
1825
+ To slow down typing use a second parameter, to set interval between key presses.
1826
+ _Note:_ Should be used when [`fillField`][29] is not an option.
1812
1827
 
1813
1828
  ```js
1814
- // When passing in a string
1829
+ // passing in a string
1815
1830
  I.type('Type this out.');
1816
- // When passing in an array
1831
+
1832
+ // typing values with a 100ms interval
1833
+ I.type('4141555311111111', 100);
1834
+
1835
+ // passing in an array
1817
1836
  I.type(['T', 'E', 'X', 'T']);
1818
1837
  ```
1819
1838
 
1820
1839
  #### Parameters
1821
1840
 
1822
1841
  - `keys`
1842
+ - `delay` **[number][22]?** (optional) delay in ms between key presses
1823
1843
  - `key` **([string][19] | [Array][28]<[string][19]>)** or array of keys to type.
1824
- Type out given array of keys or a string of text
1825
1844
 
1826
1845
  ### uncheckOption
1827
1846
 
package/docs/hooks.md CHANGED
@@ -240,7 +240,7 @@ module.exports = {
240
240
 
241
241
  Plugins allow to use CodeceptJS internal API to extend functionality. Use internal event dispatcher, container, output, promise recorder, to create your own reporters, test listeners, etc.
242
242
 
243
- CodeceptJS includes [built-in plugins](/plugins/) which extend basic functionality and can be turned on and off on purpose. Taking them as [examples](https://github.com/codecept-js/CodeceptJS/tree/master/lib/plugin) you can develop your custom plugins.
243
+ CodeceptJS includes [built-in plugins](/plugins/) which extend basic functionality and can be turned on and off on purpose. Taking them as [examples](https://github.com/codeceptjs/CodeceptJS/tree/master/lib/plugin) you can develop your custom plugins.
244
244
 
245
245
  A plugin is a basic JS module returning a function. Plugins can have individual configs which are passed into this function:
246
246
 
@@ -255,7 +255,7 @@ module.exports = function(config) {
255
255
  }
256
256
  ```
257
257
 
258
- Plugin can register event listeners or hook into promise chain with recorder. See [API reference](https://github.com/codecept-js/CodeceptJS/tree/master/lib/helper).
258
+ Plugin can register event listeners or hook into promise chain with recorder. See [API reference](https://github.com/codeceptjs/CodeceptJS/tree/master/lib/helper).
259
259
 
260
260
  To enable your custom plugin in config add it to `plugins` section. Specify path to node module using `require`.
261
261
 
@@ -332,21 +332,21 @@ module.exports = function(options) {
332
332
  CodeceptJS provides an API which can be loaded via `require('codeceptjs')` when CodeceptJS is installed locally.
333
333
  These internal objects are available:
334
334
 
335
- * [`codecept`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/codecept.js): test runner class
336
- * [`config`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/config.js): current codecept config
337
- * [`event`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/event.js): event listener
338
- * [`recorder`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/recorder.js): global promise chain
339
- * [`output`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/output.js): internal printer
340
- * [`container`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/container.js): dependency injection container for tests, includes current helpers and support objects
341
- * [`helper`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/helper.js): basic helper class
342
- * [`actor`](https://github.com/codecept-js/CodeceptJS/blob/master/lib/actor.js): basic actor (I) class
335
+ * [`codecept`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/codecept.js): test runner class
336
+ * [`config`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/config.js): current codecept config
337
+ * [`event`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/event.js): event listener
338
+ * [`recorder`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/recorder.js): global promise chain
339
+ * [`output`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/output.js): internal printer
340
+ * [`container`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/container.js): dependency injection container for tests, includes current helpers and support objects
341
+ * [`helper`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/helper.js): basic helper class
342
+ * [`actor`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/actor.js): basic actor (I) class
343
343
 
344
- [API reference](https://github.com/codecept-js/CodeceptJS/tree/master/docs/api) is available on GitHub.
344
+ [API reference](https://github.com/codeceptjs/CodeceptJS/tree/master/docs/api) is available on GitHub.
345
345
  Also please check the source code of corresponding modules.
346
346
 
347
347
  ### Event Listeners
348
348
 
349
- CodeceptJS provides a module with [event dispatcher and set of predefined events](https://github.com/codecept-js/CodeceptJS/blob/master/lib/event.js).
349
+ CodeceptJS provides a module with [event dispatcher and set of predefined events](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/event.js).
350
350
 
351
351
  It can be required from codeceptjs package if it is installed locally.
352
352
 
@@ -387,7 +387,7 @@ Available events:
387
387
  * *sync* - means that event is fired in the moment of action happens.
388
388
  * *async* - means that event is fired when an actions is scheduled. Use `recorder` to schedule your actions.
389
389
 
390
- For further reference look for [currently available listeners](https://github.com/codecept-js/CodeceptJS/tree/master/lib/listener) using event system.
390
+ For further reference look for [currently available listeners](https://github.com/codeceptjs/CodeceptJS/tree/master/lib/listener) using event system.
391
391
 
392
392
  #### Test Object
393
393
 
@@ -419,7 +419,7 @@ Step events provide step objects with following fields:
419
419
 
420
420
  ### Recorder
421
421
 
422
- To inject asynchronous functions in a test or before/after a test you can subscribe to corresponding event and register a function inside a recorder object. [Recorder](https://github.com/codecept-js/CodeceptJS/blob/master/lib/recorder.js) represents a global promises chain.
422
+ To inject asynchronous functions in a test or before/after a test you can subscribe to corresponding event and register a function inside a recorder object. [Recorder](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/recorder.js) represents a global promises chain.
423
423
 
424
424
  Provide a function description as a first parameter, function should return a promise:
425
425
 
package/docs/locators.md CHANGED
@@ -301,4 +301,4 @@ New locator strategy is ready to use:
301
301
  I.click('=Login');
302
302
  ```
303
303
 
304
- > For more details on locator object see [Locator](https://github.com/codecept-js/CodeceptJS/blob/master/lib/locator.js) class implementation.
304
+ > For more details on locator object see [Locator](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/locator.js) class implementation.
@@ -260,6 +260,19 @@ Scenario('website looks nice on iPhone', () => {
260
260
  });
261
261
  ```
262
262
 
263
+ ## Configuring CI
264
+
265
+ ### GitHub Actions
266
+
267
+ Playwright can be added to GitHub Actions using [official action](https://github.com/microsoft/playwright-github-action). Use it before starting CodeceptJS tests to install all dependencies. It is important to run tests in headless mode ([otherwise you will need to enable xvfb to emulate desktop](https://github.com/microsoft/playwright-github-action#run-in-headful-mode)).
268
+
269
+ ```yml
270
+ # from workflows/tests.yml
271
+ - uses: microsoft/playwright-github-action@v1
272
+ - name: run CodeceptJS tests
273
+ run: npx codeceptjs run
274
+ ```
275
+
263
276
  ## Extending
264
277
 
265
278
  Playwright has a very [rich and flexible API](https://github.com/microsoft/playwright/blob/master/docs/api.md). Sure, you can extend your test suites to use the methods listed there. CodeceptJS already prepares some objects for you and you can use them from your you helpers.
@@ -10,7 +10,7 @@ title: Translation
10
10
  Test output and the way tests are written can be localized.
11
11
  This way scenarios can be written in almost native language using UTF support of JavaScript.
12
12
  If you have non-English team and you work on non-English project consider enabling translation
13
- by setting translation to [one of available languages](https://github.com/codecept-js/CodeceptJS/blob/master/translations).
13
+ by setting translation to [one of available languages](https://github.com/codeceptjs/CodeceptJS/blob/master/translations).
14
14
 
15
15
  Please refer to translated steps inside translation files and send Pull Requests to add missing.
16
16
 
@@ -66,6 +66,26 @@ Scenario('Efetuar login', (Eu) => {
66
66
  });
67
67
  ```
68
68
 
69
+ ## French
70
+
71
+ To write your tests in French you can enable the French translation by adding to config:
72
+
73
+ ```json
74
+ "translation": "fr-FR"
75
+ ```
76
+
77
+ Now you can write tests like this:
78
+
79
+ ```js
80
+ Scenario('Se connecter sur GitHub', (Je) => {
81
+ Je.suisSurLaPage('https://github.com/login');
82
+ Je.remplisLeChamp("Username or email address", "jean-dupond");
83
+ Je.remplisLeChamp("Password", "*********");
84
+ Je.cliqueSur("Sign in");
85
+ Je.vois("Learn Git and GitHub without any code!");
86
+ });
87
+ ```
88
+
69
89
  ## Italian
70
90
 
71
91
  Add to config
package/docs/ui.md CHANGED
@@ -22,7 +22,7 @@ CodeceptUI can be used for
22
22
  * easily switch to headless/headful mode
23
23
 
24
24
  CodeceptUI is a useful addon to CodeceptJS, we recommend to try.
25
- It is an [open-source Vue-based application](https://github.com/codecept-js/ui) which runs in your browser.
25
+ It is an [open-source Vue-based application](https://github.com/codeceptjs/ui) which runs in your browser.
26
26
 
27
27
  > 📺 [Watch CodeceptUI in Action](https://www.youtube.com/watch?v=7pKNVjAckPA)
28
28
 
@@ -50,7 +50,7 @@ npx codecept-ui
50
50
  CodeceptUI is in beta. It means that we didn't have a chance to test it for all possible setups.
51
51
  You are highly welcome to try it, test it, send issues and **pull requests**.
52
52
 
53
- [Join development team on GitHub!](https://github.com/codecept-js/ui)
53
+ [Join development team on GitHub!](https://github.com/codeceptjs/ui)
54
54
 
55
55
 
56
56