@checkly/playwright-core 1.42.12 → 1.42.14
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/checkly/sWatcher.js +150 -0
- package/lib/cli/cli.js +62 -0
- package/lib/client/channelOwner.js +1 -1
- package/lib/client/fetch.js +9 -5
- package/lib/common/debugLogger.js +91 -0
- package/lib/vite/recorder/assets/{codeMirrorModule-I9ks4y7D.js → codeMirrorModule-W69B4LBB.js} +10 -10
- package/lib/vite/recorder/assets/{index-yg8ypzl6.js → index-Ly3PcVUb.js} +2 -2
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/{codeMirrorModule-Vg1kIqMp.js → codeMirrorModule-0bpaqixv.js} +10 -10
- package/lib/vite/traceViewer/assets/codeMirrorModule-5nkjDDU_.js +15578 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-75b0ca4f.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-RVP_AMUu.js +15585 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-c1454a2e.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-cc2329e4.js +15593 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-d725feea.js +15586 -0
- package/lib/vite/traceViewer/assets/{codeMirrorModule-wLpsbIhd.js → codeMirrorModule-e5a15eec.js} +13 -13
- package/lib/vite/traceViewer/assets/codeMirrorModule-kT-uS7F4.js +15592 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-rcsC5no8.js +15592 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-yboVpgC0.js +15592 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-ytMY1awF.js +15585 -0
- package/lib/vite/traceViewer/assets/wsPort-1-6TL4lc.js +18540 -0
- package/lib/vite/traceViewer/assets/wsPort-54626118.js +18361 -0
- package/lib/vite/traceViewer/assets/wsPort-98e00a94.js +64 -0
- package/lib/vite/traceViewer/assets/wsPort-CAXygIGt.js +18540 -0
- package/lib/vite/traceViewer/assets/wsPort-KEbz4l8i.js +18540 -0
- package/lib/vite/traceViewer/assets/{wsPort-RIoVGhlT.js → wsPort-_JBDEilC.js} +2 -2
- package/lib/vite/traceViewer/assets/wsPort-a88a6a12.js +18361 -0
- package/lib/vite/traceViewer/assets/wsPort-cb764cde.js +64 -0
- package/lib/vite/traceViewer/assets/wsPort-ee2830d7.js +64 -0
- package/lib/vite/traceViewer/assets/wsPort-lTlmZhJd.js +18564 -0
- package/lib/vite/traceViewer/assets/wsPort-xpIMLVfx.js +18540 -0
- package/lib/vite/traceViewer/assets/wsPort-yM58htfg.js +18360 -0
- package/lib/vite/traceViewer/assets/xtermModule-443332e6.js +9 -0
- package/lib/vite/traceViewer/assets/xtermModule-60687b6b.js +6410 -0
- package/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css +1 -0
- package/lib/vite/traceViewer/codeMirrorModule.eb494ea9.css +344 -0
- package/lib/vite/traceViewer/codicon.79f233d0.ttf +0 -0
- package/lib/vite/traceViewer/index.1a1fe659.css +1 -0
- package/lib/vite/traceViewer/index.4a8ee36e.js +2 -0
- package/lib/vite/traceViewer/index.55e65778.js +181 -0
- package/lib/vite/traceViewer/index.5nqVcfiC.js +180 -0
- package/lib/vite/traceViewer/index.742fd3e5.js +181 -0
- package/lib/vite/traceViewer/index.76e9f312.css +124 -0
- package/lib/vite/traceViewer/index.UNF4A0jZ.js +180 -0
- package/lib/vite/traceViewer/index.ZUjC4zt1.js +180 -0
- package/lib/vite/traceViewer/index.a265fbdb.js +2 -0
- package/lib/vite/traceViewer/index.decad628.js +2 -0
- package/lib/vite/traceViewer/index.html +2 -2
- package/lib/vite/traceViewer/index.ici1bqta.js +180 -0
- package/lib/vite/traceViewer/index.mxOcKqpu.js +180 -0
- package/lib/vite/traceViewer/{index.-_8-eHEE.js → index.u51inEcm.js} +1 -1
- package/lib/vite/traceViewer/index.zXVxM5ps.js +180 -0
- package/lib/vite/traceViewer/uiMode.08ab2d90.js +4 -0
- package/lib/vite/traceViewer/uiMode.0d0d667b.js +4 -0
- package/lib/vite/traceViewer/uiMode.216233d5.js +1484 -0
- package/lib/vite/traceViewer/uiMode.2c31018f.css +1324 -0
- package/lib/vite/traceViewer/uiMode.468b0309.js +4 -0
- package/lib/vite/traceViewer/uiMode.67C8Ij-c.js +1490 -0
- package/lib/vite/traceViewer/uiMode.8b41a49d.css +1 -0
- package/lib/vite/traceViewer/uiMode.F_k6a2aC.js +1488 -0
- package/lib/vite/traceViewer/{uiMode.9CwNsWc6.js → uiMode.Fb0bNA4H.js} +1 -1
- package/lib/vite/traceViewer/uiMode.NjZAwD_B.js +1485 -0
- package/lib/vite/traceViewer/uiMode.YQRCZjm8.js +1485 -0
- package/lib/vite/traceViewer/uiMode.b2068d00.js +1484 -0
- package/lib/vite/traceViewer/uiMode.e-PLonGl.js +1490 -0
- package/lib/vite/traceViewer/uiMode.fEEgOxJh.js +1490 -0
- package/lib/vite/traceViewer/uiMode.html +2 -2
- package/lib/vite/traceViewer/uiMode.kvEeWpo2.js +1490 -0
- package/lib/vite/traceViewer/uiMode.ljHA9Ynz.js +1490 -0
- package/lib/vite/traceViewer/uiMode.ybQP_6Xr.js +10 -0
- package/lib/vite/traceViewer/wsPort.997c92cf.css +3513 -0
- package/lib/vite/traceViewer/wsPort.9c9a6767.css +1 -0
- package/lib/vite/traceViewer/wsPort.Oa05jfrO.css +3513 -0
- package/lib/vite/traceViewer/xtermModule.125f4259.css +191 -0
- package/lib/vite/traceViewer/xtermModule.6428296b.css +32 -0
- package/package.json +1 -1
- package/lib/vite/traceViewer/assets/wsPort-f2dAQL4I.js +0 -69
- package/lib/vite/traceViewer/index.qOFdH9Ja.js +0 -2
- package/lib/vite/traceViewer/uiMode.iNIhieBM.js +0 -10
|
@@ -0,0 +1,1484 @@
|
|
|
1
|
+
import { u as useMeasure, r as reactExports, e as currentTheme, _ as __vitePreload, f as addThemeListener, g as removeThemeListener, a as jsx, j as jsxs, R as React, h as useSetting, c as connect, s as settings, S as SplitView, i as Toolbar, T as ToolbarButton, t as toggleTheme, m as msToString, k as testStatusIcon, l as idForAction, W as Workbench, M as MultiTraceModel, n as TreeView, b as applyTheme, d as reactDomExports } from "./assets/wsPort-a88a6a12.js";
|
|
2
|
+
class StringInternPool {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._stringCache = /* @__PURE__ */ new Map();
|
|
5
|
+
}
|
|
6
|
+
internString(s) {
|
|
7
|
+
let result = this._stringCache.get(s);
|
|
8
|
+
if (!result) {
|
|
9
|
+
this._stringCache.set(s, s);
|
|
10
|
+
result = s;
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class TeleReporterReceiver {
|
|
16
|
+
constructor(pathSeparator2, reporter, reuseTestCases, reportConfig) {
|
|
17
|
+
this._tests = /* @__PURE__ */ new Map();
|
|
18
|
+
this._listOnly = false;
|
|
19
|
+
this._clearPreviousResultsWhenTestBegins = false;
|
|
20
|
+
this._stringPool = new StringInternPool();
|
|
21
|
+
this._rootSuite = new TeleSuite("", "root");
|
|
22
|
+
this._pathSeparator = pathSeparator2;
|
|
23
|
+
this._reporter = reporter;
|
|
24
|
+
this._reuseTestCases = reuseTestCases;
|
|
25
|
+
this._reportConfig = reportConfig;
|
|
26
|
+
}
|
|
27
|
+
dispatch(message) {
|
|
28
|
+
const { method, params } = message;
|
|
29
|
+
if (method === "onConfigure") {
|
|
30
|
+
this._onConfigure(params.config);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (method === "onProject") {
|
|
34
|
+
this._onProject(params.project);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (method === "onBegin") {
|
|
38
|
+
this._onBegin();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (method === "onTestBegin") {
|
|
42
|
+
this._onTestBegin(params.testId, params.result);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (method === "onTestEnd") {
|
|
46
|
+
this._onTestEnd(params.test, params.result);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (method === "onStepBegin") {
|
|
50
|
+
this._onStepBegin(params.testId, params.resultId, params.step);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (method === "onStepEnd") {
|
|
54
|
+
this._onStepEnd(params.testId, params.resultId, params.step);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (method === "onError") {
|
|
58
|
+
this._onError(params.error);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (method === "onStdIO") {
|
|
62
|
+
this._onStdIO(params.type, params.testId, params.resultId, params.data, params.isBase64);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (method === "onEnd")
|
|
66
|
+
return this._onEnd(params.result);
|
|
67
|
+
if (method === "onExit")
|
|
68
|
+
return this._onExit();
|
|
69
|
+
}
|
|
70
|
+
_setClearPreviousResultsWhenTestBegins() {
|
|
71
|
+
this._clearPreviousResultsWhenTestBegins = true;
|
|
72
|
+
}
|
|
73
|
+
_onConfigure(config) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
this._rootDir = config.rootDir;
|
|
76
|
+
this._listOnly = config.listOnly;
|
|
77
|
+
this._config = this._parseConfig(config);
|
|
78
|
+
(_b = (_a = this._reporter).onConfigure) == null ? void 0 : _b.call(_a, this._config);
|
|
79
|
+
}
|
|
80
|
+
_onProject(project) {
|
|
81
|
+
let projectSuite = this._rootSuite.suites.find((suite) => suite.project().__projectId === project.id);
|
|
82
|
+
if (!projectSuite) {
|
|
83
|
+
projectSuite = new TeleSuite(project.name, "project");
|
|
84
|
+
this._rootSuite.suites.push(projectSuite);
|
|
85
|
+
projectSuite.parent = this._rootSuite;
|
|
86
|
+
}
|
|
87
|
+
const p = this._parseProject(project);
|
|
88
|
+
projectSuite.project = () => p;
|
|
89
|
+
this._mergeSuitesInto(project.suites, projectSuite);
|
|
90
|
+
if (this._listOnly) {
|
|
91
|
+
const testIds = /* @__PURE__ */ new Set();
|
|
92
|
+
const collectIds = (suite) => {
|
|
93
|
+
suite.tests.map((t) => t.testId).forEach((testId) => testIds.add(testId));
|
|
94
|
+
suite.suites.forEach(collectIds);
|
|
95
|
+
};
|
|
96
|
+
project.suites.forEach(collectIds);
|
|
97
|
+
const filterTests = (suite) => {
|
|
98
|
+
suite.tests = suite.tests.filter((t) => testIds.has(t.id));
|
|
99
|
+
suite.suites.forEach(filterTests);
|
|
100
|
+
};
|
|
101
|
+
filterTests(projectSuite);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
_onBegin() {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
(_b = (_a = this._reporter).onBegin) == null ? void 0 : _b.call(_a, this._rootSuite);
|
|
107
|
+
}
|
|
108
|
+
_onTestBegin(testId, payload) {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
const test = this._tests.get(testId);
|
|
111
|
+
if (this._clearPreviousResultsWhenTestBegins)
|
|
112
|
+
test._clearResults();
|
|
113
|
+
const testResult = test._createTestResult(payload.id);
|
|
114
|
+
testResult.retry = payload.retry;
|
|
115
|
+
testResult.workerIndex = payload.workerIndex;
|
|
116
|
+
testResult.parallelIndex = payload.parallelIndex;
|
|
117
|
+
testResult.setStartTimeNumber(payload.startTime);
|
|
118
|
+
testResult.statusEx = "running";
|
|
119
|
+
(_b = (_a = this._reporter).onTestBegin) == null ? void 0 : _b.call(_a, test, testResult);
|
|
120
|
+
}
|
|
121
|
+
_onTestEnd(testEndPayload, payload) {
|
|
122
|
+
var _a, _b, _c;
|
|
123
|
+
const test = this._tests.get(testEndPayload.testId);
|
|
124
|
+
test.timeout = testEndPayload.timeout;
|
|
125
|
+
test.expectedStatus = testEndPayload.expectedStatus;
|
|
126
|
+
test.annotations = testEndPayload.annotations;
|
|
127
|
+
const result = test.resultsMap.get(payload.id);
|
|
128
|
+
result.duration = payload.duration;
|
|
129
|
+
result.status = payload.status;
|
|
130
|
+
result.statusEx = payload.status;
|
|
131
|
+
result.errors = payload.errors;
|
|
132
|
+
result.error = (_a = result.errors) == null ? void 0 : _a[0];
|
|
133
|
+
result.attachments = this._parseAttachments(payload.attachments);
|
|
134
|
+
(_c = (_b = this._reporter).onTestEnd) == null ? void 0 : _c.call(_b, test, result);
|
|
135
|
+
result.stepMap = /* @__PURE__ */ new Map();
|
|
136
|
+
}
|
|
137
|
+
_onStepBegin(testId, resultId, payload) {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
const test = this._tests.get(testId);
|
|
140
|
+
const result = test.resultsMap.get(resultId);
|
|
141
|
+
const parentStep = payload.parentStepId ? result.stepMap.get(payload.parentStepId) : void 0;
|
|
142
|
+
const location = this._absoluteLocation(payload.location);
|
|
143
|
+
const step = new TeleTestStep(payload, parentStep, location);
|
|
144
|
+
if (parentStep)
|
|
145
|
+
parentStep.steps.push(step);
|
|
146
|
+
else
|
|
147
|
+
result.steps.push(step);
|
|
148
|
+
result.stepMap.set(payload.id, step);
|
|
149
|
+
(_b = (_a = this._reporter).onStepBegin) == null ? void 0 : _b.call(_a, test, result, step);
|
|
150
|
+
}
|
|
151
|
+
_onStepEnd(testId, resultId, payload) {
|
|
152
|
+
var _a, _b;
|
|
153
|
+
const test = this._tests.get(testId);
|
|
154
|
+
const result = test.resultsMap.get(resultId);
|
|
155
|
+
const step = result.stepMap.get(payload.id);
|
|
156
|
+
step.duration = payload.duration;
|
|
157
|
+
step.error = payload.error;
|
|
158
|
+
(_b = (_a = this._reporter).onStepEnd) == null ? void 0 : _b.call(_a, test, result, step);
|
|
159
|
+
}
|
|
160
|
+
_onError(error) {
|
|
161
|
+
var _a, _b;
|
|
162
|
+
(_b = (_a = this._reporter).onError) == null ? void 0 : _b.call(_a, error);
|
|
163
|
+
}
|
|
164
|
+
_onStdIO(type, testId, resultId, data, isBase64) {
|
|
165
|
+
var _a, _b, _c, _d;
|
|
166
|
+
const chunk = isBase64 ? globalThis.Buffer ? Buffer.from(data, "base64") : atob(data) : data;
|
|
167
|
+
const test = testId ? this._tests.get(testId) : void 0;
|
|
168
|
+
const result = test && resultId ? test.resultsMap.get(resultId) : void 0;
|
|
169
|
+
if (type === "stdout") {
|
|
170
|
+
result == null ? void 0 : result.stdout.push(chunk);
|
|
171
|
+
(_b = (_a = this._reporter).onStdOut) == null ? void 0 : _b.call(_a, chunk, test, result);
|
|
172
|
+
} else {
|
|
173
|
+
result == null ? void 0 : result.stderr.push(chunk);
|
|
174
|
+
(_d = (_c = this._reporter).onStdErr) == null ? void 0 : _d.call(_c, chunk, test, result);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async _onEnd(result) {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
await ((_b = (_a = this._reporter).onEnd) == null ? void 0 : _b.call(_a, {
|
|
180
|
+
status: result.status,
|
|
181
|
+
startTime: new Date(result.startTime),
|
|
182
|
+
duration: result.duration
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
_onExit() {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
this._stringPool = new StringInternPool();
|
|
188
|
+
return (_b = (_a = this._reporter).onExit) == null ? void 0 : _b.call(_a);
|
|
189
|
+
}
|
|
190
|
+
_parseConfig(config) {
|
|
191
|
+
const result = { ...baseFullConfig, ...config };
|
|
192
|
+
if (this._reportConfig) {
|
|
193
|
+
result.configFile = this._reportConfig.configFile;
|
|
194
|
+
result.reportSlowTests = this._reportConfig.reportSlowTests;
|
|
195
|
+
result.quiet = this._reportConfig.quiet;
|
|
196
|
+
result.reporter = [...this._reportConfig.reporter];
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
_parseProject(project) {
|
|
201
|
+
return {
|
|
202
|
+
__projectId: project.id,
|
|
203
|
+
metadata: project.metadata,
|
|
204
|
+
name: project.name,
|
|
205
|
+
outputDir: this._absolutePath(project.outputDir),
|
|
206
|
+
repeatEach: project.repeatEach,
|
|
207
|
+
retries: project.retries,
|
|
208
|
+
testDir: this._absolutePath(project.testDir),
|
|
209
|
+
testIgnore: parseRegexPatterns(project.testIgnore),
|
|
210
|
+
testMatch: parseRegexPatterns(project.testMatch),
|
|
211
|
+
timeout: project.timeout,
|
|
212
|
+
grep: parseRegexPatterns(project.grep),
|
|
213
|
+
grepInvert: parseRegexPatterns(project.grepInvert),
|
|
214
|
+
dependencies: project.dependencies,
|
|
215
|
+
teardown: project.teardown,
|
|
216
|
+
snapshotDir: this._absolutePath(project.snapshotDir),
|
|
217
|
+
use: {}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
_parseAttachments(attachments) {
|
|
221
|
+
return attachments.map((a) => {
|
|
222
|
+
return {
|
|
223
|
+
...a,
|
|
224
|
+
body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, "base64") : void 0
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
_mergeSuitesInto(jsonSuites, parent) {
|
|
229
|
+
for (const jsonSuite of jsonSuites) {
|
|
230
|
+
let targetSuite = parent.suites.find((s) => s.title === jsonSuite.title);
|
|
231
|
+
if (!targetSuite) {
|
|
232
|
+
targetSuite = new TeleSuite(jsonSuite.title, jsonSuite.type);
|
|
233
|
+
targetSuite.parent = parent;
|
|
234
|
+
parent.suites.push(targetSuite);
|
|
235
|
+
}
|
|
236
|
+
targetSuite.location = this._absoluteLocation(jsonSuite.location);
|
|
237
|
+
targetSuite._fileId = jsonSuite.fileId;
|
|
238
|
+
targetSuite._parallelMode = jsonSuite.parallelMode;
|
|
239
|
+
this._mergeSuitesInto(jsonSuite.suites, targetSuite);
|
|
240
|
+
this._mergeTestsInto(jsonSuite.tests, targetSuite);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
_mergeTestsInto(jsonTests, parent) {
|
|
244
|
+
for (const jsonTest of jsonTests) {
|
|
245
|
+
let targetTest = this._reuseTestCases ? parent.tests.find((s) => s.title === jsonTest.title) : void 0;
|
|
246
|
+
if (!targetTest) {
|
|
247
|
+
targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location));
|
|
248
|
+
targetTest.parent = parent;
|
|
249
|
+
parent.tests.push(targetTest);
|
|
250
|
+
this._tests.set(targetTest.id, targetTest);
|
|
251
|
+
}
|
|
252
|
+
this._updateTest(jsonTest, targetTest);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
_updateTest(payload, test) {
|
|
256
|
+
test.id = payload.testId;
|
|
257
|
+
test.location = this._absoluteLocation(payload.location);
|
|
258
|
+
test.retries = payload.retries;
|
|
259
|
+
return test;
|
|
260
|
+
}
|
|
261
|
+
_absoluteLocation(location) {
|
|
262
|
+
if (!location)
|
|
263
|
+
return location;
|
|
264
|
+
return {
|
|
265
|
+
...location,
|
|
266
|
+
file: this._absolutePath(location.file)
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
_absolutePath(relativePath) {
|
|
270
|
+
if (!relativePath)
|
|
271
|
+
return relativePath;
|
|
272
|
+
return this._stringPool.internString(this._rootDir + this._pathSeparator + relativePath);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
class TeleSuite {
|
|
276
|
+
constructor(title, type) {
|
|
277
|
+
this._requireFile = "";
|
|
278
|
+
this.suites = [];
|
|
279
|
+
this.tests = [];
|
|
280
|
+
this._parallelMode = "none";
|
|
281
|
+
this.title = title;
|
|
282
|
+
this._type = type;
|
|
283
|
+
}
|
|
284
|
+
allTests() {
|
|
285
|
+
const result = [];
|
|
286
|
+
const visit = (suite) => {
|
|
287
|
+
for (const entry of [...suite.suites, ...suite.tests]) {
|
|
288
|
+
if (entry instanceof TeleSuite)
|
|
289
|
+
visit(entry);
|
|
290
|
+
else
|
|
291
|
+
result.push(entry);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
visit(this);
|
|
295
|
+
return result;
|
|
296
|
+
}
|
|
297
|
+
titlePath() {
|
|
298
|
+
const titlePath = this.parent ? this.parent.titlePath() : [];
|
|
299
|
+
if (this.title || this._type !== "describe")
|
|
300
|
+
titlePath.push(this.title);
|
|
301
|
+
return titlePath;
|
|
302
|
+
}
|
|
303
|
+
project() {
|
|
304
|
+
return void 0;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
class TeleTestCase {
|
|
308
|
+
constructor(id, title, location) {
|
|
309
|
+
this.fn = () => {
|
|
310
|
+
};
|
|
311
|
+
this.results = [];
|
|
312
|
+
this.expectedStatus = "passed";
|
|
313
|
+
this.timeout = 0;
|
|
314
|
+
this.annotations = [];
|
|
315
|
+
this.retries = 0;
|
|
316
|
+
this.repeatEachIndex = 0;
|
|
317
|
+
this.resultsMap = /* @__PURE__ */ new Map();
|
|
318
|
+
this.id = id;
|
|
319
|
+
this.title = title;
|
|
320
|
+
this.location = location;
|
|
321
|
+
}
|
|
322
|
+
titlePath() {
|
|
323
|
+
const titlePath = this.parent ? this.parent.titlePath() : [];
|
|
324
|
+
titlePath.push(this.title);
|
|
325
|
+
return titlePath;
|
|
326
|
+
}
|
|
327
|
+
outcome() {
|
|
328
|
+
var _a, _b;
|
|
329
|
+
const results = [...this.results];
|
|
330
|
+
while (((_a = results[0]) == null ? void 0 : _a.status) === "skipped" || ((_b = results[0]) == null ? void 0 : _b.status) === "interrupted")
|
|
331
|
+
results.shift();
|
|
332
|
+
if (!results.length)
|
|
333
|
+
return "skipped";
|
|
334
|
+
const failures = results.filter((result) => result.status !== "skipped" && result.status !== "interrupted" && result.status !== this.expectedStatus);
|
|
335
|
+
if (!failures.length)
|
|
336
|
+
return "expected";
|
|
337
|
+
if (failures.length === results.length)
|
|
338
|
+
return "unexpected";
|
|
339
|
+
return "flaky";
|
|
340
|
+
}
|
|
341
|
+
ok() {
|
|
342
|
+
const status = this.outcome();
|
|
343
|
+
return status === "expected" || status === "flaky" || status === "skipped";
|
|
344
|
+
}
|
|
345
|
+
_clearResults() {
|
|
346
|
+
this.results = [];
|
|
347
|
+
this.resultsMap.clear();
|
|
348
|
+
}
|
|
349
|
+
_createTestResult(id) {
|
|
350
|
+
const result = new TeleTestResult(this.results.length);
|
|
351
|
+
this.results.push(result);
|
|
352
|
+
this.resultsMap.set(id, result);
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
class TeleTestStep {
|
|
357
|
+
constructor(payload, parentStep, location) {
|
|
358
|
+
this.duration = -1;
|
|
359
|
+
this.steps = [];
|
|
360
|
+
this._startTime = 0;
|
|
361
|
+
this.title = payload.title;
|
|
362
|
+
this.category = payload.category;
|
|
363
|
+
this.location = location;
|
|
364
|
+
this.parent = parentStep;
|
|
365
|
+
this._startTime = payload.startTime;
|
|
366
|
+
}
|
|
367
|
+
titlePath() {
|
|
368
|
+
var _a;
|
|
369
|
+
const parentPath = ((_a = this.parent) == null ? void 0 : _a.titlePath()) || [];
|
|
370
|
+
return [...parentPath, this.title];
|
|
371
|
+
}
|
|
372
|
+
get startTime() {
|
|
373
|
+
return new Date(this._startTime);
|
|
374
|
+
}
|
|
375
|
+
set startTime(value) {
|
|
376
|
+
this._startTime = +value;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
class TeleTestResult {
|
|
380
|
+
constructor(retry) {
|
|
381
|
+
this.parallelIndex = -1;
|
|
382
|
+
this.workerIndex = -1;
|
|
383
|
+
this.duration = -1;
|
|
384
|
+
this.stdout = [];
|
|
385
|
+
this.stderr = [];
|
|
386
|
+
this.attachments = [];
|
|
387
|
+
this.status = "skipped";
|
|
388
|
+
this.steps = [];
|
|
389
|
+
this.errors = [];
|
|
390
|
+
this.stepMap = /* @__PURE__ */ new Map();
|
|
391
|
+
this.statusEx = "scheduled";
|
|
392
|
+
this._startTime = 0;
|
|
393
|
+
this.retry = retry;
|
|
394
|
+
}
|
|
395
|
+
setStartTimeNumber(startTime) {
|
|
396
|
+
this._startTime = startTime;
|
|
397
|
+
}
|
|
398
|
+
get startTime() {
|
|
399
|
+
return new Date(this._startTime);
|
|
400
|
+
}
|
|
401
|
+
set startTime(value) {
|
|
402
|
+
this._startTime = +value;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const baseFullConfig = {
|
|
406
|
+
forbidOnly: false,
|
|
407
|
+
fullyParallel: false,
|
|
408
|
+
globalSetup: null,
|
|
409
|
+
globalTeardown: null,
|
|
410
|
+
globalTimeout: 0,
|
|
411
|
+
grep: /.*/,
|
|
412
|
+
grepInvert: null,
|
|
413
|
+
maxFailures: 0,
|
|
414
|
+
metadata: {},
|
|
415
|
+
preserveOutput: "always",
|
|
416
|
+
projects: [],
|
|
417
|
+
reporter: [[{}.CI ? "dot" : "list"]],
|
|
418
|
+
reportSlowTests: { max: 5, threshold: 15e3 },
|
|
419
|
+
configFile: "",
|
|
420
|
+
rootDir: "",
|
|
421
|
+
quiet: false,
|
|
422
|
+
shard: null,
|
|
423
|
+
updateSnapshots: "missing",
|
|
424
|
+
version: "",
|
|
425
|
+
workers: 0,
|
|
426
|
+
webServer: null
|
|
427
|
+
};
|
|
428
|
+
function parseRegexPatterns(patterns) {
|
|
429
|
+
return patterns.map((p) => {
|
|
430
|
+
if (p.s)
|
|
431
|
+
return p.s;
|
|
432
|
+
return new RegExp(p.r.source, p.r.flags);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
const uiModeView = "";
|
|
436
|
+
const xtermWrapper = "";
|
|
437
|
+
const XtermWrapper = ({
|
|
438
|
+
source
|
|
439
|
+
}) => {
|
|
440
|
+
const [measure, xtermElement] = useMeasure();
|
|
441
|
+
const [theme, setTheme] = reactExports.useState(currentTheme());
|
|
442
|
+
const [modulePromise] = reactExports.useState(__vitePreload(() => import("./assets/xtermModule-60687b6b.js"), true ? ["./assets/xtermModule-60687b6b.js","./xtermModule.125f4259.css"] : void 0, import.meta.url).then((m) => m.default));
|
|
443
|
+
const terminal = reactExports.useRef(null);
|
|
444
|
+
reactExports.useEffect(() => {
|
|
445
|
+
addThemeListener(setTheme);
|
|
446
|
+
return () => removeThemeListener(setTheme);
|
|
447
|
+
}, []);
|
|
448
|
+
reactExports.useEffect(() => {
|
|
449
|
+
const oldSourceWrite = source.write;
|
|
450
|
+
const oldSourceClear = source.clear;
|
|
451
|
+
(async () => {
|
|
452
|
+
const { Terminal, FitAddon } = await modulePromise;
|
|
453
|
+
const element = xtermElement.current;
|
|
454
|
+
if (!element)
|
|
455
|
+
return;
|
|
456
|
+
const terminalTheme = theme === "dark-mode" ? darkTheme : lightTheme;
|
|
457
|
+
if (terminal.current && terminal.current.terminal.options.theme === terminalTheme)
|
|
458
|
+
return;
|
|
459
|
+
if (terminal.current)
|
|
460
|
+
element.textContent = "";
|
|
461
|
+
const newTerminal = new Terminal({
|
|
462
|
+
convertEol: true,
|
|
463
|
+
fontSize: 13,
|
|
464
|
+
scrollback: 1e4,
|
|
465
|
+
fontFamily: "var(--vscode-editor-font-family)",
|
|
466
|
+
theme: terminalTheme
|
|
467
|
+
});
|
|
468
|
+
const fitAddon = new FitAddon();
|
|
469
|
+
newTerminal.loadAddon(fitAddon);
|
|
470
|
+
for (const p of source.pending)
|
|
471
|
+
newTerminal.write(p);
|
|
472
|
+
source.write = (data) => {
|
|
473
|
+
source.pending.push(data);
|
|
474
|
+
newTerminal.write(data);
|
|
475
|
+
};
|
|
476
|
+
source.clear = () => {
|
|
477
|
+
source.pending = [];
|
|
478
|
+
newTerminal.clear();
|
|
479
|
+
};
|
|
480
|
+
newTerminal.open(element);
|
|
481
|
+
fitAddon.fit();
|
|
482
|
+
terminal.current = { terminal: newTerminal, fitAddon };
|
|
483
|
+
})();
|
|
484
|
+
return () => {
|
|
485
|
+
source.clear = oldSourceClear;
|
|
486
|
+
source.write = oldSourceWrite;
|
|
487
|
+
};
|
|
488
|
+
}, [modulePromise, terminal, xtermElement, source, theme]);
|
|
489
|
+
reactExports.useEffect(() => {
|
|
490
|
+
setTimeout(() => {
|
|
491
|
+
if (!terminal.current)
|
|
492
|
+
return;
|
|
493
|
+
terminal.current.fitAddon.fit();
|
|
494
|
+
source.resize(terminal.current.terminal.cols, terminal.current.terminal.rows);
|
|
495
|
+
}, 250);
|
|
496
|
+
}, [measure, source]);
|
|
497
|
+
return /* @__PURE__ */ jsx("div", { "data-testid": "output", className: "xterm-wrapper", style: { flex: "auto" }, ref: xtermElement });
|
|
498
|
+
};
|
|
499
|
+
const lightTheme = {
|
|
500
|
+
foreground: "#383a42",
|
|
501
|
+
background: "#fafafa",
|
|
502
|
+
cursor: "#383a42",
|
|
503
|
+
black: "#000000",
|
|
504
|
+
red: "#e45649",
|
|
505
|
+
green: "#50a14f",
|
|
506
|
+
yellow: "#c18401",
|
|
507
|
+
blue: "#4078f2",
|
|
508
|
+
magenta: "#a626a4",
|
|
509
|
+
cyan: "#0184bc",
|
|
510
|
+
white: "#a0a0a0",
|
|
511
|
+
brightBlack: "#000000",
|
|
512
|
+
brightRed: "#e06c75",
|
|
513
|
+
brightGreen: "#98c379",
|
|
514
|
+
brightYellow: "#d19a66",
|
|
515
|
+
brightBlue: "#4078f2",
|
|
516
|
+
brightMagenta: "#a626a4",
|
|
517
|
+
brightCyan: "#0184bc",
|
|
518
|
+
brightWhite: "#383a42",
|
|
519
|
+
selectionBackground: "#d7d7d7",
|
|
520
|
+
selectionForeground: "#383a42"
|
|
521
|
+
};
|
|
522
|
+
const darkTheme = {
|
|
523
|
+
foreground: "#f8f8f2",
|
|
524
|
+
background: "#1e1e1e",
|
|
525
|
+
cursor: "#f8f8f0",
|
|
526
|
+
black: "#000000",
|
|
527
|
+
red: "#ff5555",
|
|
528
|
+
green: "#50fa7b",
|
|
529
|
+
yellow: "#f1fa8c",
|
|
530
|
+
blue: "#bd93f9",
|
|
531
|
+
magenta: "#ff79c6",
|
|
532
|
+
cyan: "#8be9fd",
|
|
533
|
+
white: "#bfbfbf",
|
|
534
|
+
brightBlack: "#4d4d4d",
|
|
535
|
+
brightRed: "#ff6e6e",
|
|
536
|
+
brightGreen: "#69ff94",
|
|
537
|
+
brightYellow: "#ffffa5",
|
|
538
|
+
brightBlue: "#d6acff",
|
|
539
|
+
brightMagenta: "#ff92df",
|
|
540
|
+
brightCyan: "#a4ffff",
|
|
541
|
+
brightWhite: "#e6e6e6",
|
|
542
|
+
selectionBackground: "#44475a",
|
|
543
|
+
selectionForeground: "#f8f8f2"
|
|
544
|
+
};
|
|
545
|
+
const expandable = "";
|
|
546
|
+
const Expandable = ({ title, children, setExpanded, expanded, expandOnTitleClick }) => {
|
|
547
|
+
return /* @__PURE__ */ jsxs("div", { className: "expandable" + (expanded ? " expanded" : ""), children: [
|
|
548
|
+
/* @__PURE__ */ jsxs("div", { className: "expandable-title", onClick: () => expandOnTitleClick && setExpanded(!expanded), children: [
|
|
549
|
+
/* @__PURE__ */ jsx(
|
|
550
|
+
"div",
|
|
551
|
+
{
|
|
552
|
+
className: "codicon codicon-" + (expanded ? "chevron-down" : "chevron-right"),
|
|
553
|
+
style: { cursor: "pointer", color: "var(--vscode-foreground)", marginLeft: "5px" },
|
|
554
|
+
onClick: () => !expandOnTitleClick && setExpanded(!expanded)
|
|
555
|
+
}
|
|
556
|
+
),
|
|
557
|
+
title
|
|
558
|
+
] }),
|
|
559
|
+
expanded && /* @__PURE__ */ jsx("div", { style: { marginLeft: 25 }, children })
|
|
560
|
+
] });
|
|
561
|
+
};
|
|
562
|
+
function artifactsFolderName(workerIndex) {
|
|
563
|
+
return `.playwright-artifacts-${workerIndex}`;
|
|
564
|
+
}
|
|
565
|
+
let updateRootSuite = () => {
|
|
566
|
+
};
|
|
567
|
+
let runWatchedTests = (fileNames) => {
|
|
568
|
+
};
|
|
569
|
+
let xtermSize = { cols: 80, rows: 24 };
|
|
570
|
+
let sendMessage = async () => {
|
|
571
|
+
};
|
|
572
|
+
const xtermDataSource = {
|
|
573
|
+
pending: [],
|
|
574
|
+
clear: () => {
|
|
575
|
+
},
|
|
576
|
+
write: (data) => xtermDataSource.pending.push(data),
|
|
577
|
+
resize: (cols, rows) => {
|
|
578
|
+
xtermSize = { cols, rows };
|
|
579
|
+
sendMessageNoReply("resizeTerminal", { cols, rows });
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
const UIModeView = ({}) => {
|
|
583
|
+
var _a;
|
|
584
|
+
const [filterText, setFilterText] = React.useState("");
|
|
585
|
+
const [isShowingOutput, setIsShowingOutput] = React.useState(false);
|
|
586
|
+
const [statusFilters, setStatusFilters] = React.useState(/* @__PURE__ */ new Map([
|
|
587
|
+
["passed", false],
|
|
588
|
+
["failed", false],
|
|
589
|
+
["skipped", false]
|
|
590
|
+
]));
|
|
591
|
+
const [projectFilters, setProjectFilters] = React.useState(/* @__PURE__ */ new Map());
|
|
592
|
+
const [testModel, setTestModel] = React.useState({ config: void 0, rootSuite: void 0, loadErrors: [] });
|
|
593
|
+
const [progress, setProgress] = React.useState();
|
|
594
|
+
const [selectedItem, setSelectedItem] = React.useState({});
|
|
595
|
+
const [visibleTestIds, setVisibleTestIds] = React.useState(/* @__PURE__ */ new Set());
|
|
596
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
597
|
+
const [runningState, setRunningState] = React.useState();
|
|
598
|
+
const [watchAll, setWatchAll] = useSetting("watch-all", false);
|
|
599
|
+
const [watchedTreeIds, setWatchedTreeIds] = React.useState({ value: /* @__PURE__ */ new Set() });
|
|
600
|
+
const runTestPromiseChain = React.useRef(Promise.resolve());
|
|
601
|
+
const runTestBacklog = React.useRef(/* @__PURE__ */ new Set());
|
|
602
|
+
const [collapseAllCount, setCollapseAllCount] = React.useState(0);
|
|
603
|
+
const [isDisconnected, setIsDisconnected] = React.useState(false);
|
|
604
|
+
const [hasBrowsers, setHasBrowsers] = React.useState(true);
|
|
605
|
+
const inputRef = React.useRef(null);
|
|
606
|
+
const reloadTests = React.useCallback(() => {
|
|
607
|
+
setIsLoading(true);
|
|
608
|
+
setWatchedTreeIds({ value: /* @__PURE__ */ new Set() });
|
|
609
|
+
updateRootSuite(baseFullConfig, new TeleSuite("", "root"), [], void 0);
|
|
610
|
+
refreshRootSuite(true).then(async () => {
|
|
611
|
+
setIsLoading(false);
|
|
612
|
+
const { hasBrowsers: hasBrowsers2 } = await sendMessage("checkBrowsers");
|
|
613
|
+
setHasBrowsers(hasBrowsers2);
|
|
614
|
+
});
|
|
615
|
+
}, []);
|
|
616
|
+
React.useEffect(() => {
|
|
617
|
+
var _a2;
|
|
618
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
619
|
+
setIsLoading(true);
|
|
620
|
+
connect({ onEvent: dispatchEvent, onClose: () => setIsDisconnected(true) }).then((send) => {
|
|
621
|
+
sendMessage = async (method, params) => {
|
|
622
|
+
const logForTest = window.__logForTest;
|
|
623
|
+
logForTest == null ? void 0 : logForTest({ method, params });
|
|
624
|
+
await send(method, params);
|
|
625
|
+
};
|
|
626
|
+
reloadTests();
|
|
627
|
+
});
|
|
628
|
+
}, [reloadTests]);
|
|
629
|
+
updateRootSuite = React.useCallback((config, rootSuite, loadErrors, newProgress) => {
|
|
630
|
+
const selectedProjects = config.configFile ? settings.getObject(config.configFile + ":projects", void 0) : void 0;
|
|
631
|
+
for (const projectName of projectFilters.keys()) {
|
|
632
|
+
if (!rootSuite.suites.find((s) => s.title === projectName))
|
|
633
|
+
projectFilters.delete(projectName);
|
|
634
|
+
}
|
|
635
|
+
for (const projectSuite of rootSuite.suites) {
|
|
636
|
+
if (!projectFilters.has(projectSuite.title))
|
|
637
|
+
projectFilters.set(projectSuite.title, !!(selectedProjects == null ? void 0 : selectedProjects.includes(projectSuite.title)));
|
|
638
|
+
}
|
|
639
|
+
if (!selectedProjects && projectFilters.size && ![...projectFilters.values()].includes(true))
|
|
640
|
+
projectFilters.set(projectFilters.entries().next().value[0], true);
|
|
641
|
+
setTestModel({ config, rootSuite, loadErrors });
|
|
642
|
+
setProjectFilters(new Map(projectFilters));
|
|
643
|
+
if (runningState && newProgress)
|
|
644
|
+
setProgress(newProgress);
|
|
645
|
+
else if (!newProgress)
|
|
646
|
+
setProgress(void 0);
|
|
647
|
+
}, [projectFilters, runningState]);
|
|
648
|
+
const runTests = React.useCallback((mode, testIds) => {
|
|
649
|
+
if (mode === "bounce-if-busy" && runningState)
|
|
650
|
+
return;
|
|
651
|
+
runTestBacklog.current = /* @__PURE__ */ new Set([...runTestBacklog.current, ...testIds]);
|
|
652
|
+
runTestPromiseChain.current = runTestPromiseChain.current.then(async () => {
|
|
653
|
+
var _a2, _b, _c;
|
|
654
|
+
const testIds2 = runTestBacklog.current;
|
|
655
|
+
runTestBacklog.current = /* @__PURE__ */ new Set();
|
|
656
|
+
if (!testIds2.size)
|
|
657
|
+
return;
|
|
658
|
+
{
|
|
659
|
+
for (const test of ((_a2 = testModel.rootSuite) == null ? void 0 : _a2.allTests()) || []) {
|
|
660
|
+
if (testIds2.has(test.id)) {
|
|
661
|
+
test._clearResults();
|
|
662
|
+
test._createTestResult("pending");
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
setTestModel({ ...testModel });
|
|
666
|
+
}
|
|
667
|
+
const time = " [" + (/* @__PURE__ */ new Date()).toLocaleTimeString() + "]";
|
|
668
|
+
xtermDataSource.write("\x1B[2m—".repeat(Math.max(0, xtermSize.cols - time.length)) + time + "\x1B[22m");
|
|
669
|
+
setProgress({ total: 0, passed: 0, failed: 0, skipped: 0 });
|
|
670
|
+
setRunningState({ testIds: testIds2 });
|
|
671
|
+
await sendMessage("run", { testIds: [...testIds2], projects: [...projectFilters].filter(([_, v]) => v).map(([p]) => p) });
|
|
672
|
+
for (const test of ((_b = testModel.rootSuite) == null ? void 0 : _b.allTests()) || []) {
|
|
673
|
+
if (((_c = test.results[0]) == null ? void 0 : _c.duration) === -1)
|
|
674
|
+
test._clearResults();
|
|
675
|
+
}
|
|
676
|
+
setTestModel({ ...testModel });
|
|
677
|
+
setRunningState(void 0);
|
|
678
|
+
});
|
|
679
|
+
}, [projectFilters, runningState, testModel]);
|
|
680
|
+
const isRunningTest = !!runningState;
|
|
681
|
+
const dialogRef = React.useRef(null);
|
|
682
|
+
const openInstallDialog = React.useCallback((e) => {
|
|
683
|
+
var _a2;
|
|
684
|
+
e.preventDefault();
|
|
685
|
+
e.stopPropagation();
|
|
686
|
+
(_a2 = dialogRef.current) == null ? void 0 : _a2.showModal();
|
|
687
|
+
}, []);
|
|
688
|
+
const closeInstallDialog = React.useCallback((e) => {
|
|
689
|
+
var _a2;
|
|
690
|
+
e.preventDefault();
|
|
691
|
+
e.stopPropagation();
|
|
692
|
+
(_a2 = dialogRef.current) == null ? void 0 : _a2.close();
|
|
693
|
+
}, []);
|
|
694
|
+
const installBrowsers = React.useCallback((e) => {
|
|
695
|
+
closeInstallDialog(e);
|
|
696
|
+
setIsShowingOutput(true);
|
|
697
|
+
sendMessage("installBrowsers").then(async () => {
|
|
698
|
+
setIsShowingOutput(false);
|
|
699
|
+
const { hasBrowsers: hasBrowsers2 } = await sendMessage("checkBrowsers");
|
|
700
|
+
setHasBrowsers(hasBrowsers2);
|
|
701
|
+
});
|
|
702
|
+
}, [closeInstallDialog]);
|
|
703
|
+
return /* @__PURE__ */ jsxs("div", { className: "vbox ui-mode", children: [
|
|
704
|
+
!hasBrowsers && /* @__PURE__ */ jsxs("dialog", { ref: dialogRef, children: [
|
|
705
|
+
/* @__PURE__ */ jsxs("div", { className: "title", children: [
|
|
706
|
+
/* @__PURE__ */ jsx("span", { className: "codicon codicon-lightbulb" }),
|
|
707
|
+
"Install browsers"
|
|
708
|
+
] }),
|
|
709
|
+
/* @__PURE__ */ jsxs("div", { className: "body", children: [
|
|
710
|
+
"Playwright did not find installed browsers.",
|
|
711
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
712
|
+
"Would you like to run `playwright install`?",
|
|
713
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
714
|
+
/* @__PURE__ */ jsx("button", { className: "button", onClick: installBrowsers, children: "Install" }),
|
|
715
|
+
/* @__PURE__ */ jsx("button", { className: "button secondary", onClick: closeInstallDialog, children: "Dismiss" })
|
|
716
|
+
] })
|
|
717
|
+
] }),
|
|
718
|
+
isDisconnected && /* @__PURE__ */ jsxs("div", { className: "disconnected", children: [
|
|
719
|
+
/* @__PURE__ */ jsx("div", { className: "title", children: "UI Mode disconnected" }),
|
|
720
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
721
|
+
/* @__PURE__ */ jsx("a", { href: "#", onClick: () => window.location.href = "/", children: "Reload the page" }),
|
|
722
|
+
" to reconnect"
|
|
723
|
+
] })
|
|
724
|
+
] }),
|
|
725
|
+
/* @__PURE__ */ jsxs(SplitView, { sidebarSize: 250, minSidebarSize: 150, orientation: "horizontal", sidebarIsFirst: true, settingName: "testListSidebar", children: [
|
|
726
|
+
/* @__PURE__ */ jsxs("div", { className: "vbox", children: [
|
|
727
|
+
/* @__PURE__ */ jsxs("div", { className: "vbox" + (isShowingOutput ? "" : " hidden"), children: [
|
|
728
|
+
/* @__PURE__ */ jsxs(Toolbar, { children: [
|
|
729
|
+
/* @__PURE__ */ jsx("div", { className: "section-title", style: { flex: "none" }, children: "Output" }),
|
|
730
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "circle-slash", title: "Clear output", onClick: () => xtermDataSource.clear() }),
|
|
731
|
+
/* @__PURE__ */ jsx("div", { className: "spacer" }),
|
|
732
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "close", title: "Close", onClick: () => setIsShowingOutput(false) })
|
|
733
|
+
] }),
|
|
734
|
+
/* @__PURE__ */ jsx(XtermWrapper, { source: xtermDataSource })
|
|
735
|
+
] }),
|
|
736
|
+
/* @__PURE__ */ jsx("div", { className: "vbox" + (isShowingOutput ? " hidden" : ""), children: /* @__PURE__ */ jsx(TraceView, { item: selectedItem, rootDir: (_a = testModel.config) == null ? void 0 : _a.rootDir }) })
|
|
737
|
+
] }),
|
|
738
|
+
/* @__PURE__ */ jsxs("div", { className: "vbox ui-mode-sidebar", children: [
|
|
739
|
+
/* @__PURE__ */ jsxs(Toolbar, { noShadow: true, noMinHeight: true, children: [
|
|
740
|
+
/* @__PURE__ */ jsx("img", { src: "playwright-logo.svg", alt: "Playwright logo" }),
|
|
741
|
+
/* @__PURE__ */ jsx("div", { className: "section-title", children: "Playwright" }),
|
|
742
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "color-mode", title: "Toggle color mode", onClick: () => toggleTheme() }),
|
|
743
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "refresh", title: "Reload", onClick: () => reloadTests(), disabled: isRunningTest || isLoading }),
|
|
744
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "terminal", title: "Toggle output", toggled: isShowingOutput, onClick: () => {
|
|
745
|
+
setIsShowingOutput(!isShowingOutput);
|
|
746
|
+
} }),
|
|
747
|
+
!hasBrowsers && /* @__PURE__ */ jsx(ToolbarButton, { icon: "lightbulb-autofix", style: { color: "var(--vscode-list-warningForeground)" }, title: "Playwright browsers are missing", onClick: openInstallDialog })
|
|
748
|
+
] }),
|
|
749
|
+
/* @__PURE__ */ jsx(
|
|
750
|
+
FiltersView,
|
|
751
|
+
{
|
|
752
|
+
filterText,
|
|
753
|
+
setFilterText,
|
|
754
|
+
statusFilters,
|
|
755
|
+
setStatusFilters,
|
|
756
|
+
projectFilters,
|
|
757
|
+
setProjectFilters,
|
|
758
|
+
testModel,
|
|
759
|
+
runTests: () => runTests("bounce-if-busy", visibleTestIds)
|
|
760
|
+
}
|
|
761
|
+
),
|
|
762
|
+
/* @__PURE__ */ jsxs(Toolbar, { noMinHeight: true, children: [
|
|
763
|
+
!isRunningTest && !progress && /* @__PURE__ */ jsx("div", { className: "section-title", children: "Tests" }),
|
|
764
|
+
!isRunningTest && progress && /* @__PURE__ */ jsx("div", { "data-testid": "status-line", className: "status-line", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
765
|
+
progress.passed,
|
|
766
|
+
"/",
|
|
767
|
+
progress.total,
|
|
768
|
+
" passed (",
|
|
769
|
+
progress.passed / progress.total * 100 | 0,
|
|
770
|
+
"%)"
|
|
771
|
+
] }) }),
|
|
772
|
+
isRunningTest && progress && /* @__PURE__ */ jsx("div", { "data-testid": "status-line", className: "status-line", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
773
|
+
"Running ",
|
|
774
|
+
progress.passed,
|
|
775
|
+
"/",
|
|
776
|
+
runningState.testIds.size,
|
|
777
|
+
" passed (",
|
|
778
|
+
progress.passed / runningState.testIds.size * 100 | 0,
|
|
779
|
+
"%)"
|
|
780
|
+
] }) }),
|
|
781
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "play", title: "Run all", onClick: () => runTests("bounce-if-busy", visibleTestIds), disabled: isRunningTest || isLoading }),
|
|
782
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "debug-stop", title: "Stop", onClick: () => sendMessageNoReply("stop"), disabled: !isRunningTest || isLoading }),
|
|
783
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "eye", title: "Watch all", toggled: watchAll, onClick: () => {
|
|
784
|
+
setWatchedTreeIds({ value: /* @__PURE__ */ new Set() });
|
|
785
|
+
setWatchAll(!watchAll);
|
|
786
|
+
} }),
|
|
787
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "collapse-all", title: "Collapse all", onClick: () => {
|
|
788
|
+
setCollapseAllCount(collapseAllCount + 1);
|
|
789
|
+
} })
|
|
790
|
+
] }),
|
|
791
|
+
/* @__PURE__ */ jsx(
|
|
792
|
+
TestList,
|
|
793
|
+
{
|
|
794
|
+
statusFilters,
|
|
795
|
+
projectFilters,
|
|
796
|
+
filterText,
|
|
797
|
+
testModel,
|
|
798
|
+
runningState,
|
|
799
|
+
runTests,
|
|
800
|
+
onItemSelected: setSelectedItem,
|
|
801
|
+
setVisibleTestIds,
|
|
802
|
+
watchAll,
|
|
803
|
+
watchedTreeIds,
|
|
804
|
+
setWatchedTreeIds,
|
|
805
|
+
isLoading,
|
|
806
|
+
requestedCollapseAllCount: collapseAllCount
|
|
807
|
+
}
|
|
808
|
+
)
|
|
809
|
+
] })
|
|
810
|
+
] })
|
|
811
|
+
] });
|
|
812
|
+
};
|
|
813
|
+
const FiltersView = ({ filterText, setFilterText, statusFilters, setStatusFilters, projectFilters, setProjectFilters, testModel, runTests }) => {
|
|
814
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
815
|
+
const inputRef = React.useRef(null);
|
|
816
|
+
React.useEffect(() => {
|
|
817
|
+
var _a;
|
|
818
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
819
|
+
}, []);
|
|
820
|
+
const statusLine = [...statusFilters.entries()].filter(([_, v]) => v).map(([s]) => s).join(" ") || "all";
|
|
821
|
+
const projectsLine = [...projectFilters.entries()].filter(([_, v]) => v).map(([p]) => p).join(" ") || "all";
|
|
822
|
+
return /* @__PURE__ */ jsxs("div", { className: "filters", children: [
|
|
823
|
+
/* @__PURE__ */ jsx(
|
|
824
|
+
Expandable,
|
|
825
|
+
{
|
|
826
|
+
expanded,
|
|
827
|
+
setExpanded,
|
|
828
|
+
title: /* @__PURE__ */ jsx(
|
|
829
|
+
"input",
|
|
830
|
+
{
|
|
831
|
+
ref: inputRef,
|
|
832
|
+
type: "search",
|
|
833
|
+
placeholder: "Filter (e.g. text, @tag)",
|
|
834
|
+
spellCheck: false,
|
|
835
|
+
value: filterText,
|
|
836
|
+
onChange: (e) => {
|
|
837
|
+
setFilterText(e.target.value);
|
|
838
|
+
},
|
|
839
|
+
onKeyDown: (e) => {
|
|
840
|
+
if (e.key === "Enter")
|
|
841
|
+
runTests();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
)
|
|
845
|
+
}
|
|
846
|
+
),
|
|
847
|
+
/* @__PURE__ */ jsxs("div", { className: "filter-summary", title: "Status: " + statusLine + "\nProjects: " + projectsLine, onClick: () => setExpanded(!expanded), children: [
|
|
848
|
+
/* @__PURE__ */ jsx("span", { className: "filter-label", children: "Status:" }),
|
|
849
|
+
" ",
|
|
850
|
+
statusLine,
|
|
851
|
+
/* @__PURE__ */ jsx("span", { className: "filter-label", children: "Projects:" }),
|
|
852
|
+
" ",
|
|
853
|
+
projectsLine
|
|
854
|
+
] }),
|
|
855
|
+
expanded && /* @__PURE__ */ jsxs("div", { className: "hbox", style: { marginLeft: 14, maxHeight: 200, overflowY: "auto" }, children: [
|
|
856
|
+
/* @__PURE__ */ jsx("div", { className: "filter-list", children: [...statusFilters.entries()].map(([status, value]) => {
|
|
857
|
+
return /* @__PURE__ */ jsx("div", { className: "filter-entry", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
858
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: value, onClick: () => {
|
|
859
|
+
const copy = new Map(statusFilters);
|
|
860
|
+
copy.set(status, !copy.get(status));
|
|
861
|
+
setStatusFilters(copy);
|
|
862
|
+
} }),
|
|
863
|
+
/* @__PURE__ */ jsx("div", { children: status })
|
|
864
|
+
] }) });
|
|
865
|
+
}) }),
|
|
866
|
+
/* @__PURE__ */ jsx("div", { className: "filter-list", children: [...projectFilters.entries()].map(([projectName, value]) => {
|
|
867
|
+
return /* @__PURE__ */ jsx("div", { className: "filter-entry", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
868
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: value, onClick: () => {
|
|
869
|
+
var _a;
|
|
870
|
+
const copy = new Map(projectFilters);
|
|
871
|
+
copy.set(projectName, !copy.get(projectName));
|
|
872
|
+
setProjectFilters(copy);
|
|
873
|
+
const configFile = (_a = testModel == null ? void 0 : testModel.config) == null ? void 0 : _a.configFile;
|
|
874
|
+
if (configFile)
|
|
875
|
+
settings.setObject(configFile + ":projects", [...copy.entries()].filter(([_, v]) => v).map(([k]) => k));
|
|
876
|
+
} }),
|
|
877
|
+
/* @__PURE__ */ jsx("div", { children: projectName || "untitled" })
|
|
878
|
+
] }) });
|
|
879
|
+
}) })
|
|
880
|
+
] })
|
|
881
|
+
] });
|
|
882
|
+
};
|
|
883
|
+
const TestTreeView = TreeView;
|
|
884
|
+
const TestList = ({ statusFilters, projectFilters, filterText, testModel, runTests, runningState, watchAll, watchedTreeIds, setWatchedTreeIds, isLoading, onItemSelected, setVisibleTestIds, requestedCollapseAllCount }) => {
|
|
885
|
+
const [treeState, setTreeState] = React.useState({ expandedItems: /* @__PURE__ */ new Map() });
|
|
886
|
+
const [selectedTreeItemId, setSelectedTreeItemId] = React.useState();
|
|
887
|
+
const [collapseAllCount, setCollapseAllCount] = React.useState(requestedCollapseAllCount);
|
|
888
|
+
const { rootItem, treeItemMap, fileNames } = React.useMemo(() => {
|
|
889
|
+
let rootItem2 = createTree(testModel.rootSuite, testModel.loadErrors, projectFilters);
|
|
890
|
+
filterTree(rootItem2, filterText, statusFilters, runningState == null ? void 0 : runningState.testIds);
|
|
891
|
+
sortAndPropagateStatus(rootItem2);
|
|
892
|
+
rootItem2 = shortenRoot(rootItem2);
|
|
893
|
+
hideOnlyTests(rootItem2);
|
|
894
|
+
const treeItemMap2 = /* @__PURE__ */ new Map();
|
|
895
|
+
const visibleTestIds = /* @__PURE__ */ new Set();
|
|
896
|
+
const fileNames2 = /* @__PURE__ */ new Set();
|
|
897
|
+
const visit = (treeItem) => {
|
|
898
|
+
if (treeItem.kind === "group" && treeItem.location.file)
|
|
899
|
+
fileNames2.add(treeItem.location.file);
|
|
900
|
+
if (treeItem.kind === "case")
|
|
901
|
+
treeItem.tests.forEach((t) => visibleTestIds.add(t.id));
|
|
902
|
+
treeItem.children.forEach(visit);
|
|
903
|
+
treeItemMap2.set(treeItem.id, treeItem);
|
|
904
|
+
};
|
|
905
|
+
visit(rootItem2);
|
|
906
|
+
setVisibleTestIds(visibleTestIds);
|
|
907
|
+
return { rootItem: rootItem2, treeItemMap: treeItemMap2, fileNames: fileNames2 };
|
|
908
|
+
}, [filterText, testModel, statusFilters, projectFilters, setVisibleTestIds, runningState]);
|
|
909
|
+
React.useEffect(() => {
|
|
910
|
+
if (collapseAllCount !== requestedCollapseAllCount) {
|
|
911
|
+
treeState.expandedItems.clear();
|
|
912
|
+
for (const item of treeItemMap.keys())
|
|
913
|
+
treeState.expandedItems.set(item, false);
|
|
914
|
+
setCollapseAllCount(requestedCollapseAllCount);
|
|
915
|
+
setSelectedTreeItemId(void 0);
|
|
916
|
+
setTreeState({ ...treeState });
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
if (!runningState || runningState.itemSelectedByUser)
|
|
920
|
+
return;
|
|
921
|
+
let selectedTreeItem2;
|
|
922
|
+
const visit = (treeItem) => {
|
|
923
|
+
var _a;
|
|
924
|
+
treeItem.children.forEach(visit);
|
|
925
|
+
if (selectedTreeItem2)
|
|
926
|
+
return;
|
|
927
|
+
if (treeItem.status === "failed") {
|
|
928
|
+
if (treeItem.kind === "test" && runningState.testIds.has(treeItem.test.id))
|
|
929
|
+
selectedTreeItem2 = treeItem;
|
|
930
|
+
else if (treeItem.kind === "case" && runningState.testIds.has((_a = treeItem.tests[0]) == null ? void 0 : _a.id))
|
|
931
|
+
selectedTreeItem2 = treeItem;
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
visit(rootItem);
|
|
935
|
+
if (selectedTreeItem2)
|
|
936
|
+
setSelectedTreeItemId(selectedTreeItem2.id);
|
|
937
|
+
}, [runningState, setSelectedTreeItemId, rootItem, collapseAllCount, setCollapseAllCount, requestedCollapseAllCount, treeState, setTreeState, treeItemMap]);
|
|
938
|
+
const { selectedTreeItem } = React.useMemo(() => {
|
|
939
|
+
const selectedTreeItem2 = selectedTreeItemId ? treeItemMap.get(selectedTreeItemId) : void 0;
|
|
940
|
+
let testFile;
|
|
941
|
+
if (selectedTreeItem2) {
|
|
942
|
+
testFile = {
|
|
943
|
+
file: selectedTreeItem2.location.file,
|
|
944
|
+
line: selectedTreeItem2.location.line,
|
|
945
|
+
source: {
|
|
946
|
+
errors: testModel.loadErrors.filter((e) => {
|
|
947
|
+
var _a;
|
|
948
|
+
return ((_a = e.location) == null ? void 0 : _a.file) === selectedTreeItem2.location.file;
|
|
949
|
+
}).map((e) => ({ line: e.location.line, message: e.message })),
|
|
950
|
+
content: void 0
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
let selectedTest;
|
|
955
|
+
if ((selectedTreeItem2 == null ? void 0 : selectedTreeItem2.kind) === "test")
|
|
956
|
+
selectedTest = selectedTreeItem2.test;
|
|
957
|
+
else if ((selectedTreeItem2 == null ? void 0 : selectedTreeItem2.kind) === "case" && selectedTreeItem2.tests.length === 1)
|
|
958
|
+
selectedTest = selectedTreeItem2.tests[0];
|
|
959
|
+
onItemSelected({ treeItem: selectedTreeItem2, testCase: selectedTest, testFile });
|
|
960
|
+
return { selectedTreeItem: selectedTreeItem2 };
|
|
961
|
+
}, [onItemSelected, selectedTreeItemId, testModel, treeItemMap]);
|
|
962
|
+
React.useEffect(() => {
|
|
963
|
+
if (isLoading)
|
|
964
|
+
return;
|
|
965
|
+
if (watchAll) {
|
|
966
|
+
sendMessageNoReply("watch", { fileNames: [...fileNames] });
|
|
967
|
+
} else {
|
|
968
|
+
const fileNames2 = /* @__PURE__ */ new Set();
|
|
969
|
+
for (const itemId of watchedTreeIds.value) {
|
|
970
|
+
const treeItem = treeItemMap.get(itemId);
|
|
971
|
+
const fileName = treeItem == null ? void 0 : treeItem.location.file;
|
|
972
|
+
if (fileName)
|
|
973
|
+
fileNames2.add(fileName);
|
|
974
|
+
}
|
|
975
|
+
sendMessageNoReply("watch", { fileNames: [...fileNames2] });
|
|
976
|
+
}
|
|
977
|
+
}, [isLoading, rootItem, fileNames, watchAll, watchedTreeIds, treeItemMap]);
|
|
978
|
+
const runTreeItem = (treeItem) => {
|
|
979
|
+
setSelectedTreeItemId(treeItem.id);
|
|
980
|
+
runTests("bounce-if-busy", collectTestIds(treeItem));
|
|
981
|
+
};
|
|
982
|
+
runWatchedTests = (changedTestFiles) => {
|
|
983
|
+
const testIds = [];
|
|
984
|
+
const set = new Set(changedTestFiles);
|
|
985
|
+
if (watchAll) {
|
|
986
|
+
const visit = (treeItem) => {
|
|
987
|
+
const fileName = treeItem.location.file;
|
|
988
|
+
if (fileName && set.has(fileName))
|
|
989
|
+
testIds.push(...collectTestIds(treeItem));
|
|
990
|
+
if (treeItem.kind === "group" && treeItem.subKind === "folder")
|
|
991
|
+
treeItem.children.forEach(visit);
|
|
992
|
+
};
|
|
993
|
+
visit(rootItem);
|
|
994
|
+
} else {
|
|
995
|
+
for (const treeId of watchedTreeIds.value) {
|
|
996
|
+
const treeItem = treeItemMap.get(treeId);
|
|
997
|
+
const fileName = treeItem == null ? void 0 : treeItem.location.file;
|
|
998
|
+
if (fileName && set.has(fileName))
|
|
999
|
+
testIds.push(...collectTestIds(treeItem));
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
runTests("queue-if-busy", new Set(testIds));
|
|
1003
|
+
};
|
|
1004
|
+
return /* @__PURE__ */ jsx(
|
|
1005
|
+
TestTreeView,
|
|
1006
|
+
{
|
|
1007
|
+
name: "tests",
|
|
1008
|
+
treeState,
|
|
1009
|
+
setTreeState,
|
|
1010
|
+
rootItem,
|
|
1011
|
+
dataTestId: "test-tree",
|
|
1012
|
+
render: (treeItem) => {
|
|
1013
|
+
return /* @__PURE__ */ jsxs("div", { className: "hbox ui-mode-list-item", children: [
|
|
1014
|
+
/* @__PURE__ */ jsx("div", { className: "ui-mode-list-item-title", title: treeItem.title, children: treeItem.title }),
|
|
1015
|
+
!!treeItem.duration && treeItem.status !== "skipped" && /* @__PURE__ */ jsx("div", { className: "ui-mode-list-item-time", children: msToString(treeItem.duration) }),
|
|
1016
|
+
/* @__PURE__ */ jsxs(Toolbar, { noMinHeight: true, noShadow: true, children: [
|
|
1017
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "play", title: "Run", onClick: () => runTreeItem(treeItem), disabled: !!runningState }),
|
|
1018
|
+
/* @__PURE__ */ jsx(ToolbarButton, { icon: "go-to-file", title: "Open in VS Code", onClick: () => sendMessageNoReply("open", { location: locationToOpen(treeItem) }), style: treeItem.kind === "group" && treeItem.subKind === "folder" ? { visibility: "hidden" } : {} }),
|
|
1019
|
+
!watchAll && /* @__PURE__ */ jsx(ToolbarButton, { icon: "eye", title: "Watch", onClick: () => {
|
|
1020
|
+
if (watchedTreeIds.value.has(treeItem.id))
|
|
1021
|
+
watchedTreeIds.value.delete(treeItem.id);
|
|
1022
|
+
else
|
|
1023
|
+
watchedTreeIds.value.add(treeItem.id);
|
|
1024
|
+
setWatchedTreeIds({ ...watchedTreeIds });
|
|
1025
|
+
}, toggled: watchedTreeIds.value.has(treeItem.id) })
|
|
1026
|
+
] })
|
|
1027
|
+
] });
|
|
1028
|
+
},
|
|
1029
|
+
icon: (treeItem) => testStatusIcon(treeItem.status),
|
|
1030
|
+
selectedItem: selectedTreeItem,
|
|
1031
|
+
onAccepted: runTreeItem,
|
|
1032
|
+
onSelected: (treeItem) => {
|
|
1033
|
+
if (runningState)
|
|
1034
|
+
runningState.itemSelectedByUser = true;
|
|
1035
|
+
setSelectedTreeItemId(treeItem.id);
|
|
1036
|
+
},
|
|
1037
|
+
isError: (treeItem) => treeItem.kind === "group" ? treeItem.hasLoadErrors : false,
|
|
1038
|
+
autoExpandDepth: filterText ? 5 : 1,
|
|
1039
|
+
noItemsMessage: isLoading ? "Loading…" : "No tests"
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1042
|
+
};
|
|
1043
|
+
const TraceView = ({ item, rootDir }) => {
|
|
1044
|
+
var _a;
|
|
1045
|
+
const [model, setModel] = React.useState();
|
|
1046
|
+
const [counter, setCounter] = React.useState(0);
|
|
1047
|
+
const pollTimer = React.useRef(null);
|
|
1048
|
+
const { outputDir } = React.useMemo(() => {
|
|
1049
|
+
const outputDir2 = item.testCase ? outputDirForTestCase(item.testCase) : void 0;
|
|
1050
|
+
return { outputDir: outputDir2 };
|
|
1051
|
+
}, [item]);
|
|
1052
|
+
const [selectedActionId, setSelectedActionId] = React.useState();
|
|
1053
|
+
const onSelectionChanged = React.useCallback((action) => setSelectedActionId(idForAction(action)), [setSelectedActionId]);
|
|
1054
|
+
const initialSelection = selectedActionId ? model == null ? void 0 : model.model.actions.find((a) => idForAction(a) === selectedActionId) : void 0;
|
|
1055
|
+
React.useEffect(() => {
|
|
1056
|
+
var _a2, _b;
|
|
1057
|
+
if (pollTimer.current)
|
|
1058
|
+
clearTimeout(pollTimer.current);
|
|
1059
|
+
const result = (_a2 = item.testCase) == null ? void 0 : _a2.results[0];
|
|
1060
|
+
if (!result) {
|
|
1061
|
+
setModel(void 0);
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
const attachment = result && result.duration >= 0 && result.attachments.find((a) => a.name === "trace");
|
|
1065
|
+
if (attachment && attachment.path) {
|
|
1066
|
+
loadSingleTraceFile(attachment.path).then((model2) => setModel({ model: model2, isLive: false }));
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
if (!outputDir) {
|
|
1070
|
+
setModel(void 0);
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
const traceLocation = `${outputDir}/${artifactsFolderName(result.workerIndex)}/traces/${(_b = item.testCase) == null ? void 0 : _b.id}.json`;
|
|
1074
|
+
pollTimer.current = setTimeout(async () => {
|
|
1075
|
+
try {
|
|
1076
|
+
const model2 = await loadSingleTraceFile(traceLocation);
|
|
1077
|
+
setModel({ model: model2, isLive: true });
|
|
1078
|
+
} catch {
|
|
1079
|
+
setModel(void 0);
|
|
1080
|
+
} finally {
|
|
1081
|
+
setCounter(counter + 1);
|
|
1082
|
+
}
|
|
1083
|
+
}, 500);
|
|
1084
|
+
return () => {
|
|
1085
|
+
if (pollTimer.current)
|
|
1086
|
+
clearTimeout(pollTimer.current);
|
|
1087
|
+
};
|
|
1088
|
+
}, [outputDir, item, setModel, counter, setCounter]);
|
|
1089
|
+
return /* @__PURE__ */ jsx(
|
|
1090
|
+
Workbench,
|
|
1091
|
+
{
|
|
1092
|
+
model: model == null ? void 0 : model.model,
|
|
1093
|
+
hideStackFrames: true,
|
|
1094
|
+
showSourcesFirst: true,
|
|
1095
|
+
rootDir,
|
|
1096
|
+
initialSelection,
|
|
1097
|
+
onSelectionChanged,
|
|
1098
|
+
fallbackLocation: item.testFile,
|
|
1099
|
+
isLive: model == null ? void 0 : model.isLive,
|
|
1100
|
+
status: (_a = item.treeItem) == null ? void 0 : _a.status
|
|
1101
|
+
},
|
|
1102
|
+
"workbench"
|
|
1103
|
+
);
|
|
1104
|
+
};
|
|
1105
|
+
let receiver;
|
|
1106
|
+
let lastRunReceiver;
|
|
1107
|
+
let lastRunTestCount;
|
|
1108
|
+
let throttleTimer;
|
|
1109
|
+
let throttleData;
|
|
1110
|
+
const throttledAction = () => {
|
|
1111
|
+
clearTimeout(throttleTimer);
|
|
1112
|
+
throttleTimer = void 0;
|
|
1113
|
+
updateRootSuite(throttleData.config, throttleData.rootSuite, throttleData.loadErrors, throttleData.progress);
|
|
1114
|
+
};
|
|
1115
|
+
const throttleUpdateRootSuite = (config, rootSuite, loadErrors, progress, immediate = false) => {
|
|
1116
|
+
throttleData = { config, rootSuite, loadErrors, progress };
|
|
1117
|
+
if (immediate)
|
|
1118
|
+
throttledAction();
|
|
1119
|
+
else if (!throttleTimer)
|
|
1120
|
+
throttleTimer = setTimeout(throttledAction, 250);
|
|
1121
|
+
};
|
|
1122
|
+
const refreshRootSuite = (eraseResults) => {
|
|
1123
|
+
if (!eraseResults)
|
|
1124
|
+
return sendMessage("list", {});
|
|
1125
|
+
let rootSuite;
|
|
1126
|
+
const loadErrors = [];
|
|
1127
|
+
const progress = {
|
|
1128
|
+
total: 0,
|
|
1129
|
+
passed: 0,
|
|
1130
|
+
failed: 0,
|
|
1131
|
+
skipped: 0
|
|
1132
|
+
};
|
|
1133
|
+
let config;
|
|
1134
|
+
receiver = new TeleReporterReceiver(pathSeparator, {
|
|
1135
|
+
version: () => "v2",
|
|
1136
|
+
onConfigure: (c) => {
|
|
1137
|
+
config = c;
|
|
1138
|
+
lastRunReceiver = new TeleReporterReceiver(pathSeparator, {
|
|
1139
|
+
onBegin: (suite) => {
|
|
1140
|
+
lastRunTestCount = suite.allTests().length;
|
|
1141
|
+
lastRunReceiver = void 0;
|
|
1142
|
+
}
|
|
1143
|
+
}, false);
|
|
1144
|
+
},
|
|
1145
|
+
onBegin: (suite) => {
|
|
1146
|
+
if (!rootSuite)
|
|
1147
|
+
rootSuite = suite;
|
|
1148
|
+
progress.total = lastRunTestCount;
|
|
1149
|
+
progress.passed = 0;
|
|
1150
|
+
progress.failed = 0;
|
|
1151
|
+
progress.skipped = 0;
|
|
1152
|
+
throttleUpdateRootSuite(config, rootSuite, loadErrors, progress, true);
|
|
1153
|
+
},
|
|
1154
|
+
onEnd: () => {
|
|
1155
|
+
throttleUpdateRootSuite(config, rootSuite, loadErrors, progress, true);
|
|
1156
|
+
},
|
|
1157
|
+
onTestBegin: () => {
|
|
1158
|
+
throttleUpdateRootSuite(config, rootSuite, loadErrors, progress);
|
|
1159
|
+
},
|
|
1160
|
+
onTestEnd: (test) => {
|
|
1161
|
+
if (test.outcome() === "skipped")
|
|
1162
|
+
++progress.skipped;
|
|
1163
|
+
else if (test.outcome() === "unexpected")
|
|
1164
|
+
++progress.failed;
|
|
1165
|
+
else
|
|
1166
|
+
++progress.passed;
|
|
1167
|
+
throttleUpdateRootSuite(config, rootSuite, loadErrors, progress);
|
|
1168
|
+
},
|
|
1169
|
+
onError: (error) => {
|
|
1170
|
+
xtermDataSource.write((error.stack || error.value || "") + "\n");
|
|
1171
|
+
loadErrors.push(error);
|
|
1172
|
+
throttleUpdateRootSuite(config, rootSuite ?? new TeleSuite("", "root"), loadErrors, progress);
|
|
1173
|
+
},
|
|
1174
|
+
printsToStdio: () => {
|
|
1175
|
+
return false;
|
|
1176
|
+
},
|
|
1177
|
+
onStdOut: () => {
|
|
1178
|
+
},
|
|
1179
|
+
onStdErr: () => {
|
|
1180
|
+
},
|
|
1181
|
+
onExit: () => {
|
|
1182
|
+
},
|
|
1183
|
+
onStepBegin: () => {
|
|
1184
|
+
},
|
|
1185
|
+
onStepEnd: () => {
|
|
1186
|
+
}
|
|
1187
|
+
}, true);
|
|
1188
|
+
receiver._setClearPreviousResultsWhenTestBegins();
|
|
1189
|
+
return sendMessage("list", {});
|
|
1190
|
+
};
|
|
1191
|
+
const sendMessageNoReply = (method, params) => {
|
|
1192
|
+
if (window._overrideProtocolForTest) {
|
|
1193
|
+
window._overrideProtocolForTest({ method, params }).catch(() => {
|
|
1194
|
+
});
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
sendMessage(method, params).catch((e) => {
|
|
1198
|
+
console.error(e);
|
|
1199
|
+
});
|
|
1200
|
+
};
|
|
1201
|
+
const dispatchEvent = (method, params) => {
|
|
1202
|
+
var _a, _b;
|
|
1203
|
+
if (method === "listChanged") {
|
|
1204
|
+
refreshRootSuite(false).catch(() => {
|
|
1205
|
+
});
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
if (method === "testFilesChanged") {
|
|
1209
|
+
runWatchedTests(params.testFileNames);
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
if (method === "stdio") {
|
|
1213
|
+
if (params.buffer) {
|
|
1214
|
+
const data = atob(params.buffer);
|
|
1215
|
+
xtermDataSource.write(data);
|
|
1216
|
+
} else {
|
|
1217
|
+
xtermDataSource.write(params.text);
|
|
1218
|
+
}
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
(_a = lastRunReceiver == null ? void 0 : lastRunReceiver.dispatch({ method, params })) == null ? void 0 : _a.catch(() => {
|
|
1222
|
+
});
|
|
1223
|
+
(_b = receiver == null ? void 0 : receiver.dispatch({ method, params })) == null ? void 0 : _b.catch(() => {
|
|
1224
|
+
});
|
|
1225
|
+
};
|
|
1226
|
+
const outputDirForTestCase = (testCase) => {
|
|
1227
|
+
var _a;
|
|
1228
|
+
for (let suite = testCase.parent; suite; suite = suite.parent) {
|
|
1229
|
+
if (suite.project())
|
|
1230
|
+
return (_a = suite.project()) == null ? void 0 : _a.outputDir;
|
|
1231
|
+
}
|
|
1232
|
+
return void 0;
|
|
1233
|
+
};
|
|
1234
|
+
const locationToOpen = (treeItem) => {
|
|
1235
|
+
if (!treeItem)
|
|
1236
|
+
return;
|
|
1237
|
+
return treeItem.location.file + ":" + treeItem.location.line;
|
|
1238
|
+
};
|
|
1239
|
+
const collectTestIds = (treeItem) => {
|
|
1240
|
+
const testIds = /* @__PURE__ */ new Set();
|
|
1241
|
+
if (!treeItem)
|
|
1242
|
+
return testIds;
|
|
1243
|
+
const visit = (treeItem2) => {
|
|
1244
|
+
var _a;
|
|
1245
|
+
if (treeItem2.kind === "case")
|
|
1246
|
+
treeItem2.tests.map((t) => t.id).forEach((id) => testIds.add(id));
|
|
1247
|
+
else if (treeItem2.kind === "test")
|
|
1248
|
+
testIds.add(treeItem2.id);
|
|
1249
|
+
else
|
|
1250
|
+
(_a = treeItem2.children) == null ? void 0 : _a.forEach(visit);
|
|
1251
|
+
};
|
|
1252
|
+
visit(treeItem);
|
|
1253
|
+
return testIds;
|
|
1254
|
+
};
|
|
1255
|
+
function getFileItem(rootItem, filePath, isFile, fileItems) {
|
|
1256
|
+
if (filePath.length === 0)
|
|
1257
|
+
return rootItem;
|
|
1258
|
+
const fileName = filePath.join(pathSeparator);
|
|
1259
|
+
const existingFileItem = fileItems.get(fileName);
|
|
1260
|
+
if (existingFileItem)
|
|
1261
|
+
return existingFileItem;
|
|
1262
|
+
const parentFileItem = getFileItem(rootItem, filePath.slice(0, filePath.length - 1), false, fileItems);
|
|
1263
|
+
const fileItem = {
|
|
1264
|
+
kind: "group",
|
|
1265
|
+
subKind: isFile ? "file" : "folder",
|
|
1266
|
+
id: fileName,
|
|
1267
|
+
title: filePath[filePath.length - 1],
|
|
1268
|
+
location: { file: fileName, line: 0, column: 0 },
|
|
1269
|
+
duration: 0,
|
|
1270
|
+
parent: parentFileItem,
|
|
1271
|
+
children: [],
|
|
1272
|
+
status: "none",
|
|
1273
|
+
hasLoadErrors: false
|
|
1274
|
+
};
|
|
1275
|
+
parentFileItem.children.push(fileItem);
|
|
1276
|
+
fileItems.set(fileName, fileItem);
|
|
1277
|
+
return fileItem;
|
|
1278
|
+
}
|
|
1279
|
+
function createTree(rootSuite, loadErrors, projectFilters) {
|
|
1280
|
+
const filterProjects = [...projectFilters.values()].some(Boolean);
|
|
1281
|
+
const rootItem = {
|
|
1282
|
+
kind: "group",
|
|
1283
|
+
subKind: "folder",
|
|
1284
|
+
id: "root",
|
|
1285
|
+
title: "",
|
|
1286
|
+
location: { file: "", line: 0, column: 0 },
|
|
1287
|
+
duration: 0,
|
|
1288
|
+
parent: void 0,
|
|
1289
|
+
children: [],
|
|
1290
|
+
status: "none",
|
|
1291
|
+
hasLoadErrors: false
|
|
1292
|
+
};
|
|
1293
|
+
const visitSuite = (projectName, parentSuite, parentGroup) => {
|
|
1294
|
+
for (const suite of parentSuite.suites) {
|
|
1295
|
+
const title = suite.title || "<anonymous>";
|
|
1296
|
+
let group = parentGroup.children.find((item) => item.kind === "group" && item.title === title);
|
|
1297
|
+
if (!group) {
|
|
1298
|
+
group = {
|
|
1299
|
+
kind: "group",
|
|
1300
|
+
subKind: "describe",
|
|
1301
|
+
id: "suite:" + parentSuite.titlePath().join("") + "" + title,
|
|
1302
|
+
// account for anonymous suites
|
|
1303
|
+
title,
|
|
1304
|
+
location: suite.location,
|
|
1305
|
+
duration: 0,
|
|
1306
|
+
parent: parentGroup,
|
|
1307
|
+
children: [],
|
|
1308
|
+
status: "none",
|
|
1309
|
+
hasLoadErrors: false
|
|
1310
|
+
};
|
|
1311
|
+
parentGroup.children.push(group);
|
|
1312
|
+
}
|
|
1313
|
+
visitSuite(projectName, suite, group);
|
|
1314
|
+
}
|
|
1315
|
+
for (const test of parentSuite.tests) {
|
|
1316
|
+
const title = test.title;
|
|
1317
|
+
let testCaseItem = parentGroup.children.find((t) => t.kind !== "group" && t.title === title);
|
|
1318
|
+
if (!testCaseItem) {
|
|
1319
|
+
testCaseItem = {
|
|
1320
|
+
kind: "case",
|
|
1321
|
+
id: "test:" + test.titlePath().join(""),
|
|
1322
|
+
title,
|
|
1323
|
+
parent: parentGroup,
|
|
1324
|
+
children: [],
|
|
1325
|
+
tests: [],
|
|
1326
|
+
location: test.location,
|
|
1327
|
+
duration: 0,
|
|
1328
|
+
status: "none"
|
|
1329
|
+
};
|
|
1330
|
+
parentGroup.children.push(testCaseItem);
|
|
1331
|
+
}
|
|
1332
|
+
const result = test.results[0];
|
|
1333
|
+
let status = "none";
|
|
1334
|
+
if ((result == null ? void 0 : result.statusEx) === "scheduled")
|
|
1335
|
+
status = "scheduled";
|
|
1336
|
+
else if ((result == null ? void 0 : result.statusEx) === "running")
|
|
1337
|
+
status = "running";
|
|
1338
|
+
else if ((result == null ? void 0 : result.status) === "skipped")
|
|
1339
|
+
status = "skipped";
|
|
1340
|
+
else if ((result == null ? void 0 : result.status) === "interrupted")
|
|
1341
|
+
status = "none";
|
|
1342
|
+
else if (result && test.outcome() !== "expected")
|
|
1343
|
+
status = "failed";
|
|
1344
|
+
else if (result && test.outcome() === "expected")
|
|
1345
|
+
status = "passed";
|
|
1346
|
+
testCaseItem.tests.push(test);
|
|
1347
|
+
testCaseItem.children.push({
|
|
1348
|
+
kind: "test",
|
|
1349
|
+
id: test.id,
|
|
1350
|
+
title: projectName,
|
|
1351
|
+
location: test.location,
|
|
1352
|
+
test,
|
|
1353
|
+
parent: testCaseItem,
|
|
1354
|
+
children: [],
|
|
1355
|
+
status,
|
|
1356
|
+
duration: test.results.length ? Math.max(0, test.results[0].duration) : 0,
|
|
1357
|
+
project: projectName
|
|
1358
|
+
});
|
|
1359
|
+
testCaseItem.duration = testCaseItem.children.reduce((a, b) => a + b.duration, 0);
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
const fileMap = /* @__PURE__ */ new Map();
|
|
1363
|
+
for (const projectSuite of (rootSuite == null ? void 0 : rootSuite.suites) || []) {
|
|
1364
|
+
if (filterProjects && !projectFilters.get(projectSuite.title))
|
|
1365
|
+
continue;
|
|
1366
|
+
for (const fileSuite of projectSuite.suites) {
|
|
1367
|
+
const fileItem = getFileItem(rootItem, fileSuite.location.file.split(pathSeparator), true, fileMap);
|
|
1368
|
+
visitSuite(projectSuite.title, fileSuite, fileItem);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
for (const loadError of loadErrors) {
|
|
1372
|
+
if (!loadError.location)
|
|
1373
|
+
continue;
|
|
1374
|
+
const fileItem = getFileItem(rootItem, loadError.location.file.split(pathSeparator), true, fileMap);
|
|
1375
|
+
fileItem.hasLoadErrors = true;
|
|
1376
|
+
}
|
|
1377
|
+
return rootItem;
|
|
1378
|
+
}
|
|
1379
|
+
function filterTree(rootItem, filterText, statusFilters, runningTestIds) {
|
|
1380
|
+
const tokens = filterText.trim().toLowerCase().split(" ");
|
|
1381
|
+
const filtersStatuses = [...statusFilters.values()].some(Boolean);
|
|
1382
|
+
const filter = (testCase) => {
|
|
1383
|
+
const title = testCase.tests[0].titlePath().join(" ").toLowerCase();
|
|
1384
|
+
if (!tokens.every((token) => title.includes(token)) && !testCase.tests.some((t) => runningTestIds == null ? void 0 : runningTestIds.has(t.id)))
|
|
1385
|
+
return false;
|
|
1386
|
+
testCase.children = testCase.children.filter((test) => {
|
|
1387
|
+
return !filtersStatuses || (runningTestIds == null ? void 0 : runningTestIds.has(test.test.id)) || statusFilters.get(test.status);
|
|
1388
|
+
});
|
|
1389
|
+
testCase.tests = testCase.children.map((c) => c.test);
|
|
1390
|
+
return !!testCase.children.length;
|
|
1391
|
+
};
|
|
1392
|
+
const visit = (treeItem) => {
|
|
1393
|
+
const newChildren = [];
|
|
1394
|
+
for (const child of treeItem.children) {
|
|
1395
|
+
if (child.kind === "case") {
|
|
1396
|
+
if (filter(child))
|
|
1397
|
+
newChildren.push(child);
|
|
1398
|
+
} else {
|
|
1399
|
+
visit(child);
|
|
1400
|
+
if (child.children.length || child.hasLoadErrors)
|
|
1401
|
+
newChildren.push(child);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
treeItem.children = newChildren;
|
|
1405
|
+
};
|
|
1406
|
+
visit(rootItem);
|
|
1407
|
+
}
|
|
1408
|
+
function sortAndPropagateStatus(treeItem) {
|
|
1409
|
+
for (const child of treeItem.children)
|
|
1410
|
+
sortAndPropagateStatus(child);
|
|
1411
|
+
if (treeItem.kind === "group") {
|
|
1412
|
+
treeItem.children.sort((a, b) => {
|
|
1413
|
+
const fc = a.location.file.localeCompare(b.location.file);
|
|
1414
|
+
return fc || a.location.line - b.location.line;
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
let allPassed = treeItem.children.length > 0;
|
|
1418
|
+
let allSkipped = treeItem.children.length > 0;
|
|
1419
|
+
let hasFailed = false;
|
|
1420
|
+
let hasRunning = false;
|
|
1421
|
+
let hasScheduled = false;
|
|
1422
|
+
for (const child of treeItem.children) {
|
|
1423
|
+
allSkipped = allSkipped && child.status === "skipped";
|
|
1424
|
+
allPassed = allPassed && (child.status === "passed" || child.status === "skipped");
|
|
1425
|
+
hasFailed = hasFailed || child.status === "failed";
|
|
1426
|
+
hasRunning = hasRunning || child.status === "running";
|
|
1427
|
+
hasScheduled = hasScheduled || child.status === "scheduled";
|
|
1428
|
+
}
|
|
1429
|
+
if (hasRunning)
|
|
1430
|
+
treeItem.status = "running";
|
|
1431
|
+
else if (hasScheduled)
|
|
1432
|
+
treeItem.status = "scheduled";
|
|
1433
|
+
else if (hasFailed)
|
|
1434
|
+
treeItem.status = "failed";
|
|
1435
|
+
else if (allSkipped)
|
|
1436
|
+
treeItem.status = "skipped";
|
|
1437
|
+
else if (allPassed)
|
|
1438
|
+
treeItem.status = "passed";
|
|
1439
|
+
}
|
|
1440
|
+
function shortenRoot(rootItem) {
|
|
1441
|
+
let shortRoot = rootItem;
|
|
1442
|
+
while (shortRoot.children.length === 1 && shortRoot.children[0].kind === "group" && shortRoot.children[0].subKind === "folder")
|
|
1443
|
+
shortRoot = shortRoot.children[0];
|
|
1444
|
+
shortRoot.location = rootItem.location;
|
|
1445
|
+
return shortRoot;
|
|
1446
|
+
}
|
|
1447
|
+
function hideOnlyTests(rootItem) {
|
|
1448
|
+
const visit = (treeItem) => {
|
|
1449
|
+
if (treeItem.kind === "case" && treeItem.children.length === 1)
|
|
1450
|
+
treeItem.children = [];
|
|
1451
|
+
else
|
|
1452
|
+
treeItem.children.forEach(visit);
|
|
1453
|
+
};
|
|
1454
|
+
visit(rootItem);
|
|
1455
|
+
}
|
|
1456
|
+
async function loadSingleTraceFile(url) {
|
|
1457
|
+
const params = new URLSearchParams();
|
|
1458
|
+
params.set("trace", url);
|
|
1459
|
+
const response = await fetch(`contexts?${params.toString()}`);
|
|
1460
|
+
const contextEntries = await response.json();
|
|
1461
|
+
return new MultiTraceModel(contextEntries);
|
|
1462
|
+
}
|
|
1463
|
+
const pathSeparator = navigator.userAgent.toLowerCase().includes("windows") ? "\\" : "/";
|
|
1464
|
+
(async () => {
|
|
1465
|
+
applyTheme();
|
|
1466
|
+
if (window.location.protocol !== "file:") {
|
|
1467
|
+
if (window.location.href.includes("isUnderTest=true"))
|
|
1468
|
+
await new Promise((f) => setTimeout(f, 1e3));
|
|
1469
|
+
if (!navigator.serviceWorker)
|
|
1470
|
+
throw new Error(`Service workers are not supported.
|
|
1471
|
+
Make sure to serve the website (${window.location}) via HTTPS or localhost.`);
|
|
1472
|
+
navigator.serviceWorker.register("sw.bundle.js");
|
|
1473
|
+
if (!navigator.serviceWorker.controller) {
|
|
1474
|
+
await new Promise((f) => {
|
|
1475
|
+
navigator.serviceWorker.oncontrollerchange = () => f();
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
setInterval(function() {
|
|
1479
|
+
fetch("ping");
|
|
1480
|
+
}, 1e4);
|
|
1481
|
+
}
|
|
1482
|
+
reactDomExports.render(/* @__PURE__ */ jsx(UIModeView, {}), document.querySelector("#root"));
|
|
1483
|
+
})();
|
|
1484
|
+
//# sourceMappingURL=uiMode.b2068d00.js.map
|