@wdio/runner 8.34.1 → 9.0.0-alpha.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAAgB,KAAK,OAAO,EAAgC,MAAM,aAAa,CAAA;AAGzG,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAyB,MAAM,YAAY,CAAA;AAOtE,KAAK,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAQ9G,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,cAAc,EAAE,cAAc,EAAE,CAAA;QAChC,cAAc,EAAE,GAAG,EAAE,CAAA;QACrB,gBAAgB,EAAE,MAAM,CAAA;QACxB,YAAY,CAAC,EAAE,OAAO,CAAA;KACzB;CACJ;AAED,MAAM,CAAC,OAAO,OAAO,gBAAiB,YAAW,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;;IAKpE,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;gBAJT,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,CAAC,UAAU,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EACpD,MAAM,EAAE,MAAM,EAAE,EAChB,aAAa,EAAE,YAAY,CAAC,gBAAgB,EAC5C,SAAS,EAAE,YAAY;IASnC;;OAEG;IACH,QAAQ;IAIR,IAAI;IAIE,GAAG;IAgXT,MAAM,CAAC,IAAI,CAAE,GAAG,EAAE,MAAM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AAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,gBAAgB,EAAE,QAAQ,EAAE,YAAY;CAItH"}
package/build/browser.js CHANGED
@@ -4,6 +4,7 @@ import logger from '@wdio/logger';
4
4
  import { browser } from '@wdio/globals';
5
5
  import { executeHooksWithArgs } from '@wdio/utils';
6
6
  import { matchers } from 'expect-webdriverio';
7
+ import { ELEMENT_KEY } from 'webdriver';
7
8
  import { MESSAGE_TYPES } from '@wdio/types';
8
9
  import { transformExpectArgs } from './utils.js';
9
10
  const log = logger('@wdio/runner');
@@ -235,13 +236,41 @@ export default class BrowserFramework {
235
236
  return this.#sendWorkerResponse(id, this.#commandResponse({ id: payload.id, error }));
236
237
  }
237
238
  try {
239
+ /**
240
+ * user either the browser instance or an element based on whether or not
241
+ * a scope property was passed in
242
+ */
243
+ const scope = payload.scope
244
+ ? await browser.$({ [ELEMENT_KEY]: payload.scope })
245
+ : browser;
238
246
  /**
239
247
  * double check if function is registered
240
248
  */
241
- if (typeof browser[payload.commandName] !== 'function') {
242
- throw new Error(`browser.${payload.commandName} is not a function`);
249
+ if (typeof scope[payload.commandName] !== 'function') {
250
+ throw new Error(`${payload.scope ? 'element' : 'browser'}.${payload.commandName} is not a function`);
251
+ }
252
+ let result = await scope[payload.commandName](...payload.args);
253
+ /**
254
+ * if result is an element, transform it into an element reference
255
+ */
256
+ if (result?.constructor?.name === 'Element') {
257
+ result = result.elementId
258
+ ? { [ELEMENT_KEY]: result.elementId }
259
+ : result.error
260
+ ? { message: result.error.message, stack: result.error.stack, name: result.error.name }
261
+ : undefined;
262
+ /**
263
+ * if result is an array of elements, transform it into an array of element references
264
+ */
265
+ }
266
+ else if (result?.foundWith) {
267
+ /**
268
+ * need await here since ElementArray functions return a promise
269
+ */
270
+ result = (await result.map((res) => ({
271
+ [ELEMENT_KEY]: res.elementId
272
+ }))).filter(Boolean);
243
273
  }
244
- const result = await browser[payload.commandName](...payload.args);
245
274
  const resultMsg = this.#commandResponse({ id: payload.id, result });
246
275
  log.debug(`Return command result: ${resultMsg}`);
247
276
  return this.#sendWorkerResponse(id, resultMsg);
package/build/index.d.ts CHANGED
@@ -14,7 +14,6 @@ export default class Runner extends EventEmitter {
14
14
  private _cid?;
15
15
  private _specs?;
16
16
  private _caps?;
17
- private _snapshotService?;
18
17
  /**
19
18
  * run test suite
20
19
  * @param {string} cid worker id (e.g. `0-0`)
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAc1C,OAAO,KAAK,EACoD,SAAS,EAGxE,MAAM,YAAY,CAAA;AAInB,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,YAAY;;IAC5C,OAAO,CAAC,QAAQ,CAAC,CAAsD;IACvE,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,sBAAsB,CAAI;IAElC,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,UAAU,CAAC,CAAe;IAClC,OAAO,CAAC,OAAO,CAAC,CAAoB;IACpC,OAAO,CAAC,IAAI,CAAC,CAAQ;IACrB,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,KAAK,CAAC,CAA+B;IAC7C,OAAO,CAAC,gBAAgB,CAAC,CAA6C;IAEtE;;;;;;;;;OASG;IACG,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,SAAS;IAqMpE;;;;;;OAMG;YACW,YAAY;IAkC1B;;;;;OAKG;YACW,aAAa;IAqE3B;;OAEG;YACW,gBAAgB;IA8D9B;;OAEG;YACW,SAAS;IAmCvB;;;OAGG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE,GAAG;CAuEjC;AAED,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,eAAe,CAAA;AACvD,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAc1C,OAAO,KAAK,EACoD,SAAS,EAGxE,MAAM,YAAY,CAAA;AAInB,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,YAAY;;IAC5C,OAAO,CAAC,QAAQ,CAAC,CAAsD;IACvE,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,sBAAsB,CAAI;IAElC,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,UAAU,CAAC,CAAe;IAClC,OAAO,CAAC,OAAO,CAAC,CAAoB;IACpC,OAAO,CAAC,IAAI,CAAC,CAAQ;IACrB,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,KAAK,CAAC,CAA+B;IAE7C;;;;;;;;;OASG;IACG,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,SAAS;IAsMpE;;;;;;OAMG;YACW,YAAY;IAkC1B;;;;;OAKG;YACW,aAAa;IAqE3B;;OAEG;YACW,gBAAgB;IA8D9B;;OAEG;YACW,SAAS;IAmCvB;;;OAGG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE,GAAG;CAuEjC;AAED,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,eAAe,CAAA;AACvD,cAAc,YAAY,CAAA"}
package/build/index.js CHANGED
@@ -23,7 +23,6 @@ export default class Runner extends EventEmitter {
23
23
  _cid;
24
24
  _specs;
25
25
  _caps;
26
- _snapshotService;
27
26
  /**
28
27
  * run test suite
29
28
  * @param {string} cid worker id (e.g. `0-0`)
@@ -58,11 +57,12 @@ export default class Runner extends EventEmitter {
58
57
  /**
59
58
  * add built-in services
60
59
  */
61
- this._snapshotService = SnapshotService.initiate({
60
+ const snapshotService = SnapshotService.initiate({
62
61
  updateState: this._config.updateSnapshots,
63
62
  resolveSnapshotPath: this._config.resolveSnapshotPath
64
63
  });
65
- this._configParser.addService(this._snapshotService);
64
+ // ToDo(Christian): resolve type incompatibility between v8 and v9
65
+ this._configParser.addService(snapshotService);
66
66
  /**
67
67
  * create `browser` stub only if `specFiltering` feature is enabled
68
68
  */
@@ -174,7 +174,7 @@ export default class Runner extends EventEmitter {
174
174
  process.send({
175
175
  origin: 'worker',
176
176
  name: 'snapshot',
177
- content: this._snapshotService.results
177
+ content: snapshotService.results
178
178
  });
179
179
  return this._shutdown(failures, retries);
180
180
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@wdio/runner",
3
- "version": "8.34.1",
3
+ "version": "9.0.0-alpha.9+9220932b7",
4
4
  "description": "A WebdriverIO service that runs tests in arbitrary environments",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-runner",
7
7
  "license": "MIT",
8
8
  "engines": {
9
- "node": "^16.13 || >=18"
9
+ "node": ">=18"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
@@ -30,19 +30,19 @@
30
30
  "typeScriptVersion": "3.8.3",
31
31
  "dependencies": {
32
32
  "@types/node": "^20.11.28",
33
- "@wdio/config": "8.34.0",
34
- "@wdio/globals": "8.34.1",
35
- "@wdio/logger": "8.28.0",
36
- "@wdio/types": "8.32.4",
37
- "@wdio/utils": "8.33.1",
33
+ "@wdio/config": "9.0.0-alpha.9+9220932b7",
34
+ "@wdio/globals": "9.0.0-alpha.9+9220932b7",
35
+ "@wdio/logger": "9.0.0-alpha.9+9220932b7",
36
+ "@wdio/types": "9.0.0-alpha.9+9220932b7",
37
+ "@wdio/utils": "9.0.0-alpha.9+9220932b7",
38
38
  "deepmerge-ts": "^5.1.0",
39
39
  "expect-webdriverio": "^4.12.0",
40
40
  "gaze": "^1.1.3",
41
- "webdriver": "8.34.0",
42
- "webdriverio": "8.34.1"
41
+ "webdriver": "9.0.0-alpha.9+9220932b7",
42
+ "webdriverio": "9.0.0-alpha.9+9220932b7"
43
43
  },
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "224614b872993c0a3ef196014f1f986af4b08311"
47
+ "gitHead": "9220932b7048d9b5b6c8397dda54842625be7ef2"
48
48
  }