codeceptjs 3.7.6-beta.2 → 3.7.6-beta.4
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/event.js +10 -1
- package/lib/helper/Appium.js +145 -25
- package/lib/helper/JSONResponse.js +4 -4
- package/lib/helper/Playwright.js +2 -3
- package/lib/helper/Puppeteer.js +6 -6
- package/lib/helper/WebDriver.js +3 -3
- package/lib/listener/steps.js +2 -2
- package/lib/output.js +51 -5
- package/lib/plugin/htmlReporter.js +147 -79
- package/lib/result.js +100 -23
- package/package.json +5 -2
- package/typings/promiseBasedTypes.d.ts +37 -25
- package/typings/types.d.ts +127 -30
package/typings/types.d.ts
CHANGED
|
@@ -2823,12 +2823,14 @@ declare namespace CodeceptJS {
|
|
|
2823
2823
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
2824
2824
|
* @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).
|
|
2825
2825
|
* @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).
|
|
2826
|
-
* @property [customLocatorStrategies] - custom locator strategies. An object with keys as strategy names and values as JavaScript functions. Example: `{ byRole: (selector, root) => { return root.querySelector(
|
|
2826
|
+
* @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}"]`) } }`
|
|
2827
|
+
* @property [storageState] - Playwright storage state (path to JSON file or object)
|
|
2828
|
+
* passed directly to `browser.newContext`.
|
|
2829
|
+
* If a Scenario is declared with a `cookies` option (e.g. `Scenario('name', { cookies: [...] }, fn)`),
|
|
2830
|
+
* those cookies are used instead and the configured `storageState` is ignored (no merge).
|
|
2831
|
+
* May include session cookies, auth tokens, localStorage and (if captured with
|
|
2832
|
+
* `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
|
|
2827
2833
|
*/
|
|
2828
|
-
// @ts-ignore
|
|
2829
|
-
// @ts-ignore
|
|
2830
|
-
// @ts-ignore
|
|
2831
|
-
// @ts-ignore
|
|
2832
2834
|
type PlaywrightConfig = {
|
|
2833
2835
|
url?: string;
|
|
2834
2836
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -2867,6 +2869,7 @@ declare namespace CodeceptJS {
|
|
|
2867
2869
|
recordHar?: any;
|
|
2868
2870
|
testIdAttribute?: string;
|
|
2869
2871
|
customLocatorStrategies?: any;
|
|
2872
|
+
storageState?: string | any;
|
|
2870
2873
|
};
|
|
2871
2874
|
/**
|
|
2872
2875
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
@@ -3807,7 +3810,7 @@ declare namespace CodeceptJS {
|
|
|
3807
3810
|
*/
|
|
3808
3811
|
pressKeyUp(key: string): void;
|
|
3809
3812
|
/**
|
|
3810
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
3813
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
3811
3814
|
*
|
|
3812
3815
|
* Presses a key in the browser (on a focused element).
|
|
3813
3816
|
*
|
|
@@ -4229,6 +4232,27 @@ declare namespace CodeceptJS {
|
|
|
4229
4232
|
* @returns attribute value
|
|
4230
4233
|
*/
|
|
4231
4234
|
grabCookie(name?: string): any;
|
|
4235
|
+
/**
|
|
4236
|
+
* Grab the current storage state (cookies, localStorage, etc.) via Playwright's `browserContext.storageState()`.
|
|
4237
|
+
* Returns the raw object that Playwright provides.
|
|
4238
|
+
*
|
|
4239
|
+
* Security: The returned object can contain authentication tokens, session cookies
|
|
4240
|
+
* and (when `indexedDB: true` is used) data that may include user PII. Treat it as a secret.
|
|
4241
|
+
* Avoid committing it to source control and prefer storing it in a protected secrets store / CI artifact vault.
|
|
4242
|
+
* @param [options.indexedDB] - set to true to include IndexedDB in snapshot (Playwright >=1.51)
|
|
4243
|
+
*
|
|
4244
|
+
* ```js
|
|
4245
|
+
* // basic usage
|
|
4246
|
+
* const state = await I.grabStorageState();
|
|
4247
|
+
* require('fs').writeFileSync('authState.json', JSON.stringify(state));
|
|
4248
|
+
*
|
|
4249
|
+
* // include IndexedDB when using Firebase Auth, etc.
|
|
4250
|
+
* const stateWithIDB = await I.grabStorageState({ indexedDB: true });
|
|
4251
|
+
* ```
|
|
4252
|
+
*/
|
|
4253
|
+
grabStorageState(options?: {
|
|
4254
|
+
indexedDB?: boolean;
|
|
4255
|
+
}): void;
|
|
4232
4256
|
/**
|
|
4233
4257
|
* Clears a cookie by name,
|
|
4234
4258
|
* if none provided clears all cookies.
|
|
@@ -4680,7 +4704,7 @@ declare namespace CodeceptJS {
|
|
|
4680
4704
|
/**
|
|
4681
4705
|
* Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
4682
4706
|
*
|
|
4683
|
-
* See [Playwright's reference](https://playwright.dev/docs/api/class-page
|
|
4707
|
+
* See [Playwright's reference](https://playwright.dev/docs/api/class-page#page-wait-for-navigation)
|
|
4684
4708
|
*/
|
|
4685
4709
|
waitForNavigation(options: any): void;
|
|
4686
4710
|
/**
|
|
@@ -6346,7 +6370,7 @@ declare namespace CodeceptJS {
|
|
|
6346
6370
|
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
|
|
6347
6371
|
* @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
|
|
6348
6372
|
* @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
6349
|
-
* @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/
|
|
6373
|
+
* @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.
|
|
6350
6374
|
* @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
6351
6375
|
* @property [getPageTimeout = 30000] - config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
|
|
6352
6376
|
* @property [waitForTimeout = 1000] - default wait* timeout in ms.
|
|
@@ -6354,13 +6378,9 @@ declare namespace CodeceptJS {
|
|
|
6354
6378
|
* @property [userAgent] - user-agent string.
|
|
6355
6379
|
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
6356
6380
|
* @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
6357
|
-
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/
|
|
6381
|
+
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
|
|
6358
6382
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6359
6383
|
*/
|
|
6360
|
-
// @ts-ignore
|
|
6361
|
-
// @ts-ignore
|
|
6362
|
-
// @ts-ignore
|
|
6363
|
-
// @ts-ignore
|
|
6364
6384
|
type PuppeteerConfig = {
|
|
6365
6385
|
url: string;
|
|
6366
6386
|
basicAuth?: any;
|
|
@@ -6374,7 +6394,7 @@ declare namespace CodeceptJS {
|
|
|
6374
6394
|
keepBrowserState?: boolean;
|
|
6375
6395
|
keepCookies?: boolean;
|
|
6376
6396
|
waitForAction?: number;
|
|
6377
|
-
waitForNavigation?: string;
|
|
6397
|
+
waitForNavigation?: string | string[];
|
|
6378
6398
|
pressKeyDelay?: number;
|
|
6379
6399
|
getPageTimeout?: number;
|
|
6380
6400
|
waitForTimeout?: number;
|
|
@@ -6386,7 +6406,7 @@ declare namespace CodeceptJS {
|
|
|
6386
6406
|
highlightElement?: boolean;
|
|
6387
6407
|
};
|
|
6388
6408
|
/**
|
|
6389
|
-
* Uses [Google Chrome's Puppeteer](https://github.com/
|
|
6409
|
+
* Uses [Google Chrome's Puppeteer](https://github.com/puppeteer/puppeteer) library to run tests inside headless Chrome.
|
|
6390
6410
|
* Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
6391
6411
|
* This helper works with a browser out of the box with no additional tools required to install.
|
|
6392
6412
|
*
|
|
@@ -7178,7 +7198,7 @@ declare namespace CodeceptJS {
|
|
|
7178
7198
|
*/
|
|
7179
7199
|
pressKeyUp(key: string): void;
|
|
7180
7200
|
/**
|
|
7181
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
7201
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
7182
7202
|
*
|
|
7183
7203
|
* Presses a key in the browser (on a focused element).
|
|
7184
7204
|
*
|
|
@@ -8104,7 +8124,7 @@ declare namespace CodeceptJS {
|
|
|
8104
8124
|
/**
|
|
8105
8125
|
* Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
8106
8126
|
*
|
|
8107
|
-
* See [Puppeteer's reference](https://github.com/
|
|
8127
|
+
* See [Puppeteer's reference](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md)
|
|
8108
8128
|
*/
|
|
8109
8129
|
waitForNavigation(opts: any): void;
|
|
8110
8130
|
/**
|
|
@@ -8341,10 +8361,6 @@ declare namespace CodeceptJS {
|
|
|
8341
8361
|
* @property [onResponse] - an async function which can update response object.
|
|
8342
8362
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8343
8363
|
*/
|
|
8344
|
-
// @ts-ignore
|
|
8345
|
-
// @ts-ignore
|
|
8346
|
-
// @ts-ignore
|
|
8347
|
-
// @ts-ignore
|
|
8348
8364
|
type RESTConfig = {
|
|
8349
8365
|
endpoint?: string;
|
|
8350
8366
|
prettyPrintJson?: boolean;
|
|
@@ -9560,10 +9576,6 @@ declare namespace CodeceptJS {
|
|
|
9560
9576
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
9561
9577
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9562
9578
|
*/
|
|
9563
|
-
// @ts-ignore
|
|
9564
|
-
// @ts-ignore
|
|
9565
|
-
// @ts-ignore
|
|
9566
|
-
// @ts-ignore
|
|
9567
9579
|
type WebDriverConfig = {
|
|
9568
9580
|
url: string;
|
|
9569
9581
|
browser: string;
|
|
@@ -11580,11 +11592,11 @@ declare namespace CodeceptJS {
|
|
|
11580
11592
|
/**
|
|
11581
11593
|
* Executes bootstrap.
|
|
11582
11594
|
*/
|
|
11583
|
-
bootstrap(): void
|
|
11595
|
+
bootstrap(): Promise<void>;
|
|
11584
11596
|
/**
|
|
11585
11597
|
* Executes teardown.
|
|
11586
11598
|
*/
|
|
11587
|
-
teardown(): void
|
|
11599
|
+
teardown(): Promise<void>;
|
|
11588
11600
|
/**
|
|
11589
11601
|
* Loads tests by pattern or by config.tests
|
|
11590
11602
|
*/
|
|
@@ -11600,6 +11612,11 @@ declare namespace CodeceptJS {
|
|
|
11600
11612
|
* Run a specific test or all loaded tests.
|
|
11601
11613
|
*/
|
|
11602
11614
|
run(test?: string): Promise<void>;
|
|
11615
|
+
/**
|
|
11616
|
+
* Returns the version string of CodeceptJS.
|
|
11617
|
+
* @returns The version string.
|
|
11618
|
+
*/
|
|
11619
|
+
static version(): string;
|
|
11603
11620
|
}
|
|
11604
11621
|
/**
|
|
11605
11622
|
* Current configuration
|
|
@@ -11642,7 +11659,15 @@ declare namespace CodeceptJS {
|
|
|
11642
11659
|
};
|
|
11643
11660
|
}
|
|
11644
11661
|
/**
|
|
11645
|
-
*
|
|
11662
|
+
* Statistics for a test result.
|
|
11663
|
+
* @property passes - Number of passed tests.
|
|
11664
|
+
* @property failures - Number of failed tests.
|
|
11665
|
+
* @property tests - Total number of tests.
|
|
11666
|
+
* @property pending - Number of pending tests.
|
|
11667
|
+
* @property failedHooks - Number of failed hooks.
|
|
11668
|
+
* @property start - Start time of the test run.
|
|
11669
|
+
* @property end - End time of the test run.
|
|
11670
|
+
* @property duration - Duration of the test run, in milliseconds.
|
|
11646
11671
|
*/
|
|
11647
11672
|
type Stats = {
|
|
11648
11673
|
passes: number;
|
|
@@ -11655,10 +11680,82 @@ declare namespace CodeceptJS {
|
|
|
11655
11680
|
duration: number;
|
|
11656
11681
|
};
|
|
11657
11682
|
/**
|
|
11658
|
-
*
|
|
11683
|
+
* Result of a test run. Will be emitted for example in "event.all.result" events.
|
|
11659
11684
|
*/
|
|
11660
11685
|
class Result {
|
|
11661
|
-
|
|
11686
|
+
/**
|
|
11687
|
+
* Resets all collected stats, tests, and failure reports.
|
|
11688
|
+
*/
|
|
11689
|
+
reset(): void;
|
|
11690
|
+
/**
|
|
11691
|
+
* Sets the start time to the current time.
|
|
11692
|
+
*/
|
|
11693
|
+
start(): void;
|
|
11694
|
+
/**
|
|
11695
|
+
* Sets the end time to the current time.
|
|
11696
|
+
*/
|
|
11697
|
+
finish(): void;
|
|
11698
|
+
/**
|
|
11699
|
+
* Whether this result contains any failed tests.
|
|
11700
|
+
*/
|
|
11701
|
+
readonly hasFailed: boolean;
|
|
11702
|
+
/**
|
|
11703
|
+
* All collected tests.
|
|
11704
|
+
*/
|
|
11705
|
+
readonly tests: CodeceptJS.Test[];
|
|
11706
|
+
/**
|
|
11707
|
+
* The failure reports (array of strings per failed test).
|
|
11708
|
+
*/
|
|
11709
|
+
readonly failures: string[][];
|
|
11710
|
+
/**
|
|
11711
|
+
* The test statistics.
|
|
11712
|
+
*/
|
|
11713
|
+
readonly stats: Stats;
|
|
11714
|
+
/**
|
|
11715
|
+
* The start time of the test run.
|
|
11716
|
+
*/
|
|
11717
|
+
readonly startTime: Date;
|
|
11718
|
+
/**
|
|
11719
|
+
* Adds a test to this result.
|
|
11720
|
+
*/
|
|
11721
|
+
addTest(test: CodeceptJS.Test): void;
|
|
11722
|
+
/**
|
|
11723
|
+
* Adds failure reports to this result.
|
|
11724
|
+
*/
|
|
11725
|
+
addFailures(newFailures: string[][]): void;
|
|
11726
|
+
/**
|
|
11727
|
+
* Whether this result contains any failed tests.
|
|
11728
|
+
*/
|
|
11729
|
+
readonly hasFailures: boolean;
|
|
11730
|
+
/**
|
|
11731
|
+
* The duration of the test run, in milliseconds.
|
|
11732
|
+
*/
|
|
11733
|
+
readonly duration: number;
|
|
11734
|
+
/**
|
|
11735
|
+
* All failed tests.
|
|
11736
|
+
*/
|
|
11737
|
+
failedTests: CodeceptJS.Test[];
|
|
11738
|
+
/**
|
|
11739
|
+
* All passed tests.
|
|
11740
|
+
*/
|
|
11741
|
+
readonly passedTests: CodeceptJS.Test[];
|
|
11742
|
+
/**
|
|
11743
|
+
* All skipped tests.
|
|
11744
|
+
*/
|
|
11745
|
+
readonly skippedTests: CodeceptJS.Test[];
|
|
11746
|
+
/**
|
|
11747
|
+
* @returns The JSON representation of this result.
|
|
11748
|
+
*/
|
|
11749
|
+
simplify(): any;
|
|
11750
|
+
/**
|
|
11751
|
+
* Saves this result to a JSON file.
|
|
11752
|
+
* @param [fileName] - Path to the JSON file, relative to `output_dir`. Defaults to "result.json".
|
|
11753
|
+
*/
|
|
11754
|
+
save(fileName?: string): void;
|
|
11755
|
+
/**
|
|
11756
|
+
* Adds stats to this result.
|
|
11757
|
+
*/
|
|
11758
|
+
addStats(newStats?: Partial<Stats>): void;
|
|
11662
11759
|
}
|
|
11663
11760
|
/**
|
|
11664
11761
|
* Dependency Injection Container
|