codeceptjs 4.0.1-beta.26 → 4.0.1-beta.28
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/container.js +24 -0
- package/lib/step/base.js +14 -1
- package/lib/step/record.js +9 -0
- package/package.json +1 -1
- package/typings/promiseBasedTypes.d.ts +136 -43
- package/typings/types.d.ts +150 -74
package/lib/container.js
CHANGED
|
@@ -34,6 +34,7 @@ let container = {
|
|
|
34
34
|
/** @type {Result | null} */
|
|
35
35
|
result: null,
|
|
36
36
|
sharedKeys: new Set(), // Track keys shared via share() function
|
|
37
|
+
tsFileMapping: null, // TypeScript file mapping for error stack fixing
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
/**
|
|
@@ -176,6 +177,15 @@ class Container {
|
|
|
176
177
|
return container.translation
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Get TypeScript file mapping for error stack fixing
|
|
182
|
+
*
|
|
183
|
+
* @api
|
|
184
|
+
*/
|
|
185
|
+
static tsFileMapping() {
|
|
186
|
+
return container.tsFileMapping
|
|
187
|
+
}
|
|
188
|
+
|
|
179
189
|
/**
|
|
180
190
|
* Get Mocha instance
|
|
181
191
|
*
|
|
@@ -415,6 +425,13 @@ async function requireHelperFromModule(helperName, config, HelperClass) {
|
|
|
415
425
|
importPath = tempFile
|
|
416
426
|
tempJsFile = allTempFiles
|
|
417
427
|
fileMapping = mapping
|
|
428
|
+
// Store file mapping in container for runtime error fixing (merge with existing)
|
|
429
|
+
if (!container.tsFileMapping) {
|
|
430
|
+
container.tsFileMapping = new Map()
|
|
431
|
+
}
|
|
432
|
+
for (const [key, value] of mapping.entries()) {
|
|
433
|
+
container.tsFileMapping.set(key, value)
|
|
434
|
+
}
|
|
418
435
|
} catch (tsError) {
|
|
419
436
|
throw new Error(`Failed to load TypeScript helper ${importPath}: ${tsError.message}. Make sure 'typescript' package is installed.`)
|
|
420
437
|
}
|
|
@@ -757,6 +774,13 @@ async function loadSupportObject(modulePath, supportObjectName) {
|
|
|
757
774
|
// Store temp files list in a way that cleanup can access them
|
|
758
775
|
tempJsFile = allTempFiles
|
|
759
776
|
fileMapping = mapping
|
|
777
|
+
// Store file mapping in container for runtime error fixing (merge with existing)
|
|
778
|
+
if (!container.tsFileMapping) {
|
|
779
|
+
container.tsFileMapping = new Map()
|
|
780
|
+
}
|
|
781
|
+
for (const [key, value] of mapping.entries()) {
|
|
782
|
+
container.tsFileMapping.set(key, value)
|
|
783
|
+
}
|
|
760
784
|
} catch (tsError) {
|
|
761
785
|
throw new Error(`Failed to load TypeScript file ${importPath}: ${tsError.message}. Make sure 'typescript' package is installed.`)
|
|
762
786
|
}
|
package/lib/step/base.js
CHANGED
|
@@ -147,9 +147,22 @@ class Step {
|
|
|
147
147
|
line() {
|
|
148
148
|
const lines = this.stack.split('\n')
|
|
149
149
|
if (lines[STACK_LINE]) {
|
|
150
|
-
|
|
150
|
+
let line = lines[STACK_LINE].trim()
|
|
151
151
|
.replace(global.codecept_dir || '', '.')
|
|
152
152
|
.trim()
|
|
153
|
+
|
|
154
|
+
// Map .temp.mjs back to original .ts files using container's tsFileMapping
|
|
155
|
+
const fileMapping = global.container?.tsFileMapping?.()
|
|
156
|
+
if (line.includes('.temp.mjs') && fileMapping) {
|
|
157
|
+
for (const [tsFile, mjsFile] of fileMapping.entries()) {
|
|
158
|
+
if (line.includes(mjsFile)) {
|
|
159
|
+
line = line.replace(mjsFile, tsFile)
|
|
160
|
+
break
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return line
|
|
153
166
|
}
|
|
154
167
|
return ''
|
|
155
168
|
}
|
package/lib/step/record.js
CHANGED
|
@@ -5,6 +5,8 @@ import output from '../output.js'
|
|
|
5
5
|
import store from '../store.js'
|
|
6
6
|
import { TIMEOUT_ORDER } from '../timeout.js'
|
|
7
7
|
import retryStep from './retry.js'
|
|
8
|
+
import { fixErrorStack } from '../utils/typescript.js'
|
|
9
|
+
import Container from '../container.js'
|
|
8
10
|
function recordStep(step, args) {
|
|
9
11
|
step.status = 'queued'
|
|
10
12
|
|
|
@@ -60,6 +62,13 @@ function recordStep(step, args) {
|
|
|
60
62
|
recorder.catch(err => {
|
|
61
63
|
step.status = 'failed'
|
|
62
64
|
step.endTime = +Date.now()
|
|
65
|
+
|
|
66
|
+
// Fix error stack to point to original .ts files
|
|
67
|
+
const fileMapping = Container.tsFileMapping()
|
|
68
|
+
if (fileMapping) {
|
|
69
|
+
fixErrorStack(err, fileMapping)
|
|
70
|
+
}
|
|
71
|
+
|
|
63
72
|
event.emit(event.step.failed, step, err)
|
|
64
73
|
event.emit(event.step.finished, step)
|
|
65
74
|
throw err
|
package/package.json
CHANGED
|
@@ -870,9 +870,13 @@ declare namespace CodeceptJS {
|
|
|
870
870
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
871
871
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
872
872
|
*
|
|
873
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
874
|
+
*
|
|
873
875
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
874
876
|
*
|
|
875
877
|
* ```js
|
|
878
|
+
* // click body element (default)
|
|
879
|
+
* I.click();
|
|
876
880
|
* // simple link
|
|
877
881
|
* I.click('Logout');
|
|
878
882
|
* // button of form
|
|
@@ -886,10 +890,10 @@ declare namespace CodeceptJS {
|
|
|
886
890
|
* // using strict locator
|
|
887
891
|
* I.click({css: 'nav a.login'});
|
|
888
892
|
* ```
|
|
889
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
893
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
890
894
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
891
895
|
*/
|
|
892
|
-
click(locator
|
|
896
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): Promise<any>;
|
|
893
897
|
/**
|
|
894
898
|
* Verifies that the specified checkbox is not checked.
|
|
895
899
|
*
|
|
@@ -1725,28 +1729,28 @@ declare namespace CodeceptJS {
|
|
|
1725
1729
|
*/
|
|
1726
1730
|
seeResponseEquals(resp: any): Promise<any>;
|
|
1727
1731
|
/**
|
|
1728
|
-
* Validates JSON structure of response using [
|
|
1729
|
-
* See [
|
|
1732
|
+
* Validates JSON structure of response using [Zod library](https://zod.dev).
|
|
1733
|
+
* See [Zod API](https://zod.dev/) for complete reference on usage.
|
|
1730
1734
|
*
|
|
1731
|
-
* Use pre-initialized
|
|
1735
|
+
* Use pre-initialized Zod instance by passing function callback:
|
|
1732
1736
|
*
|
|
1733
1737
|
* ```js
|
|
1734
1738
|
* // response.data is { name: 'jon', id: 1 }
|
|
1735
1739
|
*
|
|
1736
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1737
|
-
* return
|
|
1738
|
-
* name:
|
|
1739
|
-
* id:
|
|
1740
|
+
* I.seeResponseMatchesJsonSchema(z => {
|
|
1741
|
+
* return z.object({
|
|
1742
|
+
* name: z.string(),
|
|
1743
|
+
* id: z.number()
|
|
1740
1744
|
* })
|
|
1741
1745
|
* });
|
|
1742
1746
|
*
|
|
1743
1747
|
* // or pass a valid schema
|
|
1744
|
-
*
|
|
1748
|
+
* import { z } from 'zod';
|
|
1745
1749
|
*
|
|
1746
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1747
|
-
* name:
|
|
1748
|
-
* id:
|
|
1749
|
-
* });
|
|
1750
|
+
* I.seeResponseMatchesJsonSchema(z.object({
|
|
1751
|
+
* name: z.string(),
|
|
1752
|
+
* id: z.number()
|
|
1753
|
+
* }));
|
|
1750
1754
|
* ```
|
|
1751
1755
|
*/
|
|
1752
1756
|
seeResponseMatchesJsonSchema(fnOrSchema: any): Promise<any>;
|
|
@@ -2690,6 +2694,13 @@ declare namespace CodeceptJS {
|
|
|
2690
2694
|
*/
|
|
2691
2695
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
2692
2696
|
}
|
|
2697
|
+
/**
|
|
2698
|
+
* Creates a Playwright selector engine factory for a custom locator strategy.
|
|
2699
|
+
* @param name - Strategy name for error messages
|
|
2700
|
+
* @param func - The locator function (selector, root) => Element|Element[]
|
|
2701
|
+
* @returns Selector engine factory
|
|
2702
|
+
*/
|
|
2703
|
+
function createCustomSelectorEngine(name: string, func: (...params: any[]) => any): (...params: any[]) => any;
|
|
2693
2704
|
/**
|
|
2694
2705
|
* ## Configuration
|
|
2695
2706
|
*
|
|
@@ -2699,7 +2710,6 @@ declare namespace CodeceptJS {
|
|
|
2699
2710
|
* @property [show = true] - show browser window.
|
|
2700
2711
|
* @property [restart = false] - restart strategy between tests. Possible values:
|
|
2701
2712
|
* * '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.
|
|
2702
|
-
* * 'browser' or **true** - closes browser and opens it again between tests.
|
|
2703
2713
|
* * 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default before CodeceptJS 3.1
|
|
2704
2714
|
* @property [timeout = 1000] - - [timeout](https://playwright.dev/docs/api/class-page#page-set-default-timeout) in ms of all Playwright actions .
|
|
2705
2715
|
* @property [disableScreenshots = false] - don't save screenshot on failure.
|
|
@@ -2741,8 +2751,6 @@ declare namespace CodeceptJS {
|
|
|
2741
2751
|
* May include session cookies, auth tokens, localStorage and (if captured with
|
|
2742
2752
|
* `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
|
|
2743
2753
|
*/
|
|
2744
|
-
// @ts-ignore
|
|
2745
|
-
// @ts-ignore
|
|
2746
2754
|
type PlaywrightConfig = {
|
|
2747
2755
|
url?: string;
|
|
2748
2756
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -3206,20 +3214,6 @@ declare namespace CodeceptJS {
|
|
|
3206
3214
|
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-page#page-drag-and-drop) can be passed as 3rd argument.
|
|
3207
3215
|
*/
|
|
3208
3216
|
dragAndDrop(srcElement: LocatorOrString, destElement: LocatorOrString, options?: any): Promise<any>;
|
|
3209
|
-
/**
|
|
3210
|
-
* Restart browser with a new context and a new page
|
|
3211
|
-
*
|
|
3212
|
-
* ```js
|
|
3213
|
-
* // Restart browser and use a new timezone
|
|
3214
|
-
* I.restartBrowser({ timezoneId: 'America/Phoenix' });
|
|
3215
|
-
* // Open URL in a new page in changed timezone
|
|
3216
|
-
* I.amOnPage('/');
|
|
3217
|
-
* // Restart browser, allow reading/copying of text from/into clipboard in Chrome
|
|
3218
|
-
* I.restartBrowser({ permissions: ['clipboard-read', 'clipboard-write'] });
|
|
3219
|
-
* ```
|
|
3220
|
-
* @param [contextOptions] - [Options for browser context](https://playwright.dev/docs/api/class-browser#browser-new-context) when starting new browser
|
|
3221
|
-
*/
|
|
3222
|
-
restartBrowser(contextOptions?: any): Promise<any>;
|
|
3223
3217
|
/**
|
|
3224
3218
|
* Reload the current page.
|
|
3225
3219
|
*
|
|
@@ -3503,9 +3497,13 @@ declare namespace CodeceptJS {
|
|
|
3503
3497
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
3504
3498
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
3505
3499
|
*
|
|
3500
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
3501
|
+
*
|
|
3506
3502
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
3507
3503
|
*
|
|
3508
3504
|
* ```js
|
|
3505
|
+
* // click body element (default)
|
|
3506
|
+
* I.click();
|
|
3509
3507
|
* // simple link
|
|
3510
3508
|
* I.click('Logout');
|
|
3511
3509
|
* // button of form
|
|
@@ -3527,11 +3525,11 @@ declare namespace CodeceptJS {
|
|
|
3527
3525
|
* // make ctrl-click
|
|
3528
3526
|
* I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
3529
3527
|
* ```
|
|
3530
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
3528
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
3531
3529
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
3532
3530
|
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
|
|
3533
3531
|
*/
|
|
3534
|
-
click(locator
|
|
3532
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null, options?: any): Promise<any>;
|
|
3535
3533
|
/**
|
|
3536
3534
|
* Clicks link and waits for navigation (deprecated)
|
|
3537
3535
|
*/
|
|
@@ -3594,6 +3592,23 @@ declare namespace CodeceptJS {
|
|
|
3594
3592
|
* @param [context = null] - (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
3595
3593
|
*/
|
|
3596
3594
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
3595
|
+
/**
|
|
3596
|
+
* Performs click at specific coordinates.
|
|
3597
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
3598
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
3599
|
+
*
|
|
3600
|
+
* ```js
|
|
3601
|
+
* // Click at global coordinates (100, 200)
|
|
3602
|
+
* I.clickXY(100, 200);
|
|
3603
|
+
*
|
|
3604
|
+
* // Click at coordinates (50, 30) relative to element
|
|
3605
|
+
* I.clickXY('#someElement', 50, 30);
|
|
3606
|
+
* ```
|
|
3607
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
3608
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
3609
|
+
* @param [y] - Y coordinate relative to element.
|
|
3610
|
+
*/
|
|
3611
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
3597
3612
|
/**
|
|
3598
3613
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
|
|
3599
3614
|
*
|
|
@@ -4302,6 +4317,24 @@ declare namespace CodeceptJS {
|
|
|
4302
4317
|
* @returns attribute value
|
|
4303
4318
|
*/
|
|
4304
4319
|
grabAttributeFromAll(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string[]>;
|
|
4320
|
+
/**
|
|
4321
|
+
* Retrieves the ARIA snapshot for an element using Playwright's [`locator.ariaSnapshot`](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot).
|
|
4322
|
+
* This method returns a YAML representation of the accessibility tree that can be used for assertions.
|
|
4323
|
+
* If no locator is provided, it captures the snapshot of the entire page body.
|
|
4324
|
+
*
|
|
4325
|
+
* ```js
|
|
4326
|
+
* const snapshot = await I.grabAriaSnapshot();
|
|
4327
|
+
* expect(snapshot).toContain('heading "Sign up"');
|
|
4328
|
+
*
|
|
4329
|
+
* const formSnapshot = await I.grabAriaSnapshot('#login-form');
|
|
4330
|
+
* expect(formSnapshot).toContain('textbox "Email"');
|
|
4331
|
+
* ```
|
|
4332
|
+
*
|
|
4333
|
+
* [Learn more about ARIA snapshots](https://playwright.dev/docs/aria-snapshots)
|
|
4334
|
+
* @param [locator = '//body'] - element located by CSS|XPath|strict locator. Defaults to body element.
|
|
4335
|
+
* @returns YAML representation of the accessibility tree
|
|
4336
|
+
*/
|
|
4337
|
+
grabAriaSnapshot(locator?: string | any): Promise<string>;
|
|
4305
4338
|
/**
|
|
4306
4339
|
* Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
4307
4340
|
* Filename is relative to output folder.
|
|
@@ -4863,6 +4896,15 @@ declare namespace CodeceptJS {
|
|
|
4863
4896
|
*/
|
|
4864
4897
|
grabMetrics(): Promise<object[]>;
|
|
4865
4898
|
}
|
|
4899
|
+
/**
|
|
4900
|
+
* Checks if a locator is a role locator object (e.g., {role: 'button', text: 'Submit', exact: true})
|
|
4901
|
+
*/
|
|
4902
|
+
function isRoleLocatorObject(): void;
|
|
4903
|
+
/**
|
|
4904
|
+
* Handles role locator objects by converting them to Playwright's getByRole() API
|
|
4905
|
+
* Returns elements array if role locator, null otherwise
|
|
4906
|
+
*/
|
|
4907
|
+
function handleRoleLocator(): void;
|
|
4866
4908
|
/**
|
|
4867
4909
|
* Protractor helper is based on [Protractor library](http://www.protractortest.org) and used for testing web applications.
|
|
4868
4910
|
*
|
|
@@ -6115,6 +6157,11 @@ declare namespace CodeceptJS {
|
|
|
6115
6157
|
*/
|
|
6116
6158
|
setCookie(cookie: Cookie | Cookie[]): Promise<any>;
|
|
6117
6159
|
}
|
|
6160
|
+
/**
|
|
6161
|
+
* Wraps error objects that don't have a proper message property
|
|
6162
|
+
* This is needed for ESM compatibility with Puppeteer error handling
|
|
6163
|
+
*/
|
|
6164
|
+
function wrapError(): void;
|
|
6118
6165
|
/**
|
|
6119
6166
|
* ## Configuration
|
|
6120
6167
|
*
|
|
@@ -6142,8 +6189,6 @@ declare namespace CodeceptJS {
|
|
|
6142
6189
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
|
|
6143
6190
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6144
6191
|
*/
|
|
6145
|
-
// @ts-ignore
|
|
6146
|
-
// @ts-ignore
|
|
6147
6192
|
type PuppeteerConfig = {
|
|
6148
6193
|
url: string;
|
|
6149
6194
|
basicAuth?: any;
|
|
@@ -6721,9 +6766,13 @@ declare namespace CodeceptJS {
|
|
|
6721
6766
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
6722
6767
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
6723
6768
|
*
|
|
6769
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
6770
|
+
*
|
|
6724
6771
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
6725
6772
|
*
|
|
6726
6773
|
* ```js
|
|
6774
|
+
* // click body element (default)
|
|
6775
|
+
* I.click();
|
|
6727
6776
|
* // simple link
|
|
6728
6777
|
* I.click('Logout');
|
|
6729
6778
|
* // button of form
|
|
@@ -6737,10 +6786,10 @@ declare namespace CodeceptJS {
|
|
|
6737
6786
|
* // using strict locator
|
|
6738
6787
|
* I.click({css: 'nav a.login'});
|
|
6739
6788
|
* ```
|
|
6740
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
6789
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
6741
6790
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
6742
6791
|
*/
|
|
6743
|
-
click(locator
|
|
6792
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): Promise<any>;
|
|
6744
6793
|
/**
|
|
6745
6794
|
* Perform an emulated click on a link or a button, given by a locator.
|
|
6746
6795
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
@@ -6832,6 +6881,23 @@ declare namespace CodeceptJS {
|
|
|
6832
6881
|
* @param [context = null] - (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
6833
6882
|
*/
|
|
6834
6883
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
6884
|
+
/**
|
|
6885
|
+
* Performs click at specific coordinates.
|
|
6886
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
6887
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
6888
|
+
*
|
|
6889
|
+
* ```js
|
|
6890
|
+
* // Click at global coordinates (100, 200)
|
|
6891
|
+
* I.clickXY(100, 200);
|
|
6892
|
+
*
|
|
6893
|
+
* // Click at coordinates (50, 30) relative to element
|
|
6894
|
+
* I.clickXY('#someElement', 50, 30);
|
|
6895
|
+
* ```
|
|
6896
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
6897
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
6898
|
+
* @param [y] - Y coordinate relative to element.
|
|
6899
|
+
*/
|
|
6900
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
6835
6901
|
/**
|
|
6836
6902
|
* Selects a checkbox or radio button.
|
|
6837
6903
|
* Element is located by label or name or CSS or XPath.
|
|
@@ -7988,8 +8054,6 @@ declare namespace CodeceptJS {
|
|
|
7988
8054
|
* @property [onResponse] - an async function which can update response object.
|
|
7989
8055
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
7990
8056
|
*/
|
|
7991
|
-
// @ts-ignore
|
|
7992
|
-
// @ts-ignore
|
|
7993
8057
|
type RESTConfig = {
|
|
7994
8058
|
endpoint?: string;
|
|
7995
8059
|
prettyPrintJson?: boolean;
|
|
@@ -9118,6 +9182,11 @@ declare namespace CodeceptJS {
|
|
|
9118
9182
|
*/
|
|
9119
9183
|
waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
9120
9184
|
}
|
|
9185
|
+
/**
|
|
9186
|
+
* Wraps error objects that don't have a proper message property
|
|
9187
|
+
* This is needed for ESM compatibility with Puppeteer error handling
|
|
9188
|
+
*/
|
|
9189
|
+
function wrapError(): void;
|
|
9121
9190
|
/**
|
|
9122
9191
|
* ## Configuration
|
|
9123
9192
|
*
|
|
@@ -9145,8 +9214,6 @@ declare namespace CodeceptJS {
|
|
|
9145
9214
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
9146
9215
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9147
9216
|
*/
|
|
9148
|
-
// @ts-ignore
|
|
9149
|
-
// @ts-ignore
|
|
9150
9217
|
type WebDriverConfig = {
|
|
9151
9218
|
url: string;
|
|
9152
9219
|
browser: string;
|
|
@@ -9606,6 +9673,11 @@ declare namespace CodeceptJS {
|
|
|
9606
9673
|
* @param locator - element located by CSS|XPath|strict locator.
|
|
9607
9674
|
*/
|
|
9608
9675
|
_locateFields(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
9676
|
+
/**
|
|
9677
|
+
* Locate elements by ARIA role using WebdriverIO accessibility selectors
|
|
9678
|
+
* @param locator - role locator object { role: string, text?: string, exact?: boolean }
|
|
9679
|
+
*/
|
|
9680
|
+
_locateByRole(locator: any): Promise<any>;
|
|
9609
9681
|
/**
|
|
9610
9682
|
* Grab WebElements for given locator
|
|
9611
9683
|
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
@@ -9658,9 +9730,13 @@ declare namespace CodeceptJS {
|
|
|
9658
9730
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
9659
9731
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
9660
9732
|
*
|
|
9733
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
9734
|
+
*
|
|
9661
9735
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
9662
9736
|
*
|
|
9663
9737
|
* ```js
|
|
9738
|
+
* // click body element (default)
|
|
9739
|
+
* I.click();
|
|
9664
9740
|
* // simple link
|
|
9665
9741
|
* I.click('Logout');
|
|
9666
9742
|
* // button of form
|
|
@@ -9674,10 +9750,10 @@ declare namespace CodeceptJS {
|
|
|
9674
9750
|
* // using strict locator
|
|
9675
9751
|
* I.click({css: 'nav a.login'});
|
|
9676
9752
|
* ```
|
|
9677
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
9753
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
9678
9754
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
9679
9755
|
*/
|
|
9680
|
-
click(locator
|
|
9756
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): Promise<any>;
|
|
9681
9757
|
/**
|
|
9682
9758
|
* Perform an emulated click on a link or a button, given by a locator.
|
|
9683
9759
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
@@ -9736,6 +9812,23 @@ declare namespace CodeceptJS {
|
|
|
9736
9812
|
* @param [context = null] - (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
9737
9813
|
*/
|
|
9738
9814
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
9815
|
+
/**
|
|
9816
|
+
* Performs click at specific coordinates.
|
|
9817
|
+
* If locator is provided, the coordinates are relative to the element's top-left corner.
|
|
9818
|
+
* If locator is not provided, the coordinates are relative to the body element.
|
|
9819
|
+
*
|
|
9820
|
+
* ```js
|
|
9821
|
+
* // Click at coordinates (100, 200) relative to body
|
|
9822
|
+
* I.clickXY(100, 200);
|
|
9823
|
+
*
|
|
9824
|
+
* // Click at coordinates (50, 30) relative to element's top-left corner
|
|
9825
|
+
* I.clickXY('#someElement', 50, 30);
|
|
9826
|
+
* ```
|
|
9827
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
9828
|
+
* @param [x] - X coordinate relative to element's top-left, or Y coordinate if locator is a number.
|
|
9829
|
+
* @param [y] - Y coordinate relative to element's top-left.
|
|
9830
|
+
*/
|
|
9831
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
9739
9832
|
/**
|
|
9740
9833
|
* Emulates right click on an element.
|
|
9741
9834
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
package/typings/types.d.ts
CHANGED
|
@@ -872,9 +872,13 @@ declare namespace CodeceptJS {
|
|
|
872
872
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
873
873
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
874
874
|
*
|
|
875
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
876
|
+
*
|
|
875
877
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
876
878
|
*
|
|
877
879
|
* ```js
|
|
880
|
+
* // click body element (default)
|
|
881
|
+
* I.click();
|
|
878
882
|
* // simple link
|
|
879
883
|
* I.click('Logout');
|
|
880
884
|
* // button of form
|
|
@@ -888,11 +892,11 @@ declare namespace CodeceptJS {
|
|
|
888
892
|
* // using strict locator
|
|
889
893
|
* I.click({css: 'nav a.login'});
|
|
890
894
|
* ```
|
|
891
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
895
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
892
896
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
893
897
|
* @returns automatically synchronized promise through #recorder
|
|
894
898
|
*/
|
|
895
|
-
click(locator
|
|
899
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
896
900
|
/**
|
|
897
901
|
* Verifies that the specified checkbox is not checked.
|
|
898
902
|
*
|
|
@@ -1752,28 +1756,28 @@ declare namespace CodeceptJS {
|
|
|
1752
1756
|
*/
|
|
1753
1757
|
seeResponseEquals(resp: any): void;
|
|
1754
1758
|
/**
|
|
1755
|
-
* Validates JSON structure of response using [
|
|
1756
|
-
* See [
|
|
1759
|
+
* Validates JSON structure of response using [Zod library](https://zod.dev).
|
|
1760
|
+
* See [Zod API](https://zod.dev/) for complete reference on usage.
|
|
1757
1761
|
*
|
|
1758
|
-
* Use pre-initialized
|
|
1762
|
+
* Use pre-initialized Zod instance by passing function callback:
|
|
1759
1763
|
*
|
|
1760
1764
|
* ```js
|
|
1761
1765
|
* // response.data is { name: 'jon', id: 1 }
|
|
1762
1766
|
*
|
|
1763
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1764
|
-
* return
|
|
1765
|
-
* name:
|
|
1766
|
-
* id:
|
|
1767
|
+
* I.seeResponseMatchesJsonSchema(z => {
|
|
1768
|
+
* return z.object({
|
|
1769
|
+
* name: z.string(),
|
|
1770
|
+
* id: z.number()
|
|
1767
1771
|
* })
|
|
1768
1772
|
* });
|
|
1769
1773
|
*
|
|
1770
1774
|
* // or pass a valid schema
|
|
1771
|
-
*
|
|
1775
|
+
* import { z } from 'zod';
|
|
1772
1776
|
*
|
|
1773
|
-
* I.seeResponseMatchesJsonSchema(
|
|
1774
|
-
* name:
|
|
1775
|
-
* id:
|
|
1776
|
-
* });
|
|
1777
|
+
* I.seeResponseMatchesJsonSchema(z.object({
|
|
1778
|
+
* name: z.string(),
|
|
1779
|
+
* id: z.number()
|
|
1780
|
+
* }));
|
|
1777
1781
|
* ```
|
|
1778
1782
|
*/
|
|
1779
1783
|
seeResponseMatchesJsonSchema(fnOrSchema: any): void;
|
|
@@ -2780,6 +2784,13 @@ declare namespace CodeceptJS {
|
|
|
2780
2784
|
*/
|
|
2781
2785
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
2782
2786
|
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Creates a Playwright selector engine factory for a custom locator strategy.
|
|
2789
|
+
* @param name - Strategy name for error messages
|
|
2790
|
+
* @param func - The locator function (selector, root) => Element|Element[]
|
|
2791
|
+
* @returns Selector engine factory
|
|
2792
|
+
*/
|
|
2793
|
+
function createCustomSelectorEngine(name: string, func: (...params: any[]) => any): (...params: any[]) => any;
|
|
2783
2794
|
/**
|
|
2784
2795
|
* ## Configuration
|
|
2785
2796
|
*
|
|
@@ -2789,7 +2800,6 @@ declare namespace CodeceptJS {
|
|
|
2789
2800
|
* @property [show = true] - show browser window.
|
|
2790
2801
|
* @property [restart = false] - restart strategy between tests. Possible values:
|
|
2791
2802
|
* * '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.
|
|
2792
|
-
* * 'browser' or **true** - closes browser and opens it again between tests.
|
|
2793
2803
|
* * 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default before CodeceptJS 3.1
|
|
2794
2804
|
* @property [timeout = 1000] - - [timeout](https://playwright.dev/docs/api/class-page#page-set-default-timeout) in ms of all Playwright actions .
|
|
2795
2805
|
* @property [disableScreenshots = false] - don't save screenshot on failure.
|
|
@@ -2831,8 +2841,6 @@ declare namespace CodeceptJS {
|
|
|
2831
2841
|
* May include session cookies, auth tokens, localStorage and (if captured with
|
|
2832
2842
|
* `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
|
|
2833
2843
|
*/
|
|
2834
|
-
// @ts-ignore
|
|
2835
|
-
// @ts-ignore
|
|
2836
2844
|
type PlaywrightConfig = {
|
|
2837
2845
|
url?: string;
|
|
2838
2846
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -3303,20 +3311,6 @@ declare namespace CodeceptJS {
|
|
|
3303
3311
|
* @returns automatically synchronized promise through #recorder
|
|
3304
3312
|
*/
|
|
3305
3313
|
dragAndDrop(srcElement: LocatorOrString, destElement: LocatorOrString, options?: any): void;
|
|
3306
|
-
/**
|
|
3307
|
-
* Restart browser with a new context and a new page
|
|
3308
|
-
*
|
|
3309
|
-
* ```js
|
|
3310
|
-
* // Restart browser and use a new timezone
|
|
3311
|
-
* I.restartBrowser({ timezoneId: 'America/Phoenix' });
|
|
3312
|
-
* // Open URL in a new page in changed timezone
|
|
3313
|
-
* I.amOnPage('/');
|
|
3314
|
-
* // Restart browser, allow reading/copying of text from/into clipboard in Chrome
|
|
3315
|
-
* I.restartBrowser({ permissions: ['clipboard-read', 'clipboard-write'] });
|
|
3316
|
-
* ```
|
|
3317
|
-
* @param [contextOptions] - [Options for browser context](https://playwright.dev/docs/api/class-browser#browser-new-context) when starting new browser
|
|
3318
|
-
*/
|
|
3319
|
-
restartBrowser(contextOptions?: any): void;
|
|
3320
3314
|
/**
|
|
3321
3315
|
* Reload the current page.
|
|
3322
3316
|
*
|
|
@@ -3612,9 +3606,13 @@ declare namespace CodeceptJS {
|
|
|
3612
3606
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
3613
3607
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
3614
3608
|
*
|
|
3609
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
3610
|
+
*
|
|
3615
3611
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
3616
3612
|
*
|
|
3617
3613
|
* ```js
|
|
3614
|
+
* // click body element (default)
|
|
3615
|
+
* I.click();
|
|
3618
3616
|
* // simple link
|
|
3619
3617
|
* I.click('Logout');
|
|
3620
3618
|
* // button of form
|
|
@@ -3636,12 +3634,12 @@ declare namespace CodeceptJS {
|
|
|
3636
3634
|
* // make ctrl-click
|
|
3637
3635
|
* I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
3638
3636
|
* ```
|
|
3639
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
3637
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
3640
3638
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
3641
3639
|
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
|
|
3642
3640
|
* @returns automatically synchronized promise through #recorder
|
|
3643
3641
|
*/
|
|
3644
|
-
click(locator
|
|
3642
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null, options?: any): void;
|
|
3645
3643
|
/**
|
|
3646
3644
|
* Clicks link and waits for navigation (deprecated)
|
|
3647
3645
|
*/
|
|
@@ -3707,6 +3705,23 @@ declare namespace CodeceptJS {
|
|
|
3707
3705
|
* @returns automatically synchronized promise through #recorder
|
|
3708
3706
|
*/
|
|
3709
3707
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
|
|
3708
|
+
/**
|
|
3709
|
+
* Performs click at specific coordinates.
|
|
3710
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
3711
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
3712
|
+
*
|
|
3713
|
+
* ```js
|
|
3714
|
+
* // Click at global coordinates (100, 200)
|
|
3715
|
+
* I.clickXY(100, 200);
|
|
3716
|
+
*
|
|
3717
|
+
* // Click at coordinates (50, 30) relative to element
|
|
3718
|
+
* I.clickXY('#someElement', 50, 30);
|
|
3719
|
+
* ```
|
|
3720
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
3721
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
3722
|
+
* @param [y] - Y coordinate relative to element.
|
|
3723
|
+
*/
|
|
3724
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
3710
3725
|
/**
|
|
3711
3726
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
|
|
3712
3727
|
*
|
|
@@ -4447,6 +4462,24 @@ declare namespace CodeceptJS {
|
|
|
4447
4462
|
* @returns attribute value
|
|
4448
4463
|
*/
|
|
4449
4464
|
grabAttributeFromAll(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string[]>;
|
|
4465
|
+
/**
|
|
4466
|
+
* Retrieves the ARIA snapshot for an element using Playwright's [`locator.ariaSnapshot`](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot).
|
|
4467
|
+
* This method returns a YAML representation of the accessibility tree that can be used for assertions.
|
|
4468
|
+
* If no locator is provided, it captures the snapshot of the entire page body.
|
|
4469
|
+
*
|
|
4470
|
+
* ```js
|
|
4471
|
+
* const snapshot = await I.grabAriaSnapshot();
|
|
4472
|
+
* expect(snapshot).toContain('heading "Sign up"');
|
|
4473
|
+
*
|
|
4474
|
+
* const formSnapshot = await I.grabAriaSnapshot('#login-form');
|
|
4475
|
+
* expect(formSnapshot).toContain('textbox "Email"');
|
|
4476
|
+
* ```
|
|
4477
|
+
*
|
|
4478
|
+
* [Learn more about ARIA snapshots](https://playwright.dev/docs/aria-snapshots)
|
|
4479
|
+
* @param [locator = '//body'] - element located by CSS|XPath|strict locator. Defaults to body element.
|
|
4480
|
+
* @returns YAML representation of the accessibility tree
|
|
4481
|
+
*/
|
|
4482
|
+
grabAriaSnapshot(locator?: string | any): Promise<string>;
|
|
4450
4483
|
/**
|
|
4451
4484
|
* Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
4452
4485
|
* Filename is relative to output folder.
|
|
@@ -5035,6 +5068,15 @@ declare namespace CodeceptJS {
|
|
|
5035
5068
|
*/
|
|
5036
5069
|
grabMetrics(): Promise<object[]>;
|
|
5037
5070
|
}
|
|
5071
|
+
/**
|
|
5072
|
+
* Checks if a locator is a role locator object (e.g., {role: 'button', text: 'Submit', exact: true})
|
|
5073
|
+
*/
|
|
5074
|
+
function isRoleLocatorObject(): void;
|
|
5075
|
+
/**
|
|
5076
|
+
* Handles role locator objects by converting them to Playwright's getByRole() API
|
|
5077
|
+
* Returns elements array if role locator, null otherwise
|
|
5078
|
+
*/
|
|
5079
|
+
function handleRoleLocator(): void;
|
|
5038
5080
|
/**
|
|
5039
5081
|
* Protractor helper is based on [Protractor library](http://www.protractortest.org) and used for testing web applications.
|
|
5040
5082
|
*
|
|
@@ -6356,6 +6398,11 @@ declare namespace CodeceptJS {
|
|
|
6356
6398
|
*/
|
|
6357
6399
|
setCookie(cookie: Cookie | Cookie[]): void;
|
|
6358
6400
|
}
|
|
6401
|
+
/**
|
|
6402
|
+
* Wraps error objects that don't have a proper message property
|
|
6403
|
+
* This is needed for ESM compatibility with Puppeteer error handling
|
|
6404
|
+
*/
|
|
6405
|
+
function wrapError(): void;
|
|
6359
6406
|
/**
|
|
6360
6407
|
* ## Configuration
|
|
6361
6408
|
*
|
|
@@ -6383,8 +6430,6 @@ declare namespace CodeceptJS {
|
|
|
6383
6430
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
|
|
6384
6431
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6385
6432
|
*/
|
|
6386
|
-
// @ts-ignore
|
|
6387
|
-
// @ts-ignore
|
|
6388
6433
|
type PuppeteerConfig = {
|
|
6389
6434
|
url: string;
|
|
6390
6435
|
basicAuth?: any;
|
|
@@ -6986,9 +7031,13 @@ declare namespace CodeceptJS {
|
|
|
6986
7031
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
6987
7032
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
6988
7033
|
*
|
|
7034
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
7035
|
+
*
|
|
6989
7036
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
6990
7037
|
*
|
|
6991
7038
|
* ```js
|
|
7039
|
+
* // click body element (default)
|
|
7040
|
+
* I.click();
|
|
6992
7041
|
* // simple link
|
|
6993
7042
|
* I.click('Logout');
|
|
6994
7043
|
* // button of form
|
|
@@ -7002,14 +7051,14 @@ declare namespace CodeceptJS {
|
|
|
7002
7051
|
* // using strict locator
|
|
7003
7052
|
* I.click({css: 'nav a.login'});
|
|
7004
7053
|
* ```
|
|
7005
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
7054
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
7006
7055
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
7007
7056
|
* @returns automatically synchronized promise through #recorder
|
|
7008
7057
|
*
|
|
7009
7058
|
*
|
|
7010
7059
|
* {{ react }}
|
|
7011
7060
|
*/
|
|
7012
|
-
click(locator
|
|
7061
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
7013
7062
|
/**
|
|
7014
7063
|
* Perform an emulated click on a link or a button, given by a locator.
|
|
7015
7064
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
@@ -7117,6 +7166,23 @@ declare namespace CodeceptJS {
|
|
|
7117
7166
|
* {{ react }}
|
|
7118
7167
|
*/
|
|
7119
7168
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
|
|
7169
|
+
/**
|
|
7170
|
+
* Performs click at specific coordinates.
|
|
7171
|
+
* If locator is provided, the coordinates are relative to the element.
|
|
7172
|
+
* If locator is not provided, the coordinates are global page coordinates.
|
|
7173
|
+
*
|
|
7174
|
+
* ```js
|
|
7175
|
+
* // Click at global coordinates (100, 200)
|
|
7176
|
+
* I.clickXY(100, 200);
|
|
7177
|
+
*
|
|
7178
|
+
* // Click at coordinates (50, 30) relative to element
|
|
7179
|
+
* I.clickXY('#someElement', 50, 30);
|
|
7180
|
+
* ```
|
|
7181
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
7182
|
+
* @param [x] - X coordinate relative to element, or Y coordinate if locator is a number.
|
|
7183
|
+
* @param [y] - Y coordinate relative to element.
|
|
7184
|
+
*/
|
|
7185
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
7120
7186
|
/**
|
|
7121
7187
|
* Selects a checkbox or radio button.
|
|
7122
7188
|
* Element is located by label or name or CSS or XPath.
|
|
@@ -8365,8 +8431,6 @@ declare namespace CodeceptJS {
|
|
|
8365
8431
|
* @property [onResponse] - an async function which can update response object.
|
|
8366
8432
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8367
8433
|
*/
|
|
8368
|
-
// @ts-ignore
|
|
8369
|
-
// @ts-ignore
|
|
8370
8434
|
type RESTConfig = {
|
|
8371
8435
|
endpoint?: string;
|
|
8372
8436
|
prettyPrintJson?: boolean;
|
|
@@ -9555,6 +9619,11 @@ declare namespace CodeceptJS {
|
|
|
9555
9619
|
*/
|
|
9556
9620
|
waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): void;
|
|
9557
9621
|
}
|
|
9622
|
+
/**
|
|
9623
|
+
* Wraps error objects that don't have a proper message property
|
|
9624
|
+
* This is needed for ESM compatibility with Puppeteer error handling
|
|
9625
|
+
*/
|
|
9626
|
+
function wrapError(): void;
|
|
9558
9627
|
/**
|
|
9559
9628
|
* ## Configuration
|
|
9560
9629
|
*
|
|
@@ -9582,8 +9651,6 @@ declare namespace CodeceptJS {
|
|
|
9582
9651
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
9583
9652
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9584
9653
|
*/
|
|
9585
|
-
// @ts-ignore
|
|
9586
|
-
// @ts-ignore
|
|
9587
9654
|
type WebDriverConfig = {
|
|
9588
9655
|
url: string;
|
|
9589
9656
|
browser: string;
|
|
@@ -10043,6 +10110,11 @@ declare namespace CodeceptJS {
|
|
|
10043
10110
|
* @param locator - element located by CSS|XPath|strict locator.
|
|
10044
10111
|
*/
|
|
10045
10112
|
_locateFields(locator: CodeceptJS.LocatorOrString): void;
|
|
10113
|
+
/**
|
|
10114
|
+
* Locate elements by ARIA role using WebdriverIO accessibility selectors
|
|
10115
|
+
* @param locator - role locator object { role: string, text?: string, exact?: boolean }
|
|
10116
|
+
*/
|
|
10117
|
+
_locateByRole(locator: any): void;
|
|
10046
10118
|
/**
|
|
10047
10119
|
* Grab WebElements for given locator
|
|
10048
10120
|
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
@@ -10096,9 +10168,13 @@ declare namespace CodeceptJS {
|
|
|
10096
10168
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
10097
10169
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
10098
10170
|
*
|
|
10171
|
+
* If no locator is provided, defaults to clicking the body element (`'//body'`).
|
|
10172
|
+
*
|
|
10099
10173
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
10100
10174
|
*
|
|
10101
10175
|
* ```js
|
|
10176
|
+
* // click body element (default)
|
|
10177
|
+
* I.click();
|
|
10102
10178
|
* // simple link
|
|
10103
10179
|
* I.click('Logout');
|
|
10104
10180
|
* // button of form
|
|
@@ -10112,14 +10188,14 @@ declare namespace CodeceptJS {
|
|
|
10112
10188
|
* // using strict locator
|
|
10113
10189
|
* I.click({css: 'nav a.login'});
|
|
10114
10190
|
* ```
|
|
10115
|
-
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
10191
|
+
* @param [locator = '//body'] - (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
10116
10192
|
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
10117
10193
|
* @returns automatically synchronized promise through #recorder
|
|
10118
10194
|
*
|
|
10119
10195
|
*
|
|
10120
10196
|
* {{ react }}
|
|
10121
10197
|
*/
|
|
10122
|
-
click(locator
|
|
10198
|
+
click(locator?: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
10123
10199
|
/**
|
|
10124
10200
|
* Perform an emulated click on a link or a button, given by a locator.
|
|
10125
10201
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
@@ -10190,6 +10266,23 @@ declare namespace CodeceptJS {
|
|
|
10190
10266
|
* {{ react }}
|
|
10191
10267
|
*/
|
|
10192
10268
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
|
|
10269
|
+
/**
|
|
10270
|
+
* Performs click at specific coordinates.
|
|
10271
|
+
* If locator is provided, the coordinates are relative to the element's top-left corner.
|
|
10272
|
+
* If locator is not provided, the coordinates are relative to the body element.
|
|
10273
|
+
*
|
|
10274
|
+
* ```js
|
|
10275
|
+
* // Click at coordinates (100, 200) relative to body
|
|
10276
|
+
* I.clickXY(100, 200);
|
|
10277
|
+
*
|
|
10278
|
+
* // Click at coordinates (50, 30) relative to element's top-left corner
|
|
10279
|
+
* I.clickXY('#someElement', 50, 30);
|
|
10280
|
+
* ```
|
|
10281
|
+
* @param locator - Element to click on or X coordinate if no element.
|
|
10282
|
+
* @param [x] - X coordinate relative to element's top-left, or Y coordinate if locator is a number.
|
|
10283
|
+
* @param [y] - Y coordinate relative to element's top-left.
|
|
10284
|
+
*/
|
|
10285
|
+
clickXY(locator: CodeceptJS.LocatorOrString | number, x?: number, y?: number): Promise<void>;
|
|
10193
10286
|
/**
|
|
10194
10287
|
* Emulates right click on an element.
|
|
10195
10288
|
* Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
@@ -11585,8 +11678,8 @@ declare namespace CodeceptJS {
|
|
|
11585
11678
|
*/
|
|
11586
11679
|
requireModules(requiringModules: string[]): void;
|
|
11587
11680
|
/**
|
|
11588
|
-
* Initialize CodeceptJS at specific
|
|
11589
|
-
*
|
|
11681
|
+
* Initialize CodeceptJS at specific dir.
|
|
11682
|
+
* Loads config, requires factory methods
|
|
11590
11683
|
*/
|
|
11591
11684
|
init(dir: string): void;
|
|
11592
11685
|
/**
|
|
@@ -11793,6 +11886,10 @@ declare namespace CodeceptJS {
|
|
|
11793
11886
|
* Get translation
|
|
11794
11887
|
*/
|
|
11795
11888
|
static translation(): void;
|
|
11889
|
+
/**
|
|
11890
|
+
* Get TypeScript file mapping for error stack fixing
|
|
11891
|
+
*/
|
|
11892
|
+
static tsFileMapping(): void;
|
|
11796
11893
|
/**
|
|
11797
11894
|
* Get Mocha instance
|
|
11798
11895
|
*/
|
|
@@ -11865,6 +11962,7 @@ declare namespace CodeceptJS {
|
|
|
11865
11962
|
*/
|
|
11866
11963
|
transpose(): void;
|
|
11867
11964
|
}
|
|
11965
|
+
function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
|
|
11868
11966
|
/**
|
|
11869
11967
|
* - Designed for use in CodeceptJS tests as a "soft assertion."
|
|
11870
11968
|
* Unlike standard assertions, it does not stop the test execution on failure.
|
|
@@ -11977,29 +12075,6 @@ declare namespace CodeceptJS {
|
|
|
11977
12075
|
*/
|
|
11978
12076
|
function cleanDispatcher(): void;
|
|
11979
12077
|
}
|
|
11980
|
-
/**
|
|
11981
|
-
* Index file for loading CodeceptJS programmatically.
|
|
11982
|
-
*
|
|
11983
|
-
* Includes Public API objects
|
|
11984
|
-
*/
|
|
11985
|
-
namespace index {
|
|
11986
|
-
var codecept: typeof CodeceptJS.Codecept;
|
|
11987
|
-
var Codecept: typeof CodeceptJS.Codecept;
|
|
11988
|
-
var output: typeof CodeceptJS.output;
|
|
11989
|
-
var container: typeof CodeceptJS.Container;
|
|
11990
|
-
var event: typeof CodeceptJS.event;
|
|
11991
|
-
var recorder: CodeceptJS.recorder;
|
|
11992
|
-
var config: typeof CodeceptJS.Config;
|
|
11993
|
-
var actor: CodeceptJS.actor;
|
|
11994
|
-
var helper: typeof CodeceptJS.Helper;
|
|
11995
|
-
var Helper: typeof CodeceptJS.Helper;
|
|
11996
|
-
var pause: typeof CodeceptJS.pause;
|
|
11997
|
-
var within: typeof CodeceptJS.within;
|
|
11998
|
-
var dataTable: typeof CodeceptJS.DataTable;
|
|
11999
|
-
var dataTableArgument: typeof CodeceptJS.DataTableArgument;
|
|
12000
|
-
var store: typeof CodeceptJS.store;
|
|
12001
|
-
var locator: typeof CodeceptJS.Locator;
|
|
12002
|
-
}
|
|
12003
12078
|
class Locator {
|
|
12004
12079
|
constructor(locator: CodeceptJS.LocatorOrString, defaultType?: string);
|
|
12005
12080
|
toString(): string;
|
|
@@ -12008,6 +12083,7 @@ declare namespace CodeceptJS {
|
|
|
12008
12083
|
isFrame(): boolean;
|
|
12009
12084
|
isCSS(): boolean;
|
|
12010
12085
|
isPlaywrightLocator(): boolean;
|
|
12086
|
+
isRole(): boolean;
|
|
12011
12087
|
isNull(): boolean;
|
|
12012
12088
|
isXPath(): boolean;
|
|
12013
12089
|
isCustom(): boolean;
|
|
@@ -12125,7 +12201,10 @@ declare namespace CodeceptJS {
|
|
|
12125
12201
|
* Print a text in console log
|
|
12126
12202
|
*/
|
|
12127
12203
|
function say(message: string, color?: string): void;
|
|
12128
|
-
|
|
12204
|
+
/**
|
|
12205
|
+
* Prints the stats of a test run to the console.
|
|
12206
|
+
*/
|
|
12207
|
+
function result(passed: number, failed: number, skipped: number, duration: number | string, failedHooks?: number): void;
|
|
12129
12208
|
}
|
|
12130
12209
|
/**
|
|
12131
12210
|
* Pauses test execution and starts interactive shell
|
|
@@ -12416,7 +12495,6 @@ declare namespace CodeceptJS {
|
|
|
12416
12495
|
type ScenarioConfigCallback = (test: CodeceptJS.Test) => {
|
|
12417
12496
|
[key: string]: any;
|
|
12418
12497
|
};
|
|
12419
|
-
function addStep(step: any, fn: any): void;
|
|
12420
12498
|
/**
|
|
12421
12499
|
* Creates a new Hook instance
|
|
12422
12500
|
* @property suite - The test suite this hook belongs to
|
|
@@ -12457,10 +12535,6 @@ declare namespace CodeceptJS {
|
|
|
12457
12535
|
*/
|
|
12458
12536
|
err: Error | null;
|
|
12459
12537
|
}
|
|
12460
|
-
/**
|
|
12461
|
-
* TODO: move to effects
|
|
12462
|
-
*/
|
|
12463
|
-
function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
|
|
12464
12538
|
/**
|
|
12465
12539
|
* This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
|
|
12466
12540
|
* Detox provides a grey box testing for mobile applications, playing especially good for React Native apps.
|
|
@@ -13075,3 +13149,5 @@ declare var helperMethod: string;
|
|
|
13075
13149
|
*/
|
|
13076
13150
|
declare var collsapsed: boolean;
|
|
13077
13151
|
|
|
13152
|
+
declare var currentStepFile: any;
|
|
13153
|
+
|