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
|
@@ -1125,10 +1125,25 @@ declare namespace CodeceptJS {
|
|
|
1125
1125
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
1126
1126
|
* ```
|
|
1127
1127
|
*
|
|
1128
|
+
* You can also use ARIA role locators:
|
|
1129
|
+
*
|
|
1130
|
+
* ```js
|
|
1131
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
1132
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
1133
|
+
* ```
|
|
1134
|
+
*
|
|
1135
|
+
* Or JSON string locators:
|
|
1136
|
+
*
|
|
1137
|
+
* ```js
|
|
1138
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
1139
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
1140
|
+
* ```
|
|
1141
|
+
*
|
|
1128
1142
|
* Provide an array for the second argument to select multiple options.
|
|
1129
1143
|
*
|
|
1130
1144
|
* ```js
|
|
1131
1145
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
1146
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
1132
1147
|
* ```
|
|
1133
1148
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
1134
1149
|
* @param option - visible text or value of option.
|
|
@@ -1729,28 +1744,28 @@ declare namespace CodeceptJS {
|
|
|
1729
1744
|
*/
|
|
1730
1745
|
seeResponseEquals(resp: any): Promise<any>;
|
|
1731
1746
|
/**
|
|
1732
|
-
* Validates JSON structure of response using [
|
|
1733
|
-
* See [
|
|
1747
|
+
* Validates JSON structure of response using [Zod library](https://zod.dev).
|
|
1748
|
+
* See [Zod API](https://zod.dev/) for complete reference on usage.
|
|
1734
1749
|
*
|
|
1735
|
-
* Use pre-initialized
|
|
1750
|
+
* Use pre-initialized Zod instance by passing function callback:
|
|
1736
1751
|
*
|
|
1737
1752
|
* ```js
|
|
1738
1753
|
* // response.data is { name: 'jon', id: 1 }
|
|
1739
1754
|
*
|
|
1740
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1741
|
-
* return
|
|
1742
|
-
* name:
|
|
1743
|
-
* id:
|
|
1755
|
+
* I.seeResponseMatchesJsonSchema(z => {
|
|
1756
|
+
* return z.object({
|
|
1757
|
+
* name: z.string(),
|
|
1758
|
+
* id: z.number()
|
|
1744
1759
|
* })
|
|
1745
1760
|
* });
|
|
1746
1761
|
*
|
|
1747
1762
|
* // or pass a valid schema
|
|
1748
|
-
*
|
|
1763
|
+
* import { z } from 'zod';
|
|
1749
1764
|
*
|
|
1750
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1751
|
-
* name:
|
|
1752
|
-
* id:
|
|
1753
|
-
* });
|
|
1765
|
+
* I.seeResponseMatchesJsonSchema(z.object({
|
|
1766
|
+
* name: z.string(),
|
|
1767
|
+
* id: z.number()
|
|
1768
|
+
* }));
|
|
1754
1769
|
* ```
|
|
1755
1770
|
*/
|
|
1756
1771
|
seeResponseMatchesJsonSchema(fnOrSchema: any): Promise<any>;
|
|
@@ -1763,8 +1778,6 @@ declare namespace CodeceptJS {
|
|
|
1763
1778
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1764
1779
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1765
1780
|
*/
|
|
1766
|
-
// @ts-ignore
|
|
1767
|
-
// @ts-ignore
|
|
1768
1781
|
type MockServerConfig = {
|
|
1769
1782
|
port?: number;
|
|
1770
1783
|
host?: string;
|
|
@@ -1889,8 +1902,6 @@ declare namespace CodeceptJS {
|
|
|
1889
1902
|
*
|
|
1890
1903
|
* ## Methods
|
|
1891
1904
|
*/
|
|
1892
|
-
// @ts-ignore
|
|
1893
|
-
// @ts-ignore
|
|
1894
1905
|
class MockServer {
|
|
1895
1906
|
/**
|
|
1896
1907
|
* Start the mock server
|
|
@@ -1983,9 +1994,14 @@ declare namespace CodeceptJS {
|
|
|
1983
1994
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
1984
1995
|
* @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).
|
|
1985
1996
|
* @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).
|
|
1997
|
+
* @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}"]`) } }`
|
|
1998
|
+
* @property [storageState] - Playwright storage state (path to JSON file or object)
|
|
1999
|
+
* passed directly to `browser.newContext`.
|
|
2000
|
+
* If a Scenario is declared with a `cookies` option (e.g. `Scenario('name', { cookies: [...] }, fn)`),
|
|
2001
|
+
* those cookies are used instead and the configured `storageState` is ignored (no merge).
|
|
2002
|
+
* May include session cookies, auth tokens, localStorage and (if captured with
|
|
2003
|
+
* `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
|
|
1986
2004
|
*/
|
|
1987
|
-
// @ts-ignore
|
|
1988
|
-
// @ts-ignore
|
|
1989
2005
|
type PlaywrightConfig = {
|
|
1990
2006
|
url?: string;
|
|
1991
2007
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -2023,6 +2039,8 @@ declare namespace CodeceptJS {
|
|
|
2023
2039
|
highlightElement?: boolean;
|
|
2024
2040
|
recordHar?: any;
|
|
2025
2041
|
testIdAttribute?: string;
|
|
2042
|
+
customLocatorStrategies?: any;
|
|
2043
|
+
storageState?: string | any;
|
|
2026
2044
|
};
|
|
2027
2045
|
/**
|
|
2028
2046
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
@@ -2825,6 +2843,23 @@ declare namespace CodeceptJS {
|
|
|
2825
2843
|
* @param [context = null] - (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
2826
2844
|
*/
|
|
2827
2845
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
2846
|
+
/**
|
|
2847
|
+
* Performs click at specific coordinates.
|
|
2848
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
2849
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
2850
|
+
*
|
|
2851
|
+
* ```js
|
|
2852
|
+
* // Click at global coordinates (100, 200)
|
|
2853
|
+
* I.clickXY(100, 200);
|
|
2854
|
+
*
|
|
2855
|
+
* // Click at coordinates (50, 30) relative to element
|
|
2856
|
+
* I.clickXY('#someElement', 50, 30);
|
|
2857
|
+
* ```
|
|
2858
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
2859
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
2860
|
+
* @param [y] - Y coordinate relative to element.
|
|
2861
|
+
*/
|
|
2862
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
2828
2863
|
/**
|
|
2829
2864
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
|
|
2830
2865
|
*
|
|
@@ -2924,7 +2959,7 @@ declare namespace CodeceptJS {
|
|
|
2924
2959
|
*/
|
|
2925
2960
|
pressKeyUp(key: string): Promise<any>;
|
|
2926
2961
|
/**
|
|
2927
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
2962
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
2928
2963
|
*
|
|
2929
2964
|
* Presses a key in the browser (on a focused element).
|
|
2930
2965
|
*
|
|
@@ -3109,10 +3144,25 @@ declare namespace CodeceptJS {
|
|
|
3109
3144
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
3110
3145
|
* ```
|
|
3111
3146
|
*
|
|
3147
|
+
* You can also use ARIA role locators:
|
|
3148
|
+
*
|
|
3149
|
+
* ```js
|
|
3150
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
3151
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
3152
|
+
* ```
|
|
3153
|
+
*
|
|
3154
|
+
* Or JSON string locators:
|
|
3155
|
+
*
|
|
3156
|
+
* ```js
|
|
3157
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
3158
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
3159
|
+
* ```
|
|
3160
|
+
*
|
|
3112
3161
|
* Provide an array for the second argument to select multiple options.
|
|
3113
3162
|
*
|
|
3114
3163
|
* ```js
|
|
3115
3164
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
3165
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
3116
3166
|
* ```
|
|
3117
3167
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
3118
3168
|
* @param option - visible text or value of option.
|
|
@@ -3323,6 +3373,27 @@ declare namespace CodeceptJS {
|
|
|
3323
3373
|
* @param [name = null] - cookie name.
|
|
3324
3374
|
*/
|
|
3325
3375
|
grabCookie(name?: string): Promise<any>;
|
|
3376
|
+
/**
|
|
3377
|
+
* Grab the current storage state (cookies, localStorage, etc.) via Playwright's `browserContext.storageState()`.
|
|
3378
|
+
* Returns the raw object that Playwright provides.
|
|
3379
|
+
*
|
|
3380
|
+
* Security: The returned object can contain authentication tokens, session cookies
|
|
3381
|
+
* and (when `indexedDB: true` is used) data that may include user PII. Treat it as a secret.
|
|
3382
|
+
* Avoid committing it to source control and prefer storing it in a protected secrets store / CI artifact vault.
|
|
3383
|
+
* @param [options.indexedDB] - set to true to include IndexedDB in snapshot (Playwright >=1.51)
|
|
3384
|
+
*
|
|
3385
|
+
* ```js
|
|
3386
|
+
* // basic usage
|
|
3387
|
+
* const state = await I.grabStorageState();
|
|
3388
|
+
* require('fs').writeFileSync('authState.json', JSON.stringify(state));
|
|
3389
|
+
*
|
|
3390
|
+
* // include IndexedDB when using Firebase Auth, etc.
|
|
3391
|
+
* const stateWithIDB = await I.grabStorageState({ indexedDB: true });
|
|
3392
|
+
* ```
|
|
3393
|
+
*/
|
|
3394
|
+
grabStorageState(options?: {
|
|
3395
|
+
indexedDB?: boolean;
|
|
3396
|
+
}): Promise<any>;
|
|
3326
3397
|
/**
|
|
3327
3398
|
* Clears a cookie by name,
|
|
3328
3399
|
* if none provided clears all cookies.
|
|
@@ -3771,7 +3842,7 @@ declare namespace CodeceptJS {
|
|
|
3771
3842
|
/**
|
|
3772
3843
|
* Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
3773
3844
|
*
|
|
3774
|
-
* See [Playwright's reference](https://playwright.dev/docs/api/class-page
|
|
3845
|
+
* See [Playwright's reference](https://playwright.dev/docs/api/class-page#page-wait-for-navigation)
|
|
3775
3846
|
*/
|
|
3776
3847
|
waitForNavigation(options: any): Promise<any>;
|
|
3777
3848
|
/**
|
|
@@ -5364,7 +5435,7 @@ declare namespace CodeceptJS {
|
|
|
5364
5435
|
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
|
|
5365
5436
|
* @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
|
|
5366
5437
|
* @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
5367
|
-
* @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/
|
|
5438
|
+
* @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.
|
|
5368
5439
|
* @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
5369
5440
|
* @property [getPageTimeout = 30000] - config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
|
|
5370
5441
|
* @property [waitForTimeout = 1000] - default wait* timeout in ms.
|
|
@@ -5372,11 +5443,9 @@ declare namespace CodeceptJS {
|
|
|
5372
5443
|
* @property [userAgent] - user-agent string.
|
|
5373
5444
|
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
5374
5445
|
* @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
5375
|
-
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/
|
|
5446
|
+
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
|
|
5376
5447
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
5377
5448
|
*/
|
|
5378
|
-
// @ts-ignore
|
|
5379
|
-
// @ts-ignore
|
|
5380
5449
|
type PuppeteerConfig = {
|
|
5381
5450
|
url: string;
|
|
5382
5451
|
basicAuth?: any;
|
|
@@ -5390,7 +5459,7 @@ declare namespace CodeceptJS {
|
|
|
5390
5459
|
keepBrowserState?: boolean;
|
|
5391
5460
|
keepCookies?: boolean;
|
|
5392
5461
|
waitForAction?: number;
|
|
5393
|
-
waitForNavigation?: string;
|
|
5462
|
+
waitForNavigation?: string | string[];
|
|
5394
5463
|
pressKeyDelay?: number;
|
|
5395
5464
|
getPageTimeout?: number;
|
|
5396
5465
|
waitForTimeout?: number;
|
|
@@ -5402,7 +5471,7 @@ declare namespace CodeceptJS {
|
|
|
5402
5471
|
highlightElement?: boolean;
|
|
5403
5472
|
};
|
|
5404
5473
|
/**
|
|
5405
|
-
* Uses [Google Chrome's Puppeteer](https://github.com/
|
|
5474
|
+
* Uses [Google Chrome's Puppeteer](https://github.com/puppeteer/puppeteer) library to run tests inside headless Chrome.
|
|
5406
5475
|
* Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
5407
5476
|
* This helper works with a browser out of the box with no additional tools required to install.
|
|
5408
5477
|
*
|
|
@@ -5800,6 +5869,17 @@ declare namespace CodeceptJS {
|
|
|
5800
5869
|
* {{ react }}
|
|
5801
5870
|
*/
|
|
5802
5871
|
_locate(): Promise<any>;
|
|
5872
|
+
/**
|
|
5873
|
+
* Get single element by different locator types, including strict locator
|
|
5874
|
+
* Should be used in custom helpers:
|
|
5875
|
+
*
|
|
5876
|
+
* ```js
|
|
5877
|
+
* const element = await this.helpers['Puppeteer']._locateElement({name: 'password'});
|
|
5878
|
+
* ```
|
|
5879
|
+
*
|
|
5880
|
+
* {{ react }}
|
|
5881
|
+
*/
|
|
5882
|
+
_locateElement(): Promise<any>;
|
|
5803
5883
|
/**
|
|
5804
5884
|
* Find a checkbox by providing human-readable text:
|
|
5805
5885
|
* NOTE: Assumes the checkable element exists
|
|
@@ -5836,6 +5916,17 @@ declare namespace CodeceptJS {
|
|
|
5836
5916
|
* @returns WebElement of being used Web helper
|
|
5837
5917
|
*/
|
|
5838
5918
|
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
5919
|
+
/**
|
|
5920
|
+
* Grab WebElement for given locator
|
|
5921
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
5922
|
+
*
|
|
5923
|
+
* ```js
|
|
5924
|
+
* const webElement = await I.grabWebElement('#button');
|
|
5925
|
+
* ```
|
|
5926
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
5927
|
+
* @returns WebElement of being used Web helper
|
|
5928
|
+
*/
|
|
5929
|
+
grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
5839
5930
|
/**
|
|
5840
5931
|
* Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
5841
5932
|
*
|
|
@@ -6047,6 +6138,23 @@ declare namespace CodeceptJS {
|
|
|
6047
6138
|
* @param [context = null] - (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
6048
6139
|
*/
|
|
6049
6140
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
6141
|
+
/**
|
|
6142
|
+
* Performs click at specific coordinates.
|
|
6143
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
6144
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
6145
|
+
*
|
|
6146
|
+
* ```js
|
|
6147
|
+
* // Click at global coordinates (100, 200)
|
|
6148
|
+
* I.clickXY(100, 200);
|
|
6149
|
+
*
|
|
6150
|
+
* // Click at coordinates (50, 30) relative to element
|
|
6151
|
+
* I.clickXY('#someElement', 50, 30);
|
|
6152
|
+
* ```
|
|
6153
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
6154
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
6155
|
+
* @param [y] - Y coordinate relative to element.
|
|
6156
|
+
*/
|
|
6157
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
6050
6158
|
/**
|
|
6051
6159
|
* Selects a checkbox or radio button.
|
|
6052
6160
|
* Element is located by label or name or CSS or XPath.
|
|
@@ -6126,7 +6234,7 @@ declare namespace CodeceptJS {
|
|
|
6126
6234
|
*/
|
|
6127
6235
|
pressKeyUp(key: string): Promise<any>;
|
|
6128
6236
|
/**
|
|
6129
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
6237
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
6130
6238
|
*
|
|
6131
6239
|
* Presses a key in the browser (on a focused element).
|
|
6132
6240
|
*
|
|
@@ -6307,10 +6415,25 @@ declare namespace CodeceptJS {
|
|
|
6307
6415
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
6308
6416
|
* ```
|
|
6309
6417
|
*
|
|
6418
|
+
* You can also use ARIA role locators:
|
|
6419
|
+
*
|
|
6420
|
+
* ```js
|
|
6421
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
6422
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
6423
|
+
* ```
|
|
6424
|
+
*
|
|
6425
|
+
* Or JSON string locators:
|
|
6426
|
+
*
|
|
6427
|
+
* ```js
|
|
6428
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
6429
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
6430
|
+
* ```
|
|
6431
|
+
*
|
|
6310
6432
|
* Provide an array for the second argument to select multiple options.
|
|
6311
6433
|
*
|
|
6312
6434
|
* ```js
|
|
6313
6435
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
6436
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
6314
6437
|
* ```
|
|
6315
6438
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
6316
6439
|
* @param option - visible text or value of option.
|
|
@@ -6974,7 +7097,7 @@ declare namespace CodeceptJS {
|
|
|
6974
7097
|
/**
|
|
6975
7098
|
* Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
6976
7099
|
*
|
|
6977
|
-
* See [Puppeteer's reference](https://github.com/
|
|
7100
|
+
* See [Puppeteer's reference](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md)
|
|
6978
7101
|
*/
|
|
6979
7102
|
waitForNavigation(opts: any): Promise<any>;
|
|
6980
7103
|
/**
|
|
@@ -7175,6 +7298,22 @@ declare namespace CodeceptJS {
|
|
|
7175
7298
|
*/
|
|
7176
7299
|
flushWebSocketMessages(): Promise<any>;
|
|
7177
7300
|
}
|
|
7301
|
+
/**
|
|
7302
|
+
* Find elements using Puppeteer's native element discovery methods
|
|
7303
|
+
* Note: Unlike Playwright, Puppeteer's Locator API doesn't have .all() method for multiple elements
|
|
7304
|
+
* @param matcher - Puppeteer context to search within
|
|
7305
|
+
* @param locator - Locator specification
|
|
7306
|
+
* @returns Array of ElementHandle objects
|
|
7307
|
+
*/
|
|
7308
|
+
function findElements(matcher: any, locator: any | string): Promise<any[]>;
|
|
7309
|
+
/**
|
|
7310
|
+
* Find a single element using Puppeteer's native element discovery methods
|
|
7311
|
+
* Note: Puppeteer Locator API doesn't have .first() method like Playwright
|
|
7312
|
+
* @param matcher - Puppeteer context to search within
|
|
7313
|
+
* @param locator - Locator specification
|
|
7314
|
+
* @returns Single ElementHandle object
|
|
7315
|
+
*/
|
|
7316
|
+
function findElement(matcher: any, locator: any | string): Promise<object>;
|
|
7178
7317
|
/**
|
|
7179
7318
|
* ## Configuration
|
|
7180
7319
|
* @property [endpoint] - API base URL
|
|
@@ -7187,8 +7326,6 @@ declare namespace CodeceptJS {
|
|
|
7187
7326
|
* @property [onResponse] - an async function which can update response object.
|
|
7188
7327
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
7189
7328
|
*/
|
|
7190
|
-
// @ts-ignore
|
|
7191
|
-
// @ts-ignore
|
|
7192
7329
|
type RESTConfig = {
|
|
7193
7330
|
endpoint?: string;
|
|
7194
7331
|
prettyPrintJson?: boolean;
|
|
@@ -7314,6 +7451,16 @@ declare namespace CodeceptJS {
|
|
|
7314
7451
|
* @returns response
|
|
7315
7452
|
*/
|
|
7316
7453
|
sendGetRequest(url: any, headers?: any): Promise<any>;
|
|
7454
|
+
/**
|
|
7455
|
+
* Send HEAD request to REST API
|
|
7456
|
+
*
|
|
7457
|
+
* ```js
|
|
7458
|
+
* I.sendHeadRequest('/api/users.json');
|
|
7459
|
+
* ```
|
|
7460
|
+
* @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
|
|
7461
|
+
* @returns response
|
|
7462
|
+
*/
|
|
7463
|
+
sendHeadRequest(url: any, headers?: any): Promise<any>;
|
|
7317
7464
|
/**
|
|
7318
7465
|
* Sends POST request to API.
|
|
7319
7466
|
*
|
|
@@ -7413,8 +7560,6 @@ declare namespace CodeceptJS {
|
|
|
7413
7560
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
7414
7561
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
7415
7562
|
*/
|
|
7416
|
-
// @ts-ignore
|
|
7417
|
-
// @ts-ignore
|
|
7418
7563
|
type WebDriverConfig = {
|
|
7419
7564
|
url: string;
|
|
7420
7565
|
browser: string;
|
|
@@ -7890,6 +8035,17 @@ declare namespace CodeceptJS {
|
|
|
7890
8035
|
* @returns WebElement of being used Web helper
|
|
7891
8036
|
*/
|
|
7892
8037
|
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
8038
|
+
/**
|
|
8039
|
+
* Grab WebElement for given locator
|
|
8040
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
8041
|
+
*
|
|
8042
|
+
* ```js
|
|
8043
|
+
* const webElement = await I.grabWebElement('#button');
|
|
8044
|
+
* ```
|
|
8045
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
8046
|
+
* @returns WebElement of being used Web helper
|
|
8047
|
+
*/
|
|
8048
|
+
grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
7893
8049
|
/**
|
|
7894
8050
|
* Set [WebDriver timeouts](https://webdriver.io/docs/timeouts.html) in realtime.
|
|
7895
8051
|
*
|
|
@@ -8002,6 +8158,23 @@ declare namespace CodeceptJS {
|
|
|
8002
8158
|
* @param [context = null] - (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
8003
8159
|
*/
|
|
8004
8160
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
8161
|
+
/**
|
|
8162
|
+
* Performs click at specific coordinates.
|
|
8163
|
+
* If locator is provided, the coordinates are relative to the element's top-left corner.
|
|
8164
|
+
* If locator is not provided, the coordinates are relative to the body element.
|
|
8165
|
+
*
|
|
8166
|
+
* ```js
|
|
8167
|
+
* // Click at coordinates (100, 200) relative to body
|
|
8168
|
+
* I.clickXY(100, 200);
|
|
8169
|
+
*
|
|
8170
|
+
* // Click at coordinates (50, 30) relative to element's top-left corner
|
|
8171
|
+
* I.clickXY('#someElement', 50, 30);
|
|
8172
|
+
* ```
|
|
8173
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
8174
|
+
* @param [x] - X coordinate relative to element's top-left, or Y coordinate if locator is a number.
|
|
8175
|
+
* @param [y] - Y coordinate relative to element's top-left.
|
|
8176
|
+
*/
|
|
8177
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
8005
8178
|
/**
|
|
8006
8179
|
* Emulates right click on an element.
|
|
8007
8180
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
@@ -8077,10 +8250,25 @@ declare namespace CodeceptJS {
|
|
|
8077
8250
|
* I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
8078
8251
|
* ```
|
|
8079
8252
|
*
|
|
8253
|
+
* You can also use ARIA role locators:
|
|
8254
|
+
*
|
|
8255
|
+
* ```js
|
|
8256
|
+
* I.selectOption({ role: 'combobox', name: 'Country' }, 'United States');
|
|
8257
|
+
* I.selectOption({ role: 'listbox', name: 'options' }, 'Option 1');
|
|
8258
|
+
* ```
|
|
8259
|
+
*
|
|
8260
|
+
* Or JSON string locators:
|
|
8261
|
+
*
|
|
8262
|
+
* ```js
|
|
8263
|
+
* I.selectOption('{"role": "combobox", "name": "Country"}', 'United States');
|
|
8264
|
+
* I.selectOption('{"role": "listbox", "name": "options"}', 'Option 1');
|
|
8265
|
+
* ```
|
|
8266
|
+
*
|
|
8080
8267
|
* Provide an array for the second argument to select multiple options.
|
|
8081
8268
|
*
|
|
8082
8269
|
* ```js
|
|
8083
8270
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
8271
|
+
* I.selectOption({ role: 'combobox', name: 'OS' }, ['Android', 'iOS']);
|
|
8084
8272
|
* ```
|
|
8085
8273
|
* @param select - field located by label|name|CSS|XPath|strict locator.
|
|
8086
8274
|
* @param option - visible text or value of option.
|