codeceptjs 3.7.5 → 3.7.6-beta.1

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/effects.js CHANGED
@@ -89,7 +89,7 @@ async function hopeThat(callback) {
89
89
  * - Restores the session state after each attempt, whether successful or not.
90
90
  *
91
91
  * @example
92
- * const { hopeThat } = require('codeceptjs/effects')
92
+ * const { retryTo } = require('codeceptjs/effects')
93
93
  * await retryTo((tries) => {
94
94
  * if (tries < 3) {
95
95
  * I.see('Non-existent element'); // Simulates a failure
@@ -275,7 +275,7 @@ class Appium extends Webdriver {
275
275
  const _convertedCaps = {}
276
276
  for (const [key, value] of Object.entries(capabilities)) {
277
277
  if (!key.startsWith(vendorPrefix.appium)) {
278
- if (key !== 'platformName' && key !== 'bstack:options') {
278
+ if (key !== 'platformName' && key !== 'bstack:options' && key !== 'sauce:options') {
279
279
  _convertedCaps[`${vendorPrefix.appium}:${key}`] = value
280
280
  } else {
281
281
  _convertedCaps[`${key}`] = value
@@ -360,10 +360,6 @@ class Playwright extends Helper {
360
360
  // override defaults with config
361
361
  this._setConfig(config)
362
362
 
363
- // Call _init() to register selector engines - use setTimeout to avoid blocking constructor
364
- setTimeout(() => {
365
- this._init().catch(console.error)
366
- }, 0)
367
363
  }
368
364
 
369
365
  _validateConfig(config) {
@@ -281,6 +281,27 @@ class REST extends Helper {
281
281
  return this._executeRequest(request)
282
282
  }
283
283
 
284
+ /**
285
+ * Send HEAD request to REST API
286
+ *
287
+ * ```js
288
+ * I.sendHeadRequest('/api/users.json');
289
+ * ```
290
+ *
291
+ * @param {*} url
292
+ * @param {object} [headers={}] - the headers object to be sent. By default, it is sent as an empty object
293
+ *
294
+ * @returns {Promise<*>} response
295
+ */
296
+ async sendHeadRequest(url, headers = {}) {
297
+ const request = {
298
+ baseURL: this._url(url),
299
+ method: 'HEAD',
300
+ headers,
301
+ }
302
+ return this._executeRequest(request)
303
+ }
304
+
284
305
  /**
285
306
  * Sends POST request to API.
286
307
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.5",
3
+ "version": "3.7.6-beta.1",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -29,14 +29,19 @@
29
29
  "docs/webapi/**"
30
30
  ],
31
31
  "main": "lib/index.js",
32
+ "module": "lib/index.js",
33
+ "types": "typings/index.d.ts",
32
34
  "exports": {
33
- ".": "./lib/index.js",
35
+ ".": {
36
+ "import": "./lib/index.js",
37
+ "require": "./lib/index.js",
38
+ "types": "./typings/index.d.ts"
39
+ },
34
40
  "./lib/*": "./lib/*.js",
35
41
  "./els": "./lib/els.js",
36
42
  "./effects": "./lib/effects.js",
37
43
  "./steps": "./lib/steps.js"
38
44
  },
39
- "types": "typings/index.d.ts",
40
45
  "bin": {
41
46
  "codeceptjs": "./bin/codecept.js"
42
47
  },
@@ -120,7 +125,7 @@
120
125
  "uuid": "11.1.0"
121
126
  },
122
127
  "optionalDependencies": {
123
- "@codeceptjs/detox-helper": "1.1.12"
128
+ "@codeceptjs/detox-helper": "1.1.13"
124
129
  },
125
130
  "devDependencies": {
126
131
  "@apollo/server": "^5",
@@ -136,7 +141,7 @@
136
141
  "@types/node": "24.5.2",
137
142
  "@wdio/sauce-service": "9.12.5",
138
143
  "@wdio/selenium-standalone-service": "8.15.0",
139
- "@wdio/utils": "9.15.0",
144
+ "@wdio/utils": "9.19.2",
140
145
  "@xmldom/xmldom": "0.9.8",
141
146
  "chai": "^4.0.0",
142
147
  "chai-as-promised": "7.1.2",
@@ -157,7 +162,7 @@
157
162
  "jsdoc-typeof-plugin": "1.0.0",
158
163
  "json-server": "0.17.4",
159
164
  "mochawesome": "^7.1.3",
160
- "playwright": "1.55.0",
165
+ "playwright": "1.55.1",
161
166
  "prettier": "^3.3.2",
162
167
  "puppeteer": "24.15.0",
163
168
  "qrcode-terminal": "0.12.0",
@@ -2735,6 +2735,8 @@ declare namespace CodeceptJS {
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
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}\"]\`) } }`
2737
2737
  */
2738
+ // @ts-ignore
2739
+ // @ts-ignore
2738
2740
  type PlaywrightConfig = {
2739
2741
  url?: string;
2740
2742
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6112,6 +6114,8 @@ declare namespace CodeceptJS {
6112
6114
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6113
6115
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6114
6116
  */
6117
+ // @ts-ignore
6118
+ // @ts-ignore
6115
6119
  type PuppeteerConfig = {
6116
6120
  url: string;
6117
6121
  basicAuth?: any;
@@ -7956,6 +7960,8 @@ declare namespace CodeceptJS {
7956
7960
  * @property [onResponse] - an async function which can update response object.
7957
7961
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
7958
7962
  */
7963
+ // @ts-ignore
7964
+ // @ts-ignore
7959
7965
  type RESTConfig = {
7960
7966
  endpoint?: string;
7961
7967
  prettyPrintJson?: boolean;
@@ -8081,6 +8087,16 @@ declare namespace CodeceptJS {
8081
8087
  * @returns response
8082
8088
  */
8083
8089
  sendGetRequest(url: any, headers?: any): Promise<any>;
8090
+ /**
8091
+ * Send HEAD request to REST API
8092
+ *
8093
+ * ```js
8094
+ * I.sendHeadRequest('/api/users.json');
8095
+ * ```
8096
+ * @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
8097
+ * @returns response
8098
+ */
8099
+ sendHeadRequest(url: any, headers?: any): Promise<any>;
8084
8100
  /**
8085
8101
  * Sends POST request to API.
8086
8102
  *
@@ -9101,6 +9117,8 @@ declare namespace CodeceptJS {
9101
9117
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9102
9118
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9103
9119
  */
9120
+ // @ts-ignore
9121
+ // @ts-ignore
9104
9122
  type WebDriverConfig = {
9105
9123
  url: string;
9106
9124
  browser: string;
@@ -2825,6 +2825,8 @@ declare namespace CodeceptJS {
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
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
2827
  */
2828
+ // @ts-ignore
2829
+ // @ts-ignore
2828
2830
  type PlaywrightConfig = {
2829
2831
  url?: string;
2830
2832
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6353,6 +6355,8 @@ declare namespace CodeceptJS {
6353
6355
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6354
6356
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6355
6357
  */
6358
+ // @ts-ignore
6359
+ // @ts-ignore
6356
6360
  type PuppeteerConfig = {
6357
6361
  url: string;
6358
6362
  basicAuth?: any;
@@ -8333,6 +8337,8 @@ declare namespace CodeceptJS {
8333
8337
  * @property [onResponse] - an async function which can update response object.
8334
8338
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8335
8339
  */
8340
+ // @ts-ignore
8341
+ // @ts-ignore
8336
8342
  type RESTConfig = {
8337
8343
  endpoint?: string;
8338
8344
  prettyPrintJson?: boolean;
@@ -8458,6 +8464,16 @@ declare namespace CodeceptJS {
8458
8464
  * @returns response
8459
8465
  */
8460
8466
  sendGetRequest(url: any, headers?: any): Promise<any>;
8467
+ /**
8468
+ * Send HEAD request to REST API
8469
+ *
8470
+ * ```js
8471
+ * I.sendHeadRequest('/api/users.json');
8472
+ * ```
8473
+ * @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
8474
+ * @returns response
8475
+ */
8476
+ sendHeadRequest(url: any, headers?: any): Promise<any>;
8461
8477
  /**
8462
8478
  * Sends POST request to API.
8463
8479
  *
@@ -9538,6 +9554,8 @@ declare namespace CodeceptJS {
9538
9554
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
9539
9555
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9540
9556
  */
9557
+ // @ts-ignore
9558
+ // @ts-ignore
9541
9559
  type WebDriverConfig = {
9542
9560
  url: string;
9543
9561
  browser: string;
@@ -11757,7 +11775,7 @@ declare namespace CodeceptJS {
11757
11775
  * - Logs errors and retries the callback until it either succeeds or the maximum number of attempts is reached.
11758
11776
  * - Restores the session state after each attempt, whether successful or not.
11759
11777
  * @example
11760
- * const { hopeThat } = require('codeceptjs/effects')
11778
+ * const { retryTo } = require('codeceptjs/effects')
11761
11779
  * await retryTo((tries) => {
11762
11780
  * if (tries < 3) {
11763
11781
  * I.see('Non-existent element'); // Simulates a failure