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
@@ -0,0 +1,63 @@
1
+ module.exports = {
2
+ I: 'Je',
3
+ contexts: {
4
+ Feature: 'Fonctionnalité',
5
+ Scenario: 'Scénario',
6
+ Before: 'Avant',
7
+ After: 'Après',
8
+ BeforeSuite: 'AvantLaSuite',
9
+ AfterSuite: 'AprèsLaSuite',
10
+ },
11
+ actions: {
12
+ amOutsideAngularApp: 'suisALExtérieurDeLApplicationAngular',
13
+ amInsideAngularApp: 'suisALIntérieurDeLApplicationAngular',
14
+ waitForElement: 'attendsLElément',
15
+ waitForClickable: 'attends',
16
+ waitForVisible: 'attendsPourVoir',
17
+ waitForText: 'attendsLeTexte',
18
+ moveTo: 'vaisSur',
19
+ refresh: 'rafraîchis',
20
+ haveModule: 'ajouteLeModule',
21
+ resetModule: 'réinitialiseLeModule',
22
+ amOnPage: 'suisSurLaPage',
23
+ click: 'cliqueSur',
24
+ doubleClick: 'doubleCliqueSur',
25
+ see: 'vois',
26
+ dontSee: 'neVoisPas',
27
+ selectOption: 'sélectionneUneOption',
28
+ fillField: 'remplisLeChamp',
29
+ pressKey: 'appuisSurLaTouche',
30
+ triggerMouseEvent: 'déclencheLEvénementDeLaSouris',
31
+ attachFile: 'attacheLeFichier',
32
+ seeInField: 'voisDansLeChamp',
33
+ dontSeeInField: 'neVoisPasDansLeChamp',
34
+ appendField: 'ajouteAuChamp',
35
+ checkOption: 'vérifieLOption',
36
+ seeCheckboxIsChecked: 'voisQueLaCaseEstCochée',
37
+ dontSeeCheckboxIsChecked: 'neVoisPasQueLaCaseEstCochée',
38
+ grabTextFrom: 'prendsLeTexteDe',
39
+ grabValueFrom: 'prendsLaValeurDe',
40
+ grabAttributeFrom: 'prendsLAttributDe',
41
+ seeInTitle: 'voisDansLeTitre',
42
+ dontSeeInTitle: 'neVoisPasDansLeTitre',
43
+ grabTitle: 'prendsLeTitre',
44
+ seeElement: 'voisLElément',
45
+ dontSeeElement: 'neVoisPasLElément',
46
+ seeInSource: 'voisDansLeCodeSource',
47
+ dontSeeInSource: 'neVoisPasDansLeCodeSource',
48
+ executeScript: 'exécuteUnScript',
49
+ executeAsyncScript: 'exécuteUnScriptAsynchrone',
50
+ seeInCurrentUrl: 'voisDansLUrl',
51
+ dontSeeInCurrentUrl: 'neVoisPasDansLUrl',
52
+ seeCurrentUrlEquals: 'voisQueLUrlEstEgaleA',
53
+ dontSeeCurrentUrlEquals: 'neVoisPasQueLUrlEstEgaleA',
54
+ saveScreenshot: 'prendsUneCapture',
55
+ setCookie: 'déposeLeCookie',
56
+ clearCookie: 'effaceLeCookie',
57
+ seeCookie: 'voisLeCookie',
58
+ dontSeeCookie: 'neVoisPasLeCookie',
59
+ grabCookie: 'prendsLeCookie',
60
+ resizeWindow: 'redimensionneLaFenêtre',
61
+ wait: 'attends',
62
+ },
63
+ };
@@ -1,8 +1,9 @@
1
- exports['pt-BR'] = require('./pt-BR');
2
- exports['ru-RU'] = require('./ru-RU');
1
+ exports['de-DE'] = require('./de-DE');
3
2
  exports['it-IT'] = require('./it-IT');
3
+ exports['fr-FR'] = require('./fr-FR');
4
+ exports['ja-JP'] = require('./ja-JP');
4
5
  exports['pl-PL'] = require('./pl-PL');
6
+ exports['pt-BR'] = require('./pt-BR');
7
+ exports['ru-RU'] = require('./ru-RU');
5
8
  exports['zh-CN'] = require('./zh-CN');
6
9
  exports['zh-TW'] = require('./zh-TW');
7
- exports['ja-JP'] = require('./ja-JP');
8
- exports['de-DE'] = require('./de-DE');
@@ -1848,6 +1848,40 @@ declare namespace CodeceptJS {
1848
1848
  * Reload the page
1849
1849
  */
1850
1850
  refresh(): void;
1851
+ /**
1852
+ * Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
1853
+ * Filename is relative to output folder.
1854
+ *
1855
+ * ```js
1856
+ * I.saveElementScreenshot(`#submit`,'debug.png');
1857
+ * ```
1858
+ * @param locator - element located by CSS|XPath|strict locator.
1859
+ * @param fileName - file name to save.
1860
+ */
1861
+ saveElementScreenshot(locator: string | any, fileName: string): void;
1862
+ /**
1863
+ * Grab the width, height, location of given locator.
1864
+ * Provide `width` or `height`as second param to get your desired prop.
1865
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
1866
+ *
1867
+ * Returns an object with `x`, `y`, `width`, `height` keys.
1868
+ *
1869
+ * ```js
1870
+ * const value = await I.grabElementBoundingRect('h3');
1871
+ * // value is like { x: 226.5, y: 89, width: 527, height: 220 }
1872
+ * ```
1873
+ *
1874
+ * To get only one metric use second parameter:
1875
+ *
1876
+ * ```js
1877
+ * const width = await I.grabElementBoundingRect('h3', 'width');
1878
+ * // width == 527
1879
+ * ```
1880
+ * @param locator - element located by CSS|XPath|strict locator.
1881
+ * @param elementSize - x, y, width or height of the given element.
1882
+ * @returns Element bounding rectangle
1883
+ */
1884
+ grabElementBoundingRect(locator: string | any, elementSize: string): any;
1851
1885
  /**
1852
1886
  * Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
1853
1887
  * Filename is relative to output folder.
@@ -2471,9 +2505,28 @@ declare namespace CodeceptJS {
2471
2505
  * @param key - key or array of keys to press.
2472
2506
  *
2473
2507
  *
2474
- * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Playwright#1313](https://github.com/GoogleChrome/Playwright/issues/1313)).
2508
+ * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
2475
2509
  */
2476
2510
  pressKey(key: string | string[]): void;
2511
+ /**
2512
+ * Types out the given text into an active field.
2513
+ * To slow down typing use a second parameter, to set interval between key presses.
2514
+ * _Note:_ Should be used when [`fillField`](#fillfield) is not an option.
2515
+ *
2516
+ * ```js
2517
+ * // passing in a string
2518
+ * I.type('Type this out.');
2519
+ *
2520
+ * // typing values with a 100ms interval
2521
+ * I.type('4141555311111111', 100);
2522
+ *
2523
+ * // passing in an array
2524
+ * I.type(['T', 'E', 'X', 'T']);
2525
+ * ```
2526
+ * @param key - or array of keys to type.
2527
+ * @param [delay = null] - (optional) delay in ms between key presses
2528
+ */
2529
+ type(key: string | string[], delay?: number): void;
2477
2530
  /**
2478
2531
  * Fills a text field or textarea, after clearing its value, with the given string.
2479
2532
  * Field is located by name, label, CSS, or XPath.
@@ -2904,6 +2957,17 @@ declare namespace CodeceptJS {
2904
2957
  * @returns attribute value
2905
2958
  */
2906
2959
  grabAttributeFrom(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string>;
2960
+ /**
2961
+ * Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
2962
+ * Filename is relative to output folder.
2963
+ *
2964
+ * ```js
2965
+ * I.saveElementScreenshot(`#submit`,'debug.png');
2966
+ * ```
2967
+ * @param locator - element located by CSS|XPath|strict locator.
2968
+ * @param fileName - file name to save.
2969
+ */
2970
+ saveElementScreenshot(locator: string | any, fileName: string): void;
2907
2971
  /**
2908
2972
  * Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
2909
2973
  * Filename is relative to output folder.
@@ -3100,7 +3164,7 @@ declare namespace CodeceptJS {
3100
3164
  /**
3101
3165
  * Waits for navigation to finish. By default takes configured `waitForNavigation` option.
3102
3166
  *
3103
- * See [Pupeteer's reference](https://github.com/GoogleChrome/Playwright/blob/master/docs/api.md#pagewaitfornavigationoptions)
3167
+ * See [Pupeteer's reference](https://github.com/microsoft/Playwright/blob/master/docs/api.md#pagewaitfornavigationoptions)
3104
3168
  */
3105
3169
  waitForNavigation(opts: any): void;
3106
3170
  /**
@@ -3867,6 +3931,17 @@ declare namespace CodeceptJS {
3867
3931
  * @param url - value to check.
3868
3932
  */
3869
3933
  dontSeeCurrentUrlEquals(url: string): void;
3934
+ /**
3935
+ * Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
3936
+ * Filename is relative to output folder.
3937
+ *
3938
+ * ```js
3939
+ * I.saveElementScreenshot(`#submit`,'debug.png');
3940
+ * ```
3941
+ * @param locator - element located by CSS|XPath|strict locator.
3942
+ * @param fileName - file name to save.
3943
+ */
3944
+ saveElementScreenshot(locator: string | any, fileName: string): void;
3870
3945
  /**
3871
3946
  * Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
3872
3947
  * Filename is relative to output folder.
@@ -4906,6 +4981,25 @@ declare namespace CodeceptJS {
4906
4981
  * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
4907
4982
  */
4908
4983
  pressKey(key: string | string[]): void;
4984
+ /**
4985
+ * Types out the given text into an active field.
4986
+ * To slow down typing use a second parameter, to set interval between key presses.
4987
+ * _Note:_ Should be used when [`fillField`](#fillfield) is not an option.
4988
+ *
4989
+ * ```js
4990
+ * // passing in a string
4991
+ * I.type('Type this out.');
4992
+ *
4993
+ * // typing values with a 100ms interval
4994
+ * I.type('4141555311111111', 100);
4995
+ *
4996
+ * // passing in an array
4997
+ * I.type(['T', 'E', 'X', 'T']);
4998
+ * ```
4999
+ * @param key - or array of keys to type.
5000
+ * @param [delay = null] - (optional) delay in ms between key presses
5001
+ */
5002
+ type(key: string | string[], delay?: number): void;
4909
5003
  /**
4910
5004
  * Fills a text field or textarea, after clearing its value, with the given string.
4911
5005
  * Field is located by name, label, CSS, or XPath.
@@ -5393,6 +5487,17 @@ declare namespace CodeceptJS {
5393
5487
  * {{ react }}
5394
5488
  */
5395
5489
  grabAttributeFrom(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string>;
5490
+ /**
5491
+ * Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
5492
+ * Filename is relative to output folder.
5493
+ *
5494
+ * ```js
5495
+ * I.saveElementScreenshot(`#submit`,'debug.png');
5496
+ * ```
5497
+ * @param locator - element located by CSS|XPath|strict locator.
5498
+ * @param fileName - file name to save.
5499
+ */
5500
+ saveElementScreenshot(locator: string | any, fileName: string): void;
5396
5501
  /**
5397
5502
  * Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
5398
5503
  * Filename is relative to output folder.
@@ -6160,6 +6265,17 @@ declare namespace CodeceptJS {
6160
6265
  * @param value - to check.
6161
6266
  */
6162
6267
  dontSeeInSource(value: string): void;
6268
+ /**
6269
+ * Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
6270
+ * Filename is relative to output folder.
6271
+ *
6272
+ * ```js
6273
+ * I.saveElementScreenshot(`#submit`,'debug.png');
6274
+ * ```
6275
+ * @param locator - element located by CSS|XPath|strict locator.
6276
+ * @param fileName - file name to save.
6277
+ */
6278
+ saveElementScreenshot(locator: string | any, fileName: string): void;
6163
6279
  /**
6164
6280
  * Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
6165
6281
  * Filename is relative to output folder.
@@ -7256,6 +7372,17 @@ declare namespace CodeceptJS {
7256
7372
  * @param [offsetY = 0] - (optional, `0` by default) Y-axis offset.
7257
7373
  */
7258
7374
  moveCursorTo(locator: CodeceptJS.LocatorOrString, offsetX?: number, offsetY?: number): void;
7375
+ /**
7376
+ * Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
7377
+ * Filename is relative to output folder.
7378
+ *
7379
+ * ```js
7380
+ * I.saveElementScreenshot(`#submit`,'debug.png');
7381
+ * ```
7382
+ * @param locator - element located by CSS|XPath|strict locator.
7383
+ * @param fileName - file name to save.
7384
+ */
7385
+ saveElementScreenshot(locator: string | any, fileName: string): void;
7259
7386
  /**
7260
7387
  * Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
7261
7388
  * Filename is relative to output folder.
@@ -7447,19 +7574,24 @@ declare namespace CodeceptJS {
7447
7574
  */
7448
7575
  pressKey(key: string | string[]): void;
7449
7576
  /**
7450
- * Types out the given string or the array of keys provided.
7451
- * _Note:_ Should only be used when using [`fillField`](#fillfield) is not an option.
7577
+ * Types out the given text into an active field.
7578
+ * To slow down typing use a second parameter, to set interval between key presses.
7579
+ * _Note:_ Should be used when [`fillField`](#fillfield) is not an option.
7452
7580
  *
7453
7581
  * ```js
7454
- * // When passing in a string
7582
+ * // passing in a string
7455
7583
  * I.type('Type this out.');
7456
- * // When passing in an array
7584
+ *
7585
+ * // typing values with a 100ms interval
7586
+ * I.type('4141555311111111', 100);
7587
+ *
7588
+ * // passing in an array
7457
7589
  * I.type(['T', 'E', 'X', 'T']);
7458
7590
  * ```
7459
7591
  * @param key - or array of keys to type.
7460
- * Type out given array of keys or a string of text
7592
+ * @param [delay = null] - (optional) delay in ms between key presses
7461
7593
  */
7462
- type(key: string | string[]): void;
7594
+ type(key: string | string[], delay?: number): void;
7463
7595
  /**
7464
7596
  * Resize the current window to provided width and height.
7465
7597
  * First parameter can be set to `maximize`.
@@ -1,25 +0,0 @@
1
- This is the guide for maintainers:
2
-
3
- ## Release Process
4
-
5
- 1. pull in the latest changes from master
6
- 2. create branch `release-x.x.x` and switch to it `git checkout -b release-x.x.x`
7
- 3. update version in `package.json`
8
- 4. go through commits in this release and write a changelog.
9
- * Changelog should be written not for robots!
10
- * Use simple wording explaining what a change was, how to use a new feature (maybe with a code example), and mention a related issue.
11
- * When using `#123` a link for issue #123 will be automatically added.
12
- * A contributor must be mentioned. We use GitHub names with `@` prefix. A link to user profile is automatically added.
13
- 5. run `./runio.js docs` to build documentation
14
- 6. commit all changes, push, and make PR
15
- 7. check that all tests pass and merge your PR
16
- 8. run `./runio.js release` to publish latest release. A website will be updated.
17
- * to update version for patch release: `./runio.js release patch`
18
- * to update version for minor release: `./runio.js release minor`
19
- 9. Post announcements in Twitter & Slack
20
-
21
- ## Updating a website
22
-
23
- * Run `./runio.js docs:helpers` to build docs from helpers
24
- * Run `./runio.js publish:site` to update a website
25
-