@wdio/runner 8.33.0 → 9.0.0-alpha.0

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');
@@ -241,7 +242,35 @@ export default class BrowserFramework {
241
242
  if (typeof browser[payload.commandName] !== 'function') {
242
243
  throw new Error(`browser.${payload.commandName} is not a function`);
243
244
  }
244
- const result = await browser[payload.commandName](...payload.args);
245
+ /**
246
+ * user either the browser instance or an element based on whether or not
247
+ * a scope property was passed in
248
+ */
249
+ const scope = payload.scope
250
+ ? await browser.$({ [ELEMENT_KEY]: payload.scope })
251
+ : browser;
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);
273
+ }
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.33.0",
3
+ "version": "9.0.0-alpha.0",
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.1.0",
33
- "@wdio/config": "8.33.0",
34
- "@wdio/globals": "8.33.0",
35
- "@wdio/logger": "8.28.0",
36
- "@wdio/types": "8.32.4",
37
- "@wdio/utils": "8.33.0",
33
+ "@wdio/config": "9.0.0-alpha.0",
34
+ "@wdio/globals": "9.0.0-alpha.0",
35
+ "@wdio/logger": "9.0.0-alpha.0",
36
+ "@wdio/types": "9.0.0-alpha.0",
37
+ "@wdio/utils": "9.0.0-alpha.0",
38
38
  "deepmerge-ts": "^5.0.0",
39
39
  "expect-webdriverio": "^4.11.2",
40
40
  "gaze": "^1.1.2",
41
- "webdriver": "8.33.0",
42
- "webdriverio": "8.33.0"
41
+ "webdriver": "9.0.0-alpha.0",
42
+ "webdriverio": "9.0.0-alpha.0"
43
43
  },
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "b00f5062e9ca87d6b2d01b1e9fa66ab15d8636b4"
47
+ "gitHead": "75d45a1efff8705785f0fbcd2379ac624d16e007"
48
48
  }