@wdio/runner 8.13.12 → 8.13.13
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/build/browser.d.ts.map +1 -1
- package/build/browser.js +95 -86
- package/package.json +7 -7
package/build/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAW,OAAO,EAAY,MAAM,aAAa,CAAA;AAE3E,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAA6C,MAAM,YAAY,CAAA;AAM1F,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;AAO9G,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;AAID,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,QA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AQ,EAAE,YAAY;CAItH"}
|
package/build/browser.js
CHANGED
|
@@ -54,103 +54,112 @@ export default class BrowserFramework {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async #loop() {
|
|
57
|
-
const timeout = this._config.mochaOpts?.timeout || DEFAULT_TIMEOUT;
|
|
58
57
|
/**
|
|
59
58
|
* start tests
|
|
60
59
|
*/
|
|
61
60
|
let failures = 0;
|
|
62
61
|
for (const spec of this._specs) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const viteErrorElem = document.querySelector('vite-error-overlay');
|
|
104
|
-
if (viteErrorElem && viteErrorElem.shadowRoot) {
|
|
105
|
-
const errorElems = Array.from(viteErrorElem.shadowRoot.querySelectorAll('pre'));
|
|
106
|
-
if (errorElems.length) {
|
|
107
|
-
viteError = [{ message: errorElems.map((elem) => elem.innerText).join('\n') }];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const loadError = (typeof window.__wdioErrors__ === 'undefined' &&
|
|
111
|
-
document.title !== 'WebdriverIO Browser Test' &&
|
|
112
|
-
!document.querySelector('mocha-framework'))
|
|
113
|
-
? [{ message: `Failed to load test page (title = "${document.title}", source: ${document.documentElement.innerHTML})` }]
|
|
114
|
-
: null;
|
|
115
|
-
const errors = viteError || window.__wdioErrors__ || loadError;
|
|
116
|
-
return { failures, errors, hasViteError: Boolean(viteError) };
|
|
117
|
-
}).catch((err) => ({ errors: [{ message: err.message }] }));
|
|
62
|
+
failures += await this.#runSpec(spec);
|
|
63
|
+
}
|
|
64
|
+
return failures;
|
|
65
|
+
}
|
|
66
|
+
async #runSpec(spec, retried = false) {
|
|
67
|
+
const timeout = this._config.mochaOpts?.timeout || DEFAULT_TIMEOUT;
|
|
68
|
+
log.info(`Run spec file ${spec} for cid ${this._cid}`);
|
|
69
|
+
/**
|
|
70
|
+
* if a `sessionId` is part of `this._config` it means we are in watch mode and are
|
|
71
|
+
* re-using a previous session. Since Vite has already a hotreload feature, there
|
|
72
|
+
* is no need to call the url command again
|
|
73
|
+
*/
|
|
74
|
+
if (!this._config.sessionId) {
|
|
75
|
+
await browser.url(`/?cid=${this._cid}&spec=${url.parse(spec).pathname}`);
|
|
76
|
+
}
|
|
77
|
+
// await browser.debug()
|
|
78
|
+
/**
|
|
79
|
+
* set spec and cid as cookie so the Vite plugin can detect session even without
|
|
80
|
+
* query parameters
|
|
81
|
+
*/
|
|
82
|
+
await browser.setCookies([
|
|
83
|
+
{ name: 'WDIO_SPEC', value: url.fileURLToPath(spec) },
|
|
84
|
+
{ name: 'WDIO_CID', value: this._cid }
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* wait for test results or page errors
|
|
88
|
+
*/
|
|
89
|
+
let state = {};
|
|
90
|
+
const now = Date.now();
|
|
91
|
+
await browser.waitUntil(async () => {
|
|
92
|
+
while (typeof state.failures !== 'number' && (!state.errors || state.errors.length === 0)) {
|
|
93
|
+
if ((Date.now() - now) > timeout) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
await sleep();
|
|
97
|
+
/**
|
|
98
|
+
* don't fetch events if user has called debug command
|
|
99
|
+
*/
|
|
100
|
+
if (this.#inDebugMode) {
|
|
101
|
+
continue;
|
|
118
102
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
103
|
+
state = await browser?.execute(function fetchExecutionState() {
|
|
104
|
+
const failures = window.__wdioEvents__ && window.__wdioEvents__.length > 0
|
|
105
|
+
? window.__wdioFailures__
|
|
106
|
+
: null;
|
|
107
|
+
let viteError;
|
|
108
|
+
const viteErrorElem = document.querySelector('vite-error-overlay');
|
|
109
|
+
if (viteErrorElem && viteErrorElem.shadowRoot) {
|
|
110
|
+
const errorElems = Array.from(viteErrorElem.shadowRoot.querySelectorAll('pre'));
|
|
111
|
+
if (errorElems.length) {
|
|
112
|
+
viteError = [{ message: errorElems.map((elem) => elem.innerText).join('\n') }];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const loadError = (typeof window.__wdioErrors__ === 'undefined' &&
|
|
116
|
+
document.title !== 'WebdriverIO Browser Test' &&
|
|
117
|
+
!document.querySelector('mocha-framework'))
|
|
118
|
+
? [{ message: `Failed to load test page (title = "${document.title}", source: ${document.documentElement.innerHTML})` }]
|
|
119
|
+
: null;
|
|
120
|
+
const errors = viteError || window.__wdioErrors__ || loadError;
|
|
121
|
+
return { failures, errors, hasViteError: Boolean(viteError) };
|
|
122
|
+
}).catch((err) => ({ errors: [{ message: err.message }] }));
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}, {
|
|
126
|
+
timeoutMsg: 'browser test timed out',
|
|
127
|
+
timeout
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* capture coverage if enabled
|
|
131
|
+
*/
|
|
132
|
+
if (this.#runnerOptions.coverage?.enabled && process.send) {
|
|
133
|
+
const coverageMap = await browser.execute(() => (window.__coverage__ || {}));
|
|
134
|
+
process.send({
|
|
135
|
+
origin: 'worker',
|
|
136
|
+
name: 'coverageMap',
|
|
137
|
+
content: { coverageMap }
|
|
123
138
|
});
|
|
139
|
+
}
|
|
140
|
+
if (state.errors?.length) {
|
|
141
|
+
const errors = state.errors.map((ev) => state.hasViteError
|
|
142
|
+
? `${ev.message}\n${(ev.error ? ev.error.split('\n').slice(1).join('\n') : '')}`
|
|
143
|
+
: `${path.basename(ev.filename || spec)}: ${ev.message}\n${(ev.error ? ev.error.split('\n').slice(1).join('\n') : '')}`);
|
|
124
144
|
/**
|
|
125
|
-
*
|
|
145
|
+
* retry Vite dynamic import errors once
|
|
126
146
|
*/
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
origin: 'worker',
|
|
131
|
-
name: 'coverageMap',
|
|
132
|
-
content: { coverageMap }
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (state.errors?.length) {
|
|
136
|
-
const errors = state.errors.map((ev) => state.hasViteError
|
|
137
|
-
? `${ev.message}\n${(ev.error ? ev.error.split('\n').slice(1).join('\n') : '')}`
|
|
138
|
-
: `${path.basename(ev.filename || spec)}: ${ev.message}\n${(ev.error ? ev.error.split('\n').slice(1).join('\n') : '')}`);
|
|
139
|
-
const { name, message, stack } = new Error(state.hasViteError
|
|
140
|
-
? `Test failed due to the following error: ${errors.join('\n\n')}`
|
|
141
|
-
: `Test failed due to following error(s):${sep}${errors.join(sep)}`);
|
|
142
|
-
process.send({
|
|
143
|
-
origin: 'worker',
|
|
144
|
-
name: 'error',
|
|
145
|
-
content: { name, message, stack }
|
|
146
|
-
});
|
|
147
|
-
failures += 1;
|
|
148
|
-
continue;
|
|
147
|
+
if (!retried && errors.some((err) => err.includes('Failed to fetch dynamically imported module'))) {
|
|
148
|
+
log.info('Retry test run due to dynamic import error');
|
|
149
|
+
return this.#runSpec(spec, true);
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
const { name, message, stack } = new Error(state.hasViteError
|
|
152
|
+
? `Test failed due to the following error: ${errors.join('\n\n')}`
|
|
153
|
+
: `Test failed due to following error(s):${sep}${errors.join(sep)}`);
|
|
154
|
+
process.send({
|
|
155
|
+
origin: 'worker',
|
|
156
|
+
name: 'error',
|
|
157
|
+
content: { name, message, stack }
|
|
158
|
+
});
|
|
159
|
+
return 1;
|
|
152
160
|
}
|
|
153
|
-
|
|
161
|
+
await this.#fetchEvents(browser, spec);
|
|
162
|
+
return state.failures || 0;
|
|
154
163
|
}
|
|
155
164
|
async #fetchEvents(browser, spec) {
|
|
156
165
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/runner",
|
|
3
|
-
"version": "8.13.
|
|
3
|
+
"version": "8.13.13",
|
|
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",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"typeScriptVersion": "3.8.3",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@types/node": "^20.1.0",
|
|
33
|
-
"@wdio/config": "8.
|
|
34
|
-
"@wdio/globals": "8.13.
|
|
33
|
+
"@wdio/config": "8.13.13",
|
|
34
|
+
"@wdio/globals": "8.13.13",
|
|
35
35
|
"@wdio/logger": "8.11.0",
|
|
36
36
|
"@wdio/types": "8.10.4",
|
|
37
|
-
"@wdio/utils": "8.
|
|
37
|
+
"@wdio/utils": "8.13.13",
|
|
38
38
|
"deepmerge-ts": "^5.0.0",
|
|
39
39
|
"expect-webdriverio": "^4.2.5",
|
|
40
40
|
"gaze": "^1.1.2",
|
|
41
|
-
"webdriver": "8.13.
|
|
42
|
-
"webdriverio": "8.13.
|
|
41
|
+
"webdriver": "8.13.13",
|
|
42
|
+
"webdriverio": "8.13.13"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ba97a49a1294e812ed35fc05be20dd29133ab200"
|
|
48
48
|
}
|