playwright-core 1.57.0-alpha-2025-10-29 → 1.57.0-alpha-2025-10-31

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.
@@ -0,0 +1,2 @@
1
+ import{M as m,r as s,T as M,W as C,j as e,D as F,a as I,b as k,c as z,d as O,e as V}from"./assets/defaultSettingsView-SEdt3QvG.js";const $=()=>{const[o,i]=s.useState(!1),[c,l]=s.useState(),[h,u]=s.useState(),[g,L]=s.useState(N),[p,x]=s.useState({done:0,total:0}),[b,v]=s.useState(!1),[j,S]=s.useState(null),[y,P]=s.useState(null),[R,E]=s.useState(!1),w=s.useCallback(t=>{const r=new URL(window.location.href);if(!t.length)return;const n=t.item(0),a=URL.createObjectURL(n);r.searchParams.append("trace",a);const d=r.toString();window.history.pushState({},"",d),l(a),u(n.name),v(!1),S(null)},[]);s.useEffect(()=>{const t=async r=>{var n;if((n=r.clipboardData)!=null&&n.files.length){for(const a of r.clipboardData.files)if(a.type!=="application/zip")return;r.preventDefault(),w(r.clipboardData.files)}};return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)}),s.useEffect(()=>{const t=r=>{const{method:n,params:a}=r.data;if(n!=="load"||!((a==null?void 0:a.trace)instanceof Blob))return;const d=new File([a.trace],"trace.zip",{type:"application/zip"}),f=new DataTransfer;f.items.add(d),w(f.files)};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});const U=s.useCallback(t=>{t.preventDefault(),w(t.dataTransfer.files)},[w]),W=s.useCallback(t=>{t.preventDefault(),t.target.files&&w(t.target.files)},[w]);s.useEffect(()=>{const t=new URL(window.location.href).searchParams,r=t.get("trace");if(i(t.has("isServer")),r!=null&&r.startsWith("file:")){P(r||null);return}if(t.has("isServer")){const n=new URLSearchParams(window.location.search).get("ws"),a=new URL(`../${n}`,window.location.toString());a.protocol=window.location.protocol==="https:"?"wss:":"ws:";const d=new M(new C(a));d.onLoadTraceRequested(async f=>{l(f.traceUrl),v(!1),S(null)}),d.initialize({}).catch(()=>{})}else r&&!r.startsWith("blob:")&&l(r)},[]),s.useEffect(()=>{(async()=>{if(!c){L(N);return}const t=r=>{r.data.method==="progress"&&x(r.data.params)};try{navigator.serviceWorker.addEventListener("message",t),x({done:0,total:1});const r=new URLSearchParams;r.set("trace",c);const n=await fetch(`contexts?${r.toString()}`);if(!n.ok){o||l(void 0),S((await n.json()).error);return}const a=await n.json(),d=new m(c,a);x({done:0,total:0}),L(d)}finally{navigator.serviceWorker.removeEventListener("message",t)}})()},[o,c,h]);const D=p.done!==p.total&&p.total!==0&&!j;s.useEffect(()=>{if(D){const t=setTimeout(()=>{E(!0)},200);return()=>clearTimeout(t)}else E(!1)},[D]);const T=!!(!o&&!b&&!y&&(!c||j));return e.jsxs("div",{className:"vbox workbench-loader",onDragOver:t=>{t.preventDefault(),v(!0)},children:[e.jsxs("div",{className:"hbox header",...T?{inert:!0}:{},children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),g.title&&e.jsx("div",{className:"title",children:g.title}),e.jsx("div",{className:"spacer"}),e.jsx(F,{icon:"settings-gear",title:"Settings",dialogDataTestId:"settings-toolbar-dialog",children:e.jsx(I,{location:"trace-viewer"})})]}),e.jsx(k,{model:g,inert:T}),y&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),e.jsxs("div",{style:{paddingTop:20},children:[e.jsxs("div",{children:["1. Click ",e.jsx("a",{href:y,children:"here"})," to put your trace into the download shelf"]}),e.jsxs("div",{children:["2. Go to ",e.jsx("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),e.jsx("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),e.jsx(z,{open:R,isModal:!0,className:"progress-dialog",children:e.jsxs("div",{className:"progress-content",children:[e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Loading Playwright Trace..."}),e.jsx("div",{className:"progress-wrapper",children:e.jsx("div",{className:"inner-progress",style:{width:p.total?100*p.done/p.total+"%":0}})})]})}),T&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",role:"alert",children:j}),e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const t=document.createElement("input");t.type="file",t.click(),t.addEventListener("change",r=>W(r))},type:"button",children:"Select file"}),e.jsx("div",{className:"info",children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."}),e.jsxs("div",{className:"version",children:["Playwright v","1.57.0-next"]})]}),o&&!c&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),b&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{v(!1)},onDrop:t=>U(t),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},N=new m("",[]),q=({traceJson:o})=>{const[i,c]=s.useState(void 0),[l,h]=s.useState(0),u=s.useRef(null);return s.useEffect(()=>(u.current&&clearTimeout(u.current),u.current=setTimeout(async()=>{try{const g=await A(o);c(g)}catch{const g=new m("",[]);c(g)}finally{h(l+1)}},500),()=>{u.current&&clearTimeout(u.current)}),[o,l]),e.jsx(k,{isLive:!0,model:i})};async function A(o){const i=new URLSearchParams;i.set("trace",o);const l=await(await fetch(`contexts?${i.toString()}`)).json();return new m(o,l)}(async()=>{const o=new URLSearchParams(window.location.search);if(O(),window.location.protocol!=="file:"){if(o.get("isUnderTest")==="true"&&await new Promise(h=>setTimeout(h,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
+ Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(h=>{navigator.serviceWorker.oncontrollerchange=()=>h()}),setInterval(function(){fetch("ping")},1e4)}const i=o.get("trace"),l=(i==null?void 0:i.endsWith(".json"))?e.jsx(q,{traceJson:i}):e.jsx($,{});V.createRoot(document.querySelector("#root")).render(l)})();
@@ -7,8 +7,8 @@
7
7
  <link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
8
8
  <link rel="manifest" href="./manifest.webmanifest">
9
9
  <title>Playwright Trace Viewer</title>
10
- <script type="module" crossorigin src="./index.DY0nr6ME.js"></script>
11
- <link rel="modulepreload" crossorigin href="./assets/defaultSettingsView-B24Q0BeR.js">
10
+ <script type="module" crossorigin src="./index.CflMF1yt.js"></script>
11
+ <link rel="modulepreload" crossorigin href="./assets/defaultSettingsView-SEdt3QvG.js">
12
12
  <link rel="stylesheet" crossorigin href="./defaultSettingsView.BEjzWGz-.css">
13
13
  <link rel="stylesheet" crossorigin href="./index.C4Y3Aw8n.css">
14
14
  </head>
@@ -1,5 +1,5 @@
1
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 At,r as K,f as Ut,_ as Wt,g as zt,h as Vt,j as r,R as u,E as Kt,s as xt,i as ht,k as Ht,t as $t,m as qt,l as H,n as O,M as St,b as Yt,o as ot,T as Qt,W as Xt,S as Jt,p as Zt,a as Gt,d as te,e as ee}from"./assets/defaultSettingsView-B24Q0BeR.js";var se={};class dt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new X("","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 X(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 d,n;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),(n=(d=this._reporter).onTestBegin)==null||n.call(d,s,i)}_onTestEnd(t,e){var d,n,m;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const i=s.results.find(c=>c._id===e.id);i.duration=e.duration,i.status=e.status,i.errors=e.errors,i.error=(d=i.errors)==null?void 0:d[0],e.attachments&&(i.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),i.annotations=e.annotations,s.annotations=e.annotations),(m=(n=this._reporter).onTestEnd)==null||m.call(n,s,i),i._stepMap=new Map}_onStepBegin(t,e,s){var f,a;const i=this._tests.get(t),d=i.results.find(w=>w._id===e),n=s.parentStepId?d._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),c=new oe(s,n,m,d);n?n.steps.push(c):d.steps.push(c),d._stepMap.set(s.id,c),(a=(f=this._reporter).onStepBegin)==null||a.call(f,i,d,c)}_onStepEnd(t,e,s){var m,c;const i=this._tests.get(t),d=i.results.find(f=>f._id===e),n=d._stepMap.get(s.id);n._endPayload=s,n.duration=s.duration,n.error=s.error,(c=(m=this._reporter).onStepEnd)==null||c.call(m,i,d,n)}_onAttach(t,e,s){this._tests.get(t).results.find(n=>n._id===e).attachments.push(...s.map(n=>({name:n.name,contentType:n.contentType,path:n.path,body:n.base64&&globalThis.Buffer?Buffer.from(n.base64,"base64"):void 0})))}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,d){var f,a,w,x;const n=d?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,m=e?this._tests.get(e):void 0,c=m&&s?m.results.find(l=>l._id===s):void 0;t==="stdout"?(c==null||c.stdout.push(n),(a=(f=this._reporter).onStdOut)==null||a.call(f,n,m,c)):(c==null||c.stderr.push(n),(x=(w=this._reporter).onStdErr)==null||x.call(w,n,m,c))}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={...ne,...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:rt(t.testIgnore),testMatch:rt(t.testMatch),timeout:t.timeout,grep:rt(t.grep),grepInvert:rt(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 X(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 ie(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 X{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 ie{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 ae(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new re(this.results.length,t);return this.results.push(e),e}}class oe{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 re{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 ne={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[se.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 rt(o){return o.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function ae(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 ut{constructor(t,e,s,i,d,n){this._treeItemById=new Map,this._treeItemByTestId=new Map;const m=i&&[...i.values()].some(Boolean);this.pathSeparator=d,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 c=(f,a,w,x)=>{for(const l of x==="tests"?[]:a.suites){if(!l.title){c(f,l,w,"all");continue}let T=w.children.find(_=>_.kind==="group"&&_.title===l.title);T||(T={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,T)),c(f,l,T,"all")}for(const l of x==="suites"?[]:a.tests){const T=l.title;let _=w.children.find(N=>N.kind!=="group"&&N.title===T);_||(_={kind:"case",id:"test:"+l.titlePath().join(""),title:T,parent:w,children:[],tests:[],location:l.location,duration:0,status:"none",project:void 0,test:void 0,tags:l.tags},this._addChild(w,_));const b=l.results[0];let R="none";(b==null?void 0:b[J])==="scheduled"?R="scheduled":(b==null?void 0:b[J])==="running"?R="running":(b==null?void 0:b.status)==="skipped"?R="skipped":(b==null?void 0:b.status)==="interrupted"?R="none":b&&l.outcome()!=="expected"?R="failed":b&&l.outcome()==="expected"&&(R="passed"),_.tests.push(l);const k={kind:"test",id:l.id,title:f.name,location:l.location,test:l,parent:_,children:[],status:R,duration:l.results.length?Math.max(0,l.results[0].duration):0,project:f};this._addChild(_,k),this._treeItemByTestId.set(l.id,k),_.duration=_.children.reduce((N,D)=>N+D.duration,0)}};for(const f of(e==null?void 0:e.suites)||[])if(!(m&&!i.get(f.title)))for(const a of f.suites)if(n){if(c(f.project(),a,this.rootItem,"suites"),a.tests.length){const w=this._defaultDescribeItem();c(f.project(),a,w,"tests")}}else{const w=this._fileItem(a.location.file.split(d),!0);c(f.project(),a,w,"all")}for(const f of s){if(!f.location)continue;const a=this._fileItem(f.location.file.split(d),!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(" "),d=[...e.values()].some(Boolean),n=c=>{const f=[...c.tests[0].titlePath(),...c.tests[0].tags].join(" ").toLowerCase();return!i.every(a=>f.includes(a))&&!c.tests.some(a=>s==null?void 0:s.has(a.id))?!1:(c.children=c.children.filter(a=>!d||(s==null?void 0:s.has(a.test.id))||e.get(a.status)),c.tests=c.children.map(a=>a.test),!!c.children.length)},m=c=>{const f=[];for(const a of c.children)a.kind==="case"?n(a)&&f.push(a):(m(a),(a.children.length||a.hasLoadErrors)&&f.push(a));c.children=f};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 d=this._fileItem(t.slice(0,t.length-1),!1),n={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:d,children:[],status:"none",hasLoadErrors:!1};return this._addChild(d,n),n}_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(){Tt(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}testIds(){const t=new Set,e=s=>{s.kind==="case"&&s.tests.forEach(i=>t.add(i.id)),s.children.forEach(e)};return e(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 t?le(t):new Set}}function Tt(o){for(const n of o.children)Tt(n);o.kind==="group"&&o.children.sort((n,m)=>n.location.file.localeCompare(m.location.file)||n.location.line-m.location.line);let t=o.children.length>0,e=o.children.length>0,s=!1,i=!1,d=!1;for(const n of o.children)e=e&&n.status==="skipped",t=t&&(n.status==="passed"||n.status==="skipped"),s=s||n.status==="failed",i=i||n.status==="running",d=d||n.status==="scheduled";i?o.status="running":d?o.status="scheduled":s?o.status="failed":e?o.status="skipped":t&&(o.status="passed")}function le(o){const t=new Set,e=s=>{var i;s.kind==="case"?s.tests.map(d=>d.id).forEach(d=>t.add(d)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(o),t}const J=Symbol("statusEx");class ce{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new dt(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:(e,s)=>e+t.pathSeparator+s,clearPreviousResultsWhenTestBegins:!0}),this._options=t}_createReporter(){return{version:()=>"v2",onConfigure:t=>{this.config=t,this._lastRunReceiver=new dt({version:()=>"v2",onBegin:e=>{this._lastRunTestCount=e.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:(e,s)=>e+this._options.pathSeparator+s})},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[J]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[J]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1}}processGlobalReport(t){const e=new dt({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 X("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const de=({source:o})=>{const[t,e]=At(),[s,i]=K.useState(Ut()),[d]=K.useState(Wt(()=>import("./assets/xtermModule-CsJ4vdCR.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),n=K.useRef(null);return K.useEffect(()=>(zt(i),()=>Vt(i)),[]),K.useEffect(()=>{const m=o.write,c=o.clear;return(async()=>{const{Terminal:f,FitAddon:a}=await d,w=e.current;if(!w)return;const x=s==="dark-mode"?he:ue;if(n.current&&n.current.terminal.options.theme===x)return;n.current&&(w.textContent="");const l=new f({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"monospace",theme:x}),T=new a;l.loadAddon(T);for(const _ of o.pending)l.write(_);o.write=(_=>{o.pending.push(_),l.write(_)}),o.clear=()=>{o.pending=[],l.clear()},l.open(w),T.fit(),n.current={terminal:l,fitAddon:T}})(),()=>{o.clear=c,o.write=m}},[d,n,e,o,s]),K.useEffect(()=>{setTimeout(()=>{n.current&&(n.current.fitAddon.fit(),o.resize(n.current.terminal.cols,n.current.terminal.rows))},250)},[t,o]),r.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},ue={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"},he={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"},fe=({filterText:o,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:d,testModel:n,runTests:m})=>{const[c,f]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>{var l;(l=a.current)==null||l.focus()},[]);const w=[...e.entries()].filter(([l,T])=>T).map(([l])=>l).join(" ")||"all",x=[...i.entries()].filter(([l,T])=>T).map(([l])=>l).join(" ")||"all";return r.jsxs("div",{className:"filters",children:[r.jsx(Kt,{expanded:c,setExpanded:f,title:r.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()}})}),r.jsxs("div",{className:"filter-summary",title:"Status: "+w+`
2
+ import{u as At,r as K,f as Ut,_ as Wt,g as zt,h as Vt,j as r,R as u,E as Kt,s as xt,i as ht,k as Ht,t as $t,m as qt,l as H,n as O,M as St,b as Yt,o as ot,T as Qt,W as Xt,S as Jt,p as Zt,a as Gt,d as te,e as ee}from"./assets/defaultSettingsView-SEdt3QvG.js";var se={};class dt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new X("","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 X(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 d,n;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),(n=(d=this._reporter).onTestBegin)==null||n.call(d,s,i)}_onTestEnd(t,e){var d,n,m;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const i=s.results.find(c=>c._id===e.id);i.duration=e.duration,i.status=e.status,i.errors=e.errors,i.error=(d=i.errors)==null?void 0:d[0],e.attachments&&(i.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),i.annotations=e.annotations,s.annotations=e.annotations),(m=(n=this._reporter).onTestEnd)==null||m.call(n,s,i),i._stepMap=new Map}_onStepBegin(t,e,s){var f,a;const i=this._tests.get(t),d=i.results.find(w=>w._id===e),n=s.parentStepId?d._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),c=new oe(s,n,m,d);n?n.steps.push(c):d.steps.push(c),d._stepMap.set(s.id,c),(a=(f=this._reporter).onStepBegin)==null||a.call(f,i,d,c)}_onStepEnd(t,e,s){var m,c;const i=this._tests.get(t),d=i.results.find(f=>f._id===e),n=d._stepMap.get(s.id);n._endPayload=s,n.duration=s.duration,n.error=s.error,(c=(m=this._reporter).onStepEnd)==null||c.call(m,i,d,n)}_onAttach(t,e,s){this._tests.get(t).results.find(n=>n._id===e).attachments.push(...s.map(n=>({name:n.name,contentType:n.contentType,path:n.path,body:n.base64&&globalThis.Buffer?Buffer.from(n.base64,"base64"):void 0})))}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,d){var f,a,w,x;const n=d?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,m=e?this._tests.get(e):void 0,c=m&&s?m.results.find(l=>l._id===s):void 0;t==="stdout"?(c==null||c.stdout.push(n),(a=(f=this._reporter).onStdOut)==null||a.call(f,n,m,c)):(c==null||c.stderr.push(n),(x=(w=this._reporter).onStdErr)==null||x.call(w,n,m,c))}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={...ne,...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:rt(t.testIgnore),testMatch:rt(t.testMatch),timeout:t.timeout,grep:rt(t.grep),grepInvert:rt(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 X(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 ie(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 X{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 ie{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 ae(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new re(this.results.length,t);return this.results.push(e),e}}class oe{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 re{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 ne={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[se.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 rt(o){return o.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function ae(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 ut{constructor(t,e,s,i,d,n){this._treeItemById=new Map,this._treeItemByTestId=new Map;const m=i&&[...i.values()].some(Boolean);this.pathSeparator=d,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 c=(f,a,w,x)=>{for(const l of x==="tests"?[]:a.suites){if(!l.title){c(f,l,w,"all");continue}let T=w.children.find(_=>_.kind==="group"&&_.title===l.title);T||(T={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,T)),c(f,l,T,"all")}for(const l of x==="suites"?[]:a.tests){const T=l.title;let _=w.children.find(N=>N.kind!=="group"&&N.title===T);_||(_={kind:"case",id:"test:"+l.titlePath().join(""),title:T,parent:w,children:[],tests:[],location:l.location,duration:0,status:"none",project:void 0,test:void 0,tags:l.tags},this._addChild(w,_));const b=l.results[0];let R="none";(b==null?void 0:b[J])==="scheduled"?R="scheduled":(b==null?void 0:b[J])==="running"?R="running":(b==null?void 0:b.status)==="skipped"?R="skipped":(b==null?void 0:b.status)==="interrupted"?R="none":b&&l.outcome()!=="expected"?R="failed":b&&l.outcome()==="expected"&&(R="passed"),_.tests.push(l);const k={kind:"test",id:l.id,title:f.name,location:l.location,test:l,parent:_,children:[],status:R,duration:l.results.length?Math.max(0,l.results[0].duration):0,project:f};this._addChild(_,k),this._treeItemByTestId.set(l.id,k),_.duration=_.children.reduce((N,D)=>N+D.duration,0)}};for(const f of(e==null?void 0:e.suites)||[])if(!(m&&!i.get(f.title)))for(const a of f.suites)if(n){if(c(f.project(),a,this.rootItem,"suites"),a.tests.length){const w=this._defaultDescribeItem();c(f.project(),a,w,"tests")}}else{const w=this._fileItem(a.location.file.split(d),!0);c(f.project(),a,w,"all")}for(const f of s){if(!f.location)continue;const a=this._fileItem(f.location.file.split(d),!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(" "),d=[...e.values()].some(Boolean),n=c=>{const f=[...c.tests[0].titlePath(),...c.tests[0].tags].join(" ").toLowerCase();return!i.every(a=>f.includes(a))&&!c.tests.some(a=>s==null?void 0:s.has(a.id))?!1:(c.children=c.children.filter(a=>!d||(s==null?void 0:s.has(a.test.id))||e.get(a.status)),c.tests=c.children.map(a=>a.test),!!c.children.length)},m=c=>{const f=[];for(const a of c.children)a.kind==="case"?n(a)&&f.push(a):(m(a),(a.children.length||a.hasLoadErrors)&&f.push(a));c.children=f};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 d=this._fileItem(t.slice(0,t.length-1),!1),n={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:d,children:[],status:"none",hasLoadErrors:!1};return this._addChild(d,n),n}_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(){Tt(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}testIds(){const t=new Set,e=s=>{s.kind==="case"&&s.tests.forEach(i=>t.add(i.id)),s.children.forEach(e)};return e(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 t?le(t):new Set}}function Tt(o){for(const n of o.children)Tt(n);o.kind==="group"&&o.children.sort((n,m)=>n.location.file.localeCompare(m.location.file)||n.location.line-m.location.line);let t=o.children.length>0,e=o.children.length>0,s=!1,i=!1,d=!1;for(const n of o.children)e=e&&n.status==="skipped",t=t&&(n.status==="passed"||n.status==="skipped"),s=s||n.status==="failed",i=i||n.status==="running",d=d||n.status==="scheduled";i?o.status="running":d?o.status="scheduled":s?o.status="failed":e?o.status="skipped":t&&(o.status="passed")}function le(o){const t=new Set,e=s=>{var i;s.kind==="case"?s.tests.map(d=>d.id).forEach(d=>t.add(d)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(o),t}const J=Symbol("statusEx");class ce{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new dt(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:(e,s)=>e+t.pathSeparator+s,clearPreviousResultsWhenTestBegins:!0}),this._options=t}_createReporter(){return{version:()=>"v2",onConfigure:t=>{this.config=t,this._lastRunReceiver=new dt({version:()=>"v2",onBegin:e=>{this._lastRunTestCount=e.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:(e,s)=>e+this._options.pathSeparator+s})},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[J]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[J]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1}}processGlobalReport(t){const e=new dt({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 X("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const de=({source:o})=>{const[t,e]=At(),[s,i]=K.useState(Ut()),[d]=K.useState(Wt(()=>import("./assets/xtermModule-CsJ4vdCR.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),n=K.useRef(null);return K.useEffect(()=>(zt(i),()=>Vt(i)),[]),K.useEffect(()=>{const m=o.write,c=o.clear;return(async()=>{const{Terminal:f,FitAddon:a}=await d,w=e.current;if(!w)return;const x=s==="dark-mode"?he:ue;if(n.current&&n.current.terminal.options.theme===x)return;n.current&&(w.textContent="");const l=new f({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"monospace",theme:x}),T=new a;l.loadAddon(T);for(const _ of o.pending)l.write(_);o.write=(_=>{o.pending.push(_),l.write(_)}),o.clear=()=>{o.pending=[],l.clear()},l.open(w),T.fit(),n.current={terminal:l,fitAddon:T}})(),()=>{o.clear=c,o.write=m}},[d,n,e,o,s]),K.useEffect(()=>{setTimeout(()=>{n.current&&(n.current.fitAddon.fit(),o.resize(n.current.terminal.cols,n.current.terminal.rows))},250)},[t,o]),r.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},ue={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"},he={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"},fe=({filterText:o,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:d,testModel:n,runTests:m})=>{const[c,f]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>{var l;(l=a.current)==null||l.focus()},[]);const w=[...e.entries()].filter(([l,T])=>T).map(([l])=>l).join(" ")||"all",x=[...i.entries()].filter(([l,T])=>T).map(([l])=>l).join(" ")||"all";return r.jsxs("div",{className:"filters",children:[r.jsx(Kt,{expanded:c,setExpanded:f,title:r.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()}})}),r.jsxs("div",{className:"filter-summary",title:"Status: "+w+`
3
3
  Projects: `+x,onClick:()=>f(!c),children:[r.jsx("span",{className:"filter-label",children:"Status:"})," ",w,r.jsx("span",{className:"filter-label",children:"Projects:"})," ",x]}),c&&r.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[r.jsx("div",{className:"filter-list",role:"list","data-testid":"status-filters",children:[...e.entries()].map(([l,T])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:T,onChange:()=>{const _=new Map(e);_.set(l,!_.get(l)),s(_)}}),r.jsx("div",{children:l})]})},l))}),r.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...i.entries()].map(([l,T])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:T,onChange:()=>{var R;const _=new Map(i);_.set(l,!_.get(l)),d(_);const b=(R=n==null?void 0:n.config)==null?void 0:R.configFile;b&&xt.setObject(b+":projects",[..._.entries()].filter(([k,N])=>N).map(([k])=>k))}}),r.jsx("div",{children:l||"untitled"})]})},l))})]})]})},pe=({tag:o,style:t,onClick:e})=>r.jsx("span",{className:ht("tag",`tag-color-${ge(o)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${o}`,children:o});function ge(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 me=Ht,_e=({filterText:o,testModel:t,testServerConnection:e,testTree:s,runTests:i,runningState:d,watchAll:n,watchedTreeIds:m,setWatchedTreeIds:c,isLoading:f,onItemSelected:a,requestedCollapseAllCount:w,requestedExpandAllCount:x,setFilterText:l,onRevealSource:T})=>{const[_,b]=u.useState({expandedItems:new Map}),[R,k]=u.useState(),[N,D]=u.useState(w),[$,L]=u.useState(x);u.useEffect(()=>{if(N!==w){_.expandedItems.clear();for(const S of s.flatTreeItems())_.expandedItems.set(S.id,!1);D(w),k(void 0),b({..._});return}if($!==x){_.expandedItems.clear();for(const S of s.flatTreeItems())_.expandedItems.set(S.id,!0);L(x),k(void 0),b({..._});return}if(!d||d.itemSelectedByUser)return;let h;const E=S=>{var M;S.children.forEach(E),!h&&S.status==="failed"&&(S.kind==="test"&&d.testIds.has(S.test.id)||S.kind==="case"&&d.testIds.has((M=S.tests[0])==null?void 0:M.id))&&(h=S)};E(s.rootItem),h&&k(h.id)},[d,k,s,N,D,w,$,L,x,_,b]);const C=u.useMemo(()=>{if(R)return s.treeItemById(R)},[R,s]);u.useEffect(()=>{if(!t)return;const h=ve(C,t);let E;(C==null?void 0:C.kind)==="test"?E=C.test:(C==null?void 0:C.kind)==="case"&&C.tests.length===1&&(E=C.tests[0]),a({treeItem:C,testCase:E,testFile:h})},[t,C,a]),u.useEffect(()=>{if(!f)if(n)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const h=new Set;for(const E of m.value){const S=s.treeItemById(E),M=S==null?void 0:S.location.file;M&&h.add(M)}e==null||e.watchNoReply({fileNames:[...h]})}},[f,s,n,m,e]);const Z=h=>{k(h.id),i("bounce-if-busy",s.collectTestIds(h))},q=(h,E)=>{if(h.preventDefault(),h.stopPropagation(),h.metaKey||h.ctrlKey){const S=o.split(" ");S.includes(E)?l(S.filter(M=>M!==E).join(" ").trim()):l((o+" "+E).trim())}else l((o.split(" ").filter(S=>!S.startsWith("@")).join(" ")+" "+E).trim())};return r.jsx(me,{name:"tests",treeState:_,setTreeState:b,rootItem:s.rootItem,dataTestId:"test-tree",render:h=>{const E=h.id.replace(/[^\w\d-_]/g,"-"),S=E+"-label",M=E+"-time";return r.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${S} ${M}`,children:[r.jsxs("div",{id:S,className:"ui-mode-tree-item-title",children:[r.jsx("span",{children:h.title}),h.kind==="case"?h.tags.map(Y=>r.jsx(pe,{tag:Y.slice(1),onClick:G=>q(G,Y)},Y)):null]}),!!h.duration&&h.status!=="skipped"&&r.jsx("div",{id:M,className:"ui-mode-tree-item-time",children:qt(h.duration)}),r.jsxs(H,{noMinHeight:!0,noShadow:!0,children:[r.jsx(O,{icon:"play",title:"Run",onClick:()=>Z(h),disabled:!!d&&!d.completed}),r.jsx(O,{icon:"go-to-file",title:"Show source",onClick:T,style:h.kind==="group"&&h.subKind==="folder"?{visibility:"hidden"}:{}}),!n&&r.jsx(O,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(h.id)?m.value.delete(h.id):m.value.add(h.id),c({...m})},toggled:m.value.has(h.id)})]})]})},icon:h=>$t(h.status),title:h=>h.title,selectedItem:C,onAccepted:Z,onSelected:h=>{d&&(d.itemSelectedByUser=!0),k(h.id)},isError:h=>h.kind==="group"?h.hasLoadErrors:!1,autoExpandDepth:o?5:1,noItemsMessage:f?"Loading…":"No tests"})};function ve(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 we(o){return`.playwright-artifacts-${o}`}const be=({item:o,rootDir:t,onOpenExternally:e,revealSource:s,pathSeparator:i})=>{var w,x;const[d,n]=u.useState(void 0),[m,c]=u.useState(0),f=u.useRef(null),{outputDir:a}=u.useMemo(()=>({outputDir:o.testCase?xe(o.testCase):void 0}),[o]);return u.useEffect(()=>{var b,R;f.current&&clearTimeout(f.current);const l=(b=o.testCase)==null?void 0:b.results[0];if(!l){n(void 0);return}const T=l&&l.duration>=0&&l.attachments.find(k=>k.name==="trace");if(T&&T.path){vt(T.path).then(k=>n({model:k,isLive:!1}));return}if(!a){n(void 0);return}const _=[a,we(l.workerIndex),"traces",`${(R=o.testCase)==null?void 0:R.id}.json`].join(i);return f.current=setTimeout(async()=>{try{const k=await vt(_);n({model:k,isLive:!0})}catch{const k=new St("",[]);k.errorDescriptors.push(...l.errors.flatMap(N=>N.message?[{message:N.message}]:[])),n({model:k,isLive:!1})}finally{c(m+1)}},500),()=>{f.current&&clearTimeout(f.current)}},[a,o,n,m,c,i]),r.jsx(Yt,{model:d==null?void 0:d.model,showSourcesFirst:!0,rootDir:t,fallbackLocation:o.testFile,isLive:d==null?void 0:d.isLive,status:(w=o.treeItem)==null?void 0:w.status,annotations:((x=o.testCase)==null?void 0:x.annotations)??[],onOpenExternally:e,revealSource:s},"workbench")},xe=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 vt(o){const t=new URLSearchParams;t.set("trace",o);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new St(o,s)}let wt={cols:80};const z={pending:[],clear:()=>{},write:o=>z.pending.push(o),resize:()=>{}},A=new URLSearchParams(window.location.search),Se=new URL(A.get("server")??"../",window.location.href),ft=new URL(A.get("ws"),Se);ft.protocol=ft.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 bt=navigator.platform==="MacIntel",Te=({})=>{var _t;const[o,t]=u.useState(""),[e,s]=u.useState(!1),[i,d]=u.useState(!1),[n,m]=u.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[c,f]=u.useState(new Map),[a,w]=u.useState(),[x,l]=u.useState(),[T,_]=u.useState({}),[b,R]=u.useState(new Set),[k,N]=u.useState(!1),[D,$]=u.useState(),L=D&&!D.completed,[C,Z]=ot("watch-all",!1),[q,h]=u.useState({value:new Set}),E=u.useRef(Promise.resolve()),S=u.useRef(new Set),[M,Y]=u.useState(0),[G,kt]=u.useState(0),[jt,yt]=u.useState(!1),[pt,gt]=u.useState(!0),[v,Et]=u.useState(),[tt,It]=u.useState(),[et,Rt]=u.useState(!1),[st,Bt]=u.useState(!1),[Ct,mt]=u.useState(!1),Nt=u.useCallback(()=>mt(!0),[mt]),[nt,Pt]=ot("single-worker",!1),[at,Lt]=ot("updateSnapshots","missing"),[Q]=ot("mergeFiles",!1),Dt=u.useRef(null),it=u.useCallback(()=>{Et(p=>(p==null||p.close(),new Qt(new Xt(ft))))},[]);u.useEffect(()=>{var p;(p=Dt.current)==null||p.focus(),N(!0),it()},[it]),u.useEffect(()=>{if(!v)return;const p=[v.onStdio(g=>{if(g.buffer){const j=atob(g.buffer);z.write(j)}else z.write(g.text);g.type==="stderr"&&d(!0)}),v.onClose(()=>yt(!0))];return z.resize=(g,j)=>{wt={cols:g,rows:j},v.resizeTerminalNoReply({cols:g,rows:j})},()=>{for(const g of p)g.dispose()}},[v]),u.useEffect(()=>{if(!v)return;let p;const g=new ce({onUpdate:j=>{clearTimeout(p),p=void 0,j?w(g.asModel()):p||(p=setTimeout(()=>{w(g.asModel())},250))},onError:j=>{z.write((j.stack||j.value||"")+`
4
- `),d(!0)},pathSeparator:B.pathSeparator});return It(g),w(void 0),N(!0),h({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:j,report:I}=await v.runGlobalSetup({});if(g.processGlobalReport(I),j!=="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(F=>{g.processTestReportEvent(F)});const{hasBrowsers:U}=await v.checkBrowsers({});gt(U)}finally{N(!1)}})(),()=>{clearTimeout(p)}},[v]),u.useEffect(()=>{if(!a)return;const{config:p,rootSuite:g}=a,j=p.configFile?xt.getObject(p.configFile+":projects",void 0):void 0,I=new Map(c);for(const P of I.keys())g.suites.find(U=>U.title===P)||I.delete(P);for(const P of g.suites)I.has(P.title)||I.set(P.title,!!(j!=null&&j.includes(P.title)));!j&&I.size&&![...I.values()].includes(!0)&&I.set(I.entries().next().value[0],!0),(c.size!==I.size||[...c].some(([P,U])=>I.get(P)!==U))&&f(I)},[c,a]),u.useEffect(()=>{L&&(a!=null&&a.progress)?l(a.progress):a||l(void 0)},[a,L]);const{testTree:Mt}=u.useMemo(()=>{if(!a)return{testTree:new ut("",new X("","root"),[],c,B.pathSeparator,Q)};const p=new ut("",a.rootSuite,a.loadErrors,c,B.pathSeparator,Q);return p.filterTree(o,n,L?D==null?void 0:D.testIds:void 0),p.sortAndPropagateStatus(),p.shortenRoot(),p.flattenForSingleProject(),R(p.testIds()),{testTree:p}},[o,a,n,c,R,D,L,Q]),V=u.useCallback((p,g)=>{!v||!a||p==="bounce-if-busy"&&L||(S.current=new Set([...S.current,...g]),E.current=E.current.then(async()=>{var P,U,F;const j=S.current;if(S.current=new Set,!j.size)return;{for(const y of((P=a.rootSuite)==null?void 0:P.allTests())||[])if(j.has(y.id)){y.results=[];const W=y._createTestResult("pending");W[J]="scheduled"}w({...a})}const I=" ["+new Date().toLocaleTimeString()+"]";z.write("\x1B[2m—".repeat(Math.max(0,wt.cols-I.length))+I+"\x1B[22m"),l({total:0,passed:0,failed:0,skipped:0}),$({testIds:j}),await v.runTests({locations:B.args,grep:B.grep,grepInvert:B.grepInvert,testIds:[...j],projects:[...c].filter(([y,W])=>W).map(([y])=>y),updateSnapshots:at,reporters:B.reporters,workers:nt?1:void 0,trace:"on"});for(const y of((U=a.rootSuite)==null?void 0:U.allTests())||[])((F=y.results[0])==null?void 0:F.duration)===-1&&(y.results=[]);w({...a}),$(y=>y?{...y,completed:!0}:void 0)}))},[c,L,a,v,at,nt]);u.useEffect(()=>{if(!v||!tt)return;const p=v.onTestFilesChanged(async g=>{if(E.current=E.current.then(async()=>{N(!0);try{const F=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});tt.processListReport(F.report)}catch(F){console.log(F)}finally{N(!1)}}),await E.current,g.testFiles.length===0)return;const j=tt.asModel(),I=new ut("",j.rootSuite,j.loadErrors,c,B.pathSeparator,Q),P=[],U=new Set(g.testFiles);if(C){const F=y=>{const W=y.location.file;W&&U.has(W)&&P.push(...I.collectTestIds(y)),y.kind==="group"&&y.subKind==="folder"&&y.children.forEach(F)};F(I.rootItem)}else for(const F of q.value){const y=I.treeItemById(F),W=y==null?void 0:y.location.file;W&&U.has(W)&&P.push(...I.collectTestIds(y))}V("queue-if-busy",new Set(P))});return()=>p.dispose()},[V,v,C,q,tt,c,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(),V("bounce-if-busy",b))};return addEventListener("keydown",p),()=>{removeEventListener("keydown",p)}},[V,it,v,b,e]);const lt=u.useRef(null),Ft=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=lt.current)==null||g.showModal()},[]),ct=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=lt.current)==null||g.close()},[]),Ot=u.useCallback(p=>{ct(p),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));gt(g)})},[ct,v]);return r.jsxs("div",{className:"vbox ui-mode",children:[!pt&&r.jsxs("dialog",{ref:lt,children:[r.jsxs("div",{className:"title",children:[r.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),r.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",r.jsx("br",{}),"Would you like to run `playwright install`?",r.jsx("br",{}),r.jsx("button",{className:"button",onClick:Ot,children:"Install"}),r.jsx("button",{className:"button secondary",onClick:ct,children:"Dismiss"})]})]}),jt&&r.jsxs("div",{className:"disconnected",children:[r.jsx("div",{className:"title",children:"UI Mode disconnected"}),r.jsxs("div",{children:[r.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),r.jsx(Jt,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:r.jsxs("div",{className:"vbox",children:[r.jsxs("div",{className:ht("vbox",!e&&"hidden"),children:[r.jsxs(H,{children:[r.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),r.jsx(O,{icon:"circle-slash",title:"Clear output",onClick:()=>{z.clear(),d(!1)}}),r.jsx("div",{className:"spacer"}),r.jsx(O,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),r.jsx(de,{source:z})]}),r.jsx("div",{className:ht("vbox",e&&"hidden"),children:r.jsx(be,{pathSeparator:B.pathSeparator,item:T,rootDir:(_t=a==null?void 0:a.config)==null?void 0:_t.rootDir,revealSource:Ct,onOpenExternally:p=>v==null?void 0:v.openNoReply({location:{file:p.file,line:p.line,column:p.column}})})})]}),sidebar:r.jsxs("div",{className:"vbox ui-mode-sidebar",children:[r.jsxs(H,{noShadow:!0,noMinHeight:!0,children:[r.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),r.jsx("div",{className:"section-title",children:"Playwright"}),r.jsx(O,{icon:"refresh",title:"Reload",onClick:()=>it(),disabled:L||k}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(O,{icon:"terminal",title:"Toggle output — "+(bt?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),i&&r.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!pt&&r.jsx(O,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Ft})]}),r.jsx(fe,{filterText:o,setFilterText:t,statusFilters:n,setStatusFilters:m,projectFilters:c,setProjectFilters:f,testModel:a,runTests:()=>V("bounce-if-busy",b)}),r.jsxs(H,{className:"section-toolbar",noMinHeight:!0,children:[!L&&!x&&r.jsx("div",{className:"section-title",children:"Tests"}),!L&&x&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:[x.passed,"/",x.total," passed (",x.passed/x.total*100|0,"%)"]})}),L&&x&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:["Running ",x.passed,"/",D.testIds.size," passed (",x.passed/D.testIds.size*100|0,"%)"]})}),r.jsx(O,{icon:"play",title:"Run all — F5",onClick:()=>V("bounce-if-busy",b),disabled:L||k}),r.jsx(O,{icon:"debug-stop",title:"Stop — "+(bt?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!L||k}),r.jsx(O,{icon:"eye",title:"Watch all",toggled:C,onClick:()=>{h({value:new Set}),Z(!C)}}),r.jsx(O,{icon:"collapse-all",title:"Collapse all",onClick:()=>{Y(M+1)}}),r.jsx(O,{icon:"expand-all",title:"Expand all",onClick:()=>{kt(G+1)}})]}),r.jsx(_e,{filterText:o,testModel:a,testTree:Mt,testServerConnection:v,runningState:D,runTests:V,onItemSelected:_,watchAll:C,watchedTreeIds:q,setWatchedTreeIds:h,isLoading:k,requestedCollapseAllCount:M,requestedExpandAllCount:G,setFilterText:t,onRevealSource:Nt}),r.jsxs(H,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Bt(!st),children:[r.jsx("span",{className:`codicon codicon-${st?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:st?"Hide Testing Options":"Show Testing Options"}),r.jsx("div",{className:"section-title",children:"Testing Options"})]}),st&&r.jsx(Zt,{settings:[{type:"check",value:nt,set:Pt,name:"Single worker"},{type:"select",options:[{label:"All",value:"all"},{label:"Changed",value:"changed"},{label:"Missing",value:"missing"},{label:"None",value:"none"}],value:at,set:Lt,name:"Update snapshots"}]}),r.jsxs(H,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Rt(!et),children:[r.jsx("span",{className:`codicon codicon-${et?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:et?"Hide Settings":"Show Settings"}),r.jsx("div",{className:"section-title",children:"Settings"})]}),et&&r.jsx(Gt,{})]})})]})};(async()=>{if(te(),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.
4
+ `),d(!0)},pathSeparator:B.pathSeparator});return It(g),w(void 0),N(!0),h({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:j,report:I}=await v.runGlobalSetup({});if(g.processGlobalReport(I),j!=="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(F=>{g.processTestReportEvent(F)});const{hasBrowsers:U}=await v.checkBrowsers({});gt(U)}finally{N(!1)}})(),()=>{clearTimeout(p)}},[v]),u.useEffect(()=>{if(!a)return;const{config:p,rootSuite:g}=a,j=p.configFile?xt.getObject(p.configFile+":projects",void 0):void 0,I=new Map(c);for(const P of I.keys())g.suites.find(U=>U.title===P)||I.delete(P);for(const P of g.suites)I.has(P.title)||I.set(P.title,!!(j!=null&&j.includes(P.title)));!j&&I.size&&![...I.values()].includes(!0)&&I.set(I.entries().next().value[0],!0),(c.size!==I.size||[...c].some(([P,U])=>I.get(P)!==U))&&f(I)},[c,a]),u.useEffect(()=>{L&&(a!=null&&a.progress)?l(a.progress):a||l(void 0)},[a,L]);const{testTree:Mt}=u.useMemo(()=>{if(!a)return{testTree:new ut("",new X("","root"),[],c,B.pathSeparator,Q)};const p=new ut("",a.rootSuite,a.loadErrors,c,B.pathSeparator,Q);return p.filterTree(o,n,L?D==null?void 0:D.testIds:void 0),p.sortAndPropagateStatus(),p.shortenRoot(),p.flattenForSingleProject(),R(p.testIds()),{testTree:p}},[o,a,n,c,R,D,L,Q]),V=u.useCallback((p,g)=>{!v||!a||p==="bounce-if-busy"&&L||(S.current=new Set([...S.current,...g]),E.current=E.current.then(async()=>{var P,U,F;const j=S.current;if(S.current=new Set,!j.size)return;{for(const y of((P=a.rootSuite)==null?void 0:P.allTests())||[])if(j.has(y.id)){y.results=[];const W=y._createTestResult("pending");W[J]="scheduled"}w({...a})}const I=" ["+new Date().toLocaleTimeString()+"]";z.write("\x1B[2m—".repeat(Math.max(0,wt.cols-I.length))+I+"\x1B[22m"),l({total:0,passed:0,failed:0,skipped:0}),$({testIds:j}),await v.runTests({locations:B.args,grep:B.grep,grepInvert:B.grepInvert,testIds:[...j],projects:[...c].filter(([y,W])=>W).map(([y])=>y),updateSnapshots:at,reporters:B.reporters,workers:nt?1:void 0,trace:"on"});for(const y of((U=a.rootSuite)==null?void 0:U.allTests())||[])((F=y.results[0])==null?void 0:F.duration)===-1&&(y.results=[]);w({...a}),$(y=>y?{...y,completed:!0}:void 0)}))},[c,L,a,v,at,nt]);u.useEffect(()=>{if(!v||!tt)return;const p=v.onTestFilesChanged(async g=>{if(E.current=E.current.then(async()=>{N(!0);try{const F=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});tt.processListReport(F.report)}catch(F){console.log(F)}finally{N(!1)}}),await E.current,g.testFiles.length===0)return;const j=tt.asModel(),I=new ut("",j.rootSuite,j.loadErrors,c,B.pathSeparator,Q),P=[],U=new Set(g.testFiles);if(C){const F=y=>{const W=y.location.file;W&&U.has(W)&&P.push(...I.collectTestIds(y)),y.kind==="group"&&y.subKind==="folder"&&y.children.forEach(F)};F(I.rootItem)}else for(const F of q.value){const y=I.treeItemById(F),W=y==null?void 0:y.location.file;W&&U.has(W)&&P.push(...I.collectTestIds(y))}V("queue-if-busy",new Set(P))});return()=>p.dispose()},[V,v,C,q,tt,c,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(),V("bounce-if-busy",b))};return addEventListener("keydown",p),()=>{removeEventListener("keydown",p)}},[V,it,v,b,e]);const lt=u.useRef(null),Ft=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=lt.current)==null||g.showModal()},[]),ct=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=lt.current)==null||g.close()},[]),Ot=u.useCallback(p=>{ct(p),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));gt(g)})},[ct,v]);return r.jsxs("div",{className:"vbox ui-mode",children:[!pt&&r.jsxs("dialog",{ref:lt,children:[r.jsxs("div",{className:"title",children:[r.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),r.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",r.jsx("br",{}),"Would you like to run `playwright install`?",r.jsx("br",{}),r.jsx("button",{className:"button",onClick:Ot,children:"Install"}),r.jsx("button",{className:"button secondary",onClick:ct,children:"Dismiss"})]})]}),jt&&r.jsxs("div",{className:"disconnected",children:[r.jsx("div",{className:"title",children:"UI Mode disconnected"}),r.jsxs("div",{children:[r.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),r.jsx(Jt,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:r.jsxs("div",{className:"vbox",children:[r.jsxs("div",{className:ht("vbox",!e&&"hidden"),children:[r.jsxs(H,{children:[r.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),r.jsx(O,{icon:"circle-slash",title:"Clear output",onClick:()=>{z.clear(),d(!1)}}),r.jsx("div",{className:"spacer"}),r.jsx(O,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),r.jsx(de,{source:z})]}),r.jsx("div",{className:ht("vbox",e&&"hidden"),children:r.jsx(be,{pathSeparator:B.pathSeparator,item:T,rootDir:(_t=a==null?void 0:a.config)==null?void 0:_t.rootDir,revealSource:Ct,onOpenExternally:p=>v==null?void 0:v.openNoReply({location:{file:p.file,line:p.line,column:p.column}})})})]}),sidebar:r.jsxs("div",{className:"vbox ui-mode-sidebar",children:[r.jsxs(H,{noShadow:!0,noMinHeight:!0,children:[r.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),r.jsx("div",{className:"section-title",children:"Playwright"}),r.jsx(O,{icon:"refresh",title:"Reload",onClick:()=>it(),disabled:L||k}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(O,{icon:"terminal",title:"Toggle output — "+(bt?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),i&&r.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!pt&&r.jsx(O,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Ft})]}),r.jsx(fe,{filterText:o,setFilterText:t,statusFilters:n,setStatusFilters:m,projectFilters:c,setProjectFilters:f,testModel:a,runTests:()=>V("bounce-if-busy",b)}),r.jsxs(H,{className:"section-toolbar",noMinHeight:!0,children:[!L&&!x&&r.jsx("div",{className:"section-title",children:"Tests"}),!L&&x&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:[x.passed,"/",x.total," passed (",x.passed/x.total*100|0,"%)"]})}),L&&x&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:["Running ",x.passed,"/",D.testIds.size," passed (",x.passed/D.testIds.size*100|0,"%)"]})}),r.jsx(O,{icon:"play",title:"Run all — F5",onClick:()=>V("bounce-if-busy",b),disabled:L||k}),r.jsx(O,{icon:"debug-stop",title:"Stop — "+(bt?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!L||k}),r.jsx(O,{icon:"eye",title:"Watch all",toggled:C,onClick:()=>{h({value:new Set}),Z(!C)}}),r.jsx(O,{icon:"collapse-all",title:"Collapse all",onClick:()=>{Y(M+1)}}),r.jsx(O,{icon:"expand-all",title:"Expand all",onClick:()=>{kt(G+1)}})]}),r.jsx(_e,{filterText:o,testModel:a,testTree:Mt,testServerConnection:v,runningState:D,runTests:V,onItemSelected:_,watchAll:C,watchedTreeIds:q,setWatchedTreeIds:h,isLoading:k,requestedCollapseAllCount:M,requestedExpandAllCount:G,setFilterText:t,onRevealSource:Nt}),r.jsxs(H,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Bt(!st),children:[r.jsx("span",{className:`codicon codicon-${st?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:st?"Hide Testing Options":"Show Testing Options"}),r.jsx("div",{className:"section-title",children:"Testing Options"})]}),st&&r.jsx(Zt,{settings:[{type:"check",value:nt,set:Pt,name:"Single worker"},{type:"select",options:[{label:"All",value:"all"},{label:"Changed",value:"changed"},{label:"Missing",value:"missing"},{label:"None",value:"none"}],value:at,set:Lt,name:"Update snapshots"}]}),r.jsxs(H,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Rt(!et),children:[r.jsx("span",{className:`codicon codicon-${et?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:et?"Hide Settings":"Show Settings"}),r.jsx("div",{className:"section-title",children:"Settings"})]}),et&&r.jsx(Gt,{location:"ui-mode"})]})})]})};(async()=>{if(te(),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
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)}ee.createRoot(document.querySelector("#root")).render(r.jsx(Te,{}))})();
@@ -6,8 +6,8 @@
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.DKwZJGjT.js"></script>
10
- <link rel="modulepreload" crossorigin href="./assets/defaultSettingsView-B24Q0BeR.js">
9
+ <script type="module" crossorigin src="./uiMode.CL1nfSef.js"></script>
10
+ <link rel="modulepreload" crossorigin href="./assets/defaultSettingsView-SEdt3QvG.js">
11
11
  <link rel="stylesheet" crossorigin href="./defaultSettingsView.BEjzWGz-.css">
12
12
  <link rel="stylesheet" crossorigin href="./uiMode.Btcz36p_.css">
13
13
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-core",
3
- "version": "1.57.0-alpha-2025-10-29",
3
+ "version": "1.57.0-alpha-2025-10-31",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
package/types/types.d.ts CHANGED
@@ -11211,6 +11211,12 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
11211
11211
  y: number;
11212
11212
  };
11213
11213
 
11214
+ /**
11215
+ * Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between Playwright's current cursor
11216
+ * position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location.
11217
+ */
11218
+ steps?: number;
11219
+
11214
11220
  /**
11215
11221
  * Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
11216
11222
  * option in the config, or by using the
@@ -11294,6 +11300,12 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
11294
11300
  y: number;
11295
11301
  };
11296
11302
 
11303
+ /**
11304
+ * Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between Playwright's current cursor
11305
+ * position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location.
11306
+ */
11307
+ steps?: number;
11308
+
11297
11309
  /**
11298
11310
  * Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
11299
11311
  * option in the config, or by using the
@@ -12788,6 +12800,12 @@ export interface Locator {
12788
12800
  y: number;
12789
12801
  };
12790
12802
 
12803
+ /**
12804
+ * Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between Playwright's current cursor
12805
+ * position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location.
12806
+ */
12807
+ steps?: number;
12808
+
12791
12809
  /**
12792
12810
  * Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
12793
12811
  * option in the config, or by using the
@@ -12905,6 +12923,12 @@ export interface Locator {
12905
12923
  y: number;
12906
12924
  };
12907
12925
 
12926
+ /**
12927
+ * Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between Playwright's current cursor
12928
+ * position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location.
12929
+ */
12930
+ steps?: number;
12931
+
12908
12932
  /**
12909
12933
  * Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
12910
12934
  * option in the config, or by using the
@@ -20293,7 +20317,8 @@ export interface Mouse {
20293
20317
  */
20294
20318
  move(x: number, y: number, options?: {
20295
20319
  /**
20296
- * Defaults to 1. Sends intermediate `mousemove` events.
20320
+ * Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between Playwright's current cursor
20321
+ * position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location.
20297
20322
  */
20298
20323
  steps?: number;
20299
20324
  }): Promise<void>;
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var import_net = __toESM(require("net"));
25
- var import_fs = __toESM(require("fs"));
26
- var import_child_process = require("child_process");
27
- (async () => {
28
- const { PW_WSL_BRIDGE_PORT: socketPort, ...childEnv } = process.env;
29
- if (!socketPort)
30
- throw new Error("PW_WSL_BRIDGE_PORT env var is not set");
31
- const [executable, ...args] = process.argv.slice(2);
32
- if (!(await import_fs.default.promises.stat(executable)).isFile())
33
- throw new Error(`Executable does not exist. Did you update Playwright recently? Make sure to run npx playwright install webkit-wsl`);
34
- const address = (() => {
35
- const res = (0, import_child_process.spawnSync)("/usr/bin/wslinfo", ["--networking-mode"], { encoding: "utf8" });
36
- if (res.error || res.status !== 0)
37
- throw new Error(`Failed to run /usr/bin/wslinfo --networking-mode: ${res.error?.message || res.stderr || res.status}`);
38
- if (res.stdout.trim() === "nat") {
39
- const ipRes = (0, import_child_process.spawnSync)("/usr/sbin/ip", ["route", "show"], { encoding: "utf8" });
40
- if (ipRes.error || ipRes.status !== 0)
41
- throw new Error(`Failed to run ip route show: ${ipRes.error?.message || ipRes.stderr || ipRes.status}`);
42
- const ip = ipRes.stdout.trim().split("\n").find((line) => line.includes("default"))?.split(" ")[2];
43
- if (!ip)
44
- throw new Error("Could not determine WSL IP address (NAT mode).");
45
- return ip;
46
- }
47
- return "127.0.0.1";
48
- })();
49
- const socket = import_net.default.createConnection(parseInt(socketPort, 10), address);
50
- socket.setNoDelay(true);
51
- await new Promise((resolve, reject) => {
52
- socket.on("connect", resolve);
53
- socket.on("error", reject);
54
- });
55
- const child = (0, import_child_process.spawn)(executable, args, {
56
- stdio: ["inherit", "inherit", "inherit", "pipe", "pipe"],
57
- env: childEnv
58
- });
59
- const [childOutput, childInput] = [child.stdio[3], child.stdio[4]];
60
- socket.pipe(childOutput);
61
- childInput.pipe(socket);
62
- socket.on("end", () => child.kill());
63
- child.on("exit", (exitCode) => {
64
- socket.end();
65
- process.exit(exitCode || 0);
66
- });
67
- await new Promise((resolve, reject) => {
68
- child.on("exit", resolve);
69
- child.on("error", reject);
70
- });
71
- })().catch((error) => {
72
- console.error("Error occurred:", error);
73
- process.exit(1);
74
- });
@@ -1,113 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var import_net = __toESM(require("net"));
25
- var import_path = __toESM(require("path"));
26
- var import_child_process = require("child_process");
27
- (async () => {
28
- const argv = process.argv.slice(2);
29
- if (!argv.length) {
30
- console.error(`Usage: node ${import_path.default.basename(__filename)} <executable> [args...]`);
31
- process.exit(1);
32
- }
33
- const parentIn = new import_net.default.Socket({ fd: 3, readable: true, writable: false });
34
- const parentOut = new import_net.default.Socket({ fd: 4, readable: false, writable: true });
35
- const server = import_net.default.createServer();
36
- let socket = null;
37
- server.on("connection", (s) => {
38
- if (socket) {
39
- log("Extra connection received, destroying.");
40
- socket.destroy();
41
- return;
42
- }
43
- socket = s;
44
- socket.setNoDelay(true);
45
- log("Client connected, wiring pipes.");
46
- socket.pipe(parentOut);
47
- parentIn.pipe(socket);
48
- socket.on("close", () => {
49
- log("Socket closed");
50
- socket = null;
51
- });
52
- });
53
- await new Promise((resolve, reject) => {
54
- server.once("error", reject);
55
- server.listen(0, () => resolve(null));
56
- });
57
- const address = server.address();
58
- if (!address || typeof address === "string") {
59
- console.error("Failed to obtain listening address");
60
- process.exit(1);
61
- }
62
- const port = address.port;
63
- log("Server listening on", port);
64
- const env = {
65
- ...process.env,
66
- // WSLENV is a colon-delimited list of environment variables that should be included when launching WSL processes from Win32 or Win32 processes from WSL
67
- WSLENV: "PW_WSL_BRIDGE_PORT",
68
- PW_WSL_BRIDGE_PORT: String(port)
69
- };
70
- let shuttingDown = false;
71
- const child = (0, import_child_process.spawn)("wsl.exe", [
72
- "-d",
73
- "playwright",
74
- "--cd",
75
- "/home/pwuser",
76
- "/home/pwuser/node/bin/node",
77
- "/home/pwuser/webkit-wsl-transport-client.js",
78
- process.env.WEBKIT_EXECUTABLE || "",
79
- ...argv
80
- ], {
81
- env,
82
- stdio: ["inherit", "inherit", "inherit"]
83
- // no fd3/fd4 here; they stay only in this wrapper
84
- });
85
- log("Spawned child pid", child.pid);
86
- child.on("close", (code, signal) => {
87
- log("Child exit", { code, signal });
88
- const exitCode = code ?? (signal ? 128 : 0);
89
- shutdown(exitCode);
90
- });
91
- child.on("error", (err) => {
92
- console.error("Child process failed to start:", err);
93
- shutdown(1);
94
- });
95
- await new Promise((resolve) => child.once("close", resolve));
96
- async function shutdown(code = 0) {
97
- if (shuttingDown)
98
- return;
99
- shuttingDown = true;
100
- server.close();
101
- parentIn.destroy();
102
- parentOut.destroy();
103
- socket?.destroy();
104
- await new Promise((resolve) => server.once("close", resolve));
105
- process.exit(code);
106
- }
107
- function log(...args) {
108
- console.error(/* @__PURE__ */ new Date(), `[${import_path.default.basename(__filename)}]`, ...args);
109
- }
110
- })().catch((error) => {
111
- console.error("Error occurred:", error);
112
- process.exit(1);
113
- });
@@ -1,2 +0,0 @@
1
- import{M as m,r,T as M,W as C,j as e,D as F,a as I,b as k,c as z,d as O,e as V}from"./assets/defaultSettingsView-B24Q0BeR.js";const $=()=>{const[o,i]=r.useState(!1),[c,l]=r.useState(),[h,u]=r.useState(),[g,L]=r.useState(N),[p,x]=r.useState({done:0,total:0}),[b,v]=r.useState(!1),[j,S]=r.useState(null),[y,P]=r.useState(null),[R,E]=r.useState(!1),w=r.useCallback(t=>{const s=new URL(window.location.href);if(!t.length)return;const n=t.item(0),a=URL.createObjectURL(n);s.searchParams.append("trace",a);const d=s.toString();window.history.pushState({},"",d),l(a),u(n.name),v(!1),S(null)},[]);r.useEffect(()=>{const t=async s=>{var n;if((n=s.clipboardData)!=null&&n.files.length){for(const a of s.clipboardData.files)if(a.type!=="application/zip")return;s.preventDefault(),w(s.clipboardData.files)}};return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)}),r.useEffect(()=>{const t=s=>{const{method:n,params:a}=s.data;if(n!=="load"||!((a==null?void 0:a.trace)instanceof Blob))return;const d=new File([a.trace],"trace.zip",{type:"application/zip"}),f=new DataTransfer;f.items.add(d),w(f.files)};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});const U=r.useCallback(t=>{t.preventDefault(),w(t.dataTransfer.files)},[w]),W=r.useCallback(t=>{t.preventDefault(),t.target.files&&w(t.target.files)},[w]);r.useEffect(()=>{const t=new URL(window.location.href).searchParams,s=t.get("trace");if(i(t.has("isServer")),s!=null&&s.startsWith("file:")){P(s||null);return}if(t.has("isServer")){const n=new URLSearchParams(window.location.search).get("ws"),a=new URL(`../${n}`,window.location.toString());a.protocol=window.location.protocol==="https:"?"wss:":"ws:";const d=new M(new C(a));d.onLoadTraceRequested(async f=>{l(f.traceUrl),v(!1),S(null)}),d.initialize({}).catch(()=>{})}else s&&!s.startsWith("blob:")&&l(s)},[]),r.useEffect(()=>{(async()=>{if(!c){L(N);return}const t=s=>{s.data.method==="progress"&&x(s.data.params)};try{navigator.serviceWorker.addEventListener("message",t),x({done:0,total:1});const s=new URLSearchParams;s.set("trace",c);const n=await fetch(`contexts?${s.toString()}`);if(!n.ok){o||l(void 0),S((await n.json()).error);return}const a=await n.json(),d=new m(c,a);x({done:0,total:0}),L(d)}finally{navigator.serviceWorker.removeEventListener("message",t)}})()},[o,c,h]);const D=p.done!==p.total&&p.total!==0&&!j;r.useEffect(()=>{if(D){const t=setTimeout(()=>{E(!0)},200);return()=>clearTimeout(t)}else E(!1)},[D]);const T=!!(!o&&!b&&!y&&(!c||j));return e.jsxs("div",{className:"vbox workbench-loader",onDragOver:t=>{t.preventDefault(),v(!0)},children:[e.jsxs("div",{className:"hbox header",...T?{inert:!0}:{},children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),g.title&&e.jsx("div",{className:"title",children:g.title}),e.jsx("div",{className:"spacer"}),e.jsx(F,{icon:"settings-gear",title:"Settings",dialogDataTestId:"settings-toolbar-dialog",children:e.jsx(I,{})})]}),e.jsx(k,{model:g,inert:T}),y&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),e.jsxs("div",{style:{paddingTop:20},children:[e.jsxs("div",{children:["1. Click ",e.jsx("a",{href:y,children:"here"})," to put your trace into the download shelf"]}),e.jsxs("div",{children:["2. Go to ",e.jsx("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),e.jsx("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),e.jsx(z,{open:R,isModal:!0,className:"progress-dialog",children:e.jsxs("div",{className:"progress-content",children:[e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Loading Playwright Trace..."}),e.jsx("div",{className:"progress-wrapper",children:e.jsx("div",{className:"inner-progress",style:{width:p.total?100*p.done/p.total+"%":0}})})]})}),T&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",role:"alert",children:j}),e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const t=document.createElement("input");t.type="file",t.click(),t.addEventListener("change",s=>W(s))},type:"button",children:"Select file"}),e.jsx("div",{className:"info",children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."}),e.jsxs("div",{className:"version",children:["Playwright v","1.57.0-next"]})]}),o&&!c&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),b&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{v(!1)},onDrop:t=>U(t),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},N=new m("",[]),q=({traceJson:o})=>{const[i,c]=r.useState(void 0),[l,h]=r.useState(0),u=r.useRef(null);return r.useEffect(()=>(u.current&&clearTimeout(u.current),u.current=setTimeout(async()=>{try{const g=await A(o);c(g)}catch{const g=new m("",[]);c(g)}finally{h(l+1)}},500),()=>{u.current&&clearTimeout(u.current)}),[o,l]),e.jsx(k,{isLive:!0,model:i})};async function A(o){const i=new URLSearchParams;i.set("trace",o);const l=await(await fetch(`contexts?${i.toString()}`)).json();return new m(o,l)}(async()=>{const o=new URLSearchParams(window.location.search);if(O(),window.location.protocol!=="file:"){if(o.get("isUnderTest")==="true"&&await new Promise(h=>setTimeout(h,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
- Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(h=>{navigator.serviceWorker.oncontrollerchange=()=>h()}),setInterval(function(){fetch("ping")},1e4)}const i=o.get("trace"),l=(i==null?void 0:i.endsWith(".json"))?e.jsx(q,{traceJson:i}):e.jsx($,{});V.createRoot(document.querySelector("#root")).render(l)})();