codeceptjs 3.7.6-beta.1 → 3.7.6-beta.3
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/codecept.js +8 -1
- package/lib/command/workers/runTests.js +39 -1
- package/lib/event.js +10 -1
- package/lib/helper/Appium.js +149 -27
- package/lib/helper/Playwright.js +39 -5
- package/lib/helper/Puppeteer.js +6 -6
- package/lib/output.js +51 -5
- package/lib/plugin/htmlReporter.js +31 -31
- package/lib/result.js +100 -23
- package/package.json +5 -5
- package/typings/index.d.ts +10 -11
- package/typings/promiseBasedTypes.d.ts +37 -17
- package/typings/types.d.ts +127 -22
package/typings/types.d.ts
CHANGED
|
@@ -2823,10 +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
2834
|
type PlaywrightConfig = {
|
|
2831
2835
|
url?: string;
|
|
2832
2836
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -2865,6 +2869,7 @@ declare namespace CodeceptJS {
|
|
|
2865
2869
|
recordHar?: any;
|
|
2866
2870
|
testIdAttribute?: string;
|
|
2867
2871
|
customLocatorStrategies?: any;
|
|
2872
|
+
storageState?: string | any;
|
|
2868
2873
|
};
|
|
2869
2874
|
/**
|
|
2870
2875
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
@@ -3805,7 +3810,7 @@ declare namespace CodeceptJS {
|
|
|
3805
3810
|
*/
|
|
3806
3811
|
pressKeyUp(key: string): void;
|
|
3807
3812
|
/**
|
|
3808
|
-
* _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)).
|
|
3809
3814
|
*
|
|
3810
3815
|
* Presses a key in the browser (on a focused element).
|
|
3811
3816
|
*
|
|
@@ -4227,6 +4232,27 @@ declare namespace CodeceptJS {
|
|
|
4227
4232
|
* @returns attribute value
|
|
4228
4233
|
*/
|
|
4229
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;
|
|
4230
4256
|
/**
|
|
4231
4257
|
* Clears a cookie by name,
|
|
4232
4258
|
* if none provided clears all cookies.
|
|
@@ -4678,7 +4704,7 @@ declare namespace CodeceptJS {
|
|
|
4678
4704
|
/**
|
|
4679
4705
|
* Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
4680
4706
|
*
|
|
4681
|
-
* 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)
|
|
4682
4708
|
*/
|
|
4683
4709
|
waitForNavigation(options: any): void;
|
|
4684
4710
|
/**
|
|
@@ -6344,7 +6370,7 @@ declare namespace CodeceptJS {
|
|
|
6344
6370
|
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
|
|
6345
6371
|
* @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
|
|
6346
6372
|
* @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
6347
|
-
* @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.
|
|
6348
6374
|
* @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
6349
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.
|
|
6350
6376
|
* @property [waitForTimeout = 1000] - default wait* timeout in ms.
|
|
@@ -6352,11 +6378,9 @@ declare namespace CodeceptJS {
|
|
|
6352
6378
|
* @property [userAgent] - user-agent string.
|
|
6353
6379
|
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
6354
6380
|
* @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
6355
|
-
* @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).
|
|
6356
6382
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6357
6383
|
*/
|
|
6358
|
-
// @ts-ignore
|
|
6359
|
-
// @ts-ignore
|
|
6360
6384
|
type PuppeteerConfig = {
|
|
6361
6385
|
url: string;
|
|
6362
6386
|
basicAuth?: any;
|
|
@@ -6370,7 +6394,7 @@ declare namespace CodeceptJS {
|
|
|
6370
6394
|
keepBrowserState?: boolean;
|
|
6371
6395
|
keepCookies?: boolean;
|
|
6372
6396
|
waitForAction?: number;
|
|
6373
|
-
waitForNavigation?: string;
|
|
6397
|
+
waitForNavigation?: string | string[];
|
|
6374
6398
|
pressKeyDelay?: number;
|
|
6375
6399
|
getPageTimeout?: number;
|
|
6376
6400
|
waitForTimeout?: number;
|
|
@@ -6382,7 +6406,7 @@ declare namespace CodeceptJS {
|
|
|
6382
6406
|
highlightElement?: boolean;
|
|
6383
6407
|
};
|
|
6384
6408
|
/**
|
|
6385
|
-
* 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.
|
|
6386
6410
|
* Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
6387
6411
|
* This helper works with a browser out of the box with no additional tools required to install.
|
|
6388
6412
|
*
|
|
@@ -7174,7 +7198,7 @@ declare namespace CodeceptJS {
|
|
|
7174
7198
|
*/
|
|
7175
7199
|
pressKeyUp(key: string): void;
|
|
7176
7200
|
/**
|
|
7177
|
-
* _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)).
|
|
7178
7202
|
*
|
|
7179
7203
|
* Presses a key in the browser (on a focused element).
|
|
7180
7204
|
*
|
|
@@ -8100,7 +8124,7 @@ declare namespace CodeceptJS {
|
|
|
8100
8124
|
/**
|
|
8101
8125
|
* Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
8102
8126
|
*
|
|
8103
|
-
* 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)
|
|
8104
8128
|
*/
|
|
8105
8129
|
waitForNavigation(opts: any): void;
|
|
8106
8130
|
/**
|
|
@@ -8337,8 +8361,6 @@ declare namespace CodeceptJS {
|
|
|
8337
8361
|
* @property [onResponse] - an async function which can update response object.
|
|
8338
8362
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8339
8363
|
*/
|
|
8340
|
-
// @ts-ignore
|
|
8341
|
-
// @ts-ignore
|
|
8342
8364
|
type RESTConfig = {
|
|
8343
8365
|
endpoint?: string;
|
|
8344
8366
|
prettyPrintJson?: boolean;
|
|
@@ -9554,8 +9576,6 @@ declare namespace CodeceptJS {
|
|
|
9554
9576
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
9555
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
|
|
9556
9578
|
*/
|
|
9557
|
-
// @ts-ignore
|
|
9558
|
-
// @ts-ignore
|
|
9559
9579
|
type WebDriverConfig = {
|
|
9560
9580
|
url: string;
|
|
9561
9581
|
browser: string;
|
|
@@ -11572,11 +11592,11 @@ declare namespace CodeceptJS {
|
|
|
11572
11592
|
/**
|
|
11573
11593
|
* Executes bootstrap.
|
|
11574
11594
|
*/
|
|
11575
|
-
bootstrap(): void
|
|
11595
|
+
bootstrap(): Promise<void>;
|
|
11576
11596
|
/**
|
|
11577
11597
|
* Executes teardown.
|
|
11578
11598
|
*/
|
|
11579
|
-
teardown(): void
|
|
11599
|
+
teardown(): Promise<void>;
|
|
11580
11600
|
/**
|
|
11581
11601
|
* Loads tests by pattern or by config.tests
|
|
11582
11602
|
*/
|
|
@@ -11592,6 +11612,11 @@ declare namespace CodeceptJS {
|
|
|
11592
11612
|
* Run a specific test or all loaded tests.
|
|
11593
11613
|
*/
|
|
11594
11614
|
run(test?: string): Promise<void>;
|
|
11615
|
+
/**
|
|
11616
|
+
* Returns the version string of CodeceptJS.
|
|
11617
|
+
* @returns The version string.
|
|
11618
|
+
*/
|
|
11619
|
+
static version(): string;
|
|
11595
11620
|
}
|
|
11596
11621
|
/**
|
|
11597
11622
|
* Current configuration
|
|
@@ -11634,7 +11659,15 @@ declare namespace CodeceptJS {
|
|
|
11634
11659
|
};
|
|
11635
11660
|
}
|
|
11636
11661
|
/**
|
|
11637
|
-
*
|
|
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.
|
|
11638
11671
|
*/
|
|
11639
11672
|
type Stats = {
|
|
11640
11673
|
passes: number;
|
|
@@ -11647,10 +11680,82 @@ declare namespace CodeceptJS {
|
|
|
11647
11680
|
duration: number;
|
|
11648
11681
|
};
|
|
11649
11682
|
/**
|
|
11650
|
-
*
|
|
11683
|
+
* Result of a test run. Will be emitted for example in "event.all.result" events.
|
|
11651
11684
|
*/
|
|
11652
11685
|
class Result {
|
|
11653
|
-
|
|
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;
|
|
11654
11759
|
}
|
|
11655
11760
|
/**
|
|
11656
11761
|
* Dependency Injection Container
|