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