codeceptjs 3.5.9 → 3.5.10

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/workers.js CHANGED
@@ -359,6 +359,7 @@ class Workers extends EventEmitter {
359
359
  this.stats.start = new Date();
360
360
  recorder.startUnlessRunning();
361
361
  event.dispatcher.emit(event.workers.before);
362
+ process.env.RUNS_WITH_WORKERS = 'true';
362
363
  recorder.add('starting workers', () => {
363
364
  for (const worker of this.workers) {
364
365
  const workerThread = createWorker(worker);
@@ -492,6 +493,7 @@ class Workers extends EventEmitter {
492
493
  }
493
494
 
494
495
  output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration));
496
+ process.env.RUNS_WITH_WORKERS = 'false';
495
497
  }
496
498
  }
497
499
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.5.9",
3
+ "version": "3.5.10",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -59,7 +59,8 @@
59
59
  "publish:site": "./runok.js publish:site",
60
60
  "update-contributor-faces": "./runok.js contributor:faces",
61
61
  "dtslint": "dtslint typings --localTs './node_modules/typescript/lib'",
62
- "prepare": "husky install"
62
+ "prepare": "husky install",
63
+ "prepare-release": "./runok.js versioning && ./runok.js get:commit-log"
63
64
  },
64
65
  "dependencies": {
65
66
  "@codeceptjs/configure": "0.10.0",
@@ -68,9 +69,9 @@
68
69
  "@cucumber/gherkin": "26",
69
70
  "@cucumber/messages": "22.0.0",
70
71
  "@xmldom/xmldom": "0.8.10",
71
- "acorn": "8.10.0",
72
+ "acorn": "8.11.2",
72
73
  "arrify": "2.0.1",
73
- "axios": "1.3.3",
74
+ "axios": "1.6.2",
74
75
  "chai": "4.3.8",
75
76
  "chai-deep-match": "1.2.1",
76
77
  "chai-exclude": "^2.1.0",
@@ -79,19 +80,19 @@
79
80
  "chai-match-pattern": "^1.3.0",
80
81
  "chai-string": "^1.5.0",
81
82
  "chalk": "4.1.2",
82
- "commander": "11.0.0",
83
+ "commander": "11.1.0",
84
+ "convert-cssxpath": "1.0.2",
83
85
  "cross-spawn": "7.0.3",
84
- "css-to-xpath": "0.1.0",
85
- "envinfo": "7.8.1",
86
+ "envinfo": "7.11.0",
86
87
  "escape-string-regexp": "4.0.0",
87
88
  "figures": "3.2.0",
88
89
  "fn-args": "4.0.0",
89
- "fs-extra": "8.1.0",
90
+ "fs-extra": "11.2.0",
90
91
  "glob": "6.0.1",
91
- "html-minifier": "4.0.0",
92
+ "html-minifier-terser": "^7.2.0",
92
93
  "inquirer": "6.5.2",
93
94
  "joi": "17.11.0",
94
- "js-beautify": "1.14.9",
95
+ "js-beautify": "1.14.11",
95
96
  "lodash.clonedeep": "4.5.0",
96
97
  "lodash.merge": "4.6.2",
97
98
  "mkdirp": "1.0.4",
@@ -106,8 +107,10 @@
106
107
  "sprintf-js": "1.1.1",
107
108
  "uuid": "9.0"
108
109
  },
110
+ "optionalDependencies": {
111
+ "@codeceptjs/detox-helper": "1.0.2"
112
+ },
109
113
  "devDependencies": {
110
- "@codeceptjs/detox-helper": "1.0.2",
111
114
  "@codeceptjs/mock-request": "0.3.1",
112
115
  "@faker-js/faker": "7.6.0",
113
116
  "@pollyjs/adapter-puppeteer": "6.0.6",
@@ -125,7 +128,7 @@
125
128
  "documentation": "12.3.0",
126
129
  "dtslint": "4.2.1",
127
130
  "electron": "27.0.4",
128
- "eslint": "8.53.0",
131
+ "eslint": "8.55.0",
129
132
  "eslint-config-airbnb-base": "15.0.0",
130
133
  "eslint-plugin-import": "2.29.0",
131
134
  "eslint-plugin-mocha": "6.3.0",
@@ -137,7 +140,7 @@
137
140
  "jsdoc": "3.6.11",
138
141
  "jsdoc-typeof-plugin": "1.0.0",
139
142
  "json-server": "0.10.1",
140
- "playwright": "1.39.0",
143
+ "playwright": "1.40.1",
141
144
  "puppeteer": "21.1.1",
142
145
  "qrcode-terminal": "0.12.0",
143
146
  "rosie": "2.1.0",
@@ -154,7 +157,7 @@
154
157
  "wdio-docker-service": "1.5.0",
155
158
  "webdriverio": "8.3.8",
156
159
  "xml2js": "0.6.2",
157
- "xmldom": "0.6.0",
160
+ "@xmldom/xmldom": "0.7.7",
158
161
  "xpath": "0.0.33"
159
162
  },
160
163
  "engines": {
@@ -458,7 +458,7 @@ declare namespace CodeceptJS {
458
458
  * Switch to the specified context.
459
459
  * @param context - the context to switch to
460
460
  */
461
- _switchToContext(context: any): Promise<any>;
461
+ switchToContext(context: any): Promise<any>;
462
462
  /**
463
463
  * Switches to web context.
464
464
  * If no context is provided switches to the first detected web context
@@ -749,7 +749,7 @@ declare namespace CodeceptJS {
749
749
  * ```js
750
750
  * I.closeApp();
751
751
  * ```
752
- * @returns Appium: support only iOS
752
+ * @returns Appium: support both Android and iOS
753
753
  */
754
754
  closeApp(): Promise<void>;
755
755
  /**
@@ -2761,6 +2761,21 @@ declare namespace CodeceptJS {
2761
2761
  * * `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
2762
2762
  * * `keepTraceForPassedTests`: - save trace for passed tests
2763
2763
  *
2764
+ * #### HAR Recording Customization
2765
+ *
2766
+ * A HAR file is an HTTP Archive file that contains a record of all the network requests that are made when a page is loaded.
2767
+ * It contains information about the request and response headers, cookies, content, timings, and more. You can use HAR files to mock network requests in your tests.
2768
+ * HAR will be saved to `output/har`. More info could be found here https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har.
2769
+ *
2770
+ * ```
2771
+ * ...
2772
+ * recordHar: {
2773
+ * mode: 'minimal', // possible values: 'minimal'|'full'.
2774
+ * content: 'embed' // possible values: "omit"|"embed"|"attach".
2775
+ * }
2776
+ * ...
2777
+ * ```
2778
+ *
2764
2779
  * #### Example #1: Wait for 0 network connections.
2765
2780
  *
2766
2781
  * ```js
@@ -3135,6 +3150,21 @@ declare namespace CodeceptJS {
3135
3150
  * ```
3136
3151
  */
3137
3152
  refreshPage(): Promise<any>;
3153
+ /**
3154
+ * Replaying from HAR
3155
+ *
3156
+ * ```js
3157
+ * // Replay API requests from HAR.
3158
+ * // Either use a matching response from the HAR,
3159
+ * // or abort the request if nothing matches.
3160
+ * I.replayFromHar('./output/har/something.har', { url: "*\/**\/api/v1/fruits" });
3161
+ * I.amOnPage('https://demo.playwright.dev/api-mocking');
3162
+ * I.see('CodeceptJS');
3163
+ * ```
3164
+ * @param harFilePath - Path to recorded HAR file
3165
+ * @param [opts] - [Options for replaying from HAR](https://playwright.dev/docs/api/class-page#page-route-from-har)
3166
+ */
3167
+ replayFromHar(harFilePath: string, opts?: any): Promise<any>;
3138
3168
  /**
3139
3169
  * Scroll page to the top.
3140
3170
  *
@@ -3254,6 +3284,28 @@ declare namespace CodeceptJS {
3254
3284
  * ```
3255
3285
  */
3256
3286
  _locateFields(): Promise<any>;
3287
+ /**
3288
+ * Grab WebElements for given locator
3289
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
3290
+ *
3291
+ * ```js
3292
+ * const webElements = await I.grabWebElements('#button');
3293
+ * ```
3294
+ * @param locator - element located by CSS|XPath|strict locator.
3295
+ * @returns WebElement of being used Web helper
3296
+ */
3297
+ grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
3298
+ /**
3299
+ * Grab WebElement for given locator
3300
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
3301
+ *
3302
+ * ```js
3303
+ * const webElement = await I.grabWebElement('#button');
3304
+ * ```
3305
+ * @param locator - element located by CSS|XPath|strict locator.
3306
+ * @returns WebElement of being used Web helper
3307
+ */
3308
+ grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
3257
3309
  /**
3258
3310
  * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
3259
3311
  *
@@ -6329,6 +6381,17 @@ declare namespace CodeceptJS {
6329
6381
  * ```
6330
6382
  */
6331
6383
  _locateFields(): Promise<any>;
6384
+ /**
6385
+ * Grab WebElements for given locator
6386
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
6387
+ *
6388
+ * ```js
6389
+ * const webElements = await I.grabWebElements('#button');
6390
+ * ```
6391
+ * @param locator - element located by CSS|XPath|strict locator.
6392
+ * @returns WebElement of being used Web helper
6393
+ */
6394
+ grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
6332
6395
  /**
6333
6396
  * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
6334
6397
  *
@@ -8951,6 +9014,17 @@ declare namespace CodeceptJS {
8951
9014
  * @param locator - element located by CSS|XPath|strict locator.
8952
9015
  */
8953
9016
  _locateFields(locator: CodeceptJS.LocatorOrString): Promise<any>;
9017
+ /**
9018
+ * Grab WebElements for given locator
9019
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
9020
+ *
9021
+ * ```js
9022
+ * const webElements = await I.grabWebElements('#button');
9023
+ * ```
9024
+ * @param locator - element located by CSS|XPath|strict locator.
9025
+ * @returns WebElement of being used Web helper
9026
+ */
9027
+ grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
8954
9028
  /**
8955
9029
  * Set [WebDriver timeouts](https://webdriver.io/docs/timeouts.html) in realtime.
8956
9030
  *
@@ -458,7 +458,7 @@ declare namespace CodeceptJS {
458
458
  * Switch to the specified context.
459
459
  * @param context - the context to switch to
460
460
  */
461
- _switchToContext(context: any): void;
461
+ switchToContext(context: any): void;
462
462
  /**
463
463
  * Switches to web context.
464
464
  * If no context is provided switches to the first detected web context
@@ -749,7 +749,7 @@ declare namespace CodeceptJS {
749
749
  * ```js
750
750
  * I.closeApp();
751
751
  * ```
752
- * @returns Appium: support only iOS
752
+ * @returns Appium: support both Android and iOS
753
753
  */
754
754
  closeApp(): Promise<void>;
755
755
  /**
@@ -2848,6 +2848,7 @@ declare namespace CodeceptJS {
2848
2848
  * @property [ignoreHTTPSErrors] - Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
2849
2849
  * @property [bypassCSP] - bypass Content Security Policy or CSP
2850
2850
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
2851
+ * @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).
2851
2852
  */
2852
2853
  type PlaywrightConfig = {
2853
2854
  url?: string;
@@ -2884,6 +2885,7 @@ declare namespace CodeceptJS {
2884
2885
  ignoreHTTPSErrors?: boolean;
2885
2886
  bypassCSP?: boolean;
2886
2887
  highlightElement?: boolean;
2888
+ recordHar?: any;
2887
2889
  };
2888
2890
  /**
2889
2891
  * Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
@@ -2929,6 +2931,21 @@ declare namespace CodeceptJS {
2929
2931
  * * `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
2930
2932
  * * `keepTraceForPassedTests`: - save trace for passed tests
2931
2933
  *
2934
+ * #### HAR Recording Customization
2935
+ *
2936
+ * A HAR file is an HTTP Archive file that contains a record of all the network requests that are made when a page is loaded.
2937
+ * It contains information about the request and response headers, cookies, content, timings, and more. You can use HAR files to mock network requests in your tests.
2938
+ * HAR will be saved to `output/har`. More info could be found here https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har.
2939
+ *
2940
+ * ```
2941
+ * ...
2942
+ * recordHar: {
2943
+ * mode: 'minimal', // possible values: 'minimal'|'full'.
2944
+ * content: 'embed' // possible values: "omit"|"embed"|"attach".
2945
+ * }
2946
+ * ...
2947
+ * ```
2948
+ *
2932
2949
  * #### Example #1: Wait for 0 network connections.
2933
2950
  *
2934
2951
  * ```js
@@ -3324,6 +3341,22 @@ declare namespace CodeceptJS {
3324
3341
  * @returns automatically synchronized promise through #recorder
3325
3342
  */
3326
3343
  refreshPage(): void;
3344
+ /**
3345
+ * Replaying from HAR
3346
+ *
3347
+ * ```js
3348
+ * // Replay API requests from HAR.
3349
+ * // Either use a matching response from the HAR,
3350
+ * // or abort the request if nothing matches.
3351
+ * I.replayFromHar('./output/har/something.har', { url: "*\/**\/api/v1/fruits" });
3352
+ * I.amOnPage('https://demo.playwright.dev/api-mocking');
3353
+ * I.see('CodeceptJS');
3354
+ * ```
3355
+ * @param harFilePath - Path to recorded HAR file
3356
+ * @param [opts] - [Options for replaying from HAR](https://playwright.dev/docs/api/class-page#page-route-from-har)
3357
+ * @returns Promise<void>
3358
+ */
3359
+ replayFromHar(harFilePath: string, opts?: any): any;
3327
3360
  /**
3328
3361
  * Scroll page to the top.
3329
3362
  *
@@ -3449,6 +3482,28 @@ declare namespace CodeceptJS {
3449
3482
  * ```
3450
3483
  */
3451
3484
  _locateFields(): void;
3485
+ /**
3486
+ * Grab WebElements for given locator
3487
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
3488
+ *
3489
+ * ```js
3490
+ * const webElements = await I.grabWebElements('#button');
3491
+ * ```
3492
+ * @param locator - element located by CSS|XPath|strict locator.
3493
+ * @returns WebElement of being used Web helper
3494
+ */
3495
+ grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
3496
+ /**
3497
+ * Grab WebElement for given locator
3498
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
3499
+ *
3500
+ * ```js
3501
+ * const webElement = await I.grabWebElement('#button');
3502
+ * ```
3503
+ * @param locator - element located by CSS|XPath|strict locator.
3504
+ * @returns WebElement of being used Web helper
3505
+ */
3506
+ grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
3452
3507
  /**
3453
3508
  * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
3454
3509
  *
@@ -6754,6 +6809,17 @@ declare namespace CodeceptJS {
6754
6809
  * ```
6755
6810
  */
6756
6811
  _locateFields(): void;
6812
+ /**
6813
+ * Grab WebElements for given locator
6814
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
6815
+ *
6816
+ * ```js
6817
+ * const webElements = await I.grabWebElements('#button');
6818
+ * ```
6819
+ * @param locator - element located by CSS|XPath|strict locator.
6820
+ * @returns WebElement of being used Web helper
6821
+ */
6822
+ grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
6757
6823
  /**
6758
6824
  * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
6759
6825
  *
@@ -9620,6 +9686,17 @@ declare namespace CodeceptJS {
9620
9686
  * @param locator - element located by CSS|XPath|strict locator.
9621
9687
  */
9622
9688
  _locateFields(locator: CodeceptJS.LocatorOrString): void;
9689
+ /**
9690
+ * Grab WebElements for given locator
9691
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
9692
+ *
9693
+ * ```js
9694
+ * const webElements = await I.grabWebElements('#button');
9695
+ * ```
9696
+ * @param locator - element located by CSS|XPath|strict locator.
9697
+ * @returns WebElement of being used Web helper
9698
+ */
9699
+ grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
9623
9700
  /**
9624
9701
  * Set [WebDriver timeouts](https://webdriver.io/docs/timeouts.html) in realtime.
9625
9702
  *
@@ -11354,6 +11431,7 @@ declare namespace CodeceptJS {
11354
11431
  const workers: {
11355
11432
  before: 'workers.before';
11356
11433
  after: 'workers.after';
11434
+ result: 'workers.result';
11357
11435
  };
11358
11436
  function emit(event: string, param?: any): void;
11359
11437
  /**