@wdio/browser-runner 9.30.0 → 9.31.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.
@@ -96,7 +96,7 @@ var ProxyDriver = class {
96
96
  const bidiPrototype = {};
97
97
  const webSocketUrl = "alwaysMatch" in params.capabilities ? (_b = params.capabilities.alwaysMatch) == null ? void 0 : _b.webSocketUrl : params.capabilities.webSocketUrl;
98
98
  if (webSocketUrl) {
99
- Object.assign(bidiPrototype, initiateBidi(webSocketUrl));
99
+ Object.assign(bidiPrototype, initiateBidi(webSocketUrl, void 0, void 0, params.bidiResponseTimeout));
100
100
  }
101
101
  const ee = new EventEmitter();
102
102
  const eventPrototype = {
@@ -1,3 +1,16 @@
1
1
  import { expect } from 'expect';
2
- export { expect };
2
+ import type { ChainablePromiseArray } from 'webdriverio';
3
+ declare class AsymmetricMatcher {
4
+ sample: unknown;
5
+ matcherName?: string | undefined;
6
+ $$typeof: number | symbol;
7
+ constructor(sample: unknown, matcherName?: string | undefined);
8
+ toString(): string | undefined;
9
+ }
10
+ type Expect = typeof expect & {
11
+ some(elements: WebdriverIO.Element[] | WebdriverIO.ElementArray | ChainablePromiseArray): AsymmetricMatcher;
12
+ oneOf(...sample: string[]): AsymmetricMatcher;
13
+ };
14
+ declare const expectWithHelpers: Expect;
15
+ export { expectWithHelpers as expect };
3
16
  //# sourceMappingURL=expect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/browser/expect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA2E,MAAM,QAAQ,CAAA;AA4LxG,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/browser/expect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA2E,MAAM,QAAQ,CAAA;AAGxG,OAAO,KAAK,EAA2B,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAMjF,cAAM,iBAAiB;IAEA,MAAM,EAAE,OAAO;IAAS,WAAW,CAAC,EAAE,MAAM;IAD/D,QAAQ,kBAAoB;gBACT,MAAM,EAAE,OAAO,EAAS,WAAW,CAAC,EAAE,MAAM,YAAA;IAC/D,QAAQ;CAGX;AAED,KAAK,MAAM,GAAG,OAAO,MAAM,GAAG;IAE1B,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,YAAY,GAAG,qBAAqB,GAAG,iBAAiB,CAAA;IAC3G,KAAK,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;CAChD,CAAA;AACD,QAAA,MAAM,iBAAiB,EAAa,MAAM,CAAA;AA2N1C,OAAO,EAAE,iBAAiB,IAAI,MAAM,EAAE,CAAA"}
@@ -1,3 +1,7 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
1
5
  // src/browser/expect.ts
2
6
  import { expect } from "expect";
3
7
  import { MESSAGE_TYPES } from "@wdio/types";
@@ -22,6 +26,19 @@ function getCID() {
22
26
  var WDIO_EVENT_NAME = "wdio:workerMessage";
23
27
 
24
28
  // src/browser/expect.ts
29
+ var AsymmetricMatcher = class {
30
+ constructor(sample, matcherName) {
31
+ __publicField(this, "sample", sample);
32
+ __publicField(this, "matcherName", matcherName);
33
+ __publicField(this, "$$typeof", asymmetricMatcher);
34
+ }
35
+ toString() {
36
+ return this.matcherName;
37
+ }
38
+ };
39
+ var expectWithHelpers = expect;
40
+ expectWithHelpers.oneOf = (...sample) => new AsymmetricMatcher(sample, "OneOf");
41
+ expectWithHelpers.some = (sample) => new AsymmetricMatcher(sample, "Some");
25
42
  var asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("jest.asymmetricMatcher") : 1267621;
26
43
  var matcherRequestCount = 0;
27
44
  var matcherRequests = /* @__PURE__ */ new Map();
@@ -36,30 +53,32 @@ function createMatcher(matcherName) {
36
53
  message: () => "Could not connect to testrunner"
37
54
  };
38
55
  }
39
- if (typeof args[0] === "object" && "$$typeof" in args[0] && args[0].$$typeof === asymmetricMatcher && args[0].asymmetricMatch) {
40
- args[0] = {
41
- $$typeof: args[0].toString(),
42
- sample: args[0].sample,
43
- inverse: args[0].inverse
44
- };
45
- }
56
+ const serializedArgs = args.map(serializeAsymmetricMatchers);
46
57
  const expectRequest = {
47
58
  id: matcherRequestCount++,
48
59
  cid,
49
60
  scope: this,
50
61
  matcherName,
51
- args
62
+ args: serializedArgs
52
63
  };
53
- const isContextObject = typeof context === "object";
54
- if (isContextObject && "selector" in context && "selector" in context) {
55
- expectRequest.element = context;
64
+ if (context instanceof AsymmetricMatcher && context.matcherName === "Some") {
65
+ expectRequest.scope.isSome = true;
66
+ context = context.sample;
56
67
  }
57
- if (isContextObject && "then" in context && typeof context.selector === "object") {
58
- expectRequest.element = await context;
68
+ const isContextObject = typeof context === "object";
69
+ if (context && isContextObject) {
70
+ if ("then" in context && typeof context.selector === "object") {
71
+ expectRequest.element = await context;
72
+ } else if ("selector" in context) {
73
+ expectRequest.element = context;
74
+ }
75
+ if (Array.isArray(context) && context.every((el) => "selector" in el)) {
76
+ expectRequest.element = context;
77
+ }
59
78
  }
60
79
  if (context instanceof Element) {
61
80
  expectRequest.element = await $(context);
62
- } else if (isContextObject && !("sessionId" in context)) {
81
+ } else if (context && isContextObject && !("sessionId" in context)) {
63
82
  expectRequest.context = context;
64
83
  if ("then" in context) {
65
84
  expectRequest.context = await context;
@@ -109,6 +128,23 @@ var _a2;
109
128
  message: () => message.value.message
110
129
  });
111
130
  });
131
+ function serializeAsymmetricMatchers(arg) {
132
+ if (!arg || typeof arg !== "object") {
133
+ return arg;
134
+ }
135
+ const asymmetricArg = arg;
136
+ if ("$$typeof" in asymmetricArg && asymmetricArg.$$typeof === asymmetricMatcher) {
137
+ return {
138
+ $$typeof: asymmetricArg.toString(),
139
+ matcherName: asymmetricArg.matcherName,
140
+ sample: serializeAsymmetricMatchers(asymmetricArg.sample)
141
+ };
142
+ }
143
+ if (Array.isArray(arg)) {
144
+ return arg.map(serializeAsymmetricMatchers);
145
+ }
146
+ return arg;
147
+ }
112
148
  export {
113
- expect
149
+ expectWithHelpers as expect
114
150
  };
@@ -302,7 +302,8 @@ globalThis.confirm = showPopupWarning("confirm", false, true);
302
302
  globalThis.prompt = showPopupWarning("prompt", null, "your value");
303
303
  var browser = await remote({
304
304
  automationProtocol: automationProtocolPath,
305
- capabilities: window.__wdioEnv__.capabilities
305
+ capabilities: window.__wdioEnv__.capabilities,
306
+ bidiResponseTimeout: window.__wdioEnv__.config.bidiResponseTimeout
306
307
  });
307
308
  _setGlobal("browser", browser, window.__wdioEnv__.injectGlobals);
308
309
  _setGlobal("driver", browser, window.__wdioEnv__.injectGlobals);
package/build/index.js CHANGED
@@ -1124,9 +1124,13 @@ async function stencilVitePlugin(rootDir) {
1124
1124
  transformedCode = injectStencilImports(transformedCode, stencilImports);
1125
1125
  findStaticImports(transformedCode).filter((imp) => imp.specifier.includes("&encapsulation=shadow")).forEach((imp) => {
1126
1126
  const cssPath = path8.resolve(path8.dirname(id), imp.specifier);
1127
+ const styleVarName = imp.imports.trim();
1128
+ const isStyleCalledAsFunction = new RegExp(`return\\s+${styleVarName}\\s*\\(\\)`).test(transformedCode);
1127
1129
  transformedCode = transformedCode.replace(
1128
1130
  imp.code,
1129
- `import ${imp.imports.trim()} from '/@fs/${cssPath}&inline';
1131
+ isStyleCalledAsFunction ? `import __${styleVarName}Css from '/@fs/${cssPath}&inline';
1132
+ const ${styleVarName} = () => __${styleVarName}Css;
1133
+ ` : `import ${styleVarName} from '/@fs/${cssPath}&inline';
1130
1134
  `
1131
1135
  );
1132
1136
  });
@@ -1124,9 +1124,13 @@ async function stencilVitePlugin(rootDir) {
1124
1124
  transformedCode = injectStencilImports(transformedCode, stencilImports);
1125
1125
  findStaticImports(transformedCode).filter((imp) => imp.specifier.includes("&encapsulation=shadow")).forEach((imp) => {
1126
1126
  const cssPath = path8.resolve(path8.dirname(id), imp.specifier);
1127
+ const styleVarName = imp.imports.trim();
1128
+ const isStyleCalledAsFunction = new RegExp(`return\\s+${styleVarName}\\s*\\(\\)`).test(transformedCode);
1127
1129
  transformedCode = transformedCode.replace(
1128
1130
  imp.code,
1129
- `import ${imp.imports.trim()} from '/@fs/${cssPath}&inline';
1131
+ isStyleCalledAsFunction ? `import __${styleVarName}Css from '/@fs/${cssPath}&inline';
1132
+ const ${styleVarName} = () => __${styleVarName}Css;
1133
+ ` : `import ${styleVarName} from '/@fs/${cssPath}&inline';
1130
1134
  `
1131
1135
  );
1132
1136
  });
@@ -1 +1 @@
1
- {"version":3,"file":"stencil.d.ts","sourceRoot":"","sources":["../../../src/vite/frameworks/stencil.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAU,MAAM,MAAM,CAAA;AAahD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,oBAEhG;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,yBAwBvD;AAyJD;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,gBAaxD"}
1
+ {"version":3,"file":"stencil.d.ts","sourceRoot":"","sources":["../../../src/vite/frameworks/stencil.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAU,MAAM,MAAM,CAAA;AAahD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,oBAEhG;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,yBAwBvD;AA2KD;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,gBAaxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browser-runner",
3
- "version": "9.30.0",
3
+ "version": "9.31.1",
4
4
  "description": "A WebdriverIO runner to run unit tests tests in the browser.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browser-runner",
@@ -74,16 +74,16 @@
74
74
  "dependencies": {
75
75
  "@originjs/vite-plugin-commonjs": "^1.0.3",
76
76
  "@vitest/spy": "^2.0.4",
77
- "@wdio/globals": "9.29.1",
78
- "@wdio/local-runner": "9.30.0",
77
+ "@wdio/globals": "9.31.1",
78
+ "@wdio/local-runner": "9.31.1",
79
79
  "@wdio/logger": "9.29.1",
80
- "@wdio/mocha-framework": "9.30.0",
81
- "@wdio/protocols": "9.30.0",
82
- "@wdio/runner": "9.30.0",
83
- "@wdio/types": "9.29.1",
84
- "@wdio/utils": "9.30.0",
80
+ "@wdio/mocha-framework": "9.31.1",
81
+ "@wdio/protocols": "9.31.1",
82
+ "@wdio/runner": "9.31.1",
83
+ "@wdio/types": "9.31.1",
84
+ "@wdio/utils": "9.31.1",
85
85
  "deepmerge-ts": "^7.0.3",
86
- "expect": "30.2.0",
86
+ "expect": "30.4.1",
87
87
  "get-port": "^7.1.0",
88
88
  "import-meta-resolve": "^4.0.0",
89
89
  "istanbul-lib-coverage": "^3.2.2",
@@ -97,10 +97,11 @@
97
97
  "source-map-support": "^0.5.21",
98
98
  "vite": "^5.4.10",
99
99
  "vite-plugin-istanbul": "^6.0.0",
100
- "vite-plugin-top-level-await": "^1.4.1"
100
+ "vite-plugin-top-level-await": "^1.4.1",
101
+ "webdriver": "9.31.1"
101
102
  },
102
103
  "peerDependencies": {
103
- "expect-webdriverio": "^5.6.5",
104
+ "expect-webdriverio": "^6.0.5",
104
105
  "webdriver": "^9.0.0",
105
106
  "webdriverio": "^9.0.0"
106
107
  },
@@ -124,7 +125,7 @@
124
125
  "esbuild": "^0.28.1",
125
126
  "geckodriver": "^6.1.1",
126
127
  "mocha": "^10.7.3",
127
- "webdriverio": "9.30.0"
128
+ "webdriverio": "9.31.1"
128
129
  },
129
130
  "optionalDependencies": {
130
131
  "@nuxt/kit": "^3.12.4",
@@ -134,5 +135,5 @@
134
135
  "publishConfig": {
135
136
  "access": "public"
136
137
  },
137
- "gitHead": "5e412ba964c99fb2a4cbf34b5e8ecfee746a5835"
138
+ "gitHead": "c766850846f7ac91cd6cd1d2cd979fbb8a6e8daf"
138
139
  }