playwright-core 1.58.0-alpha-2025-12-09 → 1.58.0-alpha-2025-12-10

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/browsers.json CHANGED
@@ -17,16 +17,16 @@
17
17
  },
18
18
  {
19
19
  "name": "chromium-tip-of-tree",
20
- "revision": "1384",
20
+ "revision": "1389",
21
21
  "installByDefault": false,
22
- "browserVersion": "143.0.7499.25",
22
+ "browserVersion": "144.0.7559.3",
23
23
  "title": "Chrome Canary for Testing"
24
24
  },
25
25
  {
26
26
  "name": "chromium-tip-of-tree-headless-shell",
27
- "revision": "1384",
27
+ "revision": "1389",
28
28
  "installByDefault": false,
29
- "browserVersion": "143.0.7499.25",
29
+ "browserVersion": "144.0.7559.3",
30
30
  "title": "Chrome Canary Headless Shell"
31
31
  },
32
32
  {
@@ -38,14 +38,14 @@
38
38
  },
39
39
  {
40
40
  "name": "firefox-beta",
41
- "revision": "1498",
41
+ "revision": "1499",
42
42
  "installByDefault": false,
43
43
  "browserVersion": "146.0b8",
44
44
  "title": "Firefox Beta"
45
45
  },
46
46
  {
47
47
  "name": "webkit",
48
- "revision": "2237",
48
+ "revision": "2238",
49
49
  "installByDefault": true,
50
50
  "revisionOverrides": {
51
51
  "debian11-x64": "2105",
@@ -87,13 +87,13 @@ async function cachedPerform(context, options) {
87
87
  return false;
88
88
  const cache = await cachedActions(context.options.cacheFile);
89
89
  const cacheKey = options.key ?? options.task;
90
- const actions = cache[cacheKey];
91
- if (!actions) {
90
+ const entry = cache[cacheKey];
91
+ if (!entry) {
92
92
  if (context.options.cacheMode === "force")
93
93
  throw new Error(`No cached actions for key "${cacheKey}", but cache mode is set to "force"`);
94
94
  return false;
95
95
  }
96
- for (const action of actions)
96
+ for (const action of entry.actions)
97
97
  await (0, import_actionRunner.runAction)(context.progress, context.page, action, context.options.secrets ?? []);
98
98
  return true;
99
99
  }
@@ -103,7 +103,10 @@ async function updateCache(context, options) {
103
103
  return;
104
104
  const cache = await cachedActions(cacheFile);
105
105
  const cacheKey = options.key ?? options.task;
106
- cache[cacheKey] = context.actions;
106
+ cache[cacheKey] = {
107
+ timestamp: Date.now(),
108
+ actions: context.actions
109
+ };
107
110
  await import_fs.default.promises.writeFile(cacheFile, JSON.stringify(cache, void 0, 2));
108
111
  }
109
112
  async function cachedActions(cacheFile) {
@@ -366,19 +366,28 @@ class BidiBrowserContext extends import_browserContext.BrowserContext {
366
366
  }
367
367
  }
368
368
  async doUpdateDefaultViewport() {
369
- if (!this._options.viewport)
369
+ if (!this._options.viewport && !this._options.screen)
370
370
  return;
371
+ const screenSize = this._options.screen || this._options.viewport;
372
+ const viewportSize = this._options.viewport || this._options.screen;
371
373
  await Promise.all([
372
374
  this._browser._browserSession.send("browsingContext.setViewport", {
373
375
  viewport: {
374
- width: this._options.viewport.width,
375
- height: this._options.viewport.height
376
+ width: viewportSize.width,
377
+ height: viewportSize.height
376
378
  },
377
379
  devicePixelRatio: this._options.deviceScaleFactor || 1,
378
380
  userContexts: [this._userContextId()]
379
381
  }),
380
382
  this._browser._browserSession.send("emulation.setScreenOrientationOverride", {
381
- screenOrientation: getScreenOrientation(!!this._options.isMobile, this._options.viewport),
383
+ screenOrientation: getScreenOrientation(!!this._options.isMobile, screenSize),
384
+ userContexts: [this._userContextId()]
385
+ }),
386
+ this._browser._browserSession.send("emulation.setScreenSettingsOverride", {
387
+ screenArea: {
388
+ width: screenSize.width,
389
+ height: screenSize.height
390
+ },
382
391
  userContexts: [this._userContextId()]
383
392
  })
384
393
  ]);
@@ -306,6 +306,7 @@ ${params.stackTrace?.callFrames.map((f) => {
306
306
  const emulatedSize = this._page.emulatedSize();
307
307
  if (!emulatedSize)
308
308
  return;
309
+ const screenSize = emulatedSize.screen;
309
310
  const viewportSize = emulatedSize.viewport;
310
311
  await Promise.all([
311
312
  this._session.send("browsingContext.setViewport", {
@@ -318,7 +319,14 @@ ${params.stackTrace?.callFrames.map((f) => {
318
319
  }),
319
320
  this._session.send("emulation.setScreenOrientationOverride", {
320
321
  contexts: [this._session.sessionId],
321
- screenOrientation: (0, import_bidiBrowser.getScreenOrientation)(!!options.isMobile, viewportSize)
322
+ screenOrientation: (0, import_bidiBrowser.getScreenOrientation)(!!options.isMobile, screenSize)
323
+ }),
324
+ this._session.send("emulation.setScreenSettingsOverride", {
325
+ contexts: [this._session.sessionId],
326
+ screenArea: {
327
+ width: screenSize.width,
328
+ height: screenSize.height
329
+ }
322
330
  })
323
331
  ]);
324
332
  }
@@ -128,6 +128,7 @@ var Network;
128
128
  ((Network2) => {
129
129
  let DataType;
130
130
  ((DataType2) => {
131
+ DataType2["Request"] = "request";
131
132
  DataType2["Response"] = "response";
132
133
  })(DataType = Network2.DataType || (Network2.DataType = {}));
133
134
  })(Network || (Network = {}));
@@ -41,16 +41,13 @@ module.exports = __toCommonJS(network_exports);
41
41
  var import_http = __toESM(require("http"));
42
42
  var import_http2 = __toESM(require("http2"));
43
43
  var import_https = __toESM(require("https"));
44
- var import_url = __toESM(require("url"));
45
44
  var import_utilsBundle = require("../../utilsBundle");
46
45
  var import_happyEyeballs = require("./happyEyeballs");
47
46
  var import_manualPromise = require("../../utils/isomorphic/manualPromise");
48
47
  const NET_DEFAULT_TIMEOUT = 3e4;
49
48
  function httpRequest(params, onResponse, onError) {
50
- const parsedUrl = import_url.default.parse(params.url);
51
- let options = {
52
- ...parsedUrl,
53
- agent: parsedUrl.protocol === "https:" ? import_happyEyeballs.httpsHappyEyeballsAgent : import_happyEyeballs.httpHappyEyeballsAgent,
49
+ let url = new URL(params.url);
50
+ const options = {
54
51
  method: params.method || "GET",
55
52
  headers: params.headers
56
53
  };
@@ -58,21 +55,16 @@ function httpRequest(params, onResponse, onError) {
58
55
  options.rejectUnauthorized = params.rejectUnauthorized;
59
56
  const proxyURL = (0, import_utilsBundle.getProxyForUrl)(params.url);
60
57
  if (proxyURL) {
58
+ const parsedProxyURL = normalizeProxyURL(proxyURL);
61
59
  if (params.url.startsWith("http:")) {
62
- const parsedProxyURL = import_url.default.parse(proxyURL);
63
- options = {
64
- path: parsedUrl.href,
65
- host: parsedProxyURL.hostname,
66
- port: parsedProxyURL.port,
67
- protocol: parsedProxyURL.protocol || "http:",
68
- headers: options.headers,
69
- method: options.method
70
- };
60
+ parsedProxyURL.pathname = url.toString();
61
+ url = parsedProxyURL;
71
62
  } else {
72
- options.agent = new import_utilsBundle.HttpsProxyAgent(normalizeProxyURL(proxyURL));
63
+ options.agent = new import_utilsBundle.HttpsProxyAgent(parsedProxyURL);
73
64
  options.rejectUnauthorized = false;
74
65
  }
75
66
  }
67
+ options.agent ??= url.protocol === "https:" ? import_happyEyeballs.httpsHappyEyeballsAgent : import_happyEyeballs.httpHappyEyeballsAgent;
76
68
  let cancelRequest;
77
69
  const requestCallback = (res) => {
78
70
  const statusCode = res.statusCode || 0;
@@ -83,7 +75,7 @@ function httpRequest(params, onResponse, onError) {
83
75
  onResponse(res);
84
76
  }
85
77
  };
86
- const request = options.protocol === "https:" ? import_https.default.request(options, requestCallback) : import_http.default.request(options, requestCallback);
78
+ const request = url.protocol === "https:" ? import_https.default.request(url, options, requestCallback) : import_http.default.request(url, options, requestCallback);
87
79
  request.on("error", onError);
88
80
  if (params.socketTimeout !== void 0) {
89
81
  request.setTimeout(params.socketTimeout, () => {
@@ -122,7 +114,7 @@ async function fetchData(progress, params, onError) {
122
114
  throw error;
123
115
  }
124
116
  }
125
- function shouldBypassProxy(url2, bypass) {
117
+ function shouldBypassProxy(url, bypass) {
126
118
  if (!bypass)
127
119
  return false;
128
120
  const domains = bypass.split(",").map((s) => {
@@ -131,7 +123,7 @@ function shouldBypassProxy(url2, bypass) {
131
123
  s = "." + s;
132
124
  return s;
133
125
  });
134
- const domain = "." + url2.hostname;
126
+ const domain = "." + url.hostname;
135
127
  return domains.some((d) => domain.endsWith(d));
136
128
  }
137
129
  function normalizeProxyURL(proxy) {
@@ -177,20 +169,20 @@ function createHttp2Server(...args) {
177
169
  decorateServer(server);
178
170
  return server;
179
171
  }
180
- async function isURLAvailable(url2, ignoreHTTPSErrors, onLog, onStdErr) {
181
- let statusCode = await httpStatusCode(url2, ignoreHTTPSErrors, onLog, onStdErr);
182
- if (statusCode === 404 && url2.pathname === "/") {
183
- const indexUrl = new URL(url2);
172
+ async function isURLAvailable(url, ignoreHTTPSErrors, onLog, onStdErr) {
173
+ let statusCode = await httpStatusCode(url, ignoreHTTPSErrors, onLog, onStdErr);
174
+ if (statusCode === 404 && url.pathname === "/") {
175
+ const indexUrl = new URL(url);
184
176
  indexUrl.pathname = "/index.html";
185
177
  statusCode = await httpStatusCode(indexUrl, ignoreHTTPSErrors, onLog, onStdErr);
186
178
  }
187
179
  return statusCode >= 200 && statusCode < 404;
188
180
  }
189
- async function httpStatusCode(url2, ignoreHTTPSErrors, onLog, onStdErr) {
181
+ async function httpStatusCode(url, ignoreHTTPSErrors, onLog, onStdErr) {
190
182
  return new Promise((resolve) => {
191
- onLog?.(`HTTP GET: ${url2}`);
183
+ onLog?.(`HTTP GET: ${url}`);
192
184
  httpRequest({
193
- url: url2.toString(),
185
+ url: url.toString(),
194
186
  headers: { Accept: "*/*" },
195
187
  rejectUnauthorized: !ignoreHTTPSErrors
196
188
  }, (res) => {
@@ -201,7 +193,7 @@ async function httpStatusCode(url2, ignoreHTTPSErrors, onLog, onStdErr) {
201
193
  }, (error) => {
202
194
  if (error.code === "DEPTH_ZERO_SELF_SIGNED_CERT")
203
195
  onStdErr?.(`[WebServer] Self-signed certificate detected. Try adding ignoreHTTPSErrors: true to config.webServer.`);
204
- onLog?.(`Error while checking if ${url2} is available: ${error.message}`);
196
+ onLog?.(`Error while checking if ${url} is available: ${error.message}`);
205
197
  resolve(0);
206
198
  });
207
199
  });
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-CsJ4vdCR.js","./xtermModule.DYP7pi_n.css"])))=>i.map(i=>d[i]);
2
+ import{u as zt,r as H,g as Kt,_ as Vt,h as $t,i as Ht,j as n,R as u,E as qt,s as yt,k as mt,l as Yt,t as Qt,m as Xt,n as q,o as F,T as Et,c as Jt,p as at,a as Zt,W as Gt,S as te,q as ee,b as se,e as ie,f as oe}from"./assets/defaultSettingsView-V7hnXDpz.js";var re={};class pt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new Z("","root"),this._options=e,this._reporter=t}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestPaused"){this._onTestPaused(s.testId,s.resultId,s.stepId,s.errors);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onAttach"){this._onAttach(s.testId,s.resultId,s.attachments);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===t.name):void 0;e||(e=new Z(t.name,"project"),this._rootSuite._addSuite(e)),e._project=this._parseProject(t);for(const s of t.suites)this._mergeSuiteInto(s,e)}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var c,r;const s=this._tests.get(t);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const i=s._createTestResult(e.id);i.retry=e.retry,i.workerIndex=e.workerIndex,i.parallelIndex=e.parallelIndex,i.setStartTimeNumber(e.startTime),(r=(c=this._reporter).onTestBegin)==null||r.call(c,s,i)}_onTestPaused(t,e,s,i){var d,h;const c=this._tests.get(t),r=c.results.find(a=>a._id===e),m=r._stepMap.get(s);r.errors.push(...i),r.error=r.errors[0],(h=(d=this._reporter).onTestPaused)==null||h.call(d,c,r,m)}_onTestEnd(t,e){var c,r;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const i=s.results.find(m=>m._id===e.id);i.duration=e.duration,i.status=e.status,i.errors.push(...e.errors??[]),i.error=i.errors[0],e.attachments&&(i.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),i.annotations=e.annotations,s.annotations=e.annotations),(r=(c=this._reporter).onTestEnd)==null||r.call(c,s,i),i._stepMap=new Map}_onStepBegin(t,e,s){var h,a;const i=this._tests.get(t),c=i.results.find(w=>w._id===e),r=s.parentStepId?c._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),d=new ae(s,r,m,c);r?r.steps.push(d):c.steps.push(d),c._stepMap.set(s.id,d),(a=(h=this._reporter).onStepBegin)==null||a.call(h,i,c,d)}_onStepEnd(t,e,s){var m,d;const i=this._tests.get(t),c=i.results.find(h=>h._id===e),r=c._stepMap.get(s.id);r._endPayload=s,r.duration=s.duration,r.error=s.error,(d=(m=this._reporter).onStepEnd)==null||d.call(m,i,c,r)}_onAttach(t,e,s){this._tests.get(t).results.find(r=>r._id===e).attachments.push(...s.map(r=>({name:r.name,contentType:r.contentType,path:r.path,body:r.base64&&globalThis.Buffer?Buffer.from(r.base64,"base64"):void 0})))}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,c){var h,a,w,S;const r=c?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,m=e?this._tests.get(e):void 0,d=m&&s?m.results.find(l=>l._id===s):void 0;t==="stdout"?(d==null||d.stdout.push(r),(a=(h=this._reporter).onStdOut)==null||a.call(h,r,m,d)):(d==null||d.stderr.push(r),(S=(w=this._reporter).onStdErr)==null||S.call(w,r,m,d))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,{status:t.status,startTime:new Date(t.startTime),duration:t.duration}))}_onExit(){var t,e;return(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...ce,...t};return this._options.configOverrides&&(e.configFile=this._options.configOverrides.configFile,e.reportSlowTests=this._options.configOverrides.reportSlowTests,e.quiet=this._options.configOverrides.quiet,e.reporter=[...this._options.configOverrides.reporter]),e}_parseProject(t){return{metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:lt(t.testIgnore),testMatch:lt(t.testMatch),timeout:t.timeout,grep:lt(t.grep),grepInvert:lt(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:t.use}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuiteInto(t,e){let s=e.suites.find(i=>i.title===t.title);s||(s=new Z(t.title,e.type==="project"?"file":"describe"),e._addSuite(s)),s.location=this._absoluteLocation(t.location),t.entries.forEach(i=>{"testId"in i?this._mergeTestInto(i,s):this._mergeSuiteInto(i,s)})}_mergeTestInto(t,e){let s=this._options.mergeTestCases?e.tests.find(i=>i.title===t.title&&i.repeatEachIndex===t.repeatEachIndex):void 0;s||(s=new ne(t.testId,t.title,this._absoluteLocation(t.location),t.repeatEachIndex),e._addTest(s),this._tests.set(s.id,s)),this._updateTest(t,s)}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e.tags=t.tags??[],e.annotations=t.annotations??[],this._absoluteAnnotationLocationsInplace(e.annotations),e}_absoluteAnnotationLocationsInplace(t){for(const e of t)e.location&&(e.location=this._absoluteLocation(e.location))}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){if(t!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,t):this._rootDir+"/"+t}}class Z{constructor(t,e){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=t,this._type=e}get type(){return this._type}get suites(){return this._entries.filter(t=>t.type!=="test")}get tests(){return this._entries.filter(t=>t.type==="test")}entries(){return this._entries}allTests(){const t=[],e=s=>{for(const i of s.entries())i.type==="test"?t.push(i):e(i)};return e(this),t}titlePath(){const t=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&t.push(this.title),t}project(){var t;return this._project??((t=this.parent)==null?void 0:t.project())}_addTest(t){t.parent=this,this._entries.push(t)}_addSuite(t){t.parent=this,this._entries.push(t)}}class ne{constructor(t,e,s,i){this.fn=()=>{},this.results=[],this.type="test",this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.id=t,this.title=e,this.location=s,this.repeatEachIndex=i}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){return de(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new le(this.results.length,t);return this.results.push(e),e}}class ae{constructor(t,e,s,i){this.duration=-1,this.steps=[],this._startTime=0,this.title=t.title,this.category=t.category,this.location=s,this.parent=e,this._startTime=t.startTime,this._result=i}titlePath(){var e;return[...((e=this.parent)==null?void 0:e.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}get attachments(){var t,e;return((e=(t=this._endPayload)==null?void 0:t.attachments)==null?void 0:e.map(s=>this._result.attachments[s]))??[]}get annotations(){var t;return((t=this._endPayload)==null?void 0:t.annotations)??[]}}class le{constructor(t,e){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.annotations=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=t,this._id=e}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const ce={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[re.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:3e5},configFile:"",rootDir:"",quiet:!1,shard:null,tags:[],updateSnapshots:"missing",updateSourceMethod:"patch",version:"",workers:0,webServer:null};function lt(o){return o.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function de(o){let t=0,e=0,s=0;for(const i of o.results)i.status==="interrupted"||(i.status==="skipped"&&o.expectedStatus==="skipped"?++t:i.status==="skipped"||(i.status===o.expectedStatus?++e:++s));return e===0&&s===0?"skipped":s===0?"expected":e===0&&t===0?"unexpected":"flaky"}class gt{constructor(t,e,s,i,c,r){this._treeItemById=new Map,this._treeItemByTestId=new Map;const m=i&&[...i.values()].some(Boolean);this.pathSeparator=c,this.rootItem={kind:"group",subKind:"folder",id:t,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(t,this.rootItem);const d=(h,a,w,S)=>{for(const l of S==="tests"?[]:a.suites){if(!l.title){d(h,l,w,"all");continue}let k=w.children.find(_=>_.kind==="group"&&_.title===l.title);k||(k={kind:"group",subKind:"describe",id:"suite:"+a.titlePath().join("")+""+l.title,title:l.title,location:l.location,duration:0,parent:w,children:[],status:"none",hasLoadErrors:!1},this._addChild(w,k)),d(h,l,k,"all")}for(const l of S==="suites"?[]:a.tests){const k=l.title;let _=w.children.find(D=>D.kind!=="group"&&D.title===k);_||(_={kind:"case",id:"test:"+l.titlePath().join(""),title:k,parent:w,children:[],tests:[],location:l.location,duration:0,status:"none",project:void 0,test:void 0,tags:l.tags},this._addChild(w,_));const x=l.results[0];let I="none";(x==null?void 0:x[G])==="scheduled"?I="scheduled":(x==null?void 0:x[G])==="running"?I="running":(x==null?void 0:x.status)==="skipped"?I="skipped":(x==null?void 0:x.status)==="interrupted"?I="none":x&&l.outcome()!=="expected"?I="failed":x&&l.outcome()==="expected"&&(I="passed"),_.tests.push(l);const b={kind:"test",id:l.id,title:h.name,location:l.location,test:l,parent:_,children:[],status:I,duration:l.results.length?Math.max(0,l.results[0].duration):0,project:h};this._addChild(_,b),this._treeItemByTestId.set(l.id,b),_.duration=_.children.reduce((D,C)=>D+C.duration,0)}};for(const h of(e==null?void 0:e.suites)||[])if(!(m&&!i.get(h.title)))for(const a of h.suites)if(r){if(d(h.project(),a,this.rootItem,"suites"),a.tests.length){const w=this._defaultDescribeItem();d(h.project(),a,w,"tests")}}else{const w=this._fileItem(a.location.file.split(c),!0);d(h.project(),a,w,"all")}for(const h of s){if(!h.location)continue;const a=this._fileItem(h.location.file.split(c),!0);a.hasLoadErrors=!0}}_addChild(t,e){t.children.push(e),e.parent=t,this._treeItemById.set(e.id,e)}filterTree(t,e,s){const i=t.trim().toLowerCase().split(" "),c=[...e.values()].some(Boolean),r=d=>{const h=[...d.tests[0].titlePath(),...d.tests[0].tags].join(" ").toLowerCase();return!i.every(a=>h.includes(a))&&!d.tests.some(a=>s==null?void 0:s.has(a.id))?!1:(d.children=d.children.filter(a=>!c||(s==null?void 0:s.has(a.test.id))||e.get(a.status)),d.tests=d.children.map(a=>a.test),!!d.children.length)},m=d=>{const h=[];for(const a of d.children)a.kind==="case"?r(a)&&h.push(a):(m(a),(a.children.length||a.hasLoadErrors)&&h.push(a));d.children=h};m(this.rootItem)}_fileItem(t,e){if(t.length===0)return this.rootItem;const s=t.join(this.pathSeparator),i=this._treeItemById.get(s);if(i)return i;const c=this._fileItem(t.slice(0,t.length-1),!1),r={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:c,children:[],status:"none",hasLoadErrors:!1};return this._addChild(c,r),r}_defaultDescribeItem(){let t=this._treeItemById.get("<anonymous>");return t||(t={kind:"group",subKind:"describe",id:"<anonymous>",title:"<anonymous>",location:{file:"",line:0,column:0},duration:0,parent:this.rootItem,children:[],status:"none",hasLoadErrors:!1},this._addChild(this.rootItem,t)),t}sortAndPropagateStatus(){Rt(this.rootItem)}flattenForSingleProject(){const t=e=>{e.kind==="case"&&e.children.length===1?(e.project=e.children[0].project,e.test=e.children[0].test,e.children=[],this._treeItemByTestId.set(e.test.id,e)):e.children.forEach(t)};t(this.rootItem)}shortenRoot(){let t=this.rootItem;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];t.location=this.rootItem.location,this.rootItem=t}fileNames(){const t=new Set,e=s=>{s.kind==="group"&&s.subKind==="file"?t.add(s.id):s.children.forEach(e)};return e(this.rootItem),[...t]}flatTreeItems(){const t=[],e=s=>{t.push(s),s.children.forEach(e)};return e(this.rootItem),t}treeItemById(t){return this._treeItemById.get(t)}collectTestIds(t){return ue(t)}}function Rt(o){for(const r of o.children)Rt(r);o.kind==="group"&&o.children.sort((r,m)=>r.location.file.localeCompare(m.location.file)||r.location.line-m.location.line);let t=o.children.length>0,e=o.children.length>0,s=!1,i=!1,c=!1;for(const r of o.children)e=e&&r.status==="skipped",t=t&&(r.status==="passed"||r.status==="skipped"),s=s||r.status==="failed",i=i||r.status==="running",c=c||r.status==="scheduled";i?o.status="running":c?o.status="scheduled":s?o.status="failed":e?o.status="skipped":t&&(o.status="passed")}function ue(o){const t=new Set,e=new Set,s=i=>{if(i.kind!=="test"&&i.kind!=="case"){i.children.forEach(s);return}let c=i;for(;c&&c.parent&&!(c.kind==="group"&&c.subKind==="file");)c=c.parent;e.add(c.location.file),i.kind==="case"?i.tests.forEach(r=>t.add(r.id)):t.add(i.id)};return s(o),{testIds:t,locations:e}}const G=Symbol("statusEx");class he{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new pt(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:Tt(t.pathSeparator),clearPreviousResultsWhenTestBegins:!0}),this._options=t}_createReporter(){return{version:()=>"v2",onConfigure:t=>{this.config=t,this._lastRunReceiver=new pt({version:()=>"v2",onBegin:e=>{this._lastRunTestCount=e.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:Tt(this._options.pathSeparator)}),this._lastRunReceiver.dispatch({method:"onConfigure",params:{config:t}})},onBegin:t=>{var e;if(this.rootSuite||(this.rootSuite=t),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((e=this._testResultsSnapshot)==null?void 0:e.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(t,e)=>{e[G]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[G]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1}}processGlobalReport(t){const e=new pt({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of t)e.dispatch(s)}processListReport(t){var s;const e=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(e.map(i=>[i.id,i.results])),this._receiver.reset();for(const i of t)this._receiver.dispatch(i)}processTestReportEvent(t){var e,s,i;(s=(e=this._lastRunReceiver)==null?void 0:e.dispatch(t))==null||s.catch(()=>{}),(i=this._receiver.dispatch(t))==null||i.catch(()=>{})}_handleOnError(t){var e,s;this.loadErrors.push(t),(s=(e=this._options).onError)==null||s.call(e,t),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new Z("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}function Tt(o){return(t,e)=>{const s=[];for(const i of[...t.split(o),...e.split(o)]){const c=o==="\\"&&s.length===1&&s[0].endsWith(":"),r=!s.length;if(!(!i&&!r&&!c)&&i!=="."){if(i===".."){s.pop();continue}s.push(i)}}return s.join(o)}}const fe=({source:o})=>{const[t,e]=zt(),[s,i]=H.useState(Kt()),[c]=H.useState(Vt(()=>import("./assets/xtermModule-CsJ4vdCR.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),r=H.useRef(null);return H.useEffect(()=>($t(i),()=>Ht(i)),[]),H.useEffect(()=>{const m=o.write,d=o.clear;return(async()=>{const{Terminal:h,FitAddon:a}=await c,w=e.current;if(!w)return;const S=s==="dark-mode"?ge:pe;if(r.current&&r.current.terminal.options.theme===S)return;r.current&&(w.textContent="");const l=new h({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"monospace",theme:S}),k=new a;l.loadAddon(k);for(const _ of o.pending)l.write(_);o.write=(_=>{o.pending.push(_),l.write(_)}),o.clear=()=>{o.pending=[],l.clear()},l.open(w),k.fit(),r.current={terminal:l,fitAddon:k}})(),()=>{o.clear=d,o.write=m}},[c,r,e,o,s]),H.useEffect(()=>{setTimeout(()=>{r.current&&(r.current.fitAddon.fit(),o.resize(r.current.terminal.cols,r.current.terminal.rows))},250)},[t,o]),n.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},pe={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},ge={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"},me=({filterText:o,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:c,testModel:r,runTests:m})=>{const[d,h]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>{var l;(l=a.current)==null||l.focus()},[]);const w=[...e.entries()].filter(([l,k])=>k).map(([l])=>l).join(" ")||"all",S=[...i.entries()].filter(([l,k])=>k).map(([l])=>l).join(" ")||"all";return n.jsxs("div",{className:"filters",children:[n.jsx(qt,{expanded:d,setExpanded:h,title:n.jsx("input",{ref:a,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:o,onChange:l=>{t(l.target.value)},onKeyDown:l=>{l.key==="Enter"&&m()}})}),n.jsxs("div",{className:"filter-summary",title:"Status: "+w+`
3
+ Projects: `+S,onClick:()=>h(!d),children:[n.jsx("span",{className:"filter-label",children:"Status:"})," ",w,n.jsx("span",{className:"filter-label",children:"Projects:"})," ",S]}),d&&n.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[n.jsx("div",{className:"filter-list",role:"list","data-testid":"status-filters",children:[...e.entries()].map(([l,k])=>n.jsx("div",{className:"filter-entry",role:"listitem",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:k,onChange:()=>{const _=new Map(e);_.set(l,!_.get(l)),s(_)}}),n.jsx("div",{children:l})]})},l))}),n.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...i.entries()].map(([l,k])=>n.jsx("div",{className:"filter-entry",role:"listitem",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:k,onChange:()=>{var I;const _=new Map(i);_.set(l,!_.get(l)),c(_);const x=(I=r==null?void 0:r.config)==null?void 0:I.configFile;x&&yt.setObject(x+":projects",[..._.entries()].filter(([b,D])=>D).map(([b])=>b))}}),n.jsx("div",{children:l||"untitled"})]})},l))})]})]})},_e=({tag:o,style:t,onClick:e})=>n.jsx("span",{className:mt("tag",`tag-color-${ve(o)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${o}`,children:o});function ve(o){let t=0;for(let e=0;e<o.length;e++)t=o.charCodeAt(e)+((t<<8)-t);return Math.abs(t%6)}const we=Yt,be=({filterText:o,testModel:t,testServerConnection:e,testTree:s,runTests:i,runningState:c,watchAll:r,watchedTreeIds:m,setWatchedTreeIds:d,isLoading:h,onItemSelected:a,requestedCollapseAllCount:w,requestedExpandAllCount:S,setFilterText:l,onRevealSource:k})=>{const[_,x]=u.useState({expandedItems:new Map}),[I,b]=u.useState(),[D,C]=u.useState(w),[U,tt]=u.useState(S);u.useEffect(()=>{if(D!==w){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!1);C(w),b(void 0),x({..._});return}if(U!==S){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!0);tt(S),b(void 0),x({..._});return}if(!c||c.itemSelectedByUser)return;let f;const R=j=>{var M;j.children.forEach(R),!f&&j.status==="failed"&&(j.kind==="test"&&c.testIds.has(j.test.id)||j.kind==="case"&&c.testIds.has((M=j.tests[0])==null?void 0:M.id))&&(f=j)};R(s.rootItem),f&&b(f.id)},[c,b,s,D,C,w,U,tt,S,_,x]);const P=u.useMemo(()=>{if(I)return s.treeItemById(I)},[I,s]);u.useEffect(()=>{if(!t)return;const f=xe(P,t);let R;(P==null?void 0:P.kind)==="test"?R=P.test:(P==null?void 0:P.kind)==="case"&&P.tests.length===1&&(R=P.tests[0]),a({treeItem:P,testCase:R,testFile:f})},[t,P,a]),u.useEffect(()=>{if(!h)if(r)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const f=new Set;for(const R of m.value){const j=s.treeItemById(R),M=j==null?void 0:j.location.file;M&&f.add(M)}e==null||e.watchNoReply({fileNames:[...f]})}},[h,s,r,m,e]);const $=f=>{b(f.id),i("bounce-if-busy",s.collectTestIds(f))},K=(f,R)=>{if(f.preventDefault(),f.stopPropagation(),f.metaKey||f.ctrlKey){const j=o.split(" ");j.includes(R)?l(j.filter(M=>M!==R).join(" ").trim()):l((o+" "+R).trim())}else l((o.split(" ").filter(j=>!j.startsWith("@")).join(" ")+" "+R).trim())};return n.jsx(we,{name:"tests",treeState:_,setTreeState:x,rootItem:s.rootItem,dataTestId:"test-tree",render:f=>{const R=f.id.replace(/[^\w\d-_]/g,"-"),j=R+"-label",M=R+"-time";return n.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${j} ${M}`,children:[n.jsxs("div",{id:j,className:"ui-mode-tree-item-title",children:[n.jsx("span",{children:f.title}),f.kind==="case"?f.tags.map(Y=>n.jsx(_e,{tag:Y.slice(1),onClick:ct=>K(ct,Y)},Y)):null]}),!!f.duration&&f.status!=="skipped"&&n.jsx("div",{id:M,className:"ui-mode-tree-item-time",children:Xt(f.duration)}),n.jsxs(q,{noMinHeight:!0,noShadow:!0,children:[n.jsx(F,{icon:"play",title:"Run",onClick:()=>$(f),disabled:!!c&&!c.completed}),n.jsx(F,{icon:"go-to-file",title:"Show source",onClick:k,style:f.kind==="group"&&f.subKind==="folder"?{visibility:"hidden"}:{}}),!r&&n.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(f.id)?m.value.delete(f.id):m.value.add(f.id),d({...m})},toggled:m.value.has(f.id)})]})]})},icon:f=>Qt(f.status),title:f=>f.title,selectedItem:P,onAccepted:$,onSelected:f=>{c&&(c.itemSelectedByUser=!0),b(f.id)},isError:f=>f.kind==="group"?f.hasLoadErrors:!1,autoExpandDepth:o?5:1,noItemsMessage:h?"Loading…":"No tests"})};function xe(o,t){if(!(!o||!t))return{file:o.location.file,line:o.location.line,column:o.location.column,source:{errors:t.loadErrors.filter(e=>{var s;return((s=e.location)==null?void 0:s.file)===o.location.file}).map(e=>({line:e.location.line,message:e.message})),content:void 0}}}function Se(o){return`.playwright-artifacts-${o}`}const Te=({item:o,rootDir:t,onOpenExternally:e,revealSource:s,pathSeparator:i})=>{var w,S;const[c,r]=u.useState(void 0),[m,d]=u.useState(0),h=u.useRef(null),{outputDir:a}=u.useMemo(()=>({outputDir:o.testCase?ke(o.testCase):void 0}),[o]);return u.useEffect(()=>{var x,I;h.current&&clearTimeout(h.current);const l=(x=o.testCase)==null?void 0:x.results[0];if(!l){r(void 0);return}const k=l&&l.duration>=0&&l.attachments.find(b=>b.name==="trace");if(k&&k.path){kt(k.path).then(b=>r({model:b,isLive:!1}));return}if(!a){r(void 0);return}const _=[a,Se(l.workerIndex),"traces",`${(I=o.testCase)==null?void 0:I.id}.json`].join(i);return h.current=setTimeout(async()=>{try{const b=await kt(_);r({model:b,isLive:!0})}catch{const b=new Et("",[]);b.errorDescriptors.push(...l.errors.flatMap(D=>D.message?[{message:D.message}]:[])),r({model:b,isLive:!1})}finally{d(m+1)}},500),()=>{h.current&&clearTimeout(h.current)}},[a,o,r,m,d,i]),n.jsx(Jt,{model:c==null?void 0:c.model,showSourcesFirst:!0,rootDir:t,fallbackLocation:o.testFile,isLive:c==null?void 0:c.isLive,status:(w=o.treeItem)==null?void 0:w.status,annotations:((S=o.testCase)==null?void 0:S.annotations)??[],onOpenExternally:e,revealSource:s},"workbench")},ke=o=>{var t;for(let e=o.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir};async function kt(o){const t=new URLSearchParams;t.set("trace",o);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new Et(o,s)}let jt={cols:80};const z={pending:[],clear:()=>{},write:o=>z.pending.push(o),resize:()=>{}},A=new URLSearchParams(window.location.search),je=new URL(A.get("server")??"../",window.location.href),_t=new URL(A.get("ws"),je);_t.protocol=_t.protocol==="https:"?"wss:":"ws:";const B={args:A.getAll("arg"),grep:A.get("grep")||void 0,grepInvert:A.get("grepInvert")||void 0,projects:A.getAll("project"),workers:A.get("workers")||void 0,headed:A.has("headed"),updateSnapshots:A.get("updateSnapshots")||void 0,reporters:A.has("reporter")?A.getAll("reporter"):void 0,pathSeparator:A.get("pathSeparator")||"/"};B.updateSnapshots&&!["all","changed","none","missing"].includes(B.updateSnapshots)&&(B.updateSnapshots=void 0);const It=navigator.platform==="MacIntel";function Ie(o){return o.startsWith("/")&&(o=o.substring(1)),o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const ye=({})=>{var xt;const[o,t]=u.useState(""),[e,s]=u.useState(!1),[i,c]=u.useState(!1),[r,m]=u.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[d,h]=u.useState(new Map),[a,w]=u.useState(),[S,l]=u.useState(),[k,_]=u.useState({}),[x,I]=u.useState(!1),[b,D]=u.useState(),C=b&&!b.completed,[U,tt]=at("watch-all",!1),[P,$]=u.useState({value:new Set}),K=u.useRef(Promise.resolve()),f=u.useRef({testIds:new Set,locations:new Set}),[R,j]=u.useState(0),[M,Y]=u.useState(0),[ct,Bt]=u.useState(!1),[vt,wt]=u.useState(!0),[v,Ct]=u.useState(),[et,Pt]=u.useState(),[st,Nt]=u.useState(!1),[it,Lt]=u.useState(!1),[Dt,bt]=u.useState(!1),Mt=u.useCallback(()=>bt(!0),[bt]),[dt,Ft]=at("single-worker",!1),[ut,Ot]=at("updateSnapshots","missing"),[Q]=at("mergeFiles",!1),At=u.useRef(null),ot=u.useCallback(()=>{Ct(p=>(p==null||p.close(),new Zt(new Gt(_t))))},[]);u.useEffect(()=>{var p;(p=At.current)==null||p.focus(),I(!0),ot()},[ot]),u.useEffect(()=>{if(!v)return;const p=[v.onStdio(g=>{if(g.buffer){const T=atob(g.buffer);z.write(T)}else z.write(g.text);g.type==="stderr"&&c(!0)}),v.onClose(()=>Bt(!0))];return z.resize=(g,T)=>{jt={cols:g,rows:T},v.resizeTerminalNoReply({cols:g,rows:T})},()=>{for(const g of p)g.dispose()}},[v]),u.useEffect(()=>{if(!v)return;let p;const g=new he({onUpdate:T=>{clearTimeout(p),p=void 0,T?w(g.asModel()):p||(p=setTimeout(()=>{w(g.asModel())},250))},onError:T=>{z.write((T.stack||T.value||"")+`
4
+ `),c(!0)},pathSeparator:B.pathSeparator});return Pt(g),w(void 0),I(!0),$({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:T,report:E}=await v.runGlobalSetup({});if(g.processGlobalReport(E),T!=="passed")return;const N=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});g.processListReport(N.report),v.onReport(V=>{g.processTestReportEvent(V)});const{hasBrowsers:O}=await v.checkBrowsers({});wt(O)}finally{I(!1)}})(),()=>{clearTimeout(p)}},[v]),u.useEffect(()=>{if(!a)return;const{config:p,rootSuite:g}=a,T=p.configFile?yt.getObject(p.configFile+":projects",void 0):void 0,E=new Map(d);for(const N of E.keys())g.suites.find(O=>O.title===N)||E.delete(N);for(const N of g.suites)E.has(N.title)||E.set(N.title,!!(T!=null&&T.includes(N.title)));!T&&E.size&&![...E.values()].includes(!0)&&E.set(E.entries().next().value[0],!0),(d.size!==E.size||[...d].some(([N,O])=>E.get(N)!==O))&&h(E)},[d,a]),u.useEffect(()=>{C&&(a!=null&&a.progress)?l(a.progress):a||l(void 0)},[a,C]);const{testTree:rt}=u.useMemo(()=>{if(!a)return{testTree:new gt("",new Z("","root"),[],d,B.pathSeparator,Q)};const p=new gt("",a.rootSuite,a.loadErrors,d,B.pathSeparator,Q);return p.filterTree(o,r,C?b==null?void 0:b.testIds:void 0),p.sortAndPropagateStatus(),p.shortenRoot(),p.flattenForSingleProject(),{testTree:p}},[o,a,r,d,b,C,Q]),X=u.useCallback((p,g)=>{if(!(!v||!a)&&!(p==="bounce-if-busy"&&C)){for(const T of g.testIds)f.current.testIds.add(T);for(const T of g.locations)f.current.locations.add(T);K.current=K.current.then(async()=>{var O,V,W;const{testIds:T,locations:E}=f.current;if(f.current={testIds:new Set,locations:new Set},!T.size)return;{for(const y of((O=a.rootSuite)==null?void 0:O.allTests())||[])if(T.has(y.id)){y.results=[];const L=y._createTestResult("pending");L[G]="scheduled"}w({...a})}const N=" ["+new Date().toLocaleTimeString()+"]";z.write("\x1B[2m—".repeat(Math.max(0,jt.cols-N.length))+N+"\x1B[22m"),l({total:0,passed:0,failed:0,skipped:0}),D({testIds:T}),await v.runTests({locations:[...E].map(Ie),grep:B.grep,grepInvert:B.grepInvert,testIds:[...T],projects:[...d].filter(([y,L])=>L).map(([y])=>y),updateSnapshots:ut,reporters:B.reporters,workers:dt?1:void 0,trace:"on"});for(const y of((V=a.rootSuite)==null?void 0:V.allTests())||[])((W=y.results[0])==null?void 0:W.duration)===-1&&(y.results=[]);w({...a}),D(y=>y?{...y,completed:!0}:void 0)})}},[d,C,a,v,ut,dt]),nt=u.useCallback(()=>X("bounce-if-busy",rt.collectTestIds(rt.rootItem)),[X,rt]);u.useEffect(()=>{if(!v||!et)return;const p=v.onTestFilesChanged(async g=>{if(K.current=K.current.then(async()=>{I(!0);try{const W=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});et.processListReport(W.report)}catch(W){console.log(W)}finally{I(!1)}}),await K.current,g.testFiles.length===0)return;const T=et.asModel(),E=new gt("",T.rootSuite,T.loadErrors,d,B.pathSeparator,Q),N=[],O=[],V=new Set(g.testFiles);if(U){const W=y=>{const L=y.location.file;if(L&&V.has(L)){const J=E.collectTestIds(y);N.push(...J.locations),O.push(...J.testIds)}y.kind==="group"&&y.subKind==="folder"&&y.children.forEach(W)};W(E.rootItem)}else for(const W of P.value){const y=E.treeItemById(W);if(!y)continue;let L=y;for(;!(L.kind==="group"&&(L.subKind==="file"||L.subKind==="folder"))&&L.parent;)L=L.parent;const J=L==null?void 0:L.location.file;if(J&&V.has(J)){const St=E.collectTestIds(y);N.push(...St.locations),O.push(...St.testIds)}}X("queue-if-busy",{locations:N,testIds:O})});return()=>p.dispose()},[X,v,U,P,et,d,Q]),u.useEffect(()=>{if(!v)return;const p=g=>{g.code==="Backquote"&&g.ctrlKey?(g.preventDefault(),s(!e)):g.code==="F5"&&g.shiftKey?(g.preventDefault(),v==null||v.stopTestsNoReply({})):g.code==="F5"&&(g.preventDefault(),nt())};return addEventListener("keydown",p),()=>{removeEventListener("keydown",p)}},[nt,ot,v,e]);const ht=u.useRef(null),Wt=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.showModal()},[]),ft=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.close()},[]),Ut=u.useCallback(p=>{ft(p),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));wt(g)})},[ft,v]);return n.jsxs("div",{className:"vbox ui-mode",children:[!vt&&n.jsxs("dialog",{ref:ht,children:[n.jsxs("div",{className:"title",children:[n.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),n.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",n.jsx("br",{}),"Would you like to run `playwright install`?",n.jsx("br",{}),n.jsx("button",{className:"button",onClick:Ut,children:"Install"}),n.jsx("button",{className:"button secondary",onClick:ft,children:"Dismiss"})]})]}),ct&&n.jsxs("div",{className:"disconnected",children:[n.jsx("div",{className:"title",children:"UI Mode disconnected"}),n.jsxs("div",{children:[n.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),n.jsx(te,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:n.jsxs("div",{className:"vbox",children:[n.jsxs("div",{className:mt("vbox",!e&&"hidden"),children:[n.jsxs(q,{children:[n.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),n.jsx(F,{icon:"circle-slash",title:"Clear output",onClick:()=>{z.clear(),c(!1)}}),n.jsx("div",{className:"spacer"}),n.jsx(F,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),n.jsx(fe,{source:z})]}),n.jsx("div",{className:mt("vbox",e&&"hidden"),children:n.jsx(Te,{pathSeparator:B.pathSeparator,item:k,rootDir:(xt=a==null?void 0:a.config)==null?void 0:xt.rootDir,revealSource:Dt,onOpenExternally:p=>v==null?void 0:v.openNoReply({location:{file:p.file,line:p.line,column:p.column}})})})]}),sidebar:n.jsxs("div",{className:"vbox ui-mode-sidebar",children:[n.jsxs(q,{noShadow:!0,noMinHeight:!0,children:[n.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),n.jsx("div",{className:"section-title",children:"Playwright"}),n.jsx(F,{icon:"refresh",title:"Reload",onClick:()=>ot(),disabled:C||x}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(F,{icon:"terminal",title:"Toggle output — "+(It?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),i&&n.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!vt&&n.jsx(F,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Wt})]}),n.jsx(me,{filterText:o,setFilterText:t,statusFilters:r,setStatusFilters:m,projectFilters:d,setProjectFilters:h,testModel:a,runTests:nt}),n.jsxs(q,{className:"section-toolbar",noMinHeight:!0,children:[!C&&!S&&n.jsx("div",{className:"section-title",children:"Tests"}),!C&&S&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:[S.passed,"/",S.total," passed (",S.passed/S.total*100|0,"%)"]})}),C&&S&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:["Running ",S.passed,"/",b.testIds.size," passed (",S.passed/b.testIds.size*100|0,"%)"]})}),n.jsx(F,{icon:"play",title:"Run all — F5",onClick:nt,disabled:C||x}),n.jsx(F,{icon:"debug-stop",title:"Stop — "+(It?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!C||x}),n.jsx(F,{icon:"eye",title:"Watch all",toggled:U,onClick:()=>{$({value:new Set}),tt(!U)}}),n.jsx(F,{icon:"collapse-all",title:"Collapse all",onClick:()=>{j(R+1)}}),n.jsx(F,{icon:"expand-all",title:"Expand all",onClick:()=>{Y(M+1)}})]}),n.jsx(be,{filterText:o,testModel:a,testTree:rt,testServerConnection:v,runningState:b,runTests:X,onItemSelected:_,watchAll:U,watchedTreeIds:P,setWatchedTreeIds:$,isLoading:x,requestedCollapseAllCount:R,requestedExpandAllCount:M,setFilterText:t,onRevealSource:Mt}),n.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Lt(!it),children:[n.jsx("span",{className:`codicon codicon-${it?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:it?"Hide Testing Options":"Show Testing Options"}),n.jsx("div",{className:"section-title",children:"Testing Options"})]}),it&&n.jsx(ee,{settings:[{type:"check",value:dt,set:Ft,name:"Single worker"},{type:"select",options:[{label:"All",value:"all"},{label:"Changed",value:"changed"},{label:"Missing",value:"missing"},{label:"None",value:"none"}],value:ut,set:Ot,name:"Update snapshots"}]}),n.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Nt(!st),children:[n.jsx("span",{className:`codicon codicon-${st?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:st?"Hide Settings":"Show Settings"}),n.jsx("div",{className:"section-title",children:"Settings"})]}),st&&n.jsx(se,{location:"ui-mode"})]})})]})};(async()=>{if(ie(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(o=>setTimeout(o,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
5
+ Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(o=>{navigator.serviceWorker.oncontrollerchange=()=>o()}),setInterval(function(){fetch("ping")},1e4)}oe.createRoot(document.querySelector("#root")).render(n.jsx(ye,{}))})();
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
8
8
  <title>Playwright Test</title>
9
- <script type="module" crossorigin src="./uiMode.CmFFBCQb.js"></script>
9
+ <script type="module" crossorigin src="./uiMode.DiEbKRwa.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="./assets/defaultSettingsView-V7hnXDpz.js">
11
11
  <link rel="stylesheet" crossorigin href="./defaultSettingsView.CpI7RarT.css">
12
12
  <link rel="stylesheet" crossorigin href="./uiMode.Btcz36p_.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-core",
3
- "version": "1.58.0-alpha-2025-12-09",
3
+ "version": "1.58.0-alpha-2025-12-10",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-CsJ4vdCR.js","./xtermModule.DYP7pi_n.css"])))=>i.map(i=>d[i]);
2
- import{u as zt,r as H,g as Kt,_ as Vt,h as $t,i as Ht,j as n,R as u,E as qt,s as Et,k as mt,l as Yt,t as Qt,m as Xt,n as q,o as F,T as It,c as Jt,p as at,a as Zt,W as Gt,S as te,q as ee,b as se,e as ie,f as oe}from"./assets/defaultSettingsView-V7hnXDpz.js";var ne={};class pt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new Z("","root"),this._options=e,this._reporter=t}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onAttach"){this._onAttach(s.testId,s.resultId,s.attachments);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===t.name):void 0;e||(e=new Z(t.name,"project"),this._rootSuite._addSuite(e)),e._project=this._parseProject(t);for(const s of t.suites)this._mergeSuiteInto(s,e)}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var c,r;const s=this._tests.get(t);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const o=s._createTestResult(e.id);o.retry=e.retry,o.workerIndex=e.workerIndex,o.parallelIndex=e.parallelIndex,o.setStartTimeNumber(e.startTime),(r=(c=this._reporter).onTestBegin)==null||r.call(c,s,o)}_onTestEnd(t,e){var c,r,m;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const o=s.results.find(d=>d._id===e.id);o.duration=e.duration,o.status=e.status,o.errors=e.errors,o.error=(c=o.errors)==null?void 0:c[0],e.attachments&&(o.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),o.annotations=e.annotations,s.annotations=e.annotations),(m=(r=this._reporter).onTestEnd)==null||m.call(r,s,o),o._stepMap=new Map}_onStepBegin(t,e,s){var f,a;const o=this._tests.get(t),c=o.results.find(w=>w._id===e),r=s.parentStepId?c._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),d=new ae(s,r,m,c);r?r.steps.push(d):c.steps.push(d),c._stepMap.set(s.id,d),(a=(f=this._reporter).onStepBegin)==null||a.call(f,o,c,d)}_onStepEnd(t,e,s){var m,d;const o=this._tests.get(t),c=o.results.find(f=>f._id===e),r=c._stepMap.get(s.id);r._endPayload=s,r.duration=s.duration,r.error=s.error,(d=(m=this._reporter).onStepEnd)==null||d.call(m,o,c,r)}_onAttach(t,e,s){this._tests.get(t).results.find(r=>r._id===e).attachments.push(...s.map(r=>({name:r.name,contentType:r.contentType,path:r.path,body:r.base64&&globalThis.Buffer?Buffer.from(r.base64,"base64"):void 0})))}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,o,c){var f,a,w,S;const r=c?globalThis.Buffer?Buffer.from(o,"base64"):atob(o):o,m=e?this._tests.get(e):void 0,d=m&&s?m.results.find(l=>l._id===s):void 0;t==="stdout"?(d==null||d.stdout.push(r),(a=(f=this._reporter).onStdOut)==null||a.call(f,r,m,d)):(d==null||d.stderr.push(r),(S=(w=this._reporter).onStdErr)==null||S.call(w,r,m,d))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,{status:t.status,startTime:new Date(t.startTime),duration:t.duration}))}_onExit(){var t,e;return(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...ce,...t};return this._options.configOverrides&&(e.configFile=this._options.configOverrides.configFile,e.reportSlowTests=this._options.configOverrides.reportSlowTests,e.quiet=this._options.configOverrides.quiet,e.reporter=[...this._options.configOverrides.reporter]),e}_parseProject(t){return{metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:lt(t.testIgnore),testMatch:lt(t.testMatch),timeout:t.timeout,grep:lt(t.grep),grepInvert:lt(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:t.use}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuiteInto(t,e){let s=e.suites.find(o=>o.title===t.title);s||(s=new Z(t.title,e.type==="project"?"file":"describe"),e._addSuite(s)),s.location=this._absoluteLocation(t.location),t.entries.forEach(o=>{"testId"in o?this._mergeTestInto(o,s):this._mergeSuiteInto(o,s)})}_mergeTestInto(t,e){let s=this._options.mergeTestCases?e.tests.find(o=>o.title===t.title&&o.repeatEachIndex===t.repeatEachIndex):void 0;s||(s=new re(t.testId,t.title,this._absoluteLocation(t.location),t.repeatEachIndex),e._addTest(s),this._tests.set(s.id,s)),this._updateTest(t,s)}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e.tags=t.tags??[],e.annotations=t.annotations??[],this._absoluteAnnotationLocationsInplace(e.annotations),e}_absoluteAnnotationLocationsInplace(t){for(const e of t)e.location&&(e.location=this._absoluteLocation(e.location))}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){if(t!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,t):this._rootDir+"/"+t}}class Z{constructor(t,e){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=t,this._type=e}get type(){return this._type}get suites(){return this._entries.filter(t=>t.type!=="test")}get tests(){return this._entries.filter(t=>t.type==="test")}entries(){return this._entries}allTests(){const t=[],e=s=>{for(const o of s.entries())o.type==="test"?t.push(o):e(o)};return e(this),t}titlePath(){const t=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&t.push(this.title),t}project(){var t;return this._project??((t=this.parent)==null?void 0:t.project())}_addTest(t){t.parent=this,this._entries.push(t)}_addSuite(t){t.parent=this,this._entries.push(t)}}class re{constructor(t,e,s,o){this.fn=()=>{},this.results=[],this.type="test",this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.id=t,this.title=e,this.location=s,this.repeatEachIndex=o}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){return de(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new le(this.results.length,t);return this.results.push(e),e}}class ae{constructor(t,e,s,o){this.duration=-1,this.steps=[],this._startTime=0,this.title=t.title,this.category=t.category,this.location=s,this.parent=e,this._startTime=t.startTime,this._result=o}titlePath(){var e;return[...((e=this.parent)==null?void 0:e.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}get attachments(){var t,e;return((e=(t=this._endPayload)==null?void 0:t.attachments)==null?void 0:e.map(s=>this._result.attachments[s]))??[]}get annotations(){var t;return((t=this._endPayload)==null?void 0:t.annotations)??[]}}class le{constructor(t,e){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.annotations=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=t,this._id=e}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const ce={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[ne.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:3e5},configFile:"",rootDir:"",quiet:!1,shard:null,tags:[],updateSnapshots:"missing",updateSourceMethod:"patch",version:"",workers:0,webServer:null};function lt(i){return i.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function de(i){let t=0,e=0,s=0;for(const o of i.results)o.status==="interrupted"||(o.status==="skipped"&&i.expectedStatus==="skipped"?++t:o.status==="skipped"||(o.status===i.expectedStatus?++e:++s));return e===0&&s===0?"skipped":s===0?"expected":e===0&&t===0?"unexpected":"flaky"}class gt{constructor(t,e,s,o,c,r){this._treeItemById=new Map,this._treeItemByTestId=new Map;const m=o&&[...o.values()].some(Boolean);this.pathSeparator=c,this.rootItem={kind:"group",subKind:"folder",id:t,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(t,this.rootItem);const d=(f,a,w,S)=>{for(const l of S==="tests"?[]:a.suites){if(!l.title){d(f,l,w,"all");continue}let k=w.children.find(_=>_.kind==="group"&&_.title===l.title);k||(k={kind:"group",subKind:"describe",id:"suite:"+a.titlePath().join("")+""+l.title,title:l.title,location:l.location,duration:0,parent:w,children:[],status:"none",hasLoadErrors:!1},this._addChild(w,k)),d(f,l,k,"all")}for(const l of S==="suites"?[]:a.tests){const k=l.title;let _=w.children.find(D=>D.kind!=="group"&&D.title===k);_||(_={kind:"case",id:"test:"+l.titlePath().join(""),title:k,parent:w,children:[],tests:[],location:l.location,duration:0,status:"none",project:void 0,test:void 0,tags:l.tags},this._addChild(w,_));const x=l.results[0];let y="none";(x==null?void 0:x[G])==="scheduled"?y="scheduled":(x==null?void 0:x[G])==="running"?y="running":(x==null?void 0:x.status)==="skipped"?y="skipped":(x==null?void 0:x.status)==="interrupted"?y="none":x&&l.outcome()!=="expected"?y="failed":x&&l.outcome()==="expected"&&(y="passed"),_.tests.push(l);const b={kind:"test",id:l.id,title:f.name,location:l.location,test:l,parent:_,children:[],status:y,duration:l.results.length?Math.max(0,l.results[0].duration):0,project:f};this._addChild(_,b),this._treeItemByTestId.set(l.id,b),_.duration=_.children.reduce((D,C)=>D+C.duration,0)}};for(const f of(e==null?void 0:e.suites)||[])if(!(m&&!o.get(f.title)))for(const a of f.suites)if(r){if(d(f.project(),a,this.rootItem,"suites"),a.tests.length){const w=this._defaultDescribeItem();d(f.project(),a,w,"tests")}}else{const w=this._fileItem(a.location.file.split(c),!0);d(f.project(),a,w,"all")}for(const f of s){if(!f.location)continue;const a=this._fileItem(f.location.file.split(c),!0);a.hasLoadErrors=!0}}_addChild(t,e){t.children.push(e),e.parent=t,this._treeItemById.set(e.id,e)}filterTree(t,e,s){const o=t.trim().toLowerCase().split(" "),c=[...e.values()].some(Boolean),r=d=>{const f=[...d.tests[0].titlePath(),...d.tests[0].tags].join(" ").toLowerCase();return!o.every(a=>f.includes(a))&&!d.tests.some(a=>s==null?void 0:s.has(a.id))?!1:(d.children=d.children.filter(a=>!c||(s==null?void 0:s.has(a.test.id))||e.get(a.status)),d.tests=d.children.map(a=>a.test),!!d.children.length)},m=d=>{const f=[];for(const a of d.children)a.kind==="case"?r(a)&&f.push(a):(m(a),(a.children.length||a.hasLoadErrors)&&f.push(a));d.children=f};m(this.rootItem)}_fileItem(t,e){if(t.length===0)return this.rootItem;const s=t.join(this.pathSeparator),o=this._treeItemById.get(s);if(o)return o;const c=this._fileItem(t.slice(0,t.length-1),!1),r={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:c,children:[],status:"none",hasLoadErrors:!1};return this._addChild(c,r),r}_defaultDescribeItem(){let t=this._treeItemById.get("<anonymous>");return t||(t={kind:"group",subKind:"describe",id:"<anonymous>",title:"<anonymous>",location:{file:"",line:0,column:0},duration:0,parent:this.rootItem,children:[],status:"none",hasLoadErrors:!1},this._addChild(this.rootItem,t)),t}sortAndPropagateStatus(){Rt(this.rootItem)}flattenForSingleProject(){const t=e=>{e.kind==="case"&&e.children.length===1?(e.project=e.children[0].project,e.test=e.children[0].test,e.children=[],this._treeItemByTestId.set(e.test.id,e)):e.children.forEach(t)};t(this.rootItem)}shortenRoot(){let t=this.rootItem;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];t.location=this.rootItem.location,this.rootItem=t}fileNames(){const t=new Set,e=s=>{s.kind==="group"&&s.subKind==="file"?t.add(s.id):s.children.forEach(e)};return e(this.rootItem),[...t]}flatTreeItems(){const t=[],e=s=>{t.push(s),s.children.forEach(e)};return e(this.rootItem),t}treeItemById(t){return this._treeItemById.get(t)}collectTestIds(t){return ue(t)}}function Rt(i){for(const r of i.children)Rt(r);i.kind==="group"&&i.children.sort((r,m)=>r.location.file.localeCompare(m.location.file)||r.location.line-m.location.line);let t=i.children.length>0,e=i.children.length>0,s=!1,o=!1,c=!1;for(const r of i.children)e=e&&r.status==="skipped",t=t&&(r.status==="passed"||r.status==="skipped"),s=s||r.status==="failed",o=o||r.status==="running",c=c||r.status==="scheduled";o?i.status="running":c?i.status="scheduled":s?i.status="failed":e?i.status="skipped":t&&(i.status="passed")}function ue(i){const t=new Set,e=new Set,s=o=>{if(o.kind!=="test"&&o.kind!=="case"){o.children.forEach(s);return}let c=o;for(;c&&c.parent&&!(c.kind==="group"&&c.subKind==="file");)c=c.parent;e.add(c.location.file),o.kind==="case"?o.tests.forEach(r=>t.add(r.id)):t.add(o.id)};return s(i),{testIds:t,locations:e}}const G=Symbol("statusEx");class he{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new pt(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:Tt(t.pathSeparator),clearPreviousResultsWhenTestBegins:!0}),this._options=t}_createReporter(){return{version:()=>"v2",onConfigure:t=>{this.config=t,this._lastRunReceiver=new pt({version:()=>"v2",onBegin:e=>{this._lastRunTestCount=e.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:Tt(this._options.pathSeparator)}),this._lastRunReceiver.dispatch({method:"onConfigure",params:{config:t}})},onBegin:t=>{var e;if(this.rootSuite||(this.rootSuite=t),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((e=this._testResultsSnapshot)==null?void 0:e.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(t,e)=>{e[G]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[G]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1}}processGlobalReport(t){const e=new pt({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of t)e.dispatch(s)}processListReport(t){var s;const e=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(e.map(o=>[o.id,o.results])),this._receiver.reset();for(const o of t)this._receiver.dispatch(o)}processTestReportEvent(t){var e,s,o;(s=(e=this._lastRunReceiver)==null?void 0:e.dispatch(t))==null||s.catch(()=>{}),(o=this._receiver.dispatch(t))==null||o.catch(()=>{})}_handleOnError(t){var e,s;this.loadErrors.push(t),(s=(e=this._options).onError)==null||s.call(e,t),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new Z("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}function Tt(i){return(t,e)=>{const s=[];for(const o of[...t.split(i),...e.split(i)]){const c=i==="\\"&&s.length===1&&s[0].endsWith(":"),r=!s.length;if(!(!o&&!r&&!c)&&o!=="."){if(o===".."){s.pop();continue}s.push(o)}}return s.join(i)}}const fe=({source:i})=>{const[t,e]=zt(),[s,o]=H.useState(Kt()),[c]=H.useState(Vt(()=>import("./assets/xtermModule-CsJ4vdCR.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),r=H.useRef(null);return H.useEffect(()=>($t(o),()=>Ht(o)),[]),H.useEffect(()=>{const m=i.write,d=i.clear;return(async()=>{const{Terminal:f,FitAddon:a}=await c,w=e.current;if(!w)return;const S=s==="dark-mode"?ge:pe;if(r.current&&r.current.terminal.options.theme===S)return;r.current&&(w.textContent="");const l=new f({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"monospace",theme:S}),k=new a;l.loadAddon(k);for(const _ of i.pending)l.write(_);i.write=(_=>{i.pending.push(_),l.write(_)}),i.clear=()=>{i.pending=[],l.clear()},l.open(w),k.fit(),r.current={terminal:l,fitAddon:k}})(),()=>{i.clear=d,i.write=m}},[c,r,e,i,s]),H.useEffect(()=>{setTimeout(()=>{r.current&&(r.current.fitAddon.fit(),i.resize(r.current.terminal.cols,r.current.terminal.rows))},250)},[t,i]),n.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},pe={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},ge={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"},me=({filterText:i,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:o,setProjectFilters:c,testModel:r,runTests:m})=>{const[d,f]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>{var l;(l=a.current)==null||l.focus()},[]);const w=[...e.entries()].filter(([l,k])=>k).map(([l])=>l).join(" ")||"all",S=[...o.entries()].filter(([l,k])=>k).map(([l])=>l).join(" ")||"all";return n.jsxs("div",{className:"filters",children:[n.jsx(qt,{expanded:d,setExpanded:f,title:n.jsx("input",{ref:a,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:l=>{t(l.target.value)},onKeyDown:l=>{l.key==="Enter"&&m()}})}),n.jsxs("div",{className:"filter-summary",title:"Status: "+w+`
3
- Projects: `+S,onClick:()=>f(!d),children:[n.jsx("span",{className:"filter-label",children:"Status:"})," ",w,n.jsx("span",{className:"filter-label",children:"Projects:"})," ",S]}),d&&n.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[n.jsx("div",{className:"filter-list",role:"list","data-testid":"status-filters",children:[...e.entries()].map(([l,k])=>n.jsx("div",{className:"filter-entry",role:"listitem",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:k,onChange:()=>{const _=new Map(e);_.set(l,!_.get(l)),s(_)}}),n.jsx("div",{children:l})]})},l))}),n.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...o.entries()].map(([l,k])=>n.jsx("div",{className:"filter-entry",role:"listitem",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:k,onChange:()=>{var y;const _=new Map(o);_.set(l,!_.get(l)),c(_);const x=(y=r==null?void 0:r.config)==null?void 0:y.configFile;x&&Et.setObject(x+":projects",[..._.entries()].filter(([b,D])=>D).map(([b])=>b))}}),n.jsx("div",{children:l||"untitled"})]})},l))})]})]})},_e=({tag:i,style:t,onClick:e})=>n.jsx("span",{className:mt("tag",`tag-color-${ve(i)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${i}`,children:i});function ve(i){let t=0;for(let e=0;e<i.length;e++)t=i.charCodeAt(e)+((t<<8)-t);return Math.abs(t%6)}const we=Yt,be=({filterText:i,testModel:t,testServerConnection:e,testTree:s,runTests:o,runningState:c,watchAll:r,watchedTreeIds:m,setWatchedTreeIds:d,isLoading:f,onItemSelected:a,requestedCollapseAllCount:w,requestedExpandAllCount:S,setFilterText:l,onRevealSource:k})=>{const[_,x]=u.useState({expandedItems:new Map}),[y,b]=u.useState(),[D,C]=u.useState(w),[U,tt]=u.useState(S);u.useEffect(()=>{if(D!==w){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!1);C(w),b(void 0),x({..._});return}if(U!==S){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!0);tt(S),b(void 0),x({..._});return}if(!c||c.itemSelectedByUser)return;let h;const R=j=>{var M;j.children.forEach(R),!h&&j.status==="failed"&&(j.kind==="test"&&c.testIds.has(j.test.id)||j.kind==="case"&&c.testIds.has((M=j.tests[0])==null?void 0:M.id))&&(h=j)};R(s.rootItem),h&&b(h.id)},[c,b,s,D,C,w,U,tt,S,_,x]);const N=u.useMemo(()=>{if(y)return s.treeItemById(y)},[y,s]);u.useEffect(()=>{if(!t)return;const h=xe(N,t);let R;(N==null?void 0:N.kind)==="test"?R=N.test:(N==null?void 0:N.kind)==="case"&&N.tests.length===1&&(R=N.tests[0]),a({treeItem:N,testCase:R,testFile:h})},[t,N,a]),u.useEffect(()=>{if(!f)if(r)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const h=new Set;for(const R of m.value){const j=s.treeItemById(R),M=j==null?void 0:j.location.file;M&&h.add(M)}e==null||e.watchNoReply({fileNames:[...h]})}},[f,s,r,m,e]);const $=h=>{b(h.id),o("bounce-if-busy",s.collectTestIds(h))},K=(h,R)=>{if(h.preventDefault(),h.stopPropagation(),h.metaKey||h.ctrlKey){const j=i.split(" ");j.includes(R)?l(j.filter(M=>M!==R).join(" ").trim()):l((i+" "+R).trim())}else l((i.split(" ").filter(j=>!j.startsWith("@")).join(" ")+" "+R).trim())};return n.jsx(we,{name:"tests",treeState:_,setTreeState:x,rootItem:s.rootItem,dataTestId:"test-tree",render:h=>{const R=h.id.replace(/[^\w\d-_]/g,"-"),j=R+"-label",M=R+"-time";return n.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${j} ${M}`,children:[n.jsxs("div",{id:j,className:"ui-mode-tree-item-title",children:[n.jsx("span",{children:h.title}),h.kind==="case"?h.tags.map(Y=>n.jsx(_e,{tag:Y.slice(1),onClick:ct=>K(ct,Y)},Y)):null]}),!!h.duration&&h.status!=="skipped"&&n.jsx("div",{id:M,className:"ui-mode-tree-item-time",children:Xt(h.duration)}),n.jsxs(q,{noMinHeight:!0,noShadow:!0,children:[n.jsx(F,{icon:"play",title:"Run",onClick:()=>$(h),disabled:!!c&&!c.completed}),n.jsx(F,{icon:"go-to-file",title:"Show source",onClick:k,style:h.kind==="group"&&h.subKind==="folder"?{visibility:"hidden"}:{}}),!r&&n.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(h.id)?m.value.delete(h.id):m.value.add(h.id),d({...m})},toggled:m.value.has(h.id)})]})]})},icon:h=>Qt(h.status),title:h=>h.title,selectedItem:N,onAccepted:$,onSelected:h=>{c&&(c.itemSelectedByUser=!0),b(h.id)},isError:h=>h.kind==="group"?h.hasLoadErrors:!1,autoExpandDepth:i?5:1,noItemsMessage:f?"Loading…":"No tests"})};function xe(i,t){if(!(!i||!t))return{file:i.location.file,line:i.location.line,column:i.location.column,source:{errors:t.loadErrors.filter(e=>{var s;return((s=e.location)==null?void 0:s.file)===i.location.file}).map(e=>({line:e.location.line,message:e.message})),content:void 0}}}function Se(i){return`.playwright-artifacts-${i}`}const Te=({item:i,rootDir:t,onOpenExternally:e,revealSource:s,pathSeparator:o})=>{var w,S;const[c,r]=u.useState(void 0),[m,d]=u.useState(0),f=u.useRef(null),{outputDir:a}=u.useMemo(()=>({outputDir:i.testCase?ke(i.testCase):void 0}),[i]);return u.useEffect(()=>{var x,y;f.current&&clearTimeout(f.current);const l=(x=i.testCase)==null?void 0:x.results[0];if(!l){r(void 0);return}const k=l&&l.duration>=0&&l.attachments.find(b=>b.name==="trace");if(k&&k.path){kt(k.path).then(b=>r({model:b,isLive:!1}));return}if(!a){r(void 0);return}const _=[a,Se(l.workerIndex),"traces",`${(y=i.testCase)==null?void 0:y.id}.json`].join(o);return f.current=setTimeout(async()=>{try{const b=await kt(_);r({model:b,isLive:!0})}catch{const b=new It("",[]);b.errorDescriptors.push(...l.errors.flatMap(D=>D.message?[{message:D.message}]:[])),r({model:b,isLive:!1})}finally{d(m+1)}},500),()=>{f.current&&clearTimeout(f.current)}},[a,i,r,m,d,o]),n.jsx(Jt,{model:c==null?void 0:c.model,showSourcesFirst:!0,rootDir:t,fallbackLocation:i.testFile,isLive:c==null?void 0:c.isLive,status:(w=i.treeItem)==null?void 0:w.status,annotations:((S=i.testCase)==null?void 0:S.annotations)??[],onOpenExternally:e,revealSource:s},"workbench")},ke=i=>{var t;for(let e=i.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir};async function kt(i){const t=new URLSearchParams;t.set("trace",i);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new It(i,s)}let jt={cols:80};const z={pending:[],clear:()=>{},write:i=>z.pending.push(i),resize:()=>{}},A=new URLSearchParams(window.location.search),je=new URL(A.get("server")??"../",window.location.href),_t=new URL(A.get("ws"),je);_t.protocol=_t.protocol==="https:"?"wss:":"ws:";const B={args:A.getAll("arg"),grep:A.get("grep")||void 0,grepInvert:A.get("grepInvert")||void 0,projects:A.getAll("project"),workers:A.get("workers")||void 0,headed:A.has("headed"),updateSnapshots:A.get("updateSnapshots")||void 0,reporters:A.has("reporter")?A.getAll("reporter"):void 0,pathSeparator:A.get("pathSeparator")||"/"};B.updateSnapshots&&!["all","changed","none","missing"].includes(B.updateSnapshots)&&(B.updateSnapshots=void 0);const yt=navigator.platform==="MacIntel";function ye(i){return i.startsWith("/")&&(i=i.substring(1)),i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ee=({})=>{var xt;const[i,t]=u.useState(""),[e,s]=u.useState(!1),[o,c]=u.useState(!1),[r,m]=u.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[d,f]=u.useState(new Map),[a,w]=u.useState(),[S,l]=u.useState(),[k,_]=u.useState({}),[x,y]=u.useState(!1),[b,D]=u.useState(),C=b&&!b.completed,[U,tt]=at("watch-all",!1),[N,$]=u.useState({value:new Set}),K=u.useRef(Promise.resolve()),h=u.useRef({testIds:new Set,locations:new Set}),[R,j]=u.useState(0),[M,Y]=u.useState(0),[ct,Bt]=u.useState(!1),[vt,wt]=u.useState(!0),[v,Ct]=u.useState(),[et,Nt]=u.useState(),[st,Pt]=u.useState(!1),[it,Lt]=u.useState(!1),[Dt,bt]=u.useState(!1),Mt=u.useCallback(()=>bt(!0),[bt]),[dt,Ft]=at("single-worker",!1),[ut,Ot]=at("updateSnapshots","missing"),[Q]=at("mergeFiles",!1),At=u.useRef(null),ot=u.useCallback(()=>{Ct(p=>(p==null||p.close(),new Zt(new Gt(_t))))},[]);u.useEffect(()=>{var p;(p=At.current)==null||p.focus(),y(!0),ot()},[ot]),u.useEffect(()=>{if(!v)return;const p=[v.onStdio(g=>{if(g.buffer){const T=atob(g.buffer);z.write(T)}else z.write(g.text);g.type==="stderr"&&c(!0)}),v.onClose(()=>Bt(!0))];return z.resize=(g,T)=>{jt={cols:g,rows:T},v.resizeTerminalNoReply({cols:g,rows:T})},()=>{for(const g of p)g.dispose()}},[v]),u.useEffect(()=>{if(!v)return;let p;const g=new he({onUpdate:T=>{clearTimeout(p),p=void 0,T?w(g.asModel()):p||(p=setTimeout(()=>{w(g.asModel())},250))},onError:T=>{z.write((T.stack||T.value||"")+`
4
- `),c(!0)},pathSeparator:B.pathSeparator});return Nt(g),w(void 0),y(!0),$({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:T,report:I}=await v.runGlobalSetup({});if(g.processGlobalReport(I),T!=="passed")return;const P=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});g.processListReport(P.report),v.onReport(V=>{g.processTestReportEvent(V)});const{hasBrowsers:O}=await v.checkBrowsers({});wt(O)}finally{y(!1)}})(),()=>{clearTimeout(p)}},[v]),u.useEffect(()=>{if(!a)return;const{config:p,rootSuite:g}=a,T=p.configFile?Et.getObject(p.configFile+":projects",void 0):void 0,I=new Map(d);for(const P of I.keys())g.suites.find(O=>O.title===P)||I.delete(P);for(const P of g.suites)I.has(P.title)||I.set(P.title,!!(T!=null&&T.includes(P.title)));!T&&I.size&&![...I.values()].includes(!0)&&I.set(I.entries().next().value[0],!0),(d.size!==I.size||[...d].some(([P,O])=>I.get(P)!==O))&&f(I)},[d,a]),u.useEffect(()=>{C&&(a!=null&&a.progress)?l(a.progress):a||l(void 0)},[a,C]);const{testTree:nt}=u.useMemo(()=>{if(!a)return{testTree:new gt("",new Z("","root"),[],d,B.pathSeparator,Q)};const p=new gt("",a.rootSuite,a.loadErrors,d,B.pathSeparator,Q);return p.filterTree(i,r,C?b==null?void 0:b.testIds:void 0),p.sortAndPropagateStatus(),p.shortenRoot(),p.flattenForSingleProject(),{testTree:p}},[i,a,r,d,b,C,Q]),X=u.useCallback((p,g)=>{if(!(!v||!a)&&!(p==="bounce-if-busy"&&C)){for(const T of g.testIds)h.current.testIds.add(T);for(const T of g.locations)h.current.locations.add(T);K.current=K.current.then(async()=>{var O,V,W;const{testIds:T,locations:I}=h.current;if(h.current={testIds:new Set,locations:new Set},!T.size)return;{for(const E of((O=a.rootSuite)==null?void 0:O.allTests())||[])if(T.has(E.id)){E.results=[];const L=E._createTestResult("pending");L[G]="scheduled"}w({...a})}const P=" ["+new Date().toLocaleTimeString()+"]";z.write("\x1B[2m—".repeat(Math.max(0,jt.cols-P.length))+P+"\x1B[22m"),l({total:0,passed:0,failed:0,skipped:0}),D({testIds:T}),await v.runTests({locations:[...I].map(ye),grep:B.grep,grepInvert:B.grepInvert,testIds:[...T],projects:[...d].filter(([E,L])=>L).map(([E])=>E),updateSnapshots:ut,reporters:B.reporters,workers:dt?1:void 0,trace:"on"});for(const E of((V=a.rootSuite)==null?void 0:V.allTests())||[])((W=E.results[0])==null?void 0:W.duration)===-1&&(E.results=[]);w({...a}),D(E=>E?{...E,completed:!0}:void 0)})}},[d,C,a,v,ut,dt]),rt=u.useCallback(()=>X("bounce-if-busy",nt.collectTestIds(nt.rootItem)),[X,nt]);u.useEffect(()=>{if(!v||!et)return;const p=v.onTestFilesChanged(async g=>{if(K.current=K.current.then(async()=>{y(!0);try{const W=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});et.processListReport(W.report)}catch(W){console.log(W)}finally{y(!1)}}),await K.current,g.testFiles.length===0)return;const T=et.asModel(),I=new gt("",T.rootSuite,T.loadErrors,d,B.pathSeparator,Q),P=[],O=[],V=new Set(g.testFiles);if(U){const W=E=>{const L=E.location.file;if(L&&V.has(L)){const J=I.collectTestIds(E);P.push(...J.locations),O.push(...J.testIds)}E.kind==="group"&&E.subKind==="folder"&&E.children.forEach(W)};W(I.rootItem)}else for(const W of N.value){const E=I.treeItemById(W);if(!E)continue;let L=E;for(;!(L.kind==="group"&&(L.subKind==="file"||L.subKind==="folder"))&&L.parent;)L=L.parent;const J=L==null?void 0:L.location.file;if(J&&V.has(J)){const St=I.collectTestIds(E);P.push(...St.locations),O.push(...St.testIds)}}X("queue-if-busy",{locations:P,testIds:O})});return()=>p.dispose()},[X,v,U,N,et,d,Q]),u.useEffect(()=>{if(!v)return;const p=g=>{g.code==="Backquote"&&g.ctrlKey?(g.preventDefault(),s(!e)):g.code==="F5"&&g.shiftKey?(g.preventDefault(),v==null||v.stopTestsNoReply({})):g.code==="F5"&&(g.preventDefault(),rt())};return addEventListener("keydown",p),()=>{removeEventListener("keydown",p)}},[rt,ot,v,e]);const ht=u.useRef(null),Wt=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.showModal()},[]),ft=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.close()},[]),Ut=u.useCallback(p=>{ft(p),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));wt(g)})},[ft,v]);return n.jsxs("div",{className:"vbox ui-mode",children:[!vt&&n.jsxs("dialog",{ref:ht,children:[n.jsxs("div",{className:"title",children:[n.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),n.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",n.jsx("br",{}),"Would you like to run `playwright install`?",n.jsx("br",{}),n.jsx("button",{className:"button",onClick:Ut,children:"Install"}),n.jsx("button",{className:"button secondary",onClick:ft,children:"Dismiss"})]})]}),ct&&n.jsxs("div",{className:"disconnected",children:[n.jsx("div",{className:"title",children:"UI Mode disconnected"}),n.jsxs("div",{children:[n.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),n.jsx(te,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:n.jsxs("div",{className:"vbox",children:[n.jsxs("div",{className:mt("vbox",!e&&"hidden"),children:[n.jsxs(q,{children:[n.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),n.jsx(F,{icon:"circle-slash",title:"Clear output",onClick:()=>{z.clear(),c(!1)}}),n.jsx("div",{className:"spacer"}),n.jsx(F,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),n.jsx(fe,{source:z})]}),n.jsx("div",{className:mt("vbox",e&&"hidden"),children:n.jsx(Te,{pathSeparator:B.pathSeparator,item:k,rootDir:(xt=a==null?void 0:a.config)==null?void 0:xt.rootDir,revealSource:Dt,onOpenExternally:p=>v==null?void 0:v.openNoReply({location:{file:p.file,line:p.line,column:p.column}})})})]}),sidebar:n.jsxs("div",{className:"vbox ui-mode-sidebar",children:[n.jsxs(q,{noShadow:!0,noMinHeight:!0,children:[n.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),n.jsx("div",{className:"section-title",children:"Playwright"}),n.jsx(F,{icon:"refresh",title:"Reload",onClick:()=>ot(),disabled:C||x}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(F,{icon:"terminal",title:"Toggle output — "+(yt?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),o&&n.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!vt&&n.jsx(F,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Wt})]}),n.jsx(me,{filterText:i,setFilterText:t,statusFilters:r,setStatusFilters:m,projectFilters:d,setProjectFilters:f,testModel:a,runTests:rt}),n.jsxs(q,{className:"section-toolbar",noMinHeight:!0,children:[!C&&!S&&n.jsx("div",{className:"section-title",children:"Tests"}),!C&&S&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:[S.passed,"/",S.total," passed (",S.passed/S.total*100|0,"%)"]})}),C&&S&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:["Running ",S.passed,"/",b.testIds.size," passed (",S.passed/b.testIds.size*100|0,"%)"]})}),n.jsx(F,{icon:"play",title:"Run all — F5",onClick:rt,disabled:C||x}),n.jsx(F,{icon:"debug-stop",title:"Stop — "+(yt?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!C||x}),n.jsx(F,{icon:"eye",title:"Watch all",toggled:U,onClick:()=>{$({value:new Set}),tt(!U)}}),n.jsx(F,{icon:"collapse-all",title:"Collapse all",onClick:()=>{j(R+1)}}),n.jsx(F,{icon:"expand-all",title:"Expand all",onClick:()=>{Y(M+1)}})]}),n.jsx(be,{filterText:i,testModel:a,testTree:nt,testServerConnection:v,runningState:b,runTests:X,onItemSelected:_,watchAll:U,watchedTreeIds:N,setWatchedTreeIds:$,isLoading:x,requestedCollapseAllCount:R,requestedExpandAllCount:M,setFilterText:t,onRevealSource:Mt}),n.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Lt(!it),children:[n.jsx("span",{className:`codicon codicon-${it?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:it?"Hide Testing Options":"Show Testing Options"}),n.jsx("div",{className:"section-title",children:"Testing Options"})]}),it&&n.jsx(ee,{settings:[{type:"check",value:dt,set:Ft,name:"Single worker"},{type:"select",options:[{label:"All",value:"all"},{label:"Changed",value:"changed"},{label:"Missing",value:"missing"},{label:"None",value:"none"}],value:ut,set:Ot,name:"Update snapshots"}]}),n.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Pt(!st),children:[n.jsx("span",{className:`codicon codicon-${st?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:st?"Hide Settings":"Show Settings"}),n.jsx("div",{className:"section-title",children:"Settings"})]}),st&&n.jsx(se,{location:"ui-mode"})]})})]})};(async()=>{if(ie(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
5
- Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}oe.createRoot(document.querySelector("#root")).render(n.jsx(Ee,{}))})();