codeceptjs 3.4.1 → 3.5.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 +85 -0
- package/README.md +11 -9
- package/bin/codecept.js +1 -1
- package/docs/ai.md +248 -0
- package/docs/build/Appium.js +47 -7
- package/docs/build/JSONResponse.js +4 -4
- package/docs/build/Nightmare.js +3 -1
- package/docs/build/OpenAI.js +122 -0
- package/docs/build/Playwright.js +234 -54
- package/docs/build/Protractor.js +3 -1
- package/docs/build/Puppeteer.js +101 -12
- package/docs/build/REST.js +15 -5
- package/docs/build/TestCafe.js +61 -2
- package/docs/build/WebDriver.js +85 -5
- package/docs/changelog.md +85 -0
- package/docs/helpers/Appium.md +152 -147
- package/docs/helpers/JSONResponse.md +4 -4
- package/docs/helpers/Nightmare.md +2 -0
- package/docs/helpers/OpenAI.md +70 -0
- package/docs/helpers/Playwright.md +228 -151
- package/docs/helpers/Puppeteer.md +153 -101
- package/docs/helpers/REST.md +6 -5
- package/docs/helpers/TestCafe.md +97 -49
- package/docs/helpers/WebDriver.md +159 -107
- package/docs/mobile.md +49 -2
- package/docs/parallel.md +56 -0
- package/docs/plugins.md +87 -33
- package/docs/secrets.md +6 -0
- package/docs/tutorial.md +2 -2
- package/docs/webapi/appendField.mustache +2 -0
- package/docs/webapi/blur.mustache +17 -0
- package/docs/webapi/focus.mustache +12 -0
- package/docs/webapi/type.mustache +3 -0
- package/lib/ai.js +171 -0
- package/lib/cli.js +10 -2
- package/lib/codecept.js +4 -0
- package/lib/command/dryRun.js +9 -1
- package/lib/command/generate.js +46 -3
- package/lib/command/init.js +23 -1
- package/lib/command/interactive.js +15 -1
- package/lib/command/run-workers.js +2 -1
- package/lib/container.js +13 -3
- package/lib/event.js +2 -0
- package/lib/helper/Appium.js +45 -7
- package/lib/helper/JSONResponse.js +4 -4
- package/lib/helper/Nightmare.js +1 -1
- package/lib/helper/OpenAI.js +122 -0
- package/lib/helper/Playwright.js +200 -45
- package/lib/helper/Protractor.js +1 -1
- package/lib/helper/Puppeteer.js +67 -12
- package/lib/helper/REST.js +15 -5
- package/lib/helper/TestCafe.js +30 -2
- package/lib/helper/WebDriver.js +51 -5
- package/lib/helper/scripts/blurElement.js +17 -0
- package/lib/helper/scripts/focusElement.js +17 -0
- package/lib/helper/scripts/highlightElement.js +20 -0
- package/lib/html.js +258 -0
- package/lib/interfaces/gherkin.js +8 -0
- package/lib/listener/retry.js +2 -1
- package/lib/pause.js +73 -17
- package/lib/plugin/debugErrors.js +67 -0
- package/lib/plugin/fakerTransform.js +4 -6
- package/lib/plugin/heal.js +177 -0
- package/lib/plugin/screenshotOnFail.js +11 -2
- package/lib/recorder.js +11 -8
- package/lib/secret.js +5 -4
- package/lib/step.js +6 -1
- package/lib/ui.js +4 -3
- package/lib/utils.js +17 -0
- package/lib/workers.js +57 -9
- package/package.json +25 -16
- package/translations/ja-JP.js +9 -9
- package/typings/index.d.ts +43 -9
- package/typings/promiseBasedTypes.d.ts +242 -25
- package/typings/types.d.ts +260 -35
package/typings/types.d.ts
CHANGED
|
@@ -756,6 +756,8 @@ declare namespace CodeceptJS {
|
|
|
756
756
|
*
|
|
757
757
|
* ```js
|
|
758
758
|
* I.appendField('#myTextField', 'appended');
|
|
759
|
+
* // typing secret
|
|
760
|
+
* I.appendField('password', secret('123456'));
|
|
759
761
|
* ```
|
|
760
762
|
* @param field - located by label|name|CSS|XPath|strict locator
|
|
761
763
|
* @param value - text value to append.
|
|
@@ -1658,16 +1660,16 @@ declare namespace CodeceptJS {
|
|
|
1658
1660
|
*
|
|
1659
1661
|
* I.seeResponseMatchesJsonSchema(joi => {
|
|
1660
1662
|
* return joi.object({
|
|
1661
|
-
* name: joi.string()
|
|
1662
|
-
* id: joi.number()
|
|
1663
|
+
* name: joi.string(),
|
|
1664
|
+
* id: joi.number()
|
|
1663
1665
|
* })
|
|
1664
1666
|
* });
|
|
1665
1667
|
*
|
|
1666
1668
|
* // or pass a valid schema
|
|
1667
|
-
* const joi = require('joi);
|
|
1669
|
+
* const joi = require('joi');
|
|
1668
1670
|
*
|
|
1669
1671
|
* I.seeResponseMatchesJsonSchema(joi.object({
|
|
1670
|
-
* name: joi.string()
|
|
1672
|
+
* name: joi.string(),
|
|
1671
1673
|
* id: joi.number();
|
|
1672
1674
|
* });
|
|
1673
1675
|
* ```
|
|
@@ -2171,6 +2173,8 @@ declare namespace CodeceptJS {
|
|
|
2171
2173
|
*
|
|
2172
2174
|
* ```js
|
|
2173
2175
|
* I.appendField('#myTextField', 'appended');
|
|
2176
|
+
* // typing secret
|
|
2177
|
+
* I.appendField('password', secret('123456'));
|
|
2174
2178
|
* ```
|
|
2175
2179
|
* @param field - located by label|name|CSS|XPath|strict locator
|
|
2176
2180
|
* @param value - text value to append.
|
|
@@ -2676,12 +2680,52 @@ declare namespace CodeceptJS {
|
|
|
2676
2680
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
2677
2681
|
}
|
|
2678
2682
|
/**
|
|
2683
|
+
* OpenAI Helper for CodeceptJS.
|
|
2684
|
+
*
|
|
2685
|
+
* This helper class provides integration with the OpenAI GPT-3.5 or 4 language model for generating responses to questions or prompts within the context of web pages. It allows you to interact with the GPT-3.5 model to obtain intelligent responses based on HTML fragments or general prompts.
|
|
2686
|
+
* This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
|
|
2687
|
+
*
|
|
2679
2688
|
* ## Configuration
|
|
2680
2689
|
*
|
|
2681
|
-
* This helper should be configured in codecept.conf.js
|
|
2682
|
-
*
|
|
2683
|
-
*
|
|
2684
|
-
|
|
2690
|
+
* This helper should be configured in codecept.json or codecept.conf.js
|
|
2691
|
+
*
|
|
2692
|
+
* * `chunkSize`: (optional, default: 80000) - The maximum number of characters to send to the OpenAI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4.
|
|
2693
|
+
*/
|
|
2694
|
+
class OpenAI {
|
|
2695
|
+
/**
|
|
2696
|
+
* Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
|
|
2697
|
+
*
|
|
2698
|
+
* ```js
|
|
2699
|
+
* I.askGptOnPage('what does this page do?');
|
|
2700
|
+
* ```
|
|
2701
|
+
* @param prompt - The question or prompt to ask the GPT model.
|
|
2702
|
+
* @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
|
|
2703
|
+
*/
|
|
2704
|
+
askGptOnPage(prompt: string): Promise<string>;
|
|
2705
|
+
/**
|
|
2706
|
+
* Asks the OpenAI GPT-3.5 language model a question based on the provided prompt within the context of a specific HTML fragment on the current page.
|
|
2707
|
+
*
|
|
2708
|
+
* ```js
|
|
2709
|
+
* I.askGptOnPageFragment('describe features of this screen', '.screen');
|
|
2710
|
+
* ```
|
|
2711
|
+
* @param prompt - The question or prompt to ask the GPT-3.5 model.
|
|
2712
|
+
* @param locator - The locator or selector used to identify the HTML fragment on the page.
|
|
2713
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
2714
|
+
*/
|
|
2715
|
+
askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
|
|
2716
|
+
/**
|
|
2717
|
+
* Send a general request to ChatGPT and return response.
|
|
2718
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
2719
|
+
*/
|
|
2720
|
+
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* ## Configuration
|
|
2724
|
+
*
|
|
2725
|
+
* This helper should be configured in codecept.conf.(js|ts)
|
|
2726
|
+
* @property [url] - base url of website to be tested
|
|
2727
|
+
* @property [browser = 'chromium'] - a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
2728
|
+
* @property [show = true] - show browser window.
|
|
2685
2729
|
* @property [restart = false] - restart strategy between tests. Possible values:
|
|
2686
2730
|
* * 'context' or **false** - restarts [browser context](https://playwright.dev/docs/api/class-browsercontext) but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
2687
2731
|
* * 'browser' or **true** - closes browser and opens it again between tests.
|
|
@@ -2714,10 +2758,12 @@ declare namespace CodeceptJS {
|
|
|
2714
2758
|
* @property [channel] - (While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge](https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge).
|
|
2715
2759
|
* @property [ignoreLog] - An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values](https://playwright.dev/docs/api/class-consolemessage#console-message-type).
|
|
2716
2760
|
* @property [ignoreHTTPSErrors] - Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
2761
|
+
* @property [bypassCSP] - bypass Content Security Policy or CSP
|
|
2762
|
+
* @property [highlightElement] - highlight the interacting elements
|
|
2717
2763
|
*/
|
|
2718
2764
|
type PlaywrightConfig = {
|
|
2719
|
-
url
|
|
2720
|
-
browser?:
|
|
2765
|
+
url?: string;
|
|
2766
|
+
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
2721
2767
|
show?: boolean;
|
|
2722
2768
|
restart?: string | boolean;
|
|
2723
2769
|
timeout?: number;
|
|
@@ -2732,13 +2778,13 @@ declare namespace CodeceptJS {
|
|
|
2732
2778
|
keepBrowserState?: boolean;
|
|
2733
2779
|
keepCookies?: boolean;
|
|
2734
2780
|
waitForAction?: number;
|
|
2735
|
-
waitForNavigation?:
|
|
2781
|
+
waitForNavigation?: 'load' | 'domcontentloaded' | 'networkidle';
|
|
2736
2782
|
pressKeyDelay?: number;
|
|
2737
2783
|
getPageTimeout?: number;
|
|
2738
2784
|
waitForTimeout?: number;
|
|
2739
2785
|
basicAuth?: any;
|
|
2740
2786
|
windowSize?: string;
|
|
2741
|
-
colorScheme?:
|
|
2787
|
+
colorScheme?: 'dark' | 'light' | 'no-preference';
|
|
2742
2788
|
userAgent?: string;
|
|
2743
2789
|
locale?: string;
|
|
2744
2790
|
manualStart?: boolean;
|
|
@@ -2748,6 +2794,8 @@ declare namespace CodeceptJS {
|
|
|
2748
2794
|
channel?: any;
|
|
2749
2795
|
ignoreLog?: string[];
|
|
2750
2796
|
ignoreHTTPSErrors?: boolean;
|
|
2797
|
+
bypassCSP?: boolean;
|
|
2798
|
+
highlightElement?: boolean;
|
|
2751
2799
|
};
|
|
2752
2800
|
/**
|
|
2753
2801
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
@@ -2783,7 +2831,7 @@ declare namespace CodeceptJS {
|
|
|
2783
2831
|
*
|
|
2784
2832
|
* #### Trace Recording Customization
|
|
2785
2833
|
*
|
|
2786
|
-
* Trace recording provides
|
|
2834
|
+
* Trace recording provides complete information on test execution and includes DOM snapshots, screenshots, and network requests logged during run.
|
|
2787
2835
|
* Traces will be saved to `output/trace`
|
|
2788
2836
|
*
|
|
2789
2837
|
* * `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
|
|
@@ -2913,6 +2961,22 @@ declare namespace CodeceptJS {
|
|
|
2913
2961
|
* }
|
|
2914
2962
|
* ```
|
|
2915
2963
|
*
|
|
2964
|
+
* * #### Example #9: Launch electron test
|
|
2965
|
+
*
|
|
2966
|
+
* ```js
|
|
2967
|
+
* {
|
|
2968
|
+
* helpers: {
|
|
2969
|
+
* Playwright: {
|
|
2970
|
+
* browser: 'electron',
|
|
2971
|
+
* electron: {
|
|
2972
|
+
* executablePath: require("electron"),
|
|
2973
|
+
* args: [path.join('../', "main.js")],
|
|
2974
|
+
* },
|
|
2975
|
+
* }
|
|
2976
|
+
* },
|
|
2977
|
+
* }
|
|
2978
|
+
* ```
|
|
2979
|
+
*
|
|
2916
2980
|
* Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
2917
2981
|
*
|
|
2918
2982
|
* ## Access From Helpers
|
|
@@ -3078,6 +3142,39 @@ declare namespace CodeceptJS {
|
|
|
3078
3142
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3079
3143
|
*/
|
|
3080
3144
|
moveCursorTo(locator: CodeceptJS.LocatorOrString, offsetX?: number, offsetY?: number): void;
|
|
3145
|
+
/**
|
|
3146
|
+
* Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
|
|
3147
|
+
*
|
|
3148
|
+
* Examples:
|
|
3149
|
+
*
|
|
3150
|
+
* ```js
|
|
3151
|
+
* I.dontSee('#add-to-cart-btn');
|
|
3152
|
+
* I.focus('#product-tile')
|
|
3153
|
+
* I.see('#add-to-cart-bnt');
|
|
3154
|
+
* ```
|
|
3155
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
3156
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
|
|
3157
|
+
*/
|
|
3158
|
+
focus(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
3159
|
+
/**
|
|
3160
|
+
* Remove focus from a text input, button, etc.
|
|
3161
|
+
* Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
|
3162
|
+
*
|
|
3163
|
+
* Examples:
|
|
3164
|
+
*
|
|
3165
|
+
* ```js
|
|
3166
|
+
* I.blur('.text-area')
|
|
3167
|
+
* ```
|
|
3168
|
+
* ```js
|
|
3169
|
+
* //element `#product-tile` is focused
|
|
3170
|
+
* I.see('#add-to-cart-btn');
|
|
3171
|
+
* I.blur('#product-tile')
|
|
3172
|
+
* I.dontSee('#add-to-cart-btn');
|
|
3173
|
+
* ```
|
|
3174
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
3175
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
|
|
3176
|
+
*/
|
|
3177
|
+
blur(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
3081
3178
|
/**
|
|
3082
3179
|
* Drag an item to a destination element.
|
|
3083
3180
|
*
|
|
@@ -3094,7 +3191,7 @@ declare namespace CodeceptJS {
|
|
|
3094
3191
|
* I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
3095
3192
|
* ```
|
|
3096
3193
|
*
|
|
3097
|
-
* >
|
|
3194
|
+
* > When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example `force: true`
|
|
3098
3195
|
*/
|
|
3099
3196
|
dragAndDrop(srcElement: LocatorOrString, destElement: LocatorOrString, options?: any): void;
|
|
3100
3197
|
/**
|
|
@@ -3378,7 +3475,7 @@ declare namespace CodeceptJS {
|
|
|
3378
3475
|
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
3379
3476
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
3380
3477
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
3381
|
-
* @param [
|
|
3478
|
+
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
|
|
3382
3479
|
*
|
|
3383
3480
|
* Examples:
|
|
3384
3481
|
*
|
|
@@ -3390,7 +3487,7 @@ declare namespace CodeceptJS {
|
|
|
3390
3487
|
* I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
3391
3488
|
* ```
|
|
3392
3489
|
*/
|
|
3393
|
-
click(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null,
|
|
3490
|
+
click(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null, options?: any): void;
|
|
3394
3491
|
/**
|
|
3395
3492
|
* Clicks link and waits for navigation (deprecated)
|
|
3396
3493
|
*/
|
|
@@ -3641,6 +3738,9 @@ declare namespace CodeceptJS {
|
|
|
3641
3738
|
*
|
|
3642
3739
|
* // passing in an array
|
|
3643
3740
|
* I.type(['T', 'E', 'X', 'T']);
|
|
3741
|
+
*
|
|
3742
|
+
* // passing a secret
|
|
3743
|
+
* I.type(secret('123456'));
|
|
3644
3744
|
* ```
|
|
3645
3745
|
* @param key - or array of keys to type.
|
|
3646
3746
|
* @param [delay = null] - (optional) delay in ms between key presses
|
|
@@ -3667,23 +3767,30 @@ declare namespace CodeceptJS {
|
|
|
3667
3767
|
*/
|
|
3668
3768
|
fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
|
|
3669
3769
|
/**
|
|
3670
|
-
* Clears
|
|
3770
|
+
* Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
|
|
3771
|
+
*
|
|
3772
|
+
*
|
|
3773
|
+
* Examples:
|
|
3671
3774
|
*
|
|
3672
3775
|
* ```js
|
|
3673
|
-
* I.clearField('
|
|
3674
|
-
*
|
|
3675
|
-
*
|
|
3776
|
+
* I.clearField('.text-area')
|
|
3777
|
+
*
|
|
3778
|
+
* // if this doesn't work use force option
|
|
3779
|
+
* I.clearField('#submit', { force: true })
|
|
3676
3780
|
* ```
|
|
3677
|
-
*
|
|
3678
|
-
*
|
|
3781
|
+
* Use `force` to bypass the [actionability](https://playwright.dev/docs/actionability) checks.
|
|
3782
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
3783
|
+
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-clear) for available options object as 2nd argument.
|
|
3679
3784
|
*/
|
|
3680
|
-
clearField(
|
|
3785
|
+
clearField(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
3681
3786
|
/**
|
|
3682
3787
|
* Appends text to a input field or textarea.
|
|
3683
3788
|
* Field is located by name, label, CSS or XPath
|
|
3684
3789
|
*
|
|
3685
3790
|
* ```js
|
|
3686
3791
|
* I.appendField('#myTextField', 'appended');
|
|
3792
|
+
* // typing secret
|
|
3793
|
+
* I.appendField('password', secret('123456'));
|
|
3687
3794
|
* ```
|
|
3688
3795
|
* @param field - located by label|name|CSS|XPath|strict locator
|
|
3689
3796
|
* @param value - text value to append.
|
|
@@ -4413,7 +4520,7 @@ declare namespace CodeceptJS {
|
|
|
4413
4520
|
*
|
|
4414
4521
|
* See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
|
|
4415
4522
|
*/
|
|
4416
|
-
waitForNavigation(
|
|
4523
|
+
waitForNavigation(options: any): void;
|
|
4417
4524
|
/**
|
|
4418
4525
|
* Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
4419
4526
|
* Element can be located by CSS or XPath.
|
|
@@ -4939,6 +5046,8 @@ declare namespace CodeceptJS {
|
|
|
4939
5046
|
*
|
|
4940
5047
|
* ```js
|
|
4941
5048
|
* I.appendField('#myTextField', 'appended');
|
|
5049
|
+
* // typing secret
|
|
5050
|
+
* I.appendField('password', secret('123456'));
|
|
4942
5051
|
* ```
|
|
4943
5052
|
* @param field - located by label|name|CSS|XPath|strict locator
|
|
4944
5053
|
* @param value - text value to append.
|
|
@@ -5875,6 +5984,7 @@ declare namespace CodeceptJS {
|
|
|
5875
5984
|
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
5876
5985
|
* @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
5877
5986
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
5987
|
+
* @property [highlightElement] - highlight the interacting elements
|
|
5878
5988
|
*/
|
|
5879
5989
|
type PuppeteerConfig = {
|
|
5880
5990
|
url: string;
|
|
@@ -5896,6 +6006,7 @@ declare namespace CodeceptJS {
|
|
|
5896
6006
|
manualStart?: boolean;
|
|
5897
6007
|
browser?: string;
|
|
5898
6008
|
chrome?: any;
|
|
6009
|
+
highlightElement?: boolean;
|
|
5899
6010
|
};
|
|
5900
6011
|
/**
|
|
5901
6012
|
* Uses [Google Chrome's Puppeteer](https://github.com/GoogleChrome/puppeteer) library to run tests inside headless Chrome.
|
|
@@ -6157,6 +6268,39 @@ declare namespace CodeceptJS {
|
|
|
6157
6268
|
* {{ react }}
|
|
6158
6269
|
*/
|
|
6159
6270
|
moveCursorTo(locator: CodeceptJS.LocatorOrString, offsetX?: number, offsetY?: number): void;
|
|
6271
|
+
/**
|
|
6272
|
+
* Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
|
|
6273
|
+
*
|
|
6274
|
+
* Examples:
|
|
6275
|
+
*
|
|
6276
|
+
* ```js
|
|
6277
|
+
* I.dontSee('#add-to-cart-btn');
|
|
6278
|
+
* I.focus('#product-tile')
|
|
6279
|
+
* I.see('#add-to-cart-bnt');
|
|
6280
|
+
* ```
|
|
6281
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
6282
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
|
|
6283
|
+
*/
|
|
6284
|
+
focus(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
6285
|
+
/**
|
|
6286
|
+
* Remove focus from a text input, button, etc.
|
|
6287
|
+
* Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
|
6288
|
+
*
|
|
6289
|
+
* Examples:
|
|
6290
|
+
*
|
|
6291
|
+
* ```js
|
|
6292
|
+
* I.blur('.text-area')
|
|
6293
|
+
* ```
|
|
6294
|
+
* ```js
|
|
6295
|
+
* //element `#product-tile` is focused
|
|
6296
|
+
* I.see('#add-to-cart-btn');
|
|
6297
|
+
* I.blur('#product-tile')
|
|
6298
|
+
* I.dontSee('#add-to-cart-btn');
|
|
6299
|
+
* ```
|
|
6300
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
6301
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
|
|
6302
|
+
*/
|
|
6303
|
+
blur(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
6160
6304
|
/**
|
|
6161
6305
|
* Drag an item to a destination element.
|
|
6162
6306
|
*
|
|
@@ -6693,6 +6837,9 @@ declare namespace CodeceptJS {
|
|
|
6693
6837
|
*
|
|
6694
6838
|
* // passing in an array
|
|
6695
6839
|
* I.type(['T', 'E', 'X', 'T']);
|
|
6840
|
+
*
|
|
6841
|
+
* // passing a secret
|
|
6842
|
+
* I.type(secret('123456'));
|
|
6696
6843
|
* ```
|
|
6697
6844
|
* @param key - or array of keys to type.
|
|
6698
6845
|
* @param [delay = null] - (optional) delay in ms between key presses
|
|
@@ -6738,6 +6885,8 @@ declare namespace CodeceptJS {
|
|
|
6738
6885
|
*
|
|
6739
6886
|
* ```js
|
|
6740
6887
|
* I.appendField('#myTextField', 'appended');
|
|
6888
|
+
* // typing secret
|
|
6889
|
+
* I.appendField('password', secret('123456'));
|
|
6741
6890
|
* ```
|
|
6742
6891
|
* @param field - located by label|name|CSS|XPath|strict locator
|
|
6743
6892
|
* @param value - text value to append.
|
|
@@ -7616,7 +7765,8 @@ declare namespace CodeceptJS {
|
|
|
7616
7765
|
* endpoint: 'http://site.com/api',
|
|
7617
7766
|
* prettyPrintJson: true,
|
|
7618
7767
|
* onRequest: (request) => {
|
|
7619
|
-
*
|
|
7768
|
+
* request.headers.auth = '123';
|
|
7769
|
+
* }
|
|
7620
7770
|
* }
|
|
7621
7771
|
* }
|
|
7622
7772
|
* }
|
|
@@ -7675,7 +7825,7 @@ declare namespace CodeceptJS {
|
|
|
7675
7825
|
* ```js
|
|
7676
7826
|
* I.sendGetRequest('/api/users.json');
|
|
7677
7827
|
* ```
|
|
7678
|
-
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
7828
|
+
* @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
|
|
7679
7829
|
* @returns response
|
|
7680
7830
|
*/
|
|
7681
7831
|
sendGetRequest(url: any, headers?: any): Promise<any>;
|
|
@@ -7689,8 +7839,8 @@ declare namespace CodeceptJS {
|
|
|
7689
7839
|
* I.sendPostRequest('/api/users.json', secret({ "email": "user@user.com" }));
|
|
7690
7840
|
*
|
|
7691
7841
|
* ```
|
|
7692
|
-
* @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
|
|
7693
|
-
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
7842
|
+
* @param [payload = {}] - the payload to be sent. By default, it is sent as an empty object
|
|
7843
|
+
* @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
|
|
7694
7844
|
* @returns response
|
|
7695
7845
|
*/
|
|
7696
7846
|
sendPostRequest(url: any, payload?: any, headers?: any): Promise<any>;
|
|
@@ -7730,7 +7880,7 @@ declare namespace CodeceptJS {
|
|
|
7730
7880
|
* ```js
|
|
7731
7881
|
* I.sendDeleteRequest('/api/users/1');
|
|
7732
7882
|
* ```
|
|
7733
|
-
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
7883
|
+
* @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
|
|
7734
7884
|
* @returns response
|
|
7735
7885
|
*/
|
|
7736
7886
|
sendDeleteRequest(url: any, headers?: any): Promise<any>;
|
|
@@ -7920,6 +8070,39 @@ declare namespace CodeceptJS {
|
|
|
7920
8070
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
7921
8071
|
*/
|
|
7922
8072
|
resizeWindow(width: number, height: number): void;
|
|
8073
|
+
/**
|
|
8074
|
+
* Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
|
|
8075
|
+
*
|
|
8076
|
+
* Examples:
|
|
8077
|
+
*
|
|
8078
|
+
* ```js
|
|
8079
|
+
* I.dontSee('#add-to-cart-btn');
|
|
8080
|
+
* I.focus('#product-tile')
|
|
8081
|
+
* I.see('#add-to-cart-bnt');
|
|
8082
|
+
* ```
|
|
8083
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
8084
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
|
|
8085
|
+
*/
|
|
8086
|
+
focus(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
8087
|
+
/**
|
|
8088
|
+
* Remove focus from a text input, button, etc.
|
|
8089
|
+
* Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
|
8090
|
+
*
|
|
8091
|
+
* Examples:
|
|
8092
|
+
*
|
|
8093
|
+
* ```js
|
|
8094
|
+
* I.blur('.text-area')
|
|
8095
|
+
* ```
|
|
8096
|
+
* ```js
|
|
8097
|
+
* //element `#product-tile` is focused
|
|
8098
|
+
* I.see('#add-to-cart-btn');
|
|
8099
|
+
* I.blur('#product-tile')
|
|
8100
|
+
* I.dontSee('#add-to-cart-btn');
|
|
8101
|
+
* ```
|
|
8102
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
8103
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
|
|
8104
|
+
*/
|
|
8105
|
+
blur(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
7923
8106
|
/**
|
|
7924
8107
|
* Perform a click on a link or a button, given by a locator.
|
|
7925
8108
|
* If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
@@ -8005,6 +8188,8 @@ declare namespace CodeceptJS {
|
|
|
8005
8188
|
*
|
|
8006
8189
|
* ```js
|
|
8007
8190
|
* I.appendField('#myTextField', 'appended');
|
|
8191
|
+
* // typing secret
|
|
8192
|
+
* I.appendField('password', secret('123456'));
|
|
8008
8193
|
* ```
|
|
8009
8194
|
* @param field - located by label|name|CSS|XPath|strict locator
|
|
8010
8195
|
* @param value - text value to append.
|
|
@@ -8420,7 +8605,7 @@ declare namespace CodeceptJS {
|
|
|
8420
8605
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
8421
8606
|
*
|
|
8422
8607
|
*
|
|
8423
|
-
* If a function returns a Promise It will wait for
|
|
8608
|
+
* If a function returns a Promise It will wait for its resolution.
|
|
8424
8609
|
*/
|
|
8425
8610
|
executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
|
|
8426
8611
|
/**
|
|
@@ -8756,7 +8941,7 @@ declare namespace CodeceptJS {
|
|
|
8756
8941
|
*
|
|
8757
8942
|
* This helper should be configured in codecept.conf.js
|
|
8758
8943
|
* @property url - base url of website to be tested.
|
|
8759
|
-
* @property browser -
|
|
8944
|
+
* @property browser - Browser in which to perform testing.
|
|
8760
8945
|
* @property [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
8761
8946
|
* @property [host = localhost] - WebDriver host to connect.
|
|
8762
8947
|
* @property [port = 4444] - WebDriver port to connect.
|
|
@@ -8774,6 +8959,7 @@ declare namespace CodeceptJS {
|
|
|
8774
8959
|
* @property [desiredCapabilities] - Selenium's [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities).
|
|
8775
8960
|
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
8776
8961
|
* @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
|
|
8962
|
+
* @property [highlightElement] - highlight the interacting elements
|
|
8777
8963
|
*/
|
|
8778
8964
|
type WebDriverConfig = {
|
|
8779
8965
|
url: string;
|
|
@@ -8795,6 +8981,7 @@ declare namespace CodeceptJS {
|
|
|
8795
8981
|
desiredCapabilities?: any;
|
|
8796
8982
|
manualStart?: boolean;
|
|
8797
8983
|
timeouts?: any;
|
|
8984
|
+
highlightElement?: boolean;
|
|
8798
8985
|
};
|
|
8799
8986
|
/**
|
|
8800
8987
|
* WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
|
|
@@ -9157,7 +9344,7 @@ declare namespace CodeceptJS {
|
|
|
9157
9344
|
*/
|
|
9158
9345
|
_locate(locator: CodeceptJS.LocatorOrString): void;
|
|
9159
9346
|
/**
|
|
9160
|
-
* Find a checkbox by providing human
|
|
9347
|
+
* Find a checkbox by providing human-readable text:
|
|
9161
9348
|
*
|
|
9162
9349
|
* ```js
|
|
9163
9350
|
* this.helpers['WebDriver']._locateCheckable('I agree with terms and conditions').then // ...
|
|
@@ -9166,7 +9353,7 @@ declare namespace CodeceptJS {
|
|
|
9166
9353
|
*/
|
|
9167
9354
|
_locateCheckable(locator: CodeceptJS.LocatorOrString): void;
|
|
9168
9355
|
/**
|
|
9169
|
-
* Find a clickable element by providing human
|
|
9356
|
+
* Find a clickable element by providing human-readable text:
|
|
9170
9357
|
*
|
|
9171
9358
|
* ```js
|
|
9172
9359
|
* const els = await this.helpers.WebDriver._locateClickable('Next page');
|
|
@@ -9176,7 +9363,7 @@ declare namespace CodeceptJS {
|
|
|
9176
9363
|
*/
|
|
9177
9364
|
_locateClickable(locator: CodeceptJS.LocatorOrString): void;
|
|
9178
9365
|
/**
|
|
9179
|
-
* Find field elements by providing human
|
|
9366
|
+
* Find field elements by providing human-readable text:
|
|
9180
9367
|
*
|
|
9181
9368
|
* ```js
|
|
9182
9369
|
* this.helpers['WebDriver']._locateFields('Your email').then // ...
|
|
@@ -9360,6 +9547,8 @@ declare namespace CodeceptJS {
|
|
|
9360
9547
|
*
|
|
9361
9548
|
* ```js
|
|
9362
9549
|
* I.appendField('#myTextField', 'appended');
|
|
9550
|
+
* // typing secret
|
|
9551
|
+
* I.appendField('password', secret('123456'));
|
|
9363
9552
|
* ```
|
|
9364
9553
|
* @param field - located by label|name|CSS|XPath|strict locator
|
|
9365
9554
|
* @param value - text value to append.
|
|
@@ -10239,6 +10428,9 @@ declare namespace CodeceptJS {
|
|
|
10239
10428
|
*
|
|
10240
10429
|
* // passing in an array
|
|
10241
10430
|
* I.type(['T', 'E', 'X', 'T']);
|
|
10431
|
+
*
|
|
10432
|
+
* // passing a secret
|
|
10433
|
+
* I.type(secret('123456'));
|
|
10242
10434
|
* ```
|
|
10243
10435
|
* @param key - or array of keys to type.
|
|
10244
10436
|
* @param [delay = null] - (optional) delay in ms between key presses
|
|
@@ -10255,6 +10447,39 @@ declare namespace CodeceptJS {
|
|
|
10255
10447
|
* Appium: not tested in web, in apps doesn't work
|
|
10256
10448
|
*/
|
|
10257
10449
|
resizeWindow(width: number, height: number): void;
|
|
10450
|
+
/**
|
|
10451
|
+
* Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
|
|
10452
|
+
*
|
|
10453
|
+
* Examples:
|
|
10454
|
+
*
|
|
10455
|
+
* ```js
|
|
10456
|
+
* I.dontSee('#add-to-cart-btn');
|
|
10457
|
+
* I.focus('#product-tile')
|
|
10458
|
+
* I.see('#add-to-cart-bnt');
|
|
10459
|
+
* ```
|
|
10460
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
10461
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
|
|
10462
|
+
*/
|
|
10463
|
+
focus(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
10464
|
+
/**
|
|
10465
|
+
* Remove focus from a text input, button, etc.
|
|
10466
|
+
* Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
|
10467
|
+
*
|
|
10468
|
+
* Examples:
|
|
10469
|
+
*
|
|
10470
|
+
* ```js
|
|
10471
|
+
* I.blur('.text-area')
|
|
10472
|
+
* ```
|
|
10473
|
+
* ```js
|
|
10474
|
+
* //element `#product-tile` is focused
|
|
10475
|
+
* I.see('#add-to-cart-btn');
|
|
10476
|
+
* I.blur('#product-tile')
|
|
10477
|
+
* I.dontSee('#add-to-cart-btn');
|
|
10478
|
+
* ```
|
|
10479
|
+
* @param locator - field located by label|name|CSS|XPath|strict locator.
|
|
10480
|
+
* @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
|
|
10481
|
+
*/
|
|
10482
|
+
blur(locator: CodeceptJS.LocatorOrString, options?: any): void;
|
|
10258
10483
|
/**
|
|
10259
10484
|
* Drag an item to a destination element.
|
|
10260
10485
|
*
|
|
@@ -11134,7 +11359,7 @@ declare namespace CodeceptJS {
|
|
|
11134
11359
|
* true: it will retries if `retryOpts` set.
|
|
11135
11360
|
* false: ignore `retryOpts` and won't retry.
|
|
11136
11361
|
*/
|
|
11137
|
-
add(taskName: string | ((...params: any[]) => any), fn?: (...params: any[]) => any, force?: boolean, retry?: boolean, timeout?: number): Promise<any
|
|
11362
|
+
add(taskName: string | ((...params: any[]) => any), fn?: (...params: any[]) => any, force?: boolean, retry?: boolean, timeout?: number): Promise<any>;
|
|
11138
11363
|
retry(opts: any): any;
|
|
11139
11364
|
catch(customErrFn?: (...params: any[]) => any): Promise<any>;
|
|
11140
11365
|
catchWithoutStop(customErrFn: (...params: any[]) => any): Promise<any>;
|