codeceptjs 4.0.1-beta.18 → 4.0.1-beta.19
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/lib/helper/Playwright.js +74 -80
- package/lib/helper/extras/PlaywrightLocator.js +13 -34
- package/lib/locator.js +43 -52
- package/package.json +1 -1
- package/typings/promiseBasedTypes.d.ts +220 -32
- package/typings/types.d.ts +343 -40
- package/lib/helper/extras/PlaywrightReactVueLocator.js +0 -52
package/typings/types.d.ts
CHANGED
|
@@ -1141,10 +1141,25 @@ declare namespace CodeceptJS {
|
|
|
1141
1141
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
1142
1142
|
* ```
|
|
1143
1143
|
*
|
|
1144
|
+
* You can also use ARIA role locators:
|
|
1145
|
+
*
|
|
1146
|
+
* ```js
|
|
1147
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
1148
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
1149
|
+
* ```
|
|
1150
|
+
*
|
|
1151
|
+
* Or JSON string locators:
|
|
1152
|
+
*
|
|
1153
|
+
* ```js
|
|
1154
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
1155
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
1156
|
+
* ```
|
|
1157
|
+
*
|
|
1144
1158
|
* Provide an array for the second argument to select multiple options.
|
|
1145
1159
|
*
|
|
1146
1160
|
* ```js
|
|
1147
1161
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
1162
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
1148
1163
|
* ```
|
|
1149
1164
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
1150
1165
|
* @param option - visible text or value of option.
|
|
@@ -1756,28 +1771,28 @@ declare namespace CodeceptJS {
|
|
|
1756
1771
|
*/
|
|
1757
1772
|
seeResponseEquals(resp: any): void;
|
|
1758
1773
|
/**
|
|
1759
|
-
* Validates JSON structure of response using [
|
|
1760
|
-
* See [
|
|
1774
|
+
* Validates JSON structure of response using [Zod library](https://zod.dev).
|
|
1775
|
+
* See [Zod API](https://zod.dev/) for complete reference on usage.
|
|
1761
1776
|
*
|
|
1762
|
-
* Use pre-initialized
|
|
1777
|
+
* Use pre-initialized Zod instance by passing function callback:
|
|
1763
1778
|
*
|
|
1764
1779
|
* ```js
|
|
1765
1780
|
* // response.data is { name: 'jon', id: 1 }
|
|
1766
1781
|
*
|
|
1767
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1768
|
-
* return
|
|
1769
|
-
* name:
|
|
1770
|
-
* id:
|
|
1782
|
+
* I.seeResponseMatchesJsonSchema(z => {
|
|
1783
|
+
* return z.object({
|
|
1784
|
+
* name: z.string(),
|
|
1785
|
+
* id: z.number()
|
|
1771
1786
|
* })
|
|
1772
1787
|
* });
|
|
1773
1788
|
*
|
|
1774
1789
|
* // or pass a valid schema
|
|
1775
|
-
*
|
|
1790
|
+
* import { z } from 'zod';
|
|
1776
1791
|
*
|
|
1777
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1778
|
-
* name:
|
|
1779
|
-
* id:
|
|
1780
|
-
* });
|
|
1792
|
+
* I.seeResponseMatchesJsonSchema(z.object({
|
|
1793
|
+
* name: z.string(),
|
|
1794
|
+
* id: z.number()
|
|
1795
|
+
* }));
|
|
1781
1796
|
* ```
|
|
1782
1797
|
*/
|
|
1783
1798
|
seeResponseMatchesJsonSchema(fnOrSchema: any): void;
|
|
@@ -1790,8 +1805,6 @@ declare namespace CodeceptJS {
|
|
|
1790
1805
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1791
1806
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1792
1807
|
*/
|
|
1793
|
-
// @ts-ignore
|
|
1794
|
-
// @ts-ignore
|
|
1795
1808
|
type MockServerConfig = {
|
|
1796
1809
|
port?: number;
|
|
1797
1810
|
host?: string;
|
|
@@ -1916,8 +1929,6 @@ declare namespace CodeceptJS {
|
|
|
1916
1929
|
*
|
|
1917
1930
|
* ## Methods
|
|
1918
1931
|
*/
|
|
1919
|
-
// @ts-ignore
|
|
1920
|
-
// @ts-ignore
|
|
1921
1932
|
class MockServer {
|
|
1922
1933
|
/**
|
|
1923
1934
|
* Start the mock server
|
|
@@ -2013,9 +2024,14 @@ declare namespace CodeceptJS {
|
|
|
2013
2024
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
2014
2025
|
* @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
|
|
2015
2026
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
2027
|
+
* @property [customLocatorStrategies] - custom locator strategies. An object with keys as strategy names and values as JavaScript functions. Example: `{ byRole: (selector, root) => { return root.querySelector(`[role="${selector}"]`) } }`
|
|
2028
|
+
* @property [storageState] - Playwright storage state (path to JSON file or object)
|
|
2029
|
+
* passed directly to `browser.newContext`.
|
|
2030
|
+
* If a Scenario is declared with a `cookies` option (e.g. `Scenario('name', { cookies: [...] }, fn)`),
|
|
2031
|
+
* those cookies are used instead and the configured `storageState` is ignored (no merge).
|
|
2032
|
+
* May include session cookies, auth tokens, localStorage and (if captured with
|
|
2033
|
+
* `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
|
|
2016
2034
|
*/
|
|
2017
|
-
// @ts-ignore
|
|
2018
|
-
// @ts-ignore
|
|
2019
2035
|
type PlaywrightConfig = {
|
|
2020
2036
|
url?: string;
|
|
2021
2037
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -2053,6 +2069,8 @@ declare namespace CodeceptJS {
|
|
|
2053
2069
|
highlightElement?: boolean;
|
|
2054
2070
|
recordHar?: any;
|
|
2055
2071
|
testIdAttribute?: string;
|
|
2072
|
+
customLocatorStrategies?: any;
|
|
2073
|
+
storageState?: string | any;
|
|
2056
2074
|
};
|
|
2057
2075
|
/**
|
|
2058
2076
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
@@ -2878,6 +2896,23 @@ declare namespace CodeceptJS {
|
|
|
2878
2896
|
* @returns automatically synchronized promise through #recorder
|
|
2879
2897
|
*/
|
|
2880
2898
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
|
|
2899
|
+
/**
|
|
2900
|
+
* Performs click at specific coordinates.
|
|
2901
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
2902
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
2903
|
+
*
|
|
2904
|
+
* ```js
|
|
2905
|
+
* // Click at global coordinates (100, 200)
|
|
2906
|
+
* I.clickXY(100, 200);
|
|
2907
|
+
*
|
|
2908
|
+
* // Click at coordinates (50, 30) relative to element
|
|
2909
|
+
* I.clickXY('#someElement', 50, 30);
|
|
2910
|
+
* ```
|
|
2911
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
2912
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
2913
|
+
* @param [y] - Y coordinate relative to element.
|
|
2914
|
+
*/
|
|
2915
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
2881
2916
|
/**
|
|
2882
2917
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
|
|
2883
2918
|
*
|
|
@@ -2983,7 +3018,7 @@ declare namespace CodeceptJS {
|
|
|
2983
3018
|
*/
|
|
2984
3019
|
pressKeyUp(key: string): void;
|
|
2985
3020
|
/**
|
|
2986
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
3021
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
2987
3022
|
*
|
|
2988
3023
|
* Presses a key in the browser (on a focused element).
|
|
2989
3024
|
*
|
|
@@ -3175,10 +3210,25 @@ declare namespace CodeceptJS {
|
|
|
3175
3210
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
3176
3211
|
* ```
|
|
3177
3212
|
*
|
|
3213
|
+
* You can also use ARIA role locators:
|
|
3214
|
+
*
|
|
3215
|
+
* ```js
|
|
3216
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
3217
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
3218
|
+
* ```
|
|
3219
|
+
*
|
|
3220
|
+
* Or JSON string locators:
|
|
3221
|
+
*
|
|
3222
|
+
* ```js
|
|
3223
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
3224
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
3225
|
+
* ```
|
|
3226
|
+
*
|
|
3178
3227
|
* Provide an array for the second argument to select multiple options.
|
|
3179
3228
|
*
|
|
3180
3229
|
* ```js
|
|
3181
3230
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
3231
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
3182
3232
|
* ```
|
|
3183
3233
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
3184
3234
|
* @param option - visible text or value of option.
|
|
@@ -3405,6 +3455,27 @@ declare namespace CodeceptJS {
|
|
|
3405
3455
|
* @returns attribute value
|
|
3406
3456
|
*/
|
|
3407
3457
|
grabCookie(name?: string): any;
|
|
3458
|
+
/**
|
|
3459
|
+
* Grab the current storage state (cookies, localStorage, etc.) via Playwright's `browserContext.storageState()`.
|
|
3460
|
+
* Returns the raw object that Playwright provides.
|
|
3461
|
+
*
|
|
3462
|
+
* Security: The returned object can contain authentication tokens, session cookies
|
|
3463
|
+
* and (when `indexedDB: true` is used) data that may include user PII. Treat it as a secret.
|
|
3464
|
+
* Avoid committing it to source control and prefer storing it in a protected secrets store / CI artifact vault.
|
|
3465
|
+
* @param [options.indexedDB] - set to true to include IndexedDB in snapshot (Playwright >=1.51)
|
|
3466
|
+
*
|
|
3467
|
+
* ```js
|
|
3468
|
+
* // basic usage
|
|
3469
|
+
* const state = await I.grabStorageState();
|
|
3470
|
+
* require('fs').writeFileSync('authState.json', JSON.stringify(state));
|
|
3471
|
+
*
|
|
3472
|
+
* // include IndexedDB when using Firebase Auth, etc.
|
|
3473
|
+
* const stateWithIDB = await I.grabStorageState({ indexedDB: true });
|
|
3474
|
+
* ```
|
|
3475
|
+
*/
|
|
3476
|
+
grabStorageState(options?: {
|
|
3477
|
+
indexedDB?: boolean;
|
|
3478
|
+
}): void;
|
|
3408
3479
|
/**
|
|
3409
3480
|
* Clears a cookie by name,
|
|
3410
3481
|
* if none provided clears all cookies.
|
|
@@ -3874,7 +3945,7 @@ declare namespace CodeceptJS {
|
|
|
3874
3945
|
/**
|
|
3875
3946
|
* Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
3876
3947
|
*
|
|
3877
|
-
* See [Playwright's reference](https://playwright.dev/docs/api/class-page
|
|
3948
|
+
* See [Playwright's reference](https://playwright.dev/docs/api/class-page#page-wait-for-navigation)
|
|
3878
3949
|
*/
|
|
3879
3950
|
waitForNavigation(options: any): void;
|
|
3880
3951
|
/**
|
|
@@ -5545,7 +5616,7 @@ declare namespace CodeceptJS {
|
|
|
5545
5616
|
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
|
|
5546
5617
|
* @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
|
|
5547
5618
|
* @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
5548
|
-
* @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/
|
|
5619
|
+
* @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.waitforoptions.md). Array values are accepted as well.
|
|
5549
5620
|
* @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
5550
5621
|
* @property [getPageTimeout = 30000] - config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
|
|
5551
5622
|
* @property [waitForTimeout = 1000] - default wait* timeout in ms.
|
|
@@ -5553,11 +5624,9 @@ declare namespace CodeceptJS {
|
|
|
5553
5624
|
* @property [userAgent] - user-agent string.
|
|
5554
5625
|
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
5555
5626
|
* @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
5556
|
-
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/
|
|
5627
|
+
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
|
|
5557
5628
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
5558
5629
|
*/
|
|
5559
|
-
// @ts-ignore
|
|
5560
|
-
// @ts-ignore
|
|
5561
5630
|
type PuppeteerConfig = {
|
|
5562
5631
|
url: string;
|
|
5563
5632
|
basicAuth?: any;
|
|
@@ -5571,7 +5640,7 @@ declare namespace CodeceptJS {
|
|
|
5571
5640
|
keepBrowserState?: boolean;
|
|
5572
5641
|
keepCookies?: boolean;
|
|
5573
5642
|
waitForAction?: number;
|
|
5574
|
-
waitForNavigation?: string;
|
|
5643
|
+
waitForNavigation?: string | string[];
|
|
5575
5644
|
pressKeyDelay?: number;
|
|
5576
5645
|
getPageTimeout?: number;
|
|
5577
5646
|
waitForTimeout?: number;
|
|
@@ -5583,7 +5652,7 @@ declare namespace CodeceptJS {
|
|
|
5583
5652
|
highlightElement?: boolean;
|
|
5584
5653
|
};
|
|
5585
5654
|
/**
|
|
5586
|
-
* Uses [Google Chrome's Puppeteer](https://github.com/
|
|
5655
|
+
* Uses [Google Chrome's Puppeteer](https://github.com/puppeteer/puppeteer) library to run tests inside headless Chrome.
|
|
5587
5656
|
* Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
5588
5657
|
* This helper works with a browser out of the box with no additional tools required to install.
|
|
5589
5658
|
*
|
|
@@ -5997,6 +6066,17 @@ declare namespace CodeceptJS {
|
|
|
5997
6066
|
* {{ react }}
|
|
5998
6067
|
*/
|
|
5999
6068
|
_locate(): void;
|
|
6069
|
+
/**
|
|
6070
|
+
* Get single element by different locator types, including strict locator
|
|
6071
|
+
* Should be used in custom helpers:
|
|
6072
|
+
*
|
|
6073
|
+
* ```js
|
|
6074
|
+
* const element = await this.helpers['Puppeteer']._locateElement({name: 'password'});
|
|
6075
|
+
* ```
|
|
6076
|
+
*
|
|
6077
|
+
* {{ react }}
|
|
6078
|
+
*/
|
|
6079
|
+
_locateElement(): void;
|
|
6000
6080
|
/**
|
|
6001
6081
|
* Find a checkbox by providing human-readable text:
|
|
6002
6082
|
* NOTE: Assumes the checkable element exists
|
|
@@ -6033,6 +6113,17 @@ declare namespace CodeceptJS {
|
|
|
6033
6113
|
* @returns WebElement of being used Web helper
|
|
6034
6114
|
*/
|
|
6035
6115
|
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
6116
|
+
/**
|
|
6117
|
+
* Grab WebElement for given locator
|
|
6118
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
6119
|
+
*
|
|
6120
|
+
* ```js
|
|
6121
|
+
* const webElement = await I.grabWebElement('#button');
|
|
6122
|
+
* ```
|
|
6123
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
6124
|
+
* @returns WebElement of being used Web helper
|
|
6125
|
+
*/
|
|
6126
|
+
grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
6036
6127
|
/**
|
|
6037
6128
|
* Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
6038
6129
|
*
|
|
@@ -6272,6 +6363,23 @@ declare namespace CodeceptJS {
|
|
|
6272
6363
|
* {{ react }}
|
|
6273
6364
|
*/
|
|
6274
6365
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
|
|
6366
|
+
/**
|
|
6367
|
+
* Performs click at specific coordinates.
|
|
6368
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
6369
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
6370
|
+
*
|
|
6371
|
+
* ```js
|
|
6372
|
+
* // Click at global coordinates (100, 200)
|
|
6373
|
+
* I.clickXY(100, 200);
|
|
6374
|
+
*
|
|
6375
|
+
* // Click at coordinates (50, 30) relative to element
|
|
6376
|
+
* I.clickXY('#someElement', 50, 30);
|
|
6377
|
+
* ```
|
|
6378
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
6379
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
6380
|
+
* @param [y] - Y coordinate relative to element.
|
|
6381
|
+
*/
|
|
6382
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
6275
6383
|
/**
|
|
6276
6384
|
* Selects a checkbox or radio button.
|
|
6277
6385
|
* Element is located by label or name or CSS or XPath.
|
|
@@ -6357,7 +6465,7 @@ declare namespace CodeceptJS {
|
|
|
6357
6465
|
*/
|
|
6358
6466
|
pressKeyUp(key: string): void;
|
|
6359
6467
|
/**
|
|
6360
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
6468
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
6361
6469
|
*
|
|
6362
6470
|
* Presses a key in the browser (on a focused element).
|
|
6363
6471
|
*
|
|
@@ -6551,10 +6659,25 @@ declare namespace CodeceptJS {
|
|
|
6551
6659
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
6552
6660
|
* ```
|
|
6553
6661
|
*
|
|
6662
|
+
* You can also use ARIA role locators:
|
|
6663
|
+
*
|
|
6664
|
+
* ```js
|
|
6665
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
6666
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
6667
|
+
* ```
|
|
6668
|
+
*
|
|
6669
|
+
* Or JSON string locators:
|
|
6670
|
+
*
|
|
6671
|
+
* ```js
|
|
6672
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
6673
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
6674
|
+
* ```
|
|
6675
|
+
*
|
|
6554
6676
|
* Provide an array for the second argument to select multiple options.
|
|
6555
6677
|
*
|
|
6556
6678
|
* ```js
|
|
6557
6679
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
6680
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
6558
6681
|
* ```
|
|
6559
6682
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
6560
6683
|
* @param option - visible text or value of option.
|
|
@@ -7283,7 +7406,7 @@ declare namespace CodeceptJS {
|
|
|
7283
7406
|
/**
|
|
7284
7407
|
* Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
7285
7408
|
*
|
|
7286
|
-
* See [Puppeteer's reference](https://github.com/
|
|
7409
|
+
* See [Puppeteer's reference](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md)
|
|
7287
7410
|
*/
|
|
7288
7411
|
waitForNavigation(opts: any): void;
|
|
7289
7412
|
/**
|
|
@@ -7492,6 +7615,22 @@ declare namespace CodeceptJS {
|
|
|
7492
7615
|
*/
|
|
7493
7616
|
flushWebSocketMessages(): void;
|
|
7494
7617
|
}
|
|
7618
|
+
/**
|
|
7619
|
+
* Find elements using Puppeteer's native element discovery methods
|
|
7620
|
+
* Note: Unlike Playwright, Puppeteer's Locator API doesn't have .all() method for multiple elements
|
|
7621
|
+
* @param matcher - Puppeteer context to search within
|
|
7622
|
+
* @param locator - Locator specification
|
|
7623
|
+
* @returns Array of ElementHandle objects
|
|
7624
|
+
*/
|
|
7625
|
+
function findElements(matcher: any, locator: any | string): Promise<any[]>;
|
|
7626
|
+
/**
|
|
7627
|
+
* Find a single element using Puppeteer's native element discovery methods
|
|
7628
|
+
* Note: Puppeteer Locator API doesn't have .first() method like Playwright
|
|
7629
|
+
* @param matcher - Puppeteer context to search within
|
|
7630
|
+
* @param locator - Locator specification
|
|
7631
|
+
* @returns Single ElementHandle object
|
|
7632
|
+
*/
|
|
7633
|
+
function findElement(matcher: any, locator: any | string): Promise<object>;
|
|
7495
7634
|
/**
|
|
7496
7635
|
* ## Configuration
|
|
7497
7636
|
* @property [endpoint] - API base URL
|
|
@@ -7504,8 +7643,6 @@ declare namespace CodeceptJS {
|
|
|
7504
7643
|
* @property [onResponse] - an async function which can update response object.
|
|
7505
7644
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
7506
7645
|
*/
|
|
7507
|
-
// @ts-ignore
|
|
7508
|
-
// @ts-ignore
|
|
7509
7646
|
type RESTConfig = {
|
|
7510
7647
|
endpoint?: string;
|
|
7511
7648
|
prettyPrintJson?: boolean;
|
|
@@ -7631,6 +7768,16 @@ declare namespace CodeceptJS {
|
|
|
7631
7768
|
* @returns response
|
|
7632
7769
|
*/
|
|
7633
7770
|
sendGetRequest(url: any, headers?: any): Promise<any>;
|
|
7771
|
+
/**
|
|
7772
|
+
* Send HEAD request to REST API
|
|
7773
|
+
*
|
|
7774
|
+
* ```js
|
|
7775
|
+
* I.sendHeadRequest('/api/users.json');
|
|
7776
|
+
* ```
|
|
7777
|
+
* @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
|
|
7778
|
+
* @returns response
|
|
7779
|
+
*/
|
|
7780
|
+
sendHeadRequest(url: any, headers?: any): Promise<any>;
|
|
7634
7781
|
/**
|
|
7635
7782
|
* Sends POST request to API.
|
|
7636
7783
|
*
|
|
@@ -7730,8 +7877,6 @@ declare namespace CodeceptJS {
|
|
|
7730
7877
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
7731
7878
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
7732
7879
|
*/
|
|
7733
|
-
// @ts-ignore
|
|
7734
|
-
// @ts-ignore
|
|
7735
7880
|
type WebDriverConfig = {
|
|
7736
7881
|
url: string;
|
|
7737
7882
|
browser: string;
|
|
@@ -8207,6 +8352,17 @@ declare namespace CodeceptJS {
|
|
|
8207
8352
|
* @returns WebElement of being used Web helper
|
|
8208
8353
|
*/
|
|
8209
8354
|
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
8355
|
+
/**
|
|
8356
|
+
* Grab WebElement for given locator
|
|
8357
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
8358
|
+
*
|
|
8359
|
+
* ```js
|
|
8360
|
+
* const webElement = await I.grabWebElement('#button');
|
|
8361
|
+
* ```
|
|
8362
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
8363
|
+
* @returns WebElement of being used Web helper
|
|
8364
|
+
*/
|
|
8365
|
+
grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
8210
8366
|
/**
|
|
8211
8367
|
* Set [WebDriver timeouts](https://webdriver.io/docs/timeouts.html) in realtime.
|
|
8212
8368
|
*
|
|
@@ -8336,6 +8492,23 @@ declare namespace CodeceptJS {
|
|
|
8336
8492
|
* {{ react }}
|
|
8337
8493
|
*/
|
|
8338
8494
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
|
|
8495
|
+
/**
|
|
8496
|
+
* Performs click at specific coordinates.
|
|
8497
|
+
* If locator is provided, the coordinates are relative to the element's top-left corner.
|
|
8498
|
+
* If locator is not provided, the coordinates are relative to the body element.
|
|
8499
|
+
*
|
|
8500
|
+
* ```js
|
|
8501
|
+
* // Click at coordinates (100, 200) relative to body
|
|
8502
|
+
* I.clickXY(100, 200);
|
|
8503
|
+
*
|
|
8504
|
+
* // Click at coordinates (50, 30) relative to element's top-left corner
|
|
8505
|
+
* I.clickXY('#someElement', 50, 30);
|
|
8506
|
+
* ```
|
|
8507
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
8508
|
+
* @param [x] - X coordinate relative to element's top-left, or Y coordinate if locator is a number.
|
|
8509
|
+
* @param [y] - Y coordinate relative to element's top-left.
|
|
8510
|
+
*/
|
|
8511
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
8339
8512
|
/**
|
|
8340
8513
|
* Emulates right click on an element.
|
|
8341
8514
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
@@ -8423,10 +8596,25 @@ declare namespace CodeceptJS {
|
|
|
8423
8596
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
8424
8597
|
* ```
|
|
8425
8598
|
*
|
|
8599
|
+
* You can also use ARIA role locators:
|
|
8600
|
+
*
|
|
8601
|
+
* ```js
|
|
8602
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
8603
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
8604
|
+
* ```
|
|
8605
|
+
*
|
|
8606
|
+
* Or JSON string locators:
|
|
8607
|
+
*
|
|
8608
|
+
* ```js
|
|
8609
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
8610
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
8611
|
+
* ```
|
|
8612
|
+
*
|
|
8426
8613
|
* Provide an array for the second argument to select multiple options.
|
|
8427
8614
|
*
|
|
8428
8615
|
* ```js
|
|
8429
8616
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
8617
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
8430
8618
|
* ```
|
|
8431
8619
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
8432
8620
|
* @param option - visible text or value of option.
|
|
@@ -9731,8 +9919,8 @@ declare namespace CodeceptJS {
|
|
|
9731
9919
|
*/
|
|
9732
9920
|
requireModules(requiringModules: string[]): void;
|
|
9733
9921
|
/**
|
|
9734
|
-
* Initialize CodeceptJS at specific
|
|
9735
|
-
*
|
|
9922
|
+
* Initialize CodeceptJS at specific dir.
|
|
9923
|
+
* Loads config, requires factory methods
|
|
9736
9924
|
*/
|
|
9737
9925
|
init(dir: string): void;
|
|
9738
9926
|
/**
|
|
@@ -9746,19 +9934,31 @@ declare namespace CodeceptJS {
|
|
|
9746
9934
|
/**
|
|
9747
9935
|
* Executes bootstrap.
|
|
9748
9936
|
*/
|
|
9749
|
-
bootstrap(): void
|
|
9937
|
+
bootstrap(): Promise<void>;
|
|
9750
9938
|
/**
|
|
9751
9939
|
* Executes teardown.
|
|
9752
9940
|
*/
|
|
9753
|
-
teardown(): void
|
|
9941
|
+
teardown(): Promise<void>;
|
|
9754
9942
|
/**
|
|
9755
9943
|
* Loads tests by pattern or by config.tests
|
|
9756
9944
|
*/
|
|
9757
9945
|
loadTests(pattern?: string): void;
|
|
9946
|
+
/**
|
|
9947
|
+
* Apply sharding to test files based on shard configuration
|
|
9948
|
+
* @param testFiles - Array of test file paths
|
|
9949
|
+
* @param shardConfig - Shard configuration in format "index/total" (e.g., "1/4")
|
|
9950
|
+
* @returns - Filtered array of test files for this shard
|
|
9951
|
+
*/
|
|
9952
|
+
_applySharding(testFiles: string[], shardConfig: string): string[];
|
|
9758
9953
|
/**
|
|
9759
9954
|
* Run a specific test or all loaded tests.
|
|
9760
9955
|
*/
|
|
9761
9956
|
run(test?: string): Promise<void>;
|
|
9957
|
+
/**
|
|
9958
|
+
* Returns the version string of CodeceptJS.
|
|
9959
|
+
* @returns The version string.
|
|
9960
|
+
*/
|
|
9961
|
+
static version(): string;
|
|
9762
9962
|
}
|
|
9763
9963
|
/**
|
|
9764
9964
|
* Current configuration
|
|
@@ -9801,7 +10001,15 @@ declare namespace CodeceptJS {
|
|
|
9801
10001
|
};
|
|
9802
10002
|
}
|
|
9803
10003
|
/**
|
|
9804
|
-
*
|
|
10004
|
+
* Statistics for a test result.
|
|
10005
|
+
* @property passes - Number of passed tests.
|
|
10006
|
+
* @property failures - Number of failed tests.
|
|
10007
|
+
* @property tests - Total number of tests.
|
|
10008
|
+
* @property pending - Number of pending tests.
|
|
10009
|
+
* @property failedHooks - Number of failed hooks.
|
|
10010
|
+
* @property start - Start time of the test run.
|
|
10011
|
+
* @property end - End time of the test run.
|
|
10012
|
+
* @property duration - Duration of the test run, in milliseconds.
|
|
9805
10013
|
*/
|
|
9806
10014
|
type Stats = {
|
|
9807
10015
|
passes: number;
|
|
@@ -9814,10 +10022,82 @@ declare namespace CodeceptJS {
|
|
|
9814
10022
|
duration: number;
|
|
9815
10023
|
};
|
|
9816
10024
|
/**
|
|
9817
|
-
*
|
|
10025
|
+
* Result of a test run. Will be emitted for example in "event.all.result" events.
|
|
9818
10026
|
*/
|
|
9819
10027
|
class Result {
|
|
9820
|
-
|
|
10028
|
+
/**
|
|
10029
|
+
* Resets all collected stats, tests, and failure reports.
|
|
10030
|
+
*/
|
|
10031
|
+
reset(): void;
|
|
10032
|
+
/**
|
|
10033
|
+
* Sets the start time to the current time.
|
|
10034
|
+
*/
|
|
10035
|
+
start(): void;
|
|
10036
|
+
/**
|
|
10037
|
+
* Sets the end time to the current time.
|
|
10038
|
+
*/
|
|
10039
|
+
finish(): void;
|
|
10040
|
+
/**
|
|
10041
|
+
* Whether this result contains any failed tests.
|
|
10042
|
+
*/
|
|
10043
|
+
readonly hasFailed: boolean;
|
|
10044
|
+
/**
|
|
10045
|
+
* All collected tests.
|
|
10046
|
+
*/
|
|
10047
|
+
readonly tests: CodeceptJS.Test[];
|
|
10048
|
+
/**
|
|
10049
|
+
* The failure reports (array of strings per failed test).
|
|
10050
|
+
*/
|
|
10051
|
+
readonly failures: string[][];
|
|
10052
|
+
/**
|
|
10053
|
+
* The test statistics.
|
|
10054
|
+
*/
|
|
10055
|
+
readonly stats: Stats;
|
|
10056
|
+
/**
|
|
10057
|
+
* The start time of the test run.
|
|
10058
|
+
*/
|
|
10059
|
+
readonly startTime: Date;
|
|
10060
|
+
/**
|
|
10061
|
+
* Adds a test to this result.
|
|
10062
|
+
*/
|
|
10063
|
+
addTest(test: CodeceptJS.Test): void;
|
|
10064
|
+
/**
|
|
10065
|
+
* Adds failure reports to this result.
|
|
10066
|
+
*/
|
|
10067
|
+
addFailures(newFailures: string[][]): void;
|
|
10068
|
+
/**
|
|
10069
|
+
* Whether this result contains any failed tests.
|
|
10070
|
+
*/
|
|
10071
|
+
readonly hasFailures: boolean;
|
|
10072
|
+
/**
|
|
10073
|
+
* The duration of the test run, in milliseconds.
|
|
10074
|
+
*/
|
|
10075
|
+
readonly duration: number;
|
|
10076
|
+
/**
|
|
10077
|
+
* All failed tests.
|
|
10078
|
+
*/
|
|
10079
|
+
failedTests: CodeceptJS.Test[];
|
|
10080
|
+
/**
|
|
10081
|
+
* All passed tests.
|
|
10082
|
+
*/
|
|
10083
|
+
readonly passedTests: CodeceptJS.Test[];
|
|
10084
|
+
/**
|
|
10085
|
+
* All skipped tests.
|
|
10086
|
+
*/
|
|
10087
|
+
readonly skippedTests: CodeceptJS.Test[];
|
|
10088
|
+
/**
|
|
10089
|
+
* @returns The JSON representation of this result.
|
|
10090
|
+
*/
|
|
10091
|
+
simplify(): any;
|
|
10092
|
+
/**
|
|
10093
|
+
* Saves this result to a JSON file.
|
|
10094
|
+
* @param [fileName] - Path to the JSON file, relative to `output_dir`. Defaults to "result.json".
|
|
10095
|
+
*/
|
|
10096
|
+
save(fileName?: string): void;
|
|
10097
|
+
/**
|
|
10098
|
+
* Adds stats to this result.
|
|
10099
|
+
*/
|
|
10100
|
+
addStats(newStats?: Partial<Stats>): void;
|
|
9821
10101
|
}
|
|
9822
10102
|
/**
|
|
9823
10103
|
* Dependency Injection Container
|
|
@@ -9943,7 +10223,7 @@ declare namespace CodeceptJS {
|
|
|
9943
10223
|
* - Logs errors and retries the callback until it either succeeds or the maximum number of attempts is reached.
|
|
9944
10224
|
* - Restores the session state after each attempt, whether successful or not.
|
|
9945
10225
|
* @example
|
|
9946
|
-
* const {
|
|
10226
|
+
* const { retryTo } = require('codeceptjs/effects')
|
|
9947
10227
|
* await retryTo((tries) => {
|
|
9948
10228
|
* if (tries < 3) {
|
|
9949
10229
|
* I.see('Non-existent element'); // Simulates a failure
|
|
@@ -10041,6 +10321,7 @@ declare namespace CodeceptJS {
|
|
|
10041
10321
|
isCSS(): boolean;
|
|
10042
10322
|
isPlaywrightLocator(): boolean;
|
|
10043
10323
|
isRole(): boolean;
|
|
10324
|
+
getRoleLocator(): RoleLocator | null;
|
|
10044
10325
|
isNull(): boolean;
|
|
10045
10326
|
isXPath(): boolean;
|
|
10046
10327
|
isCustom(): boolean;
|
|
@@ -10100,10 +10381,24 @@ declare namespace CodeceptJS {
|
|
|
10100
10381
|
* Filters to modify locators
|
|
10101
10382
|
*/
|
|
10102
10383
|
static filters: ((arg0: CodeceptJS.LocatorOrString, arg1: Locator) => void)[];
|
|
10384
|
+
/**
|
|
10385
|
+
* Get RoleLocator class (lazy loaded)
|
|
10386
|
+
*/
|
|
10387
|
+
static getRoleLocatorClass(): typeof RoleLocator;
|
|
10388
|
+
/**
|
|
10389
|
+
* Set RoleLocator class (called from RoleLocator module)
|
|
10390
|
+
*/
|
|
10391
|
+
static setRoleLocatorClass(RoleLocatorClass: typeof RoleLocator): void;
|
|
10103
10392
|
/**
|
|
10104
10393
|
* Appends new `Locator` filter to an `Locator.filters` array, and returns the new length of the array.
|
|
10105
10394
|
*/
|
|
10106
10395
|
static addFilter(fn: (...params: any[]) => any): number;
|
|
10396
|
+
/**
|
|
10397
|
+
* Create a role locator
|
|
10398
|
+
* @param locator - The role locator object
|
|
10399
|
+
* @returns The role locator object
|
|
10400
|
+
*/
|
|
10401
|
+
static role(locator: any): any;
|
|
10107
10402
|
}
|
|
10108
10403
|
namespace output {
|
|
10109
10404
|
var stepShift: number;
|
|
@@ -10227,6 +10522,10 @@ declare namespace CodeceptJS {
|
|
|
10227
10522
|
* Get a state of current queue and tasks
|
|
10228
10523
|
*/
|
|
10229
10524
|
toString(): string;
|
|
10525
|
+
/**
|
|
10526
|
+
* Get current session ID
|
|
10527
|
+
*/
|
|
10528
|
+
getCurrentSessionId(): string | null;
|
|
10230
10529
|
}
|
|
10231
10530
|
interface RecorderSession {
|
|
10232
10531
|
running: boolean;
|
|
@@ -10340,6 +10639,10 @@ declare namespace CodeceptJS {
|
|
|
10340
10639
|
function Feature(title: string, opts?: {
|
|
10341
10640
|
[key: string]: any;
|
|
10342
10641
|
}): FeatureConfig;
|
|
10642
|
+
/**
|
|
10643
|
+
* Exclusive test suite - runs only this feature.
|
|
10644
|
+
*/
|
|
10645
|
+
const only: CodeceptJS.IFeature;
|
|
10343
10646
|
/**
|
|
10344
10647
|
* Pending test suite.
|
|
10345
10648
|
*/
|