@checkly/playwright-core 1.42.14 → 1.42.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/lib/vite/{traceViewer/assets/codeMirrorModule-75b0ca4f.js → recorder/assets/codeMirrorModule-LTVFY0Ab.js} +1 -1
  2. package/lib/vite/recorder/assets/{index-Ly3PcVUb.js → index-wuONJPd7.js} +2 -2
  3. package/lib/vite/recorder/index.html +1 -1
  4. package/lib/vite/traceViewer/assets/{codeMirrorModule-c1454a2e.js → codeMirrorModule-Vg1kIqMp.js} +10 -10
  5. package/lib/vite/traceViewer/assets/{codeMirrorModule-e5a15eec.js → codeMirrorModule-wLpsbIhd.js} +13 -13
  6. package/lib/vite/traceViewer/assets/wsPort-RIoVGhlT.js +69 -0
  7. package/lib/vite/traceViewer/assets/wsPort-f2dAQL4I.js +69 -0
  8. package/lib/vite/traceViewer/index.-_8-eHEE.js +2 -0
  9. package/lib/vite/traceViewer/index.html +2 -2
  10. package/lib/vite/traceViewer/index.qOFdH9Ja.js +2 -0
  11. package/lib/vite/traceViewer/uiMode.9CwNsWc6.js +10 -0
  12. package/lib/vite/traceViewer/uiMode.html +2 -2
  13. package/lib/vite/traceViewer/uiMode.iNIhieBM.js +10 -0
  14. package/package.json +1 -1
  15. package/lib/checkly/sWatcher.js +0 -150
  16. package/lib/cli/cli.js +0 -62
  17. package/lib/common/debugLogger.js +0 -91
  18. package/lib/vite/recorder/assets/codeMirrorModule-W69B4LBB.js +0 -24
  19. package/lib/vite/traceViewer/assets/codeMirrorModule-5nkjDDU_.js +0 -15578
  20. package/lib/vite/traceViewer/assets/codeMirrorModule-cc2329e4.js +0 -15593
  21. package/lib/vite/traceViewer/assets/codeMirrorModule-d725feea.js +0 -15586
  22. package/lib/vite/traceViewer/assets/codeMirrorModule-kT-uS7F4.js +0 -15592
  23. package/lib/vite/traceViewer/assets/codeMirrorModule-rcsC5no8.js +0 -15592
  24. package/lib/vite/traceViewer/assets/codeMirrorModule-ytMY1awF.js +0 -15585
  25. package/lib/vite/traceViewer/assets/wsPort-54626118.js +0 -18361
  26. package/lib/vite/traceViewer/assets/wsPort-98e00a94.js +0 -64
  27. package/lib/vite/traceViewer/assets/wsPort-KEbz4l8i.js +0 -18540
  28. package/lib/vite/traceViewer/assets/wsPort-a88a6a12.js +0 -18361
  29. package/lib/vite/traceViewer/assets/wsPort-cb764cde.js +0 -64
  30. package/lib/vite/traceViewer/assets/wsPort-ee2830d7.js +0 -64
  31. package/lib/vite/traceViewer/assets/wsPort-lTlmZhJd.js +0 -18564
  32. package/lib/vite/traceViewer/assets/wsPort-xpIMLVfx.js +0 -18540
  33. package/lib/vite/traceViewer/assets/wsPort-yM58htfg.js +0 -18360
  34. package/lib/vite/traceViewer/assets/xtermModule-443332e6.js +0 -9
  35. package/lib/vite/traceViewer/assets/xtermModule-60687b6b.js +0 -6410
  36. package/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css +0 -1
  37. package/lib/vite/traceViewer/codeMirrorModule.eb494ea9.css +0 -344
  38. package/lib/vite/traceViewer/codicon.79f233d0.ttf +0 -0
  39. package/lib/vite/traceViewer/index.1a1fe659.css +0 -1
  40. package/lib/vite/traceViewer/index.4a8ee36e.js +0 -2
  41. package/lib/vite/traceViewer/index.55e65778.js +0 -181
  42. package/lib/vite/traceViewer/index.742fd3e5.js +0 -181
  43. package/lib/vite/traceViewer/index.76e9f312.css +0 -124
  44. package/lib/vite/traceViewer/index.ZUjC4zt1.js +0 -180
  45. package/lib/vite/traceViewer/index.a265fbdb.js +0 -2
  46. package/lib/vite/traceViewer/index.decad628.js +0 -2
  47. package/lib/vite/traceViewer/index.ici1bqta.js +0 -180
  48. package/lib/vite/traceViewer/index.mxOcKqpu.js +0 -180
  49. package/lib/vite/traceViewer/index.zXVxM5ps.js +0 -180
  50. package/lib/vite/traceViewer/uiMode.08ab2d90.js +0 -4
  51. package/lib/vite/traceViewer/uiMode.0d0d667b.js +0 -4
  52. package/lib/vite/traceViewer/uiMode.216233d5.js +0 -1484
  53. package/lib/vite/traceViewer/uiMode.2c31018f.css +0 -1324
  54. package/lib/vite/traceViewer/uiMode.468b0309.js +0 -4
  55. package/lib/vite/traceViewer/uiMode.67C8Ij-c.js +0 -1490
  56. package/lib/vite/traceViewer/uiMode.8b41a49d.css +0 -1
  57. package/lib/vite/traceViewer/uiMode.F_k6a2aC.js +0 -1488
  58. package/lib/vite/traceViewer/uiMode.NjZAwD_B.js +0 -1485
  59. package/lib/vite/traceViewer/uiMode.YQRCZjm8.js +0 -1485
  60. package/lib/vite/traceViewer/uiMode.b2068d00.js +0 -1484
  61. package/lib/vite/traceViewer/uiMode.kvEeWpo2.js +0 -1490
  62. package/lib/vite/traceViewer/uiMode.ljHA9Ynz.js +0 -1490
  63. package/lib/vite/traceViewer/uiMode.ybQP_6Xr.js +0 -10
  64. package/lib/vite/traceViewer/wsPort.997c92cf.css +0 -3513
  65. package/lib/vite/traceViewer/wsPort.9c9a6767.css +0 -1
  66. package/lib/vite/traceViewer/wsPort.Oa05jfrO.css +0 -3513
  67. package/lib/vite/traceViewer/xtermModule.125f4259.css +0 -191
  68. package/lib/vite/traceViewer/xtermModule.6428296b.css +0 -32
@@ -0,0 +1,2 @@
1
+ import{M as b,r as a,c as U,j as e,T as D,t as R,W as M,a as C,b as F}from"./assets/wsPort-f2dAQL4I.js";const O=()=>{const[l,k]=a.useState(!1),[c,d]=a.useState([]),[u,E]=a.useState([]),[p,j]=a.useState(N),[v,m]=a.useState({done:0,total:0}),[T,h]=a.useState(!1),[y,f]=a.useState(null),[w,L]=a.useState(null),g=a.useCallback(r=>{const o=[],t=[],s=new URL(window.location.href);for(let i=0;i<r.length;i++){const n=r.item(i);if(!n)continue;const S=URL.createObjectURL(n);o.push(S),t.push(n.name),s.searchParams.append("trace",S),s.searchParams.append("traceFileName",n.name)}const x=s.toString();window.history.pushState({},"",x),d(o),E(t),h(!1),f(null)},[]),P=a.useCallback(r=>{r.preventDefault(),g(r.dataTransfer.files)},[g]),W=a.useCallback(r=>{r.preventDefault(),r.target.files&&g(r.target.files)},[g]);return a.useEffect(()=>{const r=new URL(window.location.href).searchParams,o=r.getAll("trace");k(r.has("isServer"));for(const t of o)if(t.startsWith("file:")){L(t||null);return}r.has("isServer")?U({onEvent(t,s){t==="loadTrace"&&(d(s.url?[s.url]:[]),h(!1),f(null))},onClose(){}}).then(t=>{t("ready")}):o.some(t=>t.startsWith("blob:"))||d(o)},[]),a.useEffect(()=>{(async()=>{if(c.length){const r=s=>{s.data.method==="progress"&&m(s.data.params)};navigator.serviceWorker.addEventListener("message",r),m({done:0,total:1});const o=[];for(let s=0;s<c.length;s++){const x=c[s],i=new URLSearchParams;i.set("trace",x),u.length&&i.set("traceFileName",u[s]);const n=await fetch(`contexts?${i.toString()}`);if(!n.ok){l||d([]),f((await n.json()).error);return}o.push(...await n.json())}navigator.serviceWorker.removeEventListener("message",r);const t=new b(o);m({done:0,total:0}),j(t)}else j(N)})()},[l,c,u]),e.jsxs("div",{className:"vbox workbench-loader",onDragOver:r=>{r.preventDefault(),h(!0)},children:[e.jsxs("div",{className:"hbox header",children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),p.title&&e.jsx("div",{className:"title",children:p.title}),e.jsx("div",{className:"spacer"}),e.jsx(D,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>R()})]}),e.jsx("div",{className:"progress",children:e.jsx("div",{className:"inner-progress",style:{width:v.total?100*v.done/v.total+"%":0}})}),e.jsx(M,{model:p}),w&&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:w,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"})]})]}),!l&&!T&&!w&&(!c.length||y)&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",children:y}),e.jsx("div",{className:"title",children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const r=document.createElement("input");r.type="file",r.multiple=!0,r.click(),r.addEventListener("change",o=>W(o))},children:"Select file(s)"}),e.jsx("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),l&&!c.length&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),T&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{h(!1)},onDrop:r=>P(r),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},N=new b([]);(async()=>{if(C(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(l=>setTimeout(l,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(l=>{navigator.serviceWorker.oncontrollerchange=()=>l()}),setInterval(function(){fetch("ping")},1e4)}F.render(e.jsx(O,{}),document.querySelector("#root"))})();
@@ -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.u51inEcm.js"></script>
11
- <link rel="modulepreload" crossorigin href="./assets/wsPort-_JBDEilC.js">
10
+ <script type="module" crossorigin src="./index.cbtHmFgM.js"></script>
11
+ <link rel="modulepreload" crossorigin href="./assets/wsPort-964mA9MZ.js">
12
12
  <link rel="stylesheet" crossorigin href="./wsPort.zR1WIy9-.css">
13
13
  <link rel="stylesheet" crossorigin href="./index.-g_5lMbJ.css">
14
14
  </head>
@@ -0,0 +1,2 @@
1
+ import{M as b,r as a,c as U,j as e,T as D,t as R,W as M,a as C,b as F}from"./assets/wsPort-RIoVGhlT.js";const O=()=>{const[l,k]=a.useState(!1),[c,d]=a.useState([]),[u,E]=a.useState([]),[p,j]=a.useState(N),[v,m]=a.useState({done:0,total:0}),[T,h]=a.useState(!1),[y,f]=a.useState(null),[w,L]=a.useState(null),g=a.useCallback(r=>{const o=[],t=[],s=new URL(window.location.href);for(let i=0;i<r.length;i++){const n=r.item(i);if(!n)continue;const S=URL.createObjectURL(n);o.push(S),t.push(n.name),s.searchParams.append("trace",S),s.searchParams.append("traceFileName",n.name)}const x=s.toString();window.history.pushState({},"",x),d(o),E(t),h(!1),f(null)},[]),P=a.useCallback(r=>{r.preventDefault(),g(r.dataTransfer.files)},[g]),W=a.useCallback(r=>{r.preventDefault(),r.target.files&&g(r.target.files)},[g]);return a.useEffect(()=>{const r=new URL(window.location.href).searchParams,o=r.getAll("trace");k(r.has("isServer"));for(const t of o)if(t.startsWith("file:")){L(t||null);return}r.has("isServer")?U({onEvent(t,s){t==="loadTrace"&&(d(s.url?[s.url]:[]),h(!1),f(null))},onClose(){}}).then(t=>{t("ready")}):o.some(t=>t.startsWith("blob:"))||d(o)},[]),a.useEffect(()=>{(async()=>{if(c.length){const r=s=>{s.data.method==="progress"&&m(s.data.params)};navigator.serviceWorker.addEventListener("message",r),m({done:0,total:1});const o=[];for(let s=0;s<c.length;s++){const x=c[s],i=new URLSearchParams;i.set("trace",x),u.length&&i.set("traceFileName",u[s]);const n=await fetch(`contexts?${i.toString()}`);if(!n.ok){l||d([]),f((await n.json()).error);return}o.push(...await n.json())}navigator.serviceWorker.removeEventListener("message",r);const t=new b(o);m({done:0,total:0}),j(t)}else j(N)})()},[l,c,u]),e.jsxs("div",{className:"vbox workbench-loader",onDragOver:r=>{r.preventDefault(),h(!0)},children:[e.jsxs("div",{className:"hbox header",children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),p.title&&e.jsx("div",{className:"title",children:p.title}),e.jsx("div",{className:"spacer"}),e.jsx(D,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>R()})]}),e.jsx("div",{className:"progress",children:e.jsx("div",{className:"inner-progress",style:{width:v.total?100*v.done/v.total+"%":0}})}),e.jsx(M,{model:p}),w&&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:w,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"})]})]}),!l&&!T&&!w&&(!c.length||y)&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",children:y}),e.jsx("div",{className:"title",children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const r=document.createElement("input");r.type="file",r.multiple=!0,r.click(),r.addEventListener("change",o=>W(o))},children:"Select file(s)"}),e.jsx("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),l&&!c.length&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),T&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{h(!1)},onDrop:r=>P(r),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},N=new b([]);(async()=>{if(C(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(l=>setTimeout(l,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(l=>{navigator.serviceWorker.oncontrollerchange=()=>l()}),setInterval(function(){fetch("ping")},1e4)}F.render(e.jsx(O,{}),document.querySelector("#root"))})();
@@ -0,0 +1,10 @@
1
+ import{u as Ct,r as V,d as yt,_ as Bt,e as Mt,f as Nt,j as l,R as f,g as Rt,c as Pt,s as wt,S as Dt,h as G,T as y,t as Lt,m as Ft,i as It,k as dt,W as Wt,M as Ot,l as At,a as zt,b as Vt}from"./assets/wsPort-f2dAQL4I.js";class ht{constructor(){this._stringCache=new Map}internString(t){let e=this._stringCache.get(t);return e||(this._stringCache.set(t,t),e=t),e}}var Kt={};class ft{constructor(t,e,s,i){this._tests=new Map,this._listOnly=!1,this._clearPreviousResultsWhenTestBegins=!1,this._stringPool=new ht,this._rootSuite=new W("","root"),this._pathSeparator=t,this._reporter=e,this._reuseTestCases=s,this._reportConfig=i}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==="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()}_setClearPreviousResultsWhenTestBegins(){this._clearPreviousResultsWhenTestBegins=!0}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._listOnly=t.listOnly,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._rootSuite.suites.find(s=>s.project().__projectId===t.id);if(e||(e=new W(t.name,"project"),this._rootSuite.suites.push(e),e.parent=this._rootSuite),e._project=this._parseProject(t),this._mergeSuitesInto(t.suites,e),this._listOnly){const s=new Set,i=o=>{o.tests.map(c=>c.testId).forEach(c=>s.add(c)),o.suites.forEach(i)};t.suites.forEach(i);const r=o=>{o.tests=o.tests.filter(c=>s.has(c.id)),o.suites.forEach(r)};r(e)}}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var r,o;const s=this._tests.get(t);this._clearPreviousResultsWhenTestBegins&&s._clearResults();const i=s._createTestResult(e.id);i.retry=e.retry,i.workerIndex=e.workerIndex,i.parallelIndex=e.parallelIndex,i.setStartTimeNumber(e.startTime),i.statusEx="running",(o=(r=this._reporter).onTestBegin)==null||o.call(r,s,i)}_onTestEnd(t,e){var r,o,c;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus,s.annotations=t.annotations;const i=s.resultsMap.get(e.id);i.duration=e.duration,i.status=e.status,i.statusEx=e.status,i.errors=e.errors,i.error=(r=i.errors)==null?void 0:r[0],i.attachments=this._parseAttachments(e.attachments),(c=(o=this._reporter).onTestEnd)==null||c.call(o,s,i),i.stepMap=new Map}_onStepBegin(t,e,s){var p,d;const i=this._tests.get(t),r=i.resultsMap.get(e),o=s.parentStepId?r.stepMap.get(s.parentStepId):void 0,c=this._absoluteLocation(s.location),h=new Ht(s,o,c);o?o.steps.push(h):r.steps.push(h),r.stepMap.set(s.id,h),(d=(p=this._reporter).onStepBegin)==null||d.call(p,i,r,h)}_onStepEnd(t,e,s){var c,h;const i=this._tests.get(t),r=i.resultsMap.get(e),o=r.stepMap.get(s.id);o.duration=s.duration,o.error=s.error,(h=(c=this._reporter).onStepEnd)==null||h.call(c,i,r,o)}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,r){var p,d,v,g;const o=r?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,c=e?this._tests.get(e):void 0,h=c&&s?c.resultsMap.get(s):void 0;t==="stdout"?(h==null||h.stdout.push(o),(d=(p=this._reporter).onStdOut)==null||d.call(p,o,c,h)):(h==null||h.stderr.push(o),(g=(v=this._reporter).onStdErr)==null||g.call(v,o,c,h))}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 this._stringPool=new ht,(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...xt,...t};return this._reportConfig&&(e.configFile=this._reportConfig.configFile,e.reportSlowTests=this._reportConfig.reportSlowTests,e.quiet=this._reportConfig.quiet,e.reporter=[...this._reportConfig.reporter]),e}_parseProject(t){return{__projectId:t.id,metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:Z(t.testIgnore),testMatch:Z(t.testMatch),timeout:t.timeout,grep:Z(t.grep),grepInvert:Z(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:{}}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuitesInto(t,e){for(const s of t){let i=e.suites.find(r=>r.title===s.title);i||(i=new W(s.title,s.type),i.parent=e,e.suites.push(i)),i.location=this._absoluteLocation(s.location),i._fileId=s.fileId,i._parallelMode=s.parallelMode,this._mergeSuitesInto(s.suites,i),this._mergeTestsInto(s.tests,i)}}_mergeTestsInto(t,e){for(const s of t){let i=this._reuseTestCases?e.tests.find(r=>r.title===s.title):void 0;i||(i=new Ut(s.testId,s.title,this._absoluteLocation(s.location)),i.parent=e,e.tests.push(i),this._tests.set(i.id,i)),this._updateTest(s,i)}}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e.tags=t.tags??[],e}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){return t&&this._stringPool.internString(this._rootDir+this._pathSeparator+t)}}class W{constructor(t,e){this._requireFile="",this.suites=[],this.tests=[],this._parallelMode="none",this.title=t,this._type=e}allTests(){const t=[],e=s=>{for(const i of[...s.suites,...s.tests])i instanceof W?e(i):t.push(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())}}class Ut{constructor(t,e,s){this.fn=()=>{},this.results=[],this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.resultsMap=new Map,this.id=t,this.title=e,this.location=s}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){var s,i;const t=[...this.results];for(;((s=t[0])==null?void 0:s.status)==="skipped"||((i=t[0])==null?void 0:i.status)==="interrupted";)t.shift();if(!t.length)return"skipped";const e=t.filter(r=>r.status!=="skipped"&&r.status!=="interrupted"&&r.status!==this.expectedStatus);return e.length?e.length===t.length?"unexpected":"flaky":"expected"}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_clearResults(){this.results=[],this.resultsMap.clear()}_createTestResult(t){const e=new $t(this.results.length);return this.results.push(e),this.resultsMap.set(t,e),e}}class Ht{constructor(t,e,s){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}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}}class $t{constructor(t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this.stepMap=new Map,this.statusEx="scheduled",this._startTime=0,this.retry=t}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const xt={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[Kt.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function Z(n){return n.map(t=>t.s?t.s:new RegExp(t.r.source,t.r.flags))}const qt=({source:n})=>{const[t,e]=Ct(),[s,i]=V.useState(yt()),[r]=V.useState(Bt(()=>import("./assets/xtermModule-Yt6xwiJ_.js"),__vite__mapDeps([0,1]),import.meta.url).then(c=>c.default)),o=V.useRef(null);return V.useEffect(()=>(Mt(i),()=>Nt(i)),[]),V.useEffect(()=>{const c=n.write,h=n.clear;return(async()=>{const{Terminal:p,FitAddon:d}=await r,v=e.current;if(!v)return;const g=s==="dark-mode"?Xt:Yt;if(o.current&&o.current.terminal.options.theme===g)return;o.current&&(v.textContent="");const a=new p({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:g}),m=new d;a.loadAddon(m);for(const x of n.pending)a.write(x);n.write=x=>{n.pending.push(x),a.write(x)},n.clear=()=>{n.pending=[],a.clear()},a.open(v),m.fit(),o.current={terminal:a,fitAddon:m}})(),()=>{n.clear=h,n.write=c}},[r,o,e,n,s]),V.useEffect(()=>{setTimeout(()=>{o.current&&(o.current.fitAddon.fit(),n.resize(o.current.terminal.cols,o.current.terminal.rows))},250)},[t,n]),l.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},Yt={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"},Xt={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"},Jt=({title:n,children:t,setExpanded:e,expanded:s,expandOnTitleClick:i})=>l.jsxs("div",{className:"expandable"+(s?" expanded":""),children:[l.jsxs("div",{className:"expandable-title",onClick:()=>i&&e(!s),children:[l.jsx("div",{className:"codicon codicon-"+(s?"chevron-down":"chevron-right"),style:{cursor:"pointer",color:"var(--vscode-foreground)",marginLeft:"5px"},onClick:()=>!i&&e(!s)}),n]}),s&&l.jsx("div",{style:{marginLeft:25},children:t})]});function Qt(n){return`.playwright-artifacts-${n}`}let lt=()=>{},vt=n=>{},_t={cols:80,rows:24},I=async()=>{};const O={pending:[],clear:()=>{},write:n=>O.pending.push(n),resize:(n,t)=>{_t={cols:n,rows:t},q("resizeTerminal",{cols:n,rows:t})}},Zt=({})=>{var ut;const[n,t]=f.useState(""),[e,s]=f.useState(!1),[i,r]=f.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[o,c]=f.useState(new Map),[h,p]=f.useState({config:void 0,rootSuite:void 0,loadErrors:[]}),[d,v]=f.useState(),[g,a]=f.useState({}),[m,x]=f.useState(new Set),[T,B]=f.useState(!1),[_,R]=f.useState(),[M,X]=Rt("watch-all",!1),[et,A]=f.useState({value:new Set}),u=f.useRef(Promise.resolve()),S=f.useRef(new Set),[w,b]=f.useState(0),[k,E]=f.useState(!1),[J,ct]=f.useState(!0),Tt=f.useRef(null),st=f.useCallback(()=>{B(!0),A({value:new Set}),lt(xt,new W("","root"),[],void 0),bt(!0).then(async()=>{B(!1);const{hasBrowsers:j}=await I("checkBrowsers");ct(j)})},[]);f.useEffect(()=>{var j;(j=Tt.current)==null||j.focus(),B(!0),Pt({onEvent:ie,onClose:()=>E(!0)}).then(C=>{I=async(P,D)=>{const N=window.__logForTest;N==null||N({method:P,params:D}),await C(P,D)},st()})},[st]),lt=f.useCallback((j,C,P,D)=>{const N=j.configFile?wt.getObject(j.configFile+":projects",void 0):void 0;for(const L of o.keys())C.suites.find(Q=>Q.title===L)||o.delete(L);for(const L of C.suites)o.has(L.title)||o.set(L.title,!!(N!=null&&N.includes(L.title)));!N&&o.size&&![...o.values()].includes(!0)&&o.set(o.entries().next().value[0],!0),p({config:j,rootSuite:C,loadErrors:P}),c(new Map(o)),_&&D?v(D):D||v(void 0)},[o,_]);const it=f.useCallback((j,C)=>{j==="bounce-if-busy"&&_||(S.current=new Set([...S.current,...C]),u.current=u.current.then(async()=>{var N,L,Q;const P=S.current;if(S.current=new Set,!P.size)return;{for(const F of((N=h.rootSuite)==null?void 0:N.allTests())||[])P.has(F.id)&&(F._clearResults(),F._createTestResult("pending"));p({...h})}const D=" ["+new Date().toLocaleTimeString()+"]";O.write("\x1B[2m—".repeat(Math.max(0,_t.cols-D.length))+D+"\x1B[22m"),v({total:0,passed:0,failed:0,skipped:0}),R({testIds:P}),await I("run",{testIds:[...P],projects:[...o].filter(([F,Et])=>Et).map(([F])=>F)});for(const F of((L=h.rootSuite)==null?void 0:L.allTests())||[])((Q=F.results[0])==null?void 0:Q.duration)===-1&&F._clearResults();p({...h}),R(void 0)}))},[o,_,h]),z=!!_,nt=f.useRef(null),kt=f.useCallback(j=>{var C;j.preventDefault(),j.stopPropagation(),(C=nt.current)==null||C.showModal()},[]),ot=f.useCallback(j=>{var C;j.preventDefault(),j.stopPropagation(),(C=nt.current)==null||C.close()},[]),jt=f.useCallback(j=>{ot(j),s(!0),I("installBrowsers").then(async()=>{s(!1);const{hasBrowsers:C}=await I("checkBrowsers");ct(C)})},[ot]);return l.jsxs("div",{className:"vbox ui-mode",children:[!J&&l.jsxs("dialog",{ref:nt,children:[l.jsxs("div",{className:"title",children:[l.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),l.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",l.jsx("br",{}),"Would you like to run `playwright install`?",l.jsx("br",{}),l.jsx("button",{className:"button",onClick:jt,children:"Install"}),l.jsx("button",{className:"button secondary",onClick:ot,children:"Dismiss"})]})]}),k&&l.jsxs("div",{className:"disconnected",children:[l.jsx("div",{className:"title",children:"UI Mode disconnected"}),l.jsxs("div",{children:[l.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),l.jsxs(Dt,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",children:[l.jsxs("div",{className:"vbox",children:[l.jsxs("div",{className:"vbox"+(e?"":" hidden"),children:[l.jsxs(G,{children:[l.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),l.jsx(y,{icon:"circle-slash",title:"Clear output",onClick:()=>O.clear()}),l.jsx("div",{className:"spacer"}),l.jsx(y,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),l.jsx(qt,{source:O})]}),l.jsx("div",{className:"vbox"+(e?" hidden":""),children:l.jsx(se,{item:g,rootDir:(ut=h.config)==null?void 0:ut.rootDir})})]}),l.jsxs("div",{className:"vbox ui-mode-sidebar",children:[l.jsxs(G,{noShadow:!0,noMinHeight:!0,children:[l.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),l.jsx("div",{className:"section-title",children:"Playwright"}),l.jsx(y,{icon:"color-mode",title:"Toggle color mode",onClick:()=>Lt()}),l.jsx(y,{icon:"refresh",title:"Reload",onClick:()=>st(),disabled:z||T}),l.jsx(y,{icon:"terminal",title:"Toggle output",toggled:e,onClick:()=>{s(!e)}}),!J&&l.jsx(y,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:kt})]}),l.jsx(Gt,{filterText:n,setFilterText:t,statusFilters:i,setStatusFilters:r,projectFilters:o,setProjectFilters:c,testModel:h,runTests:()=>it("bounce-if-busy",m)}),l.jsxs(G,{noMinHeight:!0,children:[!z&&!d&&l.jsx("div",{className:"section-title",children:"Tests"}),!z&&d&&l.jsx("div",{"data-testid":"status-line",className:"status-line",children:l.jsxs("div",{children:[d.passed,"/",d.total," passed (",d.passed/d.total*100|0,"%)"]})}),z&&d&&l.jsx("div",{"data-testid":"status-line",className:"status-line",children:l.jsxs("div",{children:["Running ",d.passed,"/",_.testIds.size," passed (",d.passed/_.testIds.size*100|0,"%)"]})}),l.jsx(y,{icon:"play",title:"Run all",onClick:()=>it("bounce-if-busy",m),disabled:z||T}),l.jsx(y,{icon:"debug-stop",title:"Stop",onClick:()=>q("stop"),disabled:!z||T}),l.jsx(y,{icon:"eye",title:"Watch all",toggled:M,onClick:()=>{A({value:new Set}),X(!M)}}),l.jsx(y,{icon:"collapse-all",title:"Collapse all",onClick:()=>{b(w+1)}})]}),l.jsx(ee,{statusFilters:i,projectFilters:o,filterText:n,testModel:h,runningState:_,runTests:it,onItemSelected:a,setVisibleTestIds:x,watchAll:M,watchedTreeIds:et,setWatchedTreeIds:A,isLoading:T,requestedCollapseAllCount:w})]})]})]})},Gt=({filterText:n,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:r,testModel:o,runTests:c})=>{const[h,p]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{var a;(a=d.current)==null||a.focus()},[]);const v=[...e.entries()].filter(([a,m])=>m).map(([a])=>a).join(" ")||"all",g=[...i.entries()].filter(([a,m])=>m).map(([a])=>a).join(" ")||"all";return l.jsxs("div",{className:"filters",children:[l.jsx(Jt,{expanded:h,setExpanded:p,title:l.jsx("input",{ref:d,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:n,onChange:a=>{t(a.target.value)},onKeyDown:a=>{a.key==="Enter"&&c()}})}),l.jsxs("div",{className:"filter-summary",title:"Status: "+v+`
2
+ Projects: `+g,onClick:()=>p(!h),children:[l.jsx("span",{className:"filter-label",children:"Status:"})," ",v,l.jsx("span",{className:"filter-label",children:"Projects:"})," ",g]}),h&&l.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[l.jsx("div",{className:"filter-list",children:[...e.entries()].map(([a,m])=>l.jsx("div",{className:"filter-entry",children:l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:m,onClick:()=>{const x=new Map(e);x.set(a,!x.get(a)),s(x)}}),l.jsx("div",{children:a})]})}))}),l.jsx("div",{className:"filter-list",children:[...i.entries()].map(([a,m])=>l.jsx("div",{className:"filter-entry",children:l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:m,onClick:()=>{var B;const x=new Map(i);x.set(a,!x.get(a)),r(x);const T=(B=o==null?void 0:o.config)==null?void 0:B.configFile;T&&wt.setObject(T+":projects",[...x.entries()].filter(([_,R])=>R).map(([_])=>_))}}),l.jsx("div",{children:a||"untitled"})]})}))})]})]})},te=At,ee=({statusFilters:n,projectFilters:t,filterText:e,testModel:s,runTests:i,runningState:r,watchAll:o,watchedTreeIds:c,setWatchedTreeIds:h,isLoading:p,onItemSelected:d,setVisibleTestIds:v,requestedCollapseAllCount:g})=>{const[a,m]=f.useState({expandedItems:new Map}),[x,T]=f.useState(),[B,_]=f.useState(g),{rootItem:R,treeItemMap:M,fileNames:X}=f.useMemo(()=>{let u=re(s.rootSuite,s.loadErrors,t);le(u,e,n,r==null?void 0:r.testIds),St(u),u=ae(u),ce(u);const S=new Map,w=new Set,b=new Set,k=E=>{E.kind==="group"&&E.location.file&&b.add(E.location.file),E.kind==="case"&&E.tests.forEach(J=>w.add(J.id)),E.children.forEach(k),S.set(E.id,E)};return k(u),v(w),{rootItem:u,treeItemMap:S,fileNames:b}},[e,s,n,t,v,r]);f.useEffect(()=>{if(B!==g){a.expandedItems.clear();for(const w of M.keys())a.expandedItems.set(w,!1);_(g),T(void 0),m({...a});return}if(!r||r.itemSelectedByUser)return;let u;const S=w=>{var b;w.children.forEach(S),!u&&w.status==="failed"&&(w.kind==="test"&&r.testIds.has(w.test.id)||w.kind==="case"&&r.testIds.has((b=w.tests[0])==null?void 0:b.id))&&(u=w)};S(R),u&&T(u.id)},[r,T,R,B,_,g,a,m,M]);const{selectedTreeItem:et}=f.useMemo(()=>{const u=x?M.get(x):void 0;let S;u&&(S={file:u.location.file,line:u.location.line,source:{errors:s.loadErrors.filter(b=>{var k;return((k=b.location)==null?void 0:k.file)===u.location.file}).map(b=>({line:b.location.line,message:b.message})),content:void 0}});let w;return(u==null?void 0:u.kind)==="test"?w=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(w=u.tests[0]),d({treeItem:u,testCase:w,testFile:S}),{selectedTreeItem:u}},[d,x,s,M]);f.useEffect(()=>{if(!p)if(o)q("watch",{fileNames:[...X]});else{const u=new Set;for(const S of c.value){const w=M.get(S),b=w==null?void 0:w.location.file;b&&u.add(b)}q("watch",{fileNames:[...u]})}},[p,R,X,o,c,M]);const A=u=>{T(u.id),i("bounce-if-busy",rt(u))};return vt=u=>{const S=[],w=new Set(u);if(o){const b=k=>{const E=k.location.file;E&&w.has(E)&&S.push(...rt(k)),k.kind==="group"&&k.subKind==="folder"&&k.children.forEach(b)};b(R)}else for(const b of c.value){const k=M.get(b),E=k==null?void 0:k.location.file;E&&w.has(E)&&S.push(...rt(k))}i("queue-if-busy",new Set(S))},l.jsx(te,{name:"tests",treeState:a,setTreeState:m,rootItem:R,dataTestId:"test-tree",render:u=>l.jsxs("div",{className:"hbox ui-mode-list-item",children:[l.jsx("div",{className:"ui-mode-list-item-title",title:u.title,children:u.title}),!!u.duration&&u.status!=="skipped"&&l.jsx("div",{className:"ui-mode-list-item-time",children:Ft(u.duration)}),l.jsxs(G,{noMinHeight:!0,noShadow:!0,children:[l.jsx(y,{icon:"play",title:"Run",onClick:()=>A(u),disabled:!!r}),l.jsx(y,{icon:"go-to-file",title:"Open in VS Code",onClick:()=>q("open",{location:oe(u)}),style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!o&&l.jsx(y,{icon:"eye",title:"Watch",onClick:()=>{c.value.has(u.id)?c.value.delete(u.id):c.value.add(u.id),h({...c})},toggled:c.value.has(u.id)})]})]}),icon:u=>It(u.status),selectedItem:et,onAccepted:A,onSelected:u=>{r&&(r.itemSelectedByUser=!0),T(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:e?5:1,noItemsMessage:p?"Loading…":"No tests"})},se=({item:n,rootDir:t})=>{var g;const[e,s]=f.useState(),[i,r]=f.useState(0),o=f.useRef(null),{outputDir:c}=f.useMemo(()=>({outputDir:n.testCase?ne(n.testCase):void 0}),[n]),[h,p]=f.useState(),d=f.useCallback(a=>p(dt(a)),[p]),v=h?e==null?void 0:e.model.actions.find(a=>dt(a)===h):void 0;return f.useEffect(()=>{var T,B;o.current&&clearTimeout(o.current);const a=(T=n.testCase)==null?void 0:T.results[0];if(!a){s(void 0);return}const m=a&&a.duration>=0&&a.attachments.find(_=>_.name==="trace");if(m&&m.path){mt(m.path).then(_=>s({model:_,isLive:!1}));return}if(!c){s(void 0);return}const x=`${c}/${Qt(a.workerIndex)}/traces/${(B=n.testCase)==null?void 0:B.id}.json`;return o.current=setTimeout(async()=>{try{const _=await mt(x);s({model:_,isLive:!0})}catch{s(void 0)}finally{r(i+1)}},500),()=>{o.current&&clearTimeout(o.current)}},[c,n,s,i,r]),l.jsx(Wt,{model:e==null?void 0:e.model,hideStackFrames:!0,showSourcesFirst:!0,rootDir:t,initialSelection:v,onSelectionChanged:d,fallbackLocation:n.testFile,isLive:e==null?void 0:e.isLive,status:(g=n.treeItem)==null?void 0:g.status},"workbench")};let H,$,pt,tt,U;const gt=()=>{clearTimeout(tt),tt=void 0,lt(U.config,U.rootSuite,U.loadErrors,U.progress)},K=(n,t,e,s,i=!1)=>{U={config:n,rootSuite:t,loadErrors:e,progress:s},i?gt():tt||(tt=setTimeout(gt,250))},bt=n=>{if(!n)return I("list",{});let t;const e=[],s={total:0,passed:0,failed:0,skipped:0};let i;return H=new ft(Y,{version:()=>"v2",onConfigure:r=>{i=r,$=new ft(Y,{onBegin:o=>{pt=o.allTests().length,$=void 0}},!1)},onBegin:r=>{t||(t=r),s.total=pt,s.passed=0,s.failed=0,s.skipped=0,K(i,t,e,s,!0)},onEnd:()=>{K(i,t,e,s,!0)},onTestBegin:()=>{K(i,t,e,s)},onTestEnd:r=>{r.outcome()==="skipped"?++s.skipped:r.outcome()==="unexpected"?++s.failed:++s.passed,K(i,t,e,s)},onError:r=>{O.write((r.stack||r.value||"")+`
3
+ `),e.push(r),K(i,t??new W("","root"),e,s)},printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}},!0),H._setClearPreviousResultsWhenTestBegins(),I("list",{})},q=(n,t)=>{if(window._overrideProtocolForTest){window._overrideProtocolForTest({method:n,params:t}).catch(()=>{});return}I(n,t).catch(e=>{console.error(e)})},ie=(n,t)=>{var e,s;if(n==="listChanged"){bt(!1).catch(()=>{});return}if(n==="testFilesChanged"){vt(t.testFileNames);return}if(n==="stdio"){if(t.buffer){const i=atob(t.buffer);O.write(i)}else O.write(t.text);return}(e=$==null?void 0:$.dispatch({method:n,params:t}))==null||e.catch(()=>{}),(s=H==null?void 0:H.dispatch({method:n,params:t}))==null||s.catch(()=>{})},ne=n=>{var t;for(let e=n.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir},oe=n=>{if(n)return n.location.file+":"+n.location.line},rt=n=>{const t=new Set;if(!n)return t;const e=s=>{var i;s.kind==="case"?s.tests.map(r=>r.id).forEach(r=>t.add(r)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(n),t};function at(n,t,e,s){if(t.length===0)return n;const i=t.join(Y),r=s.get(i);if(r)return r;const o=at(n,t.slice(0,t.length-1),!1,s),c={kind:"group",subKind:e?"file":"folder",id:i,title:t[t.length-1],location:{file:i,line:0,column:0},duration:0,parent:o,children:[],status:"none",hasLoadErrors:!1};return o.children.push(c),s.set(i,c),c}function re(n,t,e){const s=[...e.values()].some(Boolean),i={kind:"group",subKind:"folder",id:"root",title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},r=(c,h,p)=>{for(const d of h.suites){const v=d.title||"<anonymous>";let g=p.children.find(a=>a.kind==="group"&&a.title===v);g||(g={kind:"group",subKind:"describe",id:"suite:"+h.titlePath().join("")+""+v,title:v,location:d.location,duration:0,parent:p,children:[],status:"none",hasLoadErrors:!1},p.children.push(g)),r(c,d,g)}for(const d of h.tests){const v=d.title;let g=p.children.find(x=>x.kind!=="group"&&x.title===v);g||(g={kind:"case",id:"test:"+d.titlePath().join(""),title:v,parent:p,children:[],tests:[],location:d.location,duration:0,status:"none"},p.children.push(g));const a=d.results[0];let m="none";(a==null?void 0:a.statusEx)==="scheduled"?m="scheduled":(a==null?void 0:a.statusEx)==="running"?m="running":(a==null?void 0:a.status)==="skipped"?m="skipped":(a==null?void 0:a.status)==="interrupted"?m="none":a&&d.outcome()!=="expected"?m="failed":a&&d.outcome()==="expected"&&(m="passed"),g.tests.push(d),g.children.push({kind:"test",id:d.id,title:c,location:d.location,test:d,parent:g,children:[],status:m,duration:d.results.length?Math.max(0,d.results[0].duration):0,project:c}),g.duration=g.children.reduce((x,T)=>x+T.duration,0)}},o=new Map;for(const c of(n==null?void 0:n.suites)||[])if(!(s&&!e.get(c.title)))for(const h of c.suites){const p=at(i,h.location.file.split(Y),!0,o);r(c.title,h,p)}for(const c of t){if(!c.location)continue;const h=at(i,c.location.file.split(Y),!0,o);h.hasLoadErrors=!0}return i}function le(n,t,e,s){const i=t.trim().toLowerCase().split(" "),r=[...e.values()].some(Boolean),o=h=>{const p=h.tests[0].titlePath().join(" ").toLowerCase();return!i.every(d=>p.includes(d))&&!h.tests.some(d=>s==null?void 0:s.has(d.id))?!1:(h.children=h.children.filter(d=>!r||(s==null?void 0:s.has(d.test.id))||e.get(d.status)),h.tests=h.children.map(d=>d.test),!!h.children.length)},c=h=>{const p=[];for(const d of h.children)d.kind==="case"?o(d)&&p.push(d):(c(d),(d.children.length||d.hasLoadErrors)&&p.push(d));h.children=p};c(n)}function St(n){for(const o of n.children)St(o);n.kind==="group"&&n.children.sort((o,c)=>o.location.file.localeCompare(c.location.file)||o.location.line-c.location.line);let t=n.children.length>0,e=n.children.length>0,s=!1,i=!1,r=!1;for(const o of n.children)e=e&&o.status==="skipped",t=t&&(o.status==="passed"||o.status==="skipped"),s=s||o.status==="failed",i=i||o.status==="running",r=r||o.status==="scheduled";i?n.status="running":r?n.status="scheduled":s?n.status="failed":e?n.status="skipped":t&&(n.status="passed")}function ae(n){let t=n;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];return t.location=n.location,t}function ce(n){const t=e=>{e.kind==="case"&&e.children.length===1?e.children=[]:e.children.forEach(t)};t(n)}async function mt(n){const t=new URLSearchParams;t.set("trace",n);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new Ot(s)}const Y=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";(async()=>{if(zt(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(n=>setTimeout(n,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
4
+ Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(n=>{navigator.serviceWorker.oncontrollerchange=()=>n()}),setInterval(function(){fetch("ping")},1e4)}Vt.render(l.jsx(Zt,{}),document.querySelector("#root"))})();
5
+ function __vite__mapDeps(indexes) {
6
+ if (!__vite__mapDeps.viteFileDeps) {
7
+ __vite__mapDeps.viteFileDeps = ["./assets/xtermModule-Yt6xwiJ_.js","./xtermModule.0lwXJFHT.css"]
8
+ }
9
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
10
+ }
@@ -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.Fb0bNA4H.js"></script>
10
- <link rel="modulepreload" crossorigin href="./assets/wsPort-_JBDEilC.js">
9
+ <script type="module" crossorigin src="./uiMode.fcU_T5Nf.js"></script>
10
+ <link rel="modulepreload" crossorigin href="./assets/wsPort-964mA9MZ.js">
11
11
  <link rel="stylesheet" crossorigin href="./wsPort.zR1WIy9-.css">
12
12
  <link rel="stylesheet" crossorigin href="./uiMode.pWy0Re7G.css">
13
13
  </head>
@@ -0,0 +1,10 @@
1
+ import{u as Ct,r as V,d as yt,_ as Bt,e as Mt,f as Nt,j as l,R as f,g as Rt,c as Pt,s as wt,S as Dt,h as G,T as y,t as Lt,m as Ft,i as It,k as dt,W as Wt,M as Ot,l as At,a as zt,b as Vt}from"./assets/wsPort-RIoVGhlT.js";class ht{constructor(){this._stringCache=new Map}internString(t){let e=this._stringCache.get(t);return e||(this._stringCache.set(t,t),e=t),e}}var Kt={};class ft{constructor(t,e,s,i){this._tests=new Map,this._listOnly=!1,this._clearPreviousResultsWhenTestBegins=!1,this._stringPool=new ht,this._rootSuite=new W("","root"),this._pathSeparator=t,this._reporter=e,this._reuseTestCases=s,this._reportConfig=i}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==="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()}_setClearPreviousResultsWhenTestBegins(){this._clearPreviousResultsWhenTestBegins=!0}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._listOnly=t.listOnly,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._rootSuite.suites.find(s=>s.project().__projectId===t.id);if(e||(e=new W(t.name,"project"),this._rootSuite.suites.push(e),e.parent=this._rootSuite),e._project=this._parseProject(t),this._mergeSuitesInto(t.suites,e),this._listOnly){const s=new Set,i=o=>{o.tests.map(c=>c.testId).forEach(c=>s.add(c)),o.suites.forEach(i)};t.suites.forEach(i);const r=o=>{o.tests=o.tests.filter(c=>s.has(c.id)),o.suites.forEach(r)};r(e)}}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var r,o;const s=this._tests.get(t);this._clearPreviousResultsWhenTestBegins&&s._clearResults();const i=s._createTestResult(e.id);i.retry=e.retry,i.workerIndex=e.workerIndex,i.parallelIndex=e.parallelIndex,i.setStartTimeNumber(e.startTime),i.statusEx="running",(o=(r=this._reporter).onTestBegin)==null||o.call(r,s,i)}_onTestEnd(t,e){var r,o,c;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus,s.annotations=t.annotations;const i=s.resultsMap.get(e.id);i.duration=e.duration,i.status=e.status,i.statusEx=e.status,i.errors=e.errors,i.error=(r=i.errors)==null?void 0:r[0],i.attachments=this._parseAttachments(e.attachments),(c=(o=this._reporter).onTestEnd)==null||c.call(o,s,i),i.stepMap=new Map}_onStepBegin(t,e,s){var p,d;const i=this._tests.get(t),r=i.resultsMap.get(e),o=s.parentStepId?r.stepMap.get(s.parentStepId):void 0,c=this._absoluteLocation(s.location),h=new Ht(s,o,c);o?o.steps.push(h):r.steps.push(h),r.stepMap.set(s.id,h),(d=(p=this._reporter).onStepBegin)==null||d.call(p,i,r,h)}_onStepEnd(t,e,s){var c,h;const i=this._tests.get(t),r=i.resultsMap.get(e),o=r.stepMap.get(s.id);o.duration=s.duration,o.error=s.error,(h=(c=this._reporter).onStepEnd)==null||h.call(c,i,r,o)}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,r){var p,d,v,g;const o=r?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,c=e?this._tests.get(e):void 0,h=c&&s?c.resultsMap.get(s):void 0;t==="stdout"?(h==null||h.stdout.push(o),(d=(p=this._reporter).onStdOut)==null||d.call(p,o,c,h)):(h==null||h.stderr.push(o),(g=(v=this._reporter).onStdErr)==null||g.call(v,o,c,h))}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 this._stringPool=new ht,(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...xt,...t};return this._reportConfig&&(e.configFile=this._reportConfig.configFile,e.reportSlowTests=this._reportConfig.reportSlowTests,e.quiet=this._reportConfig.quiet,e.reporter=[...this._reportConfig.reporter]),e}_parseProject(t){return{__projectId:t.id,metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:Z(t.testIgnore),testMatch:Z(t.testMatch),timeout:t.timeout,grep:Z(t.grep),grepInvert:Z(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:{}}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuitesInto(t,e){for(const s of t){let i=e.suites.find(r=>r.title===s.title);i||(i=new W(s.title,s.type),i.parent=e,e.suites.push(i)),i.location=this._absoluteLocation(s.location),i._fileId=s.fileId,i._parallelMode=s.parallelMode,this._mergeSuitesInto(s.suites,i),this._mergeTestsInto(s.tests,i)}}_mergeTestsInto(t,e){for(const s of t){let i=this._reuseTestCases?e.tests.find(r=>r.title===s.title):void 0;i||(i=new Ut(s.testId,s.title,this._absoluteLocation(s.location)),i.parent=e,e.tests.push(i),this._tests.set(i.id,i)),this._updateTest(s,i)}}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e.tags=t.tags??[],e}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){return t&&this._stringPool.internString(this._rootDir+this._pathSeparator+t)}}class W{constructor(t,e){this._requireFile="",this.suites=[],this.tests=[],this._parallelMode="none",this.title=t,this._type=e}allTests(){const t=[],e=s=>{for(const i of[...s.suites,...s.tests])i instanceof W?e(i):t.push(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())}}class Ut{constructor(t,e,s){this.fn=()=>{},this.results=[],this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.resultsMap=new Map,this.id=t,this.title=e,this.location=s}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){var s,i;const t=[...this.results];for(;((s=t[0])==null?void 0:s.status)==="skipped"||((i=t[0])==null?void 0:i.status)==="interrupted";)t.shift();if(!t.length)return"skipped";const e=t.filter(r=>r.status!=="skipped"&&r.status!=="interrupted"&&r.status!==this.expectedStatus);return e.length?e.length===t.length?"unexpected":"flaky":"expected"}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_clearResults(){this.results=[],this.resultsMap.clear()}_createTestResult(t){const e=new $t(this.results.length);return this.results.push(e),this.resultsMap.set(t,e),e}}class Ht{constructor(t,e,s){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}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}}class $t{constructor(t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this.stepMap=new Map,this.statusEx="scheduled",this._startTime=0,this.retry=t}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const xt={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[Kt.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function Z(n){return n.map(t=>t.s?t.s:new RegExp(t.r.source,t.r.flags))}const qt=({source:n})=>{const[t,e]=Ct(),[s,i]=V.useState(yt()),[r]=V.useState(Bt(()=>import("./assets/xtermModule-Yt6xwiJ_.js"),__vite__mapDeps([0,1]),import.meta.url).then(c=>c.default)),o=V.useRef(null);return V.useEffect(()=>(Mt(i),()=>Nt(i)),[]),V.useEffect(()=>{const c=n.write,h=n.clear;return(async()=>{const{Terminal:p,FitAddon:d}=await r,v=e.current;if(!v)return;const g=s==="dark-mode"?Xt:Yt;if(o.current&&o.current.terminal.options.theme===g)return;o.current&&(v.textContent="");const a=new p({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:g}),m=new d;a.loadAddon(m);for(const x of n.pending)a.write(x);n.write=x=>{n.pending.push(x),a.write(x)},n.clear=()=>{n.pending=[],a.clear()},a.open(v),m.fit(),o.current={terminal:a,fitAddon:m}})(),()=>{n.clear=h,n.write=c}},[r,o,e,n,s]),V.useEffect(()=>{setTimeout(()=>{o.current&&(o.current.fitAddon.fit(),n.resize(o.current.terminal.cols,o.current.terminal.rows))},250)},[t,n]),l.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},Yt={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"},Xt={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"},Jt=({title:n,children:t,setExpanded:e,expanded:s,expandOnTitleClick:i})=>l.jsxs("div",{className:"expandable"+(s?" expanded":""),children:[l.jsxs("div",{className:"expandable-title",onClick:()=>i&&e(!s),children:[l.jsx("div",{className:"codicon codicon-"+(s?"chevron-down":"chevron-right"),style:{cursor:"pointer",color:"var(--vscode-foreground)",marginLeft:"5px"},onClick:()=>!i&&e(!s)}),n]}),s&&l.jsx("div",{style:{marginLeft:25},children:t})]});function Qt(n){return`.playwright-artifacts-${n}`}let lt=()=>{},vt=n=>{},_t={cols:80,rows:24},I=async()=>{};const O={pending:[],clear:()=>{},write:n=>O.pending.push(n),resize:(n,t)=>{_t={cols:n,rows:t},q("resizeTerminal",{cols:n,rows:t})}},Zt=({})=>{var ut;const[n,t]=f.useState(""),[e,s]=f.useState(!1),[i,r]=f.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[o,c]=f.useState(new Map),[h,p]=f.useState({config:void 0,rootSuite:void 0,loadErrors:[]}),[d,v]=f.useState(),[g,a]=f.useState({}),[m,x]=f.useState(new Set),[T,B]=f.useState(!1),[_,R]=f.useState(),[M,X]=Rt("watch-all",!1),[et,A]=f.useState({value:new Set}),u=f.useRef(Promise.resolve()),S=f.useRef(new Set),[w,b]=f.useState(0),[k,E]=f.useState(!1),[J,ct]=f.useState(!0),Tt=f.useRef(null),st=f.useCallback(()=>{B(!0),A({value:new Set}),lt(xt,new W("","root"),[],void 0),bt(!0).then(async()=>{B(!1);const{hasBrowsers:j}=await I("checkBrowsers");ct(j)})},[]);f.useEffect(()=>{var j;(j=Tt.current)==null||j.focus(),B(!0),Pt({onEvent:ie,onClose:()=>E(!0)}).then(C=>{I=async(P,D)=>{const N=window.__logForTest;N==null||N({method:P,params:D}),await C(P,D)},st()})},[st]),lt=f.useCallback((j,C,P,D)=>{const N=j.configFile?wt.getObject(j.configFile+":projects",void 0):void 0;for(const L of o.keys())C.suites.find(Q=>Q.title===L)||o.delete(L);for(const L of C.suites)o.has(L.title)||o.set(L.title,!!(N!=null&&N.includes(L.title)));!N&&o.size&&![...o.values()].includes(!0)&&o.set(o.entries().next().value[0],!0),p({config:j,rootSuite:C,loadErrors:P}),c(new Map(o)),_&&D?v(D):D||v(void 0)},[o,_]);const it=f.useCallback((j,C)=>{j==="bounce-if-busy"&&_||(S.current=new Set([...S.current,...C]),u.current=u.current.then(async()=>{var N,L,Q;const P=S.current;if(S.current=new Set,!P.size)return;{for(const F of((N=h.rootSuite)==null?void 0:N.allTests())||[])P.has(F.id)&&(F._clearResults(),F._createTestResult("pending"));p({...h})}const D=" ["+new Date().toLocaleTimeString()+"]";O.write("\x1B[2m—".repeat(Math.max(0,_t.cols-D.length))+D+"\x1B[22m"),v({total:0,passed:0,failed:0,skipped:0}),R({testIds:P}),await I("run",{testIds:[...P],projects:[...o].filter(([F,Et])=>Et).map(([F])=>F)});for(const F of((L=h.rootSuite)==null?void 0:L.allTests())||[])((Q=F.results[0])==null?void 0:Q.duration)===-1&&F._clearResults();p({...h}),R(void 0)}))},[o,_,h]),z=!!_,nt=f.useRef(null),kt=f.useCallback(j=>{var C;j.preventDefault(),j.stopPropagation(),(C=nt.current)==null||C.showModal()},[]),ot=f.useCallback(j=>{var C;j.preventDefault(),j.stopPropagation(),(C=nt.current)==null||C.close()},[]),jt=f.useCallback(j=>{ot(j),s(!0),I("installBrowsers").then(async()=>{s(!1);const{hasBrowsers:C}=await I("checkBrowsers");ct(C)})},[ot]);return l.jsxs("div",{className:"vbox ui-mode",children:[!J&&l.jsxs("dialog",{ref:nt,children:[l.jsxs("div",{className:"title",children:[l.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),l.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",l.jsx("br",{}),"Would you like to run `playwright install`?",l.jsx("br",{}),l.jsx("button",{className:"button",onClick:jt,children:"Install"}),l.jsx("button",{className:"button secondary",onClick:ot,children:"Dismiss"})]})]}),k&&l.jsxs("div",{className:"disconnected",children:[l.jsx("div",{className:"title",children:"UI Mode disconnected"}),l.jsxs("div",{children:[l.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),l.jsxs(Dt,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",children:[l.jsxs("div",{className:"vbox",children:[l.jsxs("div",{className:"vbox"+(e?"":" hidden"),children:[l.jsxs(G,{children:[l.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),l.jsx(y,{icon:"circle-slash",title:"Clear output",onClick:()=>O.clear()}),l.jsx("div",{className:"spacer"}),l.jsx(y,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),l.jsx(qt,{source:O})]}),l.jsx("div",{className:"vbox"+(e?" hidden":""),children:l.jsx(se,{item:g,rootDir:(ut=h.config)==null?void 0:ut.rootDir})})]}),l.jsxs("div",{className:"vbox ui-mode-sidebar",children:[l.jsxs(G,{noShadow:!0,noMinHeight:!0,children:[l.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),l.jsx("div",{className:"section-title",children:"Playwright"}),l.jsx(y,{icon:"color-mode",title:"Toggle color mode",onClick:()=>Lt()}),l.jsx(y,{icon:"refresh",title:"Reload",onClick:()=>st(),disabled:z||T}),l.jsx(y,{icon:"terminal",title:"Toggle output",toggled:e,onClick:()=>{s(!e)}}),!J&&l.jsx(y,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:kt})]}),l.jsx(Gt,{filterText:n,setFilterText:t,statusFilters:i,setStatusFilters:r,projectFilters:o,setProjectFilters:c,testModel:h,runTests:()=>it("bounce-if-busy",m)}),l.jsxs(G,{noMinHeight:!0,children:[!z&&!d&&l.jsx("div",{className:"section-title",children:"Tests"}),!z&&d&&l.jsx("div",{"data-testid":"status-line",className:"status-line",children:l.jsxs("div",{children:[d.passed,"/",d.total," passed (",d.passed/d.total*100|0,"%)"]})}),z&&d&&l.jsx("div",{"data-testid":"status-line",className:"status-line",children:l.jsxs("div",{children:["Running ",d.passed,"/",_.testIds.size," passed (",d.passed/_.testIds.size*100|0,"%)"]})}),l.jsx(y,{icon:"play",title:"Run all",onClick:()=>it("bounce-if-busy",m),disabled:z||T}),l.jsx(y,{icon:"debug-stop",title:"Stop",onClick:()=>q("stop"),disabled:!z||T}),l.jsx(y,{icon:"eye",title:"Watch all",toggled:M,onClick:()=>{A({value:new Set}),X(!M)}}),l.jsx(y,{icon:"collapse-all",title:"Collapse all",onClick:()=>{b(w+1)}})]}),l.jsx(ee,{statusFilters:i,projectFilters:o,filterText:n,testModel:h,runningState:_,runTests:it,onItemSelected:a,setVisibleTestIds:x,watchAll:M,watchedTreeIds:et,setWatchedTreeIds:A,isLoading:T,requestedCollapseAllCount:w})]})]})]})},Gt=({filterText:n,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:r,testModel:o,runTests:c})=>{const[h,p]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{var a;(a=d.current)==null||a.focus()},[]);const v=[...e.entries()].filter(([a,m])=>m).map(([a])=>a).join(" ")||"all",g=[...i.entries()].filter(([a,m])=>m).map(([a])=>a).join(" ")||"all";return l.jsxs("div",{className:"filters",children:[l.jsx(Jt,{expanded:h,setExpanded:p,title:l.jsx("input",{ref:d,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:n,onChange:a=>{t(a.target.value)},onKeyDown:a=>{a.key==="Enter"&&c()}})}),l.jsxs("div",{className:"filter-summary",title:"Status: "+v+`
2
+ Projects: `+g,onClick:()=>p(!h),children:[l.jsx("span",{className:"filter-label",children:"Status:"})," ",v,l.jsx("span",{className:"filter-label",children:"Projects:"})," ",g]}),h&&l.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[l.jsx("div",{className:"filter-list",children:[...e.entries()].map(([a,m])=>l.jsx("div",{className:"filter-entry",children:l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:m,onClick:()=>{const x=new Map(e);x.set(a,!x.get(a)),s(x)}}),l.jsx("div",{children:a})]})}))}),l.jsx("div",{className:"filter-list",children:[...i.entries()].map(([a,m])=>l.jsx("div",{className:"filter-entry",children:l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:m,onClick:()=>{var B;const x=new Map(i);x.set(a,!x.get(a)),r(x);const T=(B=o==null?void 0:o.config)==null?void 0:B.configFile;T&&wt.setObject(T+":projects",[...x.entries()].filter(([_,R])=>R).map(([_])=>_))}}),l.jsx("div",{children:a||"untitled"})]})}))})]})]})},te=At,ee=({statusFilters:n,projectFilters:t,filterText:e,testModel:s,runTests:i,runningState:r,watchAll:o,watchedTreeIds:c,setWatchedTreeIds:h,isLoading:p,onItemSelected:d,setVisibleTestIds:v,requestedCollapseAllCount:g})=>{const[a,m]=f.useState({expandedItems:new Map}),[x,T]=f.useState(),[B,_]=f.useState(g),{rootItem:R,treeItemMap:M,fileNames:X}=f.useMemo(()=>{let u=re(s.rootSuite,s.loadErrors,t);le(u,e,n,r==null?void 0:r.testIds),St(u),u=ae(u),ce(u);const S=new Map,w=new Set,b=new Set,k=E=>{E.kind==="group"&&E.location.file&&b.add(E.location.file),E.kind==="case"&&E.tests.forEach(J=>w.add(J.id)),E.children.forEach(k),S.set(E.id,E)};return k(u),v(w),{rootItem:u,treeItemMap:S,fileNames:b}},[e,s,n,t,v,r]);f.useEffect(()=>{if(B!==g){a.expandedItems.clear();for(const w of M.keys())a.expandedItems.set(w,!1);_(g),T(void 0),m({...a});return}if(!r||r.itemSelectedByUser)return;let u;const S=w=>{var b;w.children.forEach(S),!u&&w.status==="failed"&&(w.kind==="test"&&r.testIds.has(w.test.id)||w.kind==="case"&&r.testIds.has((b=w.tests[0])==null?void 0:b.id))&&(u=w)};S(R),u&&T(u.id)},[r,T,R,B,_,g,a,m,M]);const{selectedTreeItem:et}=f.useMemo(()=>{const u=x?M.get(x):void 0;let S;u&&(S={file:u.location.file,line:u.location.line,source:{errors:s.loadErrors.filter(b=>{var k;return((k=b.location)==null?void 0:k.file)===u.location.file}).map(b=>({line:b.location.line,message:b.message})),content:void 0}});let w;return(u==null?void 0:u.kind)==="test"?w=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(w=u.tests[0]),d({treeItem:u,testCase:w,testFile:S}),{selectedTreeItem:u}},[d,x,s,M]);f.useEffect(()=>{if(!p)if(o)q("watch",{fileNames:[...X]});else{const u=new Set;for(const S of c.value){const w=M.get(S),b=w==null?void 0:w.location.file;b&&u.add(b)}q("watch",{fileNames:[...u]})}},[p,R,X,o,c,M]);const A=u=>{T(u.id),i("bounce-if-busy",rt(u))};return vt=u=>{const S=[],w=new Set(u);if(o){const b=k=>{const E=k.location.file;E&&w.has(E)&&S.push(...rt(k)),k.kind==="group"&&k.subKind==="folder"&&k.children.forEach(b)};b(R)}else for(const b of c.value){const k=M.get(b),E=k==null?void 0:k.location.file;E&&w.has(E)&&S.push(...rt(k))}i("queue-if-busy",new Set(S))},l.jsx(te,{name:"tests",treeState:a,setTreeState:m,rootItem:R,dataTestId:"test-tree",render:u=>l.jsxs("div",{className:"hbox ui-mode-list-item",children:[l.jsx("div",{className:"ui-mode-list-item-title",title:u.title,children:u.title}),!!u.duration&&u.status!=="skipped"&&l.jsx("div",{className:"ui-mode-list-item-time",children:Ft(u.duration)}),l.jsxs(G,{noMinHeight:!0,noShadow:!0,children:[l.jsx(y,{icon:"play",title:"Run",onClick:()=>A(u),disabled:!!r}),l.jsx(y,{icon:"go-to-file",title:"Open in VS Code",onClick:()=>q("open",{location:oe(u)}),style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!o&&l.jsx(y,{icon:"eye",title:"Watch",onClick:()=>{c.value.has(u.id)?c.value.delete(u.id):c.value.add(u.id),h({...c})},toggled:c.value.has(u.id)})]})]}),icon:u=>It(u.status),selectedItem:et,onAccepted:A,onSelected:u=>{r&&(r.itemSelectedByUser=!0),T(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:e?5:1,noItemsMessage:p?"Loading…":"No tests"})},se=({item:n,rootDir:t})=>{var g;const[e,s]=f.useState(),[i,r]=f.useState(0),o=f.useRef(null),{outputDir:c}=f.useMemo(()=>({outputDir:n.testCase?ne(n.testCase):void 0}),[n]),[h,p]=f.useState(),d=f.useCallback(a=>p(dt(a)),[p]),v=h?e==null?void 0:e.model.actions.find(a=>dt(a)===h):void 0;return f.useEffect(()=>{var T,B;o.current&&clearTimeout(o.current);const a=(T=n.testCase)==null?void 0:T.results[0];if(!a){s(void 0);return}const m=a&&a.duration>=0&&a.attachments.find(_=>_.name==="trace");if(m&&m.path){mt(m.path).then(_=>s({model:_,isLive:!1}));return}if(!c){s(void 0);return}const x=`${c}/${Qt(a.workerIndex)}/traces/${(B=n.testCase)==null?void 0:B.id}.json`;return o.current=setTimeout(async()=>{try{const _=await mt(x);s({model:_,isLive:!0})}catch{s(void 0)}finally{r(i+1)}},500),()=>{o.current&&clearTimeout(o.current)}},[c,n,s,i,r]),l.jsx(Wt,{model:e==null?void 0:e.model,hideStackFrames:!0,showSourcesFirst:!0,rootDir:t,initialSelection:v,onSelectionChanged:d,fallbackLocation:n.testFile,isLive:e==null?void 0:e.isLive,status:(g=n.treeItem)==null?void 0:g.status},"workbench")};let H,$,pt,tt,U;const gt=()=>{clearTimeout(tt),tt=void 0,lt(U.config,U.rootSuite,U.loadErrors,U.progress)},K=(n,t,e,s,i=!1)=>{U={config:n,rootSuite:t,loadErrors:e,progress:s},i?gt():tt||(tt=setTimeout(gt,250))},bt=n=>{if(!n)return I("list",{});let t;const e=[],s={total:0,passed:0,failed:0,skipped:0};let i;return H=new ft(Y,{version:()=>"v2",onConfigure:r=>{i=r,$=new ft(Y,{onBegin:o=>{pt=o.allTests().length,$=void 0}},!1)},onBegin:r=>{t||(t=r),s.total=pt,s.passed=0,s.failed=0,s.skipped=0,K(i,t,e,s,!0)},onEnd:()=>{K(i,t,e,s,!0)},onTestBegin:()=>{K(i,t,e,s)},onTestEnd:r=>{r.outcome()==="skipped"?++s.skipped:r.outcome()==="unexpected"?++s.failed:++s.passed,K(i,t,e,s)},onError:r=>{O.write((r.stack||r.value||"")+`
3
+ `),e.push(r),K(i,t??new W("","root"),e,s)},printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}},!0),H._setClearPreviousResultsWhenTestBegins(),I("list",{})},q=(n,t)=>{if(window._overrideProtocolForTest){window._overrideProtocolForTest({method:n,params:t}).catch(()=>{});return}I(n,t).catch(e=>{console.error(e)})},ie=(n,t)=>{var e,s;if(n==="listChanged"){bt(!1).catch(()=>{});return}if(n==="testFilesChanged"){vt(t.testFileNames);return}if(n==="stdio"){if(t.buffer){const i=atob(t.buffer);O.write(i)}else O.write(t.text);return}(e=$==null?void 0:$.dispatch({method:n,params:t}))==null||e.catch(()=>{}),(s=H==null?void 0:H.dispatch({method:n,params:t}))==null||s.catch(()=>{})},ne=n=>{var t;for(let e=n.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir},oe=n=>{if(n)return n.location.file+":"+n.location.line},rt=n=>{const t=new Set;if(!n)return t;const e=s=>{var i;s.kind==="case"?s.tests.map(r=>r.id).forEach(r=>t.add(r)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(n),t};function at(n,t,e,s){if(t.length===0)return n;const i=t.join(Y),r=s.get(i);if(r)return r;const o=at(n,t.slice(0,t.length-1),!1,s),c={kind:"group",subKind:e?"file":"folder",id:i,title:t[t.length-1],location:{file:i,line:0,column:0},duration:0,parent:o,children:[],status:"none",hasLoadErrors:!1};return o.children.push(c),s.set(i,c),c}function re(n,t,e){const s=[...e.values()].some(Boolean),i={kind:"group",subKind:"folder",id:"root",title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},r=(c,h,p)=>{for(const d of h.suites){const v=d.title||"<anonymous>";let g=p.children.find(a=>a.kind==="group"&&a.title===v);g||(g={kind:"group",subKind:"describe",id:"suite:"+h.titlePath().join("")+""+v,title:v,location:d.location,duration:0,parent:p,children:[],status:"none",hasLoadErrors:!1},p.children.push(g)),r(c,d,g)}for(const d of h.tests){const v=d.title;let g=p.children.find(x=>x.kind!=="group"&&x.title===v);g||(g={kind:"case",id:"test:"+d.titlePath().join(""),title:v,parent:p,children:[],tests:[],location:d.location,duration:0,status:"none"},p.children.push(g));const a=d.results[0];let m="none";(a==null?void 0:a.statusEx)==="scheduled"?m="scheduled":(a==null?void 0:a.statusEx)==="running"?m="running":(a==null?void 0:a.status)==="skipped"?m="skipped":(a==null?void 0:a.status)==="interrupted"?m="none":a&&d.outcome()!=="expected"?m="failed":a&&d.outcome()==="expected"&&(m="passed"),g.tests.push(d),g.children.push({kind:"test",id:d.id,title:c,location:d.location,test:d,parent:g,children:[],status:m,duration:d.results.length?Math.max(0,d.results[0].duration):0,project:c}),g.duration=g.children.reduce((x,T)=>x+T.duration,0)}},o=new Map;for(const c of(n==null?void 0:n.suites)||[])if(!(s&&!e.get(c.title)))for(const h of c.suites){const p=at(i,h.location.file.split(Y),!0,o);r(c.title,h,p)}for(const c of t){if(!c.location)continue;const h=at(i,c.location.file.split(Y),!0,o);h.hasLoadErrors=!0}return i}function le(n,t,e,s){const i=t.trim().toLowerCase().split(" "),r=[...e.values()].some(Boolean),o=h=>{const p=h.tests[0].titlePath().join(" ").toLowerCase();return!i.every(d=>p.includes(d))&&!h.tests.some(d=>s==null?void 0:s.has(d.id))?!1:(h.children=h.children.filter(d=>!r||(s==null?void 0:s.has(d.test.id))||e.get(d.status)),h.tests=h.children.map(d=>d.test),!!h.children.length)},c=h=>{const p=[];for(const d of h.children)d.kind==="case"?o(d)&&p.push(d):(c(d),(d.children.length||d.hasLoadErrors)&&p.push(d));h.children=p};c(n)}function St(n){for(const o of n.children)St(o);n.kind==="group"&&n.children.sort((o,c)=>o.location.file.localeCompare(c.location.file)||o.location.line-c.location.line);let t=n.children.length>0,e=n.children.length>0,s=!1,i=!1,r=!1;for(const o of n.children)e=e&&o.status==="skipped",t=t&&(o.status==="passed"||o.status==="skipped"),s=s||o.status==="failed",i=i||o.status==="running",r=r||o.status==="scheduled";i?n.status="running":r?n.status="scheduled":s?n.status="failed":e?n.status="skipped":t&&(n.status="passed")}function ae(n){let t=n;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];return t.location=n.location,t}function ce(n){const t=e=>{e.kind==="case"&&e.children.length===1?e.children=[]:e.children.forEach(t)};t(n)}async function mt(n){const t=new URLSearchParams;t.set("trace",n);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new Ot(s)}const Y=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";(async()=>{if(zt(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(n=>setTimeout(n,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
4
+ Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(n=>{navigator.serviceWorker.oncontrollerchange=()=>n()}),setInterval(function(){fetch("ping")},1e4)}Vt.render(l.jsx(Zt,{}),document.querySelector("#root"))})();
5
+ function __vite__mapDeps(indexes) {
6
+ if (!__vite__mapDeps.viteFileDeps) {
7
+ __vite__mapDeps.viteFileDeps = ["./assets/xtermModule-Yt6xwiJ_.js","./xtermModule.0lwXJFHT.css"]
8
+ }
9
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkly/playwright-core",
3
- "version": "1.42.14",
3
+ "version": "v1.42.16",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,150 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _promises = _interopRequireDefault(require("fs/promises"));
8
- var _path = _interopRequireDefault(require("path"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- class SWatcher {
11
- constructor() {
12
- this._outsideRequestsData = [];
13
- // Test steps (api calls, assertions) data.
14
- this._stepsData = new Map();
15
- // Tracking test.step calls.
16
- this._testStepIds = [];
17
- // Tracking internal step to the matching test.step.
18
- this._testStepRawStepData = {};
19
- }
20
-
21
- /**
22
- * This is to track when a `test.step` statement starts and ends.
23
- */
24
- appendCurrentTestStepId() {
25
- this._testStepIds = [...this._testStepIds, this.getRandomStepId()];
26
- }
27
-
28
- /**
29
- * This is to add the "test.step" internal Playwright *step* data.
30
- *
31
- * @param {Object} rawStep
32
- */
33
- setCurrentTestStepRawStepData(rawStep) {
34
- this._testStepRawStepData = {
35
- [this.getCurrentTestStepId()]: rawStep
36
- };
37
- }
38
-
39
- /**
40
- * This is to get the parent test.step internal step data when we have nested test.step.
41
- * It's useful to tell Playwright that it belongs to a particular test.step otherwise by default PW just adds this
42
- * test.step to the root.
43
- *
44
- * @returns {Object|undefined}
45
- */
46
- getParentTestStepRawStepData() {
47
- return this._testStepRawStepData[this.getParentTestStepId()];
48
- }
49
-
50
- /**
51
- *
52
- * @returns {*}
53
- */
54
- getCurrentTestStepRawStepData() {
55
- return this._testStepRawStepData[this.getCurrentTestStepId()];
56
- }
57
-
58
- /**
59
- * When a test.step is done, we remove the ID from the tracking array.
60
- */
61
- removeCurrentTestStepId() {
62
- // Current step is always at the end of this._testStepIds
63
- this._testStepIds = this._testStepIds.filter(testStepId => testStepId !== this.getCurrentTestStepId());
64
- }
65
-
66
- /**
67
- * Get n-1 test.step ID.
68
- *
69
- * @returns {string|null}
70
- */
71
- getParentTestStepId() {
72
- if (this._testStepIds.length <= 1) return null;
73
- const [parentTestStepId] = this._testStepIds.slice(-2);
74
- return parentTestStepId;
75
- }
76
-
77
- /**
78
- * Get current test.step ID.
79
- *
80
- * @returns {string|undefined}
81
- */
82
- getCurrentTestStepId() {
83
- const [currentTestStepId] = this._testStepIds.slice(-1);
84
- return currentTestStepId;
85
- }
86
-
87
- /**
88
- * This is to track when a step (api call, assertion) starts/ends.
89
- *
90
- * @param {string} stepId
91
- */
92
- setCurrentStepId(stepId) {
93
- this._stepsData.set(stepId, []);
94
- this._stepId = stepId;
95
- }
96
-
97
- /**
98
- * Get a step data (api call with request, body etc.; assertion with expected data etc.).
99
- *
100
- * @param {string} stepId
101
- * @returns {Object}
102
- */
103
- getStepData(stepId) {
104
- return this._stepsData.get(stepId);
105
- }
106
-
107
- /**
108
- * For some reason, when we have two tests with both api calls and the first test is failing, the stepId counter
109
- * is wrong because it set the same stepId for two different api call. This might be a race condition issue with
110
- * Playwright.
111
- *
112
- * To fix this, we use a random string instead of a simple counter.
113
- *
114
- * @returns {string}
115
- */
116
- getRandomStepId() {
117
- return (Math.random() + 1).toString(36).substring(7);
118
- }
119
-
120
- /**
121
- * This adds the extra data to the current step (api call, assertion).
122
- *
123
- * @param {Object} data
124
- */
125
- appendCurrentStepData(data) {
126
- // StepId is defined which means we are inside a step.
127
- if (this._stepId) {
128
- this._stepsData.set(this._stepId, [...(this._stepsData.get(this._stepId) || []), data]);
129
- return;
130
- }
131
-
132
- // If stepId is null then it's probably a request without steps
133
- // In this case, we push data to a different array in order to track the amount of API call made
134
- // to bill it properly.
135
- this._outsideRequestsData.push(data);
136
- }
137
- async dispose() {
138
- // @todo rename getRandomStepId to getRandomId
139
- await _promises.default.writeFile(_path.default.join(process.env.TEMP_DIR, `apiCalls-${this.getRandomStepId()}.json`), JSON.stringify({
140
- outsideRequestsData: this._outsideRequestsData.filter(({
141
- checklyStepCategory
142
- }) => checklyStepCategory === 'api-call'),
143
- stepsData: Array.from(this._stepsData).filter(([, [{
144
- checklyStepCategory
145
- } = {}]]) => checklyStepCategory === 'api-call')
146
- }));
147
- }
148
- }
149
- var _default = exports.default = new SWatcher();
150
- //# sourceMappingURL=sWatcher.js.map
package/lib/cli/cli.js DELETED
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Copyright (c) Microsoft Corporation.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- /* eslint-disable no-console */
20
- "use strict";
21
-
22
- var _utils = require("../utils");
23
- var _program = _interopRequireDefault(require("./program"));
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
- function printPlaywrightTestError(command) {
26
- const packages = [];
27
- for (const pkg of ['playwright', 'playwright-chromium', 'playwright-firefox', 'playwright-webkit']) {
28
- try {
29
- require.resolve(pkg);
30
- packages.push(pkg);
31
- } catch (e) {}
32
- }
33
- if (!packages.length) packages.push('playwright');
34
- const packageManager = (0, _utils.getPackageManager)();
35
- if (packageManager === 'yarn') {
36
- console.error(`Please install @playwright/test package before running "yarn playwright ${command}"`);
37
- console.error(` yarn remove ${packages.join(' ')}`);
38
- console.error(' yarn add -D @playwright/test');
39
- } else if (packageManager === 'pnpm') {
40
- console.error(`Please install @playwright/test package before running "pnpm exec playwright ${command}"`);
41
- console.error(` pnpm remove ${packages.join(' ')}`);
42
- console.error(' pnpm add -D @playwright/test');
43
- } else {
44
- console.error(`Please install @playwright/test package before running "npx playwright ${command}"`);
45
- console.error(` npm uninstall ${packages.join(' ')}`);
46
- console.error(' npm install -D @playwright/test');
47
- }
48
- }
49
- const kExternalPlaywrightTestCommands = [['test', 'Run tests with Playwright Test.'], ['show-report', 'Show Playwright Test HTML report.'], ['merge-reports', 'Merge Playwright Test Blob reports']];
50
- function addExternalPlaywrightTestCommands() {
51
- for (const [command, description] of kExternalPlaywrightTestCommands) {
52
- const playwrightTest = _program.default.command(command).allowUnknownOption(true);
53
- playwrightTest.description(`${description} Available in @playwright/test package.`);
54
- playwrightTest.action(async () => {
55
- printPlaywrightTestError(command);
56
- (0, _utils.gracefullyProcessExitDoNotHang)(1);
57
- });
58
- }
59
- }
60
- if (!process.env.PW_LANG_NAME) addExternalPlaywrightTestCommands();
61
- _program.default.parse(process.argv);
62
- //# sourceMappingURL=cli.js.map
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.debugLogger = exports.RecentLogsCollector = void 0;
7
- var _utilsBundle = require("../utilsBundle");
8
- var _fs = _interopRequireDefault(require("fs"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- /**
11
- * Copyright (c) Microsoft Corporation.
12
- *
13
- * Licensed under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License.
15
- * You may obtain a copy of the License at
16
- *
17
- * http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software
20
- * distributed under the License is distributed on an "AS IS" BASIS,
21
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- * See the License for the specific language governing permissions and
23
- * limitations under the License.
24
- */
25
-
26
- const debugLoggerColorMap = {
27
- 'api': 45,
28
- // cyan
29
- 'protocol': 34,
30
- // green
31
- 'install': 34,
32
- // green
33
- 'download': 34,
34
- // green
35
- 'browser': 0,
36
- // reset
37
- 'socks': 92,
38
- // purple
39
- 'error': 160,
40
- // red,
41
- 'channel': 33,
42
- // blue
43
- 'server': 45,
44
- // cyan
45
- 'server:channel': 34,
46
- // green
47
- 'server:metadata': 33 // blue
48
- };
49
-
50
- class DebugLogger {
51
- constructor() {
52
- this._debuggers = new Map();
53
- if (process.env.DEBUG_FILE) {
54
- const ansiRegex = new RegExp(['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|'), 'g');
55
- const stream = _fs.default.createWriteStream(process.env.DEBUG_FILE);
56
- _utilsBundle.debug.log = data => {
57
- stream.write(data.replace(ansiRegex, ''));
58
- stream.write('\n');
59
- };
60
- }
61
- }
62
- log(name, message) {
63
- let cachedDebugger = this._debuggers.get(name);
64
- if (!cachedDebugger) {
65
- cachedDebugger = (0, _utilsBundle.debug)(`pw:${name}`);
66
- this._debuggers.set(name, cachedDebugger);
67
- cachedDebugger.color = debugLoggerColorMap[name] || 0;
68
- }
69
- cachedDebugger(message);
70
- }
71
- isEnabled(name) {
72
- return _utilsBundle.debug.enabled(`pw:${name}`);
73
- }
74
- }
75
- const debugLogger = exports.debugLogger = new DebugLogger();
76
- const kLogCount = 150;
77
- class RecentLogsCollector {
78
- constructor() {
79
- this._logs = [];
80
- }
81
- log(message) {
82
- this._logs.push(message);
83
- if (this._logs.length === kLogCount * 2) this._logs.splice(0, kLogCount);
84
- }
85
- recentLogs() {
86
- if (this._logs.length > kLogCount) return this._logs.slice(-kLogCount);
87
- return this._logs;
88
- }
89
- }
90
- exports.RecentLogsCollector = RecentLogsCollector;
91
- //# sourceMappingURL=debugLogger.js.map