codeceptjs 3.0.4 → 3.0.5

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 (45) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/docs/build/Appium.js +1 -1
  3. package/docs/build/Nightmare.js +4 -5
  4. package/docs/build/Playwright.js +41 -15
  5. package/docs/build/Protractor.js +1 -1
  6. package/docs/build/Puppeteer.js +1 -1
  7. package/docs/build/REST.js +20 -1
  8. package/docs/build/TestCafe.js +1 -1
  9. package/docs/build/WebDriver.js +3 -3
  10. package/docs/changelog.md +34 -0
  11. package/docs/data.md +5 -5
  12. package/docs/detox.md +2 -2
  13. package/docs/docker.md +11 -11
  14. package/docs/helpers/Appium.md +1 -1
  15. package/docs/helpers/Nightmare.md +4 -5
  16. package/docs/helpers/Playwright.md +81 -61
  17. package/docs/helpers/Protractor.md +1 -1
  18. package/docs/helpers/Puppeteer.md +1 -1
  19. package/docs/helpers/REST.md +9 -0
  20. package/docs/helpers/TestCafe.md +1 -1
  21. package/docs/helpers/WebDriver.md +1 -1
  22. package/docs/locators.md +2 -2
  23. package/docs/mobile-react-native-locators.md +2 -2
  24. package/docs/mobile.md +3 -3
  25. package/docs/pageobjects.md +3 -1
  26. package/docs/reports.md +3 -3
  27. package/docs/typescript.md +47 -5
  28. package/docs/webapi/fillField.mustache +1 -1
  29. package/lib/cli.js +16 -10
  30. package/lib/command/interactive.js +6 -7
  31. package/lib/config.js +6 -1
  32. package/lib/helper/Nightmare.js +1 -1
  33. package/lib/helper/Playwright.js +8 -16
  34. package/lib/helper/REST.js +20 -1
  35. package/lib/helper/WebDriver.js +2 -2
  36. package/lib/interfaces/gherkin.js +9 -3
  37. package/lib/output.js +2 -2
  38. package/lib/plugin/allure.js +3 -7
  39. package/lib/plugin/screenshotOnFail.js +1 -2
  40. package/lib/step.js +2 -1
  41. package/lib/within.js +1 -1
  42. package/lib/workers.js +13 -1
  43. package/package.json +5 -5
  44. package/typings/index.d.ts +7 -2
  45. package/typings/types.d.ts +55 -21
@@ -862,7 +862,7 @@ declare namespace CodeceptJS {
862
862
  * @param field - located by label|name|CSS|XPath|strict locator.
863
863
  * @param value - text value to fill.
864
864
  */
865
- fillField(field: CodeceptJS.LocatorOrString, value: string): void;
865
+ fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
866
866
  /**
867
867
  * Retrieves all texts from an element located by CSS or XPath and returns it to test.
868
868
  * Resumes test execution, so **should be used inside async with `await`** operator.
@@ -1847,7 +1847,7 @@ declare namespace CodeceptJS {
1847
1847
  * @param field - located by label|name|CSS|XPath|strict locator.
1848
1848
  * @param value - text value to fill.
1849
1849
  */
1850
- fillField(field: CodeceptJS.LocatorOrString, value: string): void;
1850
+ fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
1851
1851
  /**
1852
1852
  * Clears a `<textarea>` or text `<input>` element's value.
1853
1853
  *
@@ -1973,17 +1973,16 @@ declare namespace CodeceptJS {
1973
1973
  */
1974
1974
  grabTextFrom(locator: CodeceptJS.LocatorOrString): Promise<string>;
1975
1975
  /**
1976
- * Retrieves a value from a form element located by CSS or XPath and returns it to test.
1976
+ * Retrieves an array of value from a form located by CSS or XPath and returns it to test.
1977
1977
  * Resumes test execution, so **should be used inside async function with `await`** operator.
1978
- * If more than one element is found - value of first element is returned.
1979
1978
  *
1980
1979
  * ```js
1981
- * let email = await I.grabValueFrom('input[name=email]');
1980
+ * let inputs = await I.grabValueFromAll('//form/input');
1982
1981
  * ```
1983
1982
  * @param locator - field located by label|name|CSS|XPath|strict locator.
1984
1983
  * @returns attribute value
1985
1984
  */
1986
- grabValueFromAll(locator: CodeceptJS.LocatorOrString): Promise<string>;
1985
+ grabValueFromAll(locator: CodeceptJS.LocatorOrString): Promise<string[]>;
1987
1986
  /**
1988
1987
  * Retrieves a value from a form element located by CSS or XPath and returns it to test.
1989
1988
  * Resumes test execution, so **should be used inside async function with `await`** operator.
@@ -2705,11 +2704,12 @@ declare namespace CodeceptJS {
2705
2704
  /**
2706
2705
  * Checks that title is equal to provided one.
2707
2706
  *
2708
- * ```js
2709
- * I.seeTitleEquals('Test title.');
2710
- * ```
2707
+ * ```js
2708
+ * I.seeTitleEquals('Test title.');
2709
+ * ```
2710
+ * @param text - value to check.
2711
2711
  */
2712
- seeTitleEquals(): void;
2712
+ seeTitleEquals(text: string): void;
2713
2713
  /**
2714
2714
  * Checks that title does not contain text.
2715
2715
  *
@@ -2907,14 +2907,34 @@ declare namespace CodeceptJS {
2907
2907
  */
2908
2908
  clickLink(): void;
2909
2909
  /**
2910
- * Force clicks an element without waiting for it to become visible and not animating.
2910
+ * Perform an emulated click on a link or a button, given by a locator.
2911
+ * Unlike normal click instead of sending native event, emulates a click with JavaScript.
2912
+ * This works on hidden, animated or inactive elements as well.
2913
+ *
2914
+ * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
2915
+ * For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
2916
+ * For images, the "alt" attribute and inner text of any parent links are searched.
2917
+ *
2918
+ * The second parameter is a context (CSS or XPath locator) to narrow the search.
2911
2919
  *
2912
2920
  * ```js
2913
- * I.forceClick('#hiddenButton');
2914
- * I.forceClick('Click me', '#hidden');
2921
+ * // simple link
2922
+ * I.forceClick('Logout');
2923
+ * // button of form
2924
+ * I.forceClick('Submit');
2925
+ * // CSS button
2926
+ * I.forceClick('#form input[type=submit]');
2927
+ * // XPath
2928
+ * I.forceClick('//form/*[@type=submit]');
2929
+ * // link in context
2930
+ * I.forceClick('Logout', '#nav');
2931
+ * // using strict locator
2932
+ * I.forceClick({css: 'nav a.login'});
2915
2933
  * ```
2934
+ * @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
2935
+ * @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
2916
2936
  */
2917
- forceClick(): void;
2937
+ forceClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
2918
2938
  /**
2919
2939
  * Performs a double-click on an element matched by link|button|label|CSS or XPath.
2920
2940
  * Context can be specified as second parameter to narrow search.
@@ -3122,7 +3142,7 @@ declare namespace CodeceptJS {
3122
3142
  * @param field - located by label|name|CSS|XPath|strict locator.
3123
3143
  * @param value - text value to fill.
3124
3144
  */
3125
- fillField(field: CodeceptJS.LocatorOrString, value: string): void;
3145
+ fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
3126
3146
  /**
3127
3147
  * Clears a `<textarea>` or text `<input>` element's value.
3128
3148
  *
@@ -3442,8 +3462,10 @@ declare namespace CodeceptJS {
3442
3462
  * I.executeScript(([x, y]) => x + y, [x, y]);
3443
3463
  * ```
3444
3464
  * If a function returns a Promise it will wait for its resolution.
3465
+ * @param fn - function to be executed in browser context.
3466
+ * @param [arg] - optional argument to pass to the function
3445
3467
  */
3446
- executeScript(): void;
3468
+ executeScript(fn: string | ((...params: any[]) => any), arg?: any): Promise<any>;
3447
3469
  /**
3448
3470
  * Retrieves a text from an element located by CSS or XPath and returns it to test.
3449
3471
  * Resumes test execution, so **should be used inside async with `await`** operator.
@@ -3803,7 +3825,7 @@ declare namespace CodeceptJS {
3803
3825
  /**
3804
3826
  * Waits for navigation to finish. By default takes configured `waitForNavigation` option.
3805
3827
  *
3806
- * See [Pupeteer's reference](https://github.com/microsoft/Playwright/blob/master/docs/api.md#pagewaitfornavigationoptions)
3828
+ * See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
3807
3829
  */
3808
3830
  waitForNavigation(opts: any): void;
3809
3831
  /**
@@ -4243,7 +4265,7 @@ declare namespace CodeceptJS {
4243
4265
  * @param field - located by label|name|CSS|XPath|strict locator.
4244
4266
  * @param value - text value to fill.
4245
4267
  */
4246
- fillField(field: CodeceptJS.LocatorOrString, value: string): void;
4268
+ fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
4247
4269
  /**
4248
4270
  * Presses a key on a focused element.
4249
4271
  * Special keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
@@ -5961,7 +5983,7 @@ declare namespace CodeceptJS {
5961
5983
  *
5962
5984
  * {{ react }}
5963
5985
  */
5964
- fillField(field: CodeceptJS.LocatorOrString, value: string): void;
5986
+ fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
5965
5987
  /**
5966
5988
  * Clears a `<textarea>` or text `<input>` element's value.
5967
5989
  *
@@ -6850,6 +6872,10 @@ declare namespace CodeceptJS {
6850
6872
  *
6851
6873
  * ```js
6852
6874
  * I.sendPostRequest('/api/users.json', { "email": "user@user.com" });
6875
+ *
6876
+ * // To mask the payload in logs
6877
+ * I.sendPostRequest('/api/users.json', secret({ "email": "user@user.com" }));
6878
+ *
6853
6879
  * ```
6854
6880
  * @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
6855
6881
  * @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
@@ -6860,6 +6886,10 @@ declare namespace CodeceptJS {
6860
6886
  *
6861
6887
  * ```js
6862
6888
  * I.sendPatchRequest('/api/users.json', { "email": "user@user.com" });
6889
+ *
6890
+ * // To mask the payload in logs
6891
+ * I.sendPatchRequest('/api/users.json', secret({ "email": "user@user.com" }));
6892
+ *
6863
6893
  * ```
6864
6894
  * @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
6865
6895
  * @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
@@ -6870,6 +6900,10 @@ declare namespace CodeceptJS {
6870
6900
  *
6871
6901
  * ```js
6872
6902
  * I.sendPutRequest('/api/users.json', { "email": "user@user.com" });
6903
+ *
6904
+ * // To mask the payload in logs
6905
+ * I.sendPutRequest('/api/users.json', secret({ "email": "user@user.com" }));
6906
+ *
6873
6907
  * ```
6874
6908
  * @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
6875
6909
  * @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
@@ -7130,7 +7164,7 @@ declare namespace CodeceptJS {
7130
7164
  * @param field - located by label|name|CSS|XPath|strict locator.
7131
7165
  * @param value - text value to fill.
7132
7166
  */
7133
- fillField(field: CodeceptJS.LocatorOrString, value: string): void;
7167
+ fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
7134
7168
  /**
7135
7169
  * Clears a `<textarea>` or text `<input>` element's value.
7136
7170
  *
@@ -8418,7 +8452,7 @@ declare namespace CodeceptJS {
8418
8452
  *
8419
8453
  * {{ react }}
8420
8454
  */
8421
- fillField(field: CodeceptJS.LocatorOrString, value: string): void;
8455
+ fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
8422
8456
  /**
8423
8457
  * Appends text to a input field or textarea.
8424
8458
  * Field is located by name, label, CSS or XPath