codeceptjs 3.7.4 → 3.7.5-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.4",
3
+ "version": "3.7.5-beta.10",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "repository": "Codeception/codeceptjs",
44
44
  "scripts": {
45
- "json-server": "json-server test/data/rest/db.json --host 0.0.0.0 -p 8010 --watch -m test/data/rest/headers.js",
45
+ "test-server": "node bin/test-server.js test/data/rest/db.json --host 0.0.0.0 -p 8010",
46
46
  "json-server:graphql": "node test/data/graphql/index.js",
47
47
  "lint": "eslint bin/ examples/ lib/ test/ translations/ runok.js",
48
48
  "lint-fix": "eslint bin/ examples/ lib/ test/ translations/ runok.js --fix",
@@ -86,6 +86,7 @@
86
86
  "axios": "1.11.0",
87
87
  "chalk": "4.1.2",
88
88
  "cheerio": "^1.0.0",
89
+ "chokidar": "^4.0.3",
89
90
  "commander": "11.1.0",
90
91
  "cross-spawn": "7.0.6",
91
92
  "css-to-xpath": "0.1.0",
@@ -98,17 +99,18 @@
98
99
  "fuse.js": "^7.0.0",
99
100
  "glob": ">=9.0.0 <12",
100
101
  "html-minifier-terser": "7.2.0",
101
- "inquirer": "8.2.6",
102
+ "inquirer": "^8.2.7",
102
103
  "invisi-data": "^1.0.0",
103
104
  "joi": "17.13.3",
104
105
  "js-beautify": "1.15.4",
105
106
  "lodash.clonedeep": "4.5.0",
106
- "lodash.shuffle": "4.2.0",
107
107
  "lodash.merge": "4.6.2",
108
+ "lodash.shuffle": "4.2.0",
108
109
  "mkdirp": "3.0.1",
109
110
  "mocha": "11.6.0",
110
111
  "monocart-coverage-reports": "2.12.6",
111
112
  "ms": "2.1.3",
113
+ "multer": "^2.0.2",
112
114
  "ora-classic": "5.4.2",
113
115
  "parse-function": "5.6.10",
114
116
  "parse5": "7.3.0",
@@ -125,7 +127,7 @@
125
127
  "@codeceptjs/expect-helper": "^1.0.2",
126
128
  "@codeceptjs/mock-request": "0.3.1",
127
129
  "@eslint/eslintrc": "3.3.1",
128
- "@eslint/js": "9.31.0",
130
+ "@eslint/js": "9.34.0",
129
131
  "@faker-js/faker": "9.8.0",
130
132
  "@pollyjs/adapter-puppeteer": "6.0.6",
131
133
  "@pollyjs/core": "6.0.6",
@@ -145,7 +147,7 @@
145
147
  "eslint-plugin-import": "2.32.0",
146
148
  "eslint-plugin-mocha": "11.1.0",
147
149
  "expect": "30.0.5",
148
- "express": "5.1.0",
150
+ "express": "^5.1.0",
149
151
  "globals": "16.2.0",
150
152
  "graphql": "16.11.0",
151
153
  "graphql-tag": "^2.12.6",
@@ -440,7 +440,7 @@ declare namespace CodeceptJS {
440
440
  interface IHook {}
441
441
  interface IScenario {}
442
442
  interface IFeature {
443
- (title: string): FeatureConfig
443
+ (title: string, opts?: { [key: string]: any }): FeatureConfig
444
444
  }
445
445
  interface CallbackOrder extends Array<any> {}
446
446
  interface SupportObject {
@@ -486,6 +486,7 @@ declare namespace CodeceptJS {
486
486
  todo: IScenario
487
487
  }
488
488
  interface Feature extends IFeature {
489
+ only: IFeature
489
490
  skip: IFeature
490
491
  }
491
492
  interface IData {
@@ -519,11 +520,17 @@ declare namespace CodeceptJS {
519
520
  }
520
521
  }
521
522
 
523
+ type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
524
+ type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
525
+ type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>;
526
+
527
+
522
528
  // Globals
523
529
  declare const codecept_dir: string
524
530
  declare const output_dir: string
525
- declare function tryTo(...fn): Promise<boolean>
526
- declare function retryTo(...fn): Promise<null>
531
+ declare const tryTo: TryTo;
532
+ declare const retryTo: RetryTo;
533
+ declare const hopeThat: HopeThat;
527
534
 
528
535
  declare const actor: CodeceptJS.actor
529
536
  declare const codecept_actor: CodeceptJS.actor
@@ -545,7 +552,7 @@ declare const Given: typeof CodeceptJS.addStep
545
552
  declare const When: typeof CodeceptJS.addStep
546
553
  declare const Then: typeof CodeceptJS.addStep
547
554
 
548
- declare const Feature: typeof CodeceptJS.Feature
555
+ declare const Feature: CodeceptJS.Feature
549
556
  declare const Scenario: CodeceptJS.Scenario
550
557
  declare const xScenario: CodeceptJS.IScenario
551
558
  declare const xFeature: CodeceptJS.IFeature
@@ -634,3 +641,9 @@ declare module 'codeceptjs' {
634
641
  declare module '@codeceptjs/helper' {
635
642
  export = CodeceptJS.Helper
636
643
  }
644
+
645
+ declare module 'codeceptjs/effects' {
646
+ export const tryTo: TryTo;
647
+ export const retryTo: RetryTo;
648
+ export const hopeThat: HopeThat;
649
+ }
@@ -2733,7 +2733,11 @@ declare namespace CodeceptJS {
2733
2733
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
2734
2734
  * @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).
2735
2735
  * @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).
2736
+ * @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}\"]\`) } }`
2736
2737
  */
2738
+ // @ts-ignore
2739
+ // @ts-ignore
2740
+ // @ts-ignore
2737
2741
  type PlaywrightConfig = {
2738
2742
  url?: string;
2739
2743
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -2771,6 +2775,7 @@ declare namespace CodeceptJS {
2771
2775
  highlightElement?: boolean;
2772
2776
  recordHar?: any;
2773
2777
  testIdAttribute?: string;
2778
+ customLocatorStrategies?: any;
2774
2779
  };
2775
2780
  /**
2776
2781
  * Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
@@ -6110,6 +6115,9 @@ declare namespace CodeceptJS {
6110
6115
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6111
6116
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6112
6117
  */
6118
+ // @ts-ignore
6119
+ // @ts-ignore
6120
+ // @ts-ignore
6113
6121
  type PuppeteerConfig = {
6114
6122
  url: string;
6115
6123
  basicAuth?: any;
@@ -7916,6 +7924,9 @@ declare namespace CodeceptJS {
7916
7924
  * @property [onResponse] - an async function which can update response object.
7917
7925
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
7918
7926
  */
7927
+ // @ts-ignore
7928
+ // @ts-ignore
7929
+ // @ts-ignore
7919
7930
  type RESTConfig = {
7920
7931
  endpoint?: string;
7921
7932
  prettyPrintJson?: boolean;
@@ -9061,6 +9072,9 @@ declare namespace CodeceptJS {
9061
9072
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9062
9073
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9063
9074
  */
9075
+ // @ts-ignore
9076
+ // @ts-ignore
9077
+ // @ts-ignore
9064
9078
  type WebDriverConfig = {
9065
9079
  url: string;
9066
9080
  browser: string;
@@ -2823,7 +2823,11 @@ 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(\`[role="\${selector}\"]\`) } }`
2826
2827
  */
2828
+ // @ts-ignore
2829
+ // @ts-ignore
2830
+ // @ts-ignore
2827
2831
  type PlaywrightConfig = {
2828
2832
  url?: string;
2829
2833
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -2861,6 +2865,7 @@ declare namespace CodeceptJS {
2861
2865
  highlightElement?: boolean;
2862
2866
  recordHar?: any;
2863
2867
  testIdAttribute?: string;
2868
+ customLocatorStrategies?: any;
2864
2869
  };
2865
2870
  /**
2866
2871
  * Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
@@ -6351,6 +6356,9 @@ declare namespace CodeceptJS {
6351
6356
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6352
6357
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6353
6358
  */
6359
+ // @ts-ignore
6360
+ // @ts-ignore
6361
+ // @ts-ignore
6354
6362
  type PuppeteerConfig = {
6355
6363
  url: string;
6356
6364
  basicAuth?: any;
@@ -8293,6 +8301,9 @@ declare namespace CodeceptJS {
8293
8301
  * @property [onResponse] - an async function which can update response object.
8294
8302
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8295
8303
  */
8304
+ // @ts-ignore
8305
+ // @ts-ignore
8306
+ // @ts-ignore
8296
8307
  type RESTConfig = {
8297
8308
  endpoint?: string;
8298
8309
  prettyPrintJson?: boolean;
@@ -9498,6 +9509,9 @@ declare namespace CodeceptJS {
9498
9509
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9499
9510
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9500
9511
  */
9512
+ // @ts-ignore
9513
+ // @ts-ignore
9514
+ // @ts-ignore
9501
9515
  type WebDriverConfig = {
9502
9516
  url: string;
9503
9517
  browser: string;
@@ -12118,6 +12132,10 @@ declare namespace CodeceptJS {
12118
12132
  function Feature(title: string, opts?: {
12119
12133
  [key: string]: any;
12120
12134
  }): FeatureConfig;
12135
+ /**
12136
+ * Exclusive test suite - runs only this feature.
12137
+ */
12138
+ const only: CodeceptJS.IFeature;
12121
12139
  /**
12122
12140
  * Pending test suite.
12123
12141
  */