codeceptjs 3.5.0 → 3.5.2

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.
@@ -2879,6 +2879,22 @@ declare namespace CodeceptJS {
2879
2879
  * }
2880
2880
  * ```
2881
2881
  *
2882
+ * * #### Example #9: Launch electron test
2883
+ *
2884
+ * ```js
2885
+ * {
2886
+ * helpers: {
2887
+ * Playwright: {
2888
+ * browser: 'electron',
2889
+ * electron: {
2890
+ * executablePath: require("electron"),
2891
+ * args: [path.join('../', "main.js")],
2892
+ * },
2893
+ * }
2894
+ * },
2895
+ * }
2896
+ * ```
2897
+ *
2882
2898
  * Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
2883
2899
  *
2884
2900
  * ## Access From Helpers
@@ -3045,8 +3061,6 @@ declare namespace CodeceptJS {
3045
3061
  moveCursorTo(locator: CodeceptJS.LocatorOrString, offsetX?: number, offsetY?: number): Promise<any>;
3046
3062
  /**
3047
3063
  * Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
3048
- * @param locator - field located by label|name|CSS|XPath|strict locator.
3049
- * @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
3050
3064
  *
3051
3065
  * Examples:
3052
3066
  *
@@ -3055,13 +3069,13 @@ declare namespace CodeceptJS {
3055
3069
  * I.focus('#product-tile')
3056
3070
  * I.see('#add-to-cart-bnt');
3057
3071
  * ```
3072
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
3073
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
3058
3074
  */
3059
3075
  focus(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
3060
3076
  /**
3061
- * Remove focus from a text input, button, etc
3062
- * Calls [blur](https://playwright.dev/docs/api/class-locator#locator-blur) on the element.
3063
- * @param locator - field located by label|name|CSS|XPath|strict locator.
3064
- * @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
3077
+ * Remove focus from a text input, button, etc.
3078
+ * Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
3065
3079
  *
3066
3080
  * Examples:
3067
3081
  *
@@ -3074,6 +3088,8 @@ declare namespace CodeceptJS {
3074
3088
  * I.blur('#product-tile')
3075
3089
  * I.dontSee('#add-to-cart-btn');
3076
3090
  * ```
3091
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
3092
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
3077
3093
  */
3078
3094
  blur(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
3079
3095
  /**
@@ -3668,18 +3684,20 @@ declare namespace CodeceptJS {
3668
3684
  */
3669
3685
  fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): Promise<any>;
3670
3686
  /**
3671
- * Clear the <input>, <textarea> or [contenteditable] .
3672
- * @param locator - field located by label|name|CSS|XPath|strict locator.
3673
- * @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-clear) for available options object as 2nd argument.
3687
+ * Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
3688
+ *
3674
3689
  *
3675
3690
  * Examples:
3676
3691
  *
3677
3692
  * ```js
3678
3693
  * I.clearField('.text-area')
3694
+ *
3695
+ * // if this doesn't work use force option
3696
+ * I.clearField('#submit', { force: true })
3679
3697
  * ```
3680
- * ```js
3681
- * I.clearField('#submit', { force: true }) // force to bypass the [actionability](https://playwright.dev/docs/actionability) checks.
3682
- * ```
3698
+ * Use `force` to bypass the [actionability](https://playwright.dev/docs/actionability) checks.
3699
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
3700
+ * @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-clear) for available options object as 2nd argument.
3683
3701
  */
3684
3702
  clearField(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
3685
3703
  /**
@@ -6118,6 +6136,39 @@ declare namespace CodeceptJS {
6118
6136
  * {{ react }}
6119
6137
  */
6120
6138
  moveCursorTo(locator: CodeceptJS.LocatorOrString, offsetX?: number, offsetY?: number): Promise<any>;
6139
+ /**
6140
+ * Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
6141
+ *
6142
+ * Examples:
6143
+ *
6144
+ * ```js
6145
+ * I.dontSee('#add-to-cart-btn');
6146
+ * I.focus('#product-tile')
6147
+ * I.see('#add-to-cart-bnt');
6148
+ * ```
6149
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
6150
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
6151
+ */
6152
+ focus(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
6153
+ /**
6154
+ * Remove focus from a text input, button, etc.
6155
+ * Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
6156
+ *
6157
+ * Examples:
6158
+ *
6159
+ * ```js
6160
+ * I.blur('.text-area')
6161
+ * ```
6162
+ * ```js
6163
+ * //element `#product-tile` is focused
6164
+ * I.see('#add-to-cart-btn');
6165
+ * I.blur('#product-tile')
6166
+ * I.dontSee('#add-to-cart-btn');
6167
+ * ```
6168
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
6169
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
6170
+ */
6171
+ blur(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
6121
6172
  /**
6122
6173
  * Drag an item to a destination element.
6123
6174
  *
@@ -7867,6 +7918,39 @@ declare namespace CodeceptJS {
7867
7918
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
7868
7919
  */
7869
7920
  resizeWindow(width: number, height: number): Promise<any>;
7921
+ /**
7922
+ * Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
7923
+ *
7924
+ * Examples:
7925
+ *
7926
+ * ```js
7927
+ * I.dontSee('#add-to-cart-btn');
7928
+ * I.focus('#product-tile')
7929
+ * I.see('#add-to-cart-bnt');
7930
+ * ```
7931
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
7932
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
7933
+ */
7934
+ focus(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
7935
+ /**
7936
+ * Remove focus from a text input, button, etc.
7937
+ * Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
7938
+ *
7939
+ * Examples:
7940
+ *
7941
+ * ```js
7942
+ * I.blur('.text-area')
7943
+ * ```
7944
+ * ```js
7945
+ * //element `#product-tile` is focused
7946
+ * I.see('#add-to-cart-btn');
7947
+ * I.blur('#product-tile')
7948
+ * I.dontSee('#add-to-cart-btn');
7949
+ * ```
7950
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
7951
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
7952
+ */
7953
+ blur(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
7870
7954
  /**
7871
7955
  * Perform a click on a link or a button, given by a locator.
7872
7956
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -8369,7 +8453,7 @@ declare namespace CodeceptJS {
8369
8453
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
8370
8454
  *
8371
8455
  *
8372
- * If a function returns a Promise It will wait for it resolution.
8456
+ * If a function returns a Promise It will wait for its resolution.
8373
8457
  */
8374
8458
  executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
8375
8459
  /**
@@ -10163,6 +10247,39 @@ declare namespace CodeceptJS {
10163
10247
  * Appium: not tested in web, in apps doesn't work
10164
10248
  */
10165
10249
  resizeWindow(width: number, height: number): Promise<any>;
10250
+ /**
10251
+ * Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
10252
+ *
10253
+ * Examples:
10254
+ *
10255
+ * ```js
10256
+ * I.dontSee('#add-to-cart-btn');
10257
+ * I.focus('#product-tile')
10258
+ * I.see('#add-to-cart-bnt');
10259
+ * ```
10260
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
10261
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
10262
+ */
10263
+ focus(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
10264
+ /**
10265
+ * Remove focus from a text input, button, etc.
10266
+ * Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
10267
+ *
10268
+ * Examples:
10269
+ *
10270
+ * ```js
10271
+ * I.blur('.text-area')
10272
+ * ```
10273
+ * ```js
10274
+ * //element `#product-tile` is focused
10275
+ * I.see('#add-to-cart-btn');
10276
+ * I.blur('#product-tile')
10277
+ * I.dontSee('#add-to-cart-btn');
10278
+ * ```
10279
+ * @param locator - field located by label|name|CSS|XPath|strict locator.
10280
+ * @param [options] - Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
10281
+ */
10282
+ blur(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
10166
10283
  /**
10167
10284
  * Drag an item to a destination element.
10168
10285
  *
@@ -2722,10 +2722,10 @@ declare namespace CodeceptJS {
2722
2722
  /**
2723
2723
  * ## Configuration
2724
2724
  *
2725
- * This helper should be configured in codecept.conf.js
2726
- * @property url - base url of website to be tested
2725
+ * This helper should be configured in codecept.conf.(js|ts)
2726
+ * @property [url] - base url of website to be tested
2727
2727
  * @property [browser = 'chromium'] - a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
2728
- * @property [show = false] - show browser window.
2728
+ * @property [show = true] - show browser window.
2729
2729
  * @property [restart = false] - restart strategy between tests. Possible values:
2730
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.
2731
2731
  * * 'browser' or **true** - closes browser and opens it again between tests.
@@ -2762,7 +2762,7 @@ declare namespace CodeceptJS {
2762
2762
  * @property [highlightElement] - highlight the interacting elements
2763
2763
  */
2764
2764
  type PlaywrightConfig = {
2765
- url: string;
2765
+ url?: string;
2766
2766
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
2767
2767
  show?: boolean;
2768
2768
  restart?: string | boolean;
@@ -2961,6 +2961,22 @@ declare namespace CodeceptJS {
2961
2961
  * }
2962
2962
  * ```
2963
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
+ *
2964
2980
  * Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
2965
2981
  *
2966
2982
  * ## Access From Helpers
@@ -3128,8 +3144,6 @@ declare namespace CodeceptJS {
3128
3144
  moveCursorTo(locator: CodeceptJS.LocatorOrString, offsetX?: number, offsetY?: number): void;
3129
3145
  /**
3130
3146
  * Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the matching element.
3131
- * @param locator - field located by label|name|CSS|XPath|strict locator.
3132
- * @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
3133
3147
  *
3134
3148
  * Examples:
3135
3149
  *
@@ -3138,13 +3152,13 @@ declare namespace CodeceptJS {
3138
3152
  * I.focus('#product-tile')
3139
3153
  * I.see('#add-to-cart-bnt');
3140
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.
3141
3157
  */
3142
3158
  focus(locator: CodeceptJS.LocatorOrString, options?: any): void;
3143
3159
  /**
3144
- * Remove focus from a text input, button, etc
3145
- * Calls [blur](https://playwright.dev/docs/api/class-locator#locator-blur) on the element.
3146
- * @param locator - field located by label|name|CSS|XPath|strict locator.
3147
- * @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
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.
3148
3162
  *
3149
3163
  * Examples:
3150
3164
  *
@@ -3157,6 +3171,8 @@ declare namespace CodeceptJS {
3157
3171
  * I.blur('#product-tile')
3158
3172
  * I.dontSee('#add-to-cart-btn');
3159
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.
3160
3176
  */
3161
3177
  blur(locator: CodeceptJS.LocatorOrString, options?: any): void;
3162
3178
  /**
@@ -3751,18 +3767,20 @@ declare namespace CodeceptJS {
3751
3767
  */
3752
3768
  fillField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): void;
3753
3769
  /**
3754
- * Clear the <input>, <textarea> or [contenteditable] .
3755
- * @param locator - field located by label|name|CSS|XPath|strict locator.
3756
- * @param [options] - [Additional options](https://playwright.dev/docs/api/class-locator#locator-clear) for available options object as 2nd argument.
3770
+ * Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
3771
+ *
3757
3772
  *
3758
3773
  * Examples:
3759
3774
  *
3760
3775
  * ```js
3761
3776
  * I.clearField('.text-area')
3777
+ *
3778
+ * // if this doesn't work use force option
3779
+ * I.clearField('#submit', { force: true })
3762
3780
  * ```
3763
- * ```js
3764
- * I.clearField('#submit', { force: true }) // force to bypass the [actionability](https://playwright.dev/docs/actionability) checks.
3765
- * ```
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.
3766
3784
  */
3767
3785
  clearField(locator: CodeceptJS.LocatorOrString, options?: any): void;
3768
3786
  /**
@@ -6250,6 +6268,39 @@ declare namespace CodeceptJS {
6250
6268
  * {{ react }}
6251
6269
  */
6252
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;
6253
6304
  /**
6254
6305
  * Drag an item to a destination element.
6255
6306
  *
@@ -8019,6 +8070,39 @@ declare namespace CodeceptJS {
8019
8070
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
8020
8071
  */
8021
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;
8022
8106
  /**
8023
8107
  * Perform a click on a link or a button, given by a locator.
8024
8108
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -8521,7 +8605,7 @@ declare namespace CodeceptJS {
8521
8605
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
8522
8606
  *
8523
8607
  *
8524
- * If a function returns a Promise It will wait for it resolution.
8608
+ * If a function returns a Promise It will wait for its resolution.
8525
8609
  */
8526
8610
  executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): void;
8527
8611
  /**
@@ -10363,6 +10447,39 @@ declare namespace CodeceptJS {
10363
10447
  * Appium: not tested in web, in apps doesn't work
10364
10448
  */
10365
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;
10366
10483
  /**
10367
10484
  * Drag an item to a destination element.
10368
10485
  *