@checkly/playwright-core 1.47.12 → 1.48.10-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browsers.json +14 -10
- package/lib/cli/program.js +22 -12
- package/lib/client/api.js +6 -0
- package/lib/client/browserContext.js +20 -2
- package/lib/client/channelOwner.js +5 -2
- package/lib/client/connection.js +3 -0
- package/lib/client/fetch.js +16 -3
- package/lib/client/jsHandle.js +0 -8
- package/lib/client/localUtils.js +1 -0
- package/lib/client/network.js +175 -17
- package/lib/client/page.js +21 -0
- package/lib/client/playwright.js +6 -3
- package/lib/client/tracing.js +16 -20
- package/lib/generated/consoleApiSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +7 -0
- package/lib/generated/webSocketMockSource.js +7 -0
- package/lib/protocol/validator.js +79 -14
- package/lib/server/bidi/bidiBrowser.js +23 -8
- package/lib/server/bidi/bidiChromium.js +124 -0
- package/lib/server/bidi/bidiConnection.js +1 -1
- package/lib/server/bidi/bidiExecutionContext.js +0 -3
- package/lib/server/bidi/bidiFirefox.js +15 -21
- package/lib/server/bidi/bidiInput.js +16 -32
- package/lib/server/bidi/bidiNetworkManager.js +39 -5
- package/lib/server/bidi/bidiOverCdp.js +103 -0
- package/lib/server/bidi/bidiPage.js +98 -25
- package/lib/server/bidi/bidiPdf.js +140 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +221 -0
- package/lib/server/browser.js +13 -2
- package/lib/server/browserContext.js +6 -23
- package/lib/server/browserType.js +39 -11
- package/lib/server/chromium/chromium.js +3 -15
- package/lib/server/chromium/chromiumSwitches.js +3 -1
- package/lib/server/chromium/crBrowser.js +4 -3
- package/lib/server/chromium/crExecutionContext.js +0 -7
- package/lib/server/chromium/crPage.js +5 -2
- package/lib/server/chromium/videoRecorder.js +1 -1
- package/lib/server/codegen/csharp.js +2 -2
- package/lib/server/codegen/java.js +1 -1
- package/lib/server/codegen/javascript.js +1 -1
- package/lib/server/codegen/language.js +14 -2
- package/lib/server/codegen/python.js +2 -2
- package/lib/server/cookieStore.js +73 -0
- package/lib/server/debugController.js +2 -2
- package/lib/server/deviceDescriptorsSource.json +51 -51
- package/lib/server/dialog.js +1 -0
- package/lib/server/dispatchers/browserContextDispatcher.js +19 -2
- package/lib/server/dispatchers/jsHandleDispatcher.js +0 -5
- package/lib/server/dispatchers/pageDispatcher.js +9 -0
- package/lib/server/dispatchers/playwrightDispatcher.js +2 -1
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +189 -0
- package/lib/server/download.js +9 -2
- package/lib/server/fetch.js +96 -99
- package/lib/server/firefox/ffBrowser.js +6 -4
- package/lib/server/firefox/ffExecutionContext.js +0 -3
- package/lib/server/firefox/ffPage.js +3 -0
- package/lib/server/firefox/firefox.js +2 -13
- package/lib/server/frameSelectors.js +1 -1
- package/lib/server/frames.js +3 -2
- package/lib/server/har/harTracer.js +11 -0
- package/lib/server/input.js +0 -1
- package/lib/server/javascript.js +0 -7
- package/lib/server/page.js +5 -1
- package/lib/server/playwright.js +5 -2
- package/lib/server/recorder/contextRecorder.js +33 -50
- package/lib/server/recorder/recorderActions.js +2 -1
- package/lib/server/recorder/recorderApp.js +15 -9
- package/lib/server/recorder/recorderCollection.js +68 -79
- package/lib/server/recorder/recorderFrontend.js +5 -0
- package/lib/server/recorder/recorderInTraceViewer.js +144 -0
- package/lib/server/recorder/recorderRunner.js +75 -97
- package/lib/server/recorder/recorderUtils.js +47 -6
- package/lib/server/recorder.js +28 -25
- package/lib/server/registry/index.js +85 -4
- package/lib/server/socksClientCertificatesInterceptor.js +15 -3
- package/lib/server/trace/recorder/snapshotter.js +1 -0
- package/lib/server/trace/recorder/snapshotterInjected.js +2 -2
- package/lib/server/trace/recorder/tracing.js +58 -2
- package/lib/server/trace/test/inMemorySnapshotter.js +1 -1
- package/lib/server/trace/viewer/traceViewer.js +2 -5
- package/lib/server/webkit/webkit.js +1 -1
- package/lib/server/webkit/wkBrowser.js +6 -5
- package/lib/server/webkit/wkExecutionContext.js +0 -3
- package/lib/server/webkit/wkPage.js +4 -1
- package/lib/utils/happy-eyeballs.js +13 -0
- package/lib/utils/hostPlatform.js +2 -2
- package/lib/utils/httpServer.js +1 -0
- package/lib/utils/isomorphic/locatorGenerators.js +9 -18
- package/lib/utils/isomorphic/locatorParser.js +2 -2
- package/lib/utils/isomorphic/recorderUtils.js +195 -0
- package/lib/vite/htmlReport/index.html +12 -12
- package/lib/vite/recorder/assets/codeMirrorModule-CND2fZ5Q.js +24 -0
- package/lib/vite/recorder/assets/{index-NC7rIA63.css → index-BW-aOBcL.css} +1 -1
- package/lib/vite/recorder/assets/{index-A2TWT47O.js → index-CEc83sSS.js} +10 -15
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-5yiV-3wl.js +16831 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-B7Z3vq11.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-BdBhzV6t.js +16443 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-BqcXH1AO.js +16838 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-C6p3E9Zg.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-Ca-1BNel.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-CcviAl53.js +16831 -0
- package/lib/vite/{recorder/assets/codeMirrorModule-vr7pfcwZ.js → traceViewer/assets/codeMirrorModule-CqYUz5ms.js} +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-DS3v0XrQ.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-Dx6AXgMV.js +16838 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-EhKN7Okm.js +16449 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-MzSmL4X2.js +24 -0
- package/lib/vite/traceViewer/assets/{codeMirrorModule-cCPLLRBo.js → codeMirrorModule-T_sdMrbM.js} +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-U6XMqGkV.js +16437 -0
- package/lib/vite/traceViewer/assets/inspectorTab-BABZNwlH.js +17351 -0
- package/lib/vite/traceViewer/assets/inspectorTab-BPzVEZSf.js +17351 -0
- package/lib/vite/traceViewer/assets/inspectorTab-Bbgq0hgt.js +64 -0
- package/lib/vite/traceViewer/assets/inspectorTab-DhBbZz8I.js +64 -0
- package/lib/vite/traceViewer/assets/inspectorTab-DpvLVMq5.js +17351 -0
- package/lib/vite/traceViewer/assets/testServerConnection-D-tXL3sj.js +224 -0
- package/lib/vite/traceViewer/assets/workbench-B13nfocr.js +9 -0
- package/lib/vite/traceViewer/assets/workbench-BcgGQnKb.js +1473 -0
- package/lib/vite/traceViewer/assets/{wsPort-MnTGOuCA.js → workbench-Bjkiwcr1.js} +1505 -926
- package/lib/vite/traceViewer/assets/workbench-BwodYCgl.js +19119 -0
- package/lib/vite/traceViewer/assets/workbench-ByyWxoT8.js +1473 -0
- package/lib/vite/traceViewer/assets/{workbench-z8ylMSQK.js → workbench-C43LWZEX.js} +7 -7
- package/lib/vite/traceViewer/assets/workbench-C5OQh9VX.js +19119 -0
- package/lib/vite/traceViewer/assets/workbench-Crj6jzdv.js +19119 -0
- package/lib/vite/traceViewer/assets/workbench-DhqI6jeL.js +1473 -0
- package/lib/vite/traceViewer/assets/workbench-DrQjKdyE.js +72 -0
- package/lib/vite/traceViewer/assets/workbench-Pa1v1Ojh.js +72 -0
- package/lib/vite/traceViewer/assets/workbench-caTaZnzx.js +72 -0
- package/lib/vite/traceViewer/assets/workbench-gtYcQBNA.js +9 -0
- package/lib/vite/traceViewer/assets/workbench-u2lRPMOT.js +72 -0
- package/lib/vite/traceViewer/assets/xtermModule-CZ7sDYXB.js +6529 -0
- package/lib/vite/traceViewer/assets/xtermModule-DZP0glxx.js +5982 -0
- package/lib/vite/traceViewer/codeMirrorModule.Cy8X9Wtw.css +344 -0
- package/lib/vite/traceViewer/embedded.27BGR_eD.js +105 -0
- package/lib/vite/traceViewer/embedded.BBZ9gQEw.js +104 -0
- package/lib/vite/traceViewer/embedded.BQq6Psnz.js +104 -0
- package/lib/vite/traceViewer/{embedded.TOXRJZ9A.js → embedded.BVDVQOzc.js} +1 -1
- package/lib/vite/traceViewer/embedded.Bn8Ptzv6.js +2 -0
- package/lib/vite/traceViewer/embedded.CorI3dFX.js +104 -0
- package/lib/vite/traceViewer/embedded.CvhnUgIi.js +2 -0
- package/lib/vite/traceViewer/embedded.D27cnKiB.js +104 -0
- package/lib/vite/traceViewer/embedded.D4lqGydT.js +2 -0
- package/lib/vite/traceViewer/embedded.DPqrDeET.js +2 -0
- package/lib/vite/traceViewer/embedded.DTjd2aiy.js +105 -0
- package/lib/vite/traceViewer/embedded.DbzY7Q8w.js +2 -0
- package/lib/vite/traceViewer/embedded.DjZq4InJ.css +68 -0
- package/lib/vite/traceViewer/embedded.SsjKHrxC.js +105 -0
- package/lib/vite/traceViewer/embedded.f-PLGsBT.js +2 -0
- package/lib/vite/traceViewer/embedded.html +6 -4
- package/lib/vite/traceViewer/index.B7aiTMfZ.js +2 -0
- package/lib/vite/traceViewer/{index.e7qpO0B0.js → index.B8dgQwuN.js} +1 -1
- package/lib/vite/traceViewer/index.BGj8jY3H.js +2 -0
- package/lib/vite/traceViewer/index.BSak5QT9.js +2 -0
- package/lib/vite/traceViewer/index.BrT2kfuc.js +2 -0
- package/lib/vite/traceViewer/{index.RT4iItO_.js → index.C0EgJ4oW.js} +36 -21
- package/lib/vite/traceViewer/index.CUpI-BFe.js +195 -0
- package/lib/vite/traceViewer/index.DkRbtWVo.js +195 -0
- package/lib/vite/traceViewer/index.DsjmhbB6.js +195 -0
- package/lib/vite/traceViewer/index.Dz3icWJV.js +196 -0
- package/lib/vite/traceViewer/index.PqcsvBxQ.js +196 -0
- package/lib/vite/traceViewer/index.QanXxRUb.css +131 -0
- package/lib/vite/traceViewer/index._cX8k4co.js +2 -0
- package/lib/vite/traceViewer/index.html +7 -5
- package/lib/vite/traceViewer/index.pMAN88y-.js +2 -0
- package/lib/vite/traceViewer/index.yxAwzeWG.js +196 -0
- package/lib/vite/traceViewer/inspectorTab.DGJWXOSd.css +3145 -0
- package/lib/vite/traceViewer/inspectorTab.DLjBDrQR.css +1 -0
- package/lib/vite/traceViewer/recorder.7Wl6HrQl.js +550 -0
- package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
- package/lib/vite/traceViewer/recorder.BufKu9Hp.js +550 -0
- package/lib/vite/traceViewer/recorder.Ch-WHviK.js +2 -0
- package/lib/vite/traceViewer/recorder.DBDpiNOK.css +15 -0
- package/lib/vite/traceViewer/recorder.POd-toIn.js +2 -0
- package/lib/vite/traceViewer/recorder.am-MV-DQ.js +550 -0
- package/lib/vite/traceViewer/recorder.html +17 -0
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.BEZVCe5O.js +5 -0
- package/lib/vite/traceViewer/uiMode.BZoFj6zV.js +1723 -0
- package/lib/vite/traceViewer/uiMode.C4nbcio6.js +1730 -0
- package/lib/vite/traceViewer/uiMode.CAYqod-m.css +1 -0
- package/lib/vite/traceViewer/uiMode.D-tg1Oci.js +1730 -0
- package/lib/vite/traceViewer/uiMode.DKjMBMlc.js +1730 -0
- package/lib/vite/traceViewer/uiMode.DRmgrHSk.css +1462 -0
- package/lib/vite/traceViewer/uiMode.DVWUEIHq.css +1424 -0
- package/lib/vite/traceViewer/{uiMode.MTXOs_2V.js → uiMode.DVrL7a1K.js} +5 -5
- package/lib/vite/traceViewer/uiMode.DdtUZZVS.js +5 -0
- package/lib/vite/traceViewer/uiMode.Dg9oJCQU.js +10 -0
- package/lib/vite/traceViewer/uiMode.Dlo9s_YX.js +1723 -0
- package/lib/vite/traceViewer/uiMode.DwZAzstF.js +10 -0
- package/lib/vite/traceViewer/uiMode.O07awP3T.js +10 -0
- package/lib/vite/traceViewer/uiMode.gGHHTsyL.js +1730 -0
- package/lib/vite/traceViewer/uiMode.html +7 -5
- package/lib/vite/traceViewer/uiMode.jY2s-9ps.js +10 -0
- package/lib/vite/traceViewer/uiMode.wsGnVMQK.js +1723 -0
- package/lib/vite/traceViewer/workbench.B3X2QtYa.css +3702 -0
- package/lib/vite/traceViewer/workbench.BQNDbcQ0.css +550 -0
- package/lib/vite/traceViewer/{workbench.NokwQoMV.css → workbench.DjbIuxix.css} +1 -1
- package/lib/vite/traceViewer/workbench.DlsCx8k5.css +1 -0
- package/lib/vite/traceViewer/workbench.DyTpxWVb.css +1 -0
- package/lib/vite/traceViewer/workbench.wuxQoE2z.css +3703 -0
- package/lib/vite/traceViewer/xtermModule.4oRVGWQ-.css +209 -0
- package/package.json +1 -1
- package/types/protocol.d.ts +610 -173
- package/types/types.d.ts +2037 -949
- package/lib/vite/traceViewer/assets/codeMirrorModule-0bpaqixv.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-clyjx5sb.js +0 -15578
- package/lib/vite/traceViewer/assets/codeMirrorModule-wLpsbIhd.js +0 -24
- package/lib/vite/traceViewer/assets/wsPort-_JBDEilC.js +0 -69
- package/lib/vite/traceViewer/assets/wsPort-f2dAQL4I.js +0 -69
- package/lib/vite/traceViewer/index.-_8-eHEE.js +0 -2
- package/lib/vite/traceViewer/index.-g_5lMbJ.css +0 -1
- package/lib/vite/traceViewer/index.u51inEcm.js +0 -2
- package/lib/vite/traceViewer/uiMode.9CwNsWc6.js +0 -10
- package/lib/vite/traceViewer/uiMode.Fb0bNA4H.js +0 -10
- package/lib/vite/traceViewer/uiMode.pWy0Re7G.css +0 -1
- package/lib/vite/traceViewer/uiMode.yLNTmFO4.js +0 -1490
- package/lib/vite/traceViewer/wsPort.zR1WIy9-.css +0 -1
- /package/lib/vite/recorder/assets/{codeMirrorModule-Hs9-1ZG4.css → codeMirrorModule-ez37Vkbh.css} +0 -0
- /package/lib/vite/recorder/assets/{codicon-wpoHPmsu.ttf → codicon-DCmgc-ay.ttf} +0 -0
- /package/lib/vite/traceViewer/assets/{testServerConnection-_1gRQKgk.js → testServerConnection-DeE2kSzz.js} +0 -0
- /package/lib/vite/traceViewer/assets/{xtermModule-Yt6xwiJ_.js → xtermModule-BeNbaIVa.js} +0 -0
- /package/lib/vite/traceViewer/{codeMirrorModule.Hs9-1ZG4.css → codeMirrorModule.ez37Vkbh.css} +0 -0
- /package/lib/vite/traceViewer/{codicon.wpoHPmsu.ttf → codicon.DCmgc-ay.ttf} +0 -0
- /package/lib/vite/traceViewer/{embedded.MO1jdrtU.css → embedded.w7WN2u1R.css} +0 -0
- /package/lib/vite/traceViewer/{index.q21lh23x.css → index.CrbWWHbf.css} +0 -0
- /package/lib/vite/traceViewer/{uiMode.93DRT-rm.css → uiMode.D3cNFP6u.css} +0 -0
- /package/lib/vite/traceViewer/{xtermModule.0lwXJFHT.css → xtermModule.DSXBckUd.css} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{u as Ft,r as V,b as Ot,_ as At,d as Wt,e as Ut,j as n,R as c,E as zt,s as wt,f as it,m as Vt,g as K,T as F,h as Kt,i as $t,k as ht,W as Ht,M as qt,l as ft,n as Yt,S as Qt,o as Xt,a as Gt,c as Jt}from"./assets/workbench-z8ylMSQK.js";import{T as Zt,W as te}from"./assets/testServerConnection-_1gRQKgk.js";var ee={};class et{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new $("","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==="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 $(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 l,a;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),(a=(l=this._reporter).onTestBegin)==null||a.call(l,s,i)}_onTestEnd(t,e){var l,a,g;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus,s.annotations=t.annotations;const i=s.results.find(r=>r._id===e.id);i.duration=e.duration,i.status=e.status,i.errors=e.errors,i.error=(l=i.errors)==null?void 0:l[0],i.attachments=this._parseAttachments(e.attachments),(g=(a=this._reporter).onTestEnd)==null||g.call(a,s,i),i._stepMap=new Map}_onStepBegin(t,e,s){var m,d;const i=this._tests.get(t),l=i.results.find(p=>p._id===e),a=s.parentStepId?l._stepMap.get(s.parentStepId):void 0,g=this._absoluteLocation(s.location),r=new ie(s,a,g);a?a.steps.push(r):l.steps.push(r),l._stepMap.set(s.id,r),(d=(m=this._reporter).onStepBegin)==null||d.call(m,i,l,r)}_onStepEnd(t,e,s){var g,r;const i=this._tests.get(t),l=i.results.find(m=>m._id===e),a=l._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(r=(g=this._reporter).onStepEnd)==null||r.call(g,i,l,a)}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,l){var m,d,p,j;const a=l?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,g=e?this._tests.get(e):void 0,r=g&&s?g.results.find(h=>h._id===s):void 0;t==="stdout"?(r==null||r.stdout.push(a),(d=(m=this._reporter).onStdOut)==null||d.call(m,a,g,r)):(r==null||r.stderr.push(a),(j=(p=this._reporter).onStdErr)==null||j.call(p,a,g,r))}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={...re,...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:X(t.testIgnore),testMatch:X(t.testMatch),timeout:t.timeout,grep:X(t.grep),grepInvert:X(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}))}_mergeSuiteInto(t,e){let s=e.suites.find(i=>i.title===t.title);s||(s=new $(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 se(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??[],e}_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 ${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 se{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 ne(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new oe(this.results.length,t);return this.results.push(e),e}}class ie{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 oe{constructor(t,e){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._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 re={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[ee.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function X(o){return o.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function ne(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 st{constructor(t,e,s,i,l){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=i&&[...i.values()].some(Boolean);this.pathSeparator=l,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 g=(r,m,d)=>{for(const p of m.suites){const j=p.title||"<anonymous>";let h=d.children.find(f=>f.kind==="group"&&f.title===j);h||(h={kind:"group",subKind:"describe",id:"suite:"+m.titlePath().join("")+""+j,title:j,location:p.location,duration:0,parent:d,children:[],status:"none",hasLoadErrors:!1},this._addChild(d,h)),g(r,p,h)}for(const p of m.tests){const j=p.title;let h=d.children.find(E=>E.kind!=="group"&&E.title===j);h||(h={kind:"case",id:"test:"+p.titlePath().join(""),title:j,parent:d,children:[],tests:[],location:p.location,duration:0,status:"none",project:void 0,test:void 0,tags:p.tags},this._addChild(d,h));const f=p.results[0];let S="none";(f==null?void 0:f[H])==="scheduled"?S="scheduled":(f==null?void 0:f[H])==="running"?S="running":(f==null?void 0:f.status)==="skipped"?S="skipped":(f==null?void 0:f.status)==="interrupted"?S="none":f&&p.outcome()!=="expected"?S="failed":f&&p.outcome()==="expected"&&(S="passed"),h.tests.push(p);const T={kind:"test",id:p.id,title:r.name,location:p.location,test:p,parent:h,children:[],status:S,duration:p.results.length?Math.max(0,p.results[0].duration):0,project:r};this._addChild(h,T),this._treeItemByTestId.set(p.id,T),h.duration=h.children.reduce((E,R)=>E+R.duration,0)}};for(const r of(e==null?void 0:e.suites)||[])if(!(a&&!i.get(r.title)))for(const m of r.suites){const d=this._fileItem(m.location.file.split(l),!0);g(r.project(),m,d)}for(const r of s){if(!r.location)continue;const m=this._fileItem(r.location.file.split(l),!0);m.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(" "),l=[...e.values()].some(Boolean),a=r=>{const m=[...r.tests[0].titlePath(),...r.tests[0].tags].join(" ").toLowerCase();return!i.every(d=>m.includes(d))&&!r.tests.some(d=>s==null?void 0:s.has(d.id))?!1:(r.children=r.children.filter(d=>!l||(s==null?void 0:s.has(d.test.id))||e.get(d.status)),r.tests=r.children.map(d=>d.test),!!r.children.length)},g=r=>{const m=[];for(const d of r.children)d.kind==="case"?a(d)&&m.push(d):(g(d),(d.children.length||d.hasLoadErrors)&&m.push(d));r.children=m};g(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 l=this._fileItem(t.slice(0,t.length-1),!1),a={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:l,children:[],status:"none",hasLoadErrors:!1};return this._addChild(l,a),a}sortAndPropagateStatus(){_t(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?ae(t):new Set}}function _t(o){for(const a of o.children)_t(a);o.kind==="group"&&o.children.sort((a,g)=>a.location.file.localeCompare(g.location.file)||a.location.line-g.location.line);let t=o.children.length>0,e=o.children.length>0,s=!1,i=!1,l=!1;for(const a of o.children)e=e&&a.status==="skipped",t=t&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",i=i||a.status==="running",l=l||a.status==="scheduled";i?o.status="running":l?o.status="scheduled":s?o.status="failed":e?o.status="skipped":t&&(o.status="passed")}function ae(o){const t=new Set,e=s=>{var i;s.kind==="case"?s.tests.map(l=>l.id).forEach(l=>t.add(l)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(o),t}const H=Symbol("statusEx");class le{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new et(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 et({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[H]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[H]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}}}processGlobalReport(t){const e=new et({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 $("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const ce=({source:o})=>{const[t,e]=Ft(),[s,i]=V.useState(Ot()),[l]=V.useState(At(()=>import("./assets/xtermModule-Yt6xwiJ_.js"),__vite__mapDeps([0,1]),import.meta.url).then(g=>g.default)),a=V.useRef(null);return V.useEffect(()=>(Wt(i),()=>Ut(i)),[]),V.useEffect(()=>{const g=o.write,r=o.clear;return(async()=>{const{Terminal:m,FitAddon:d}=await l,p=e.current;if(!p)return;const j=s==="dark-mode"?de:ue;if(a.current&&a.current.terminal.options.theme===j)return;a.current&&(p.textContent="");const h=new m({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:j}),f=new d;h.loadAddon(f);for(const S of o.pending)h.write(S);o.write=S=>{o.pending.push(S),h.write(S)},o.clear=()=>{o.pending=[],h.clear()},h.open(p),f.fit(),a.current={terminal:h,fitAddon:f}})(),()=>{o.clear=r,o.write=g}},[l,a,e,o,s]),V.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),o.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[t,o]),n.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"},de={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"},he=({filterText:o,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:l,testModel:a,runTests:g})=>{const[r,m]=c.useState(!1),d=c.useRef(null);c.useEffect(()=>{var h;(h=d.current)==null||h.focus()},[]);const p=[...e.entries()].filter(([h,f])=>f).map(([h])=>h).join(" ")||"all",j=[...i.entries()].filter(([h,f])=>f).map(([h])=>h).join(" ")||"all";return n.jsxs("div",{className:"filters",children:[n.jsx(zt,{expanded:r,setExpanded:m,title:n.jsx("input",{ref:d,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:o,onChange:h=>{t(h.target.value)},onKeyDown:h=>{h.key==="Enter"&&g()}})}),n.jsxs("div",{className:"filter-summary",title:"Status: "+p+`
|
|
2
|
-
Projects: `+j,onClick:()=>m(!r),children:[n.jsx("span",{className:"filter-label",children:"Status:"})," ",p,n.jsx("span",{className:"filter-label",children:"Projects:"})," ",j]}),r&&n.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[n.jsx("div",{className:"filter-list",children:[...e.entries()].map(([h,f])=>n.jsx("div",{className:"filter-entry",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:f,onClick:()=>{const S=new Map(e);S.set(h,!S.get(h)),s(S)}}),n.jsx("div",{children:h})]})},h))}),n.jsx("div",{className:"filter-list",children:[...i.entries()].map(([h,f])=>n.jsx("div",{className:"filter-entry",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:f,onClick:()=>{var E;const S=new Map(i);S.set(h,!S.get(h)),l(S);const T=(E=a==null?void 0:a.config)==null?void 0:E.configFile;T&&wt.setObject(T+":projects",[...S.entries()].filter(([R,A])=>A).map(([R])=>R))}}),n.jsx("div",{children:h||"untitled"})]})},h))})]})]})},fe=({tag:o,style:t,onClick:e})=>n.jsx("span",{className:it("tag",`tag-color-${pe(o)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${o}`,children:o});function pe(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 ge=$t,me=({filterText:o,testModel:t,testServerConnection:e,testTree:s,runTests:i,runningState:l,watchAll:a,watchedTreeIds:g,setWatchedTreeIds:r,isLoading:m,onItemSelected:d,requestedCollapseAllCount:p,setFilterText:j,onRevealSource:h})=>{const[f,S]=c.useState({expandedItems:new Map}),[T,E]=c.useState(),[R,A]=c.useState(p);c.useEffect(()=>{if(R!==p){f.expandedItems.clear();for(const x of s.flatTreeItems())f.expandedItems.set(x.id,!1);A(p),E(void 0),S({...f});return}if(!l||l.itemSelectedByUser)return;let u;const B=x=>{var L;x.children.forEach(B),!u&&x.status==="failed"&&(x.kind==="test"&&l.testIds.has(x.test.id)||x.kind==="case"&&l.testIds.has((L=x.tests[0])==null?void 0:L.id))&&(u=x)};B(s.rootItem),u&&E(u.id)},[l,E,s,R,A,p,f,S]);const{selectedTreeItem:C}=c.useMemo(()=>{if(!t)return{selectedTreeItem:void 0};const u=T?s.treeItemById(T):void 0,B=we(u,t);let x;return(u==null?void 0:u.kind)==="test"?x=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(x=u.tests[0]),d({treeItem:u,testCase:x,testFile:B}),{selectedTreeItem:u}},[d,T,t,s]);c.useEffect(()=>{if(!m)if(a)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const u=new Set;for(const B of g.value){const x=s.treeItemById(B),L=x==null?void 0:x.location.file;L&&u.add(L)}e==null||e.watchNoReply({fileNames:[...u]})}},[m,s,a,g,e]);const D=u=>{E(u.id),i("bounce-if-busy",s.collectTestIds(u))},J=(u,B)=>{if(u.preventDefault(),u.stopPropagation(),u.metaKey||u.ctrlKey){const x=o.split(" ");x.includes(B)?j(x.filter(L=>L!==B).join(" ").trim()):j((o+" "+B).trim())}else j((o.split(" ").filter(x=>!x.startsWith("@")).join(" ")+" "+B).trim())};return n.jsx(ge,{name:"tests",treeState:f,setTreeState:S,rootItem:s.rootItem,dataTestId:"test-tree",render:u=>n.jsxs("div",{className:"hbox ui-mode-list-item",children:[n.jsxs("div",{className:"ui-mode-list-item-title",children:[n.jsx("span",{title:u.title,children:u.title}),u.kind==="case"?u.tags.map(B=>n.jsx(fe,{tag:B.slice(1),onClick:x=>J(x,B)},B)):null]}),!!u.duration&&u.status!=="skipped"&&n.jsx("div",{className:"ui-mode-list-item-time",children:Vt(u.duration)}),n.jsxs(K,{noMinHeight:!0,noShadow:!0,children:[n.jsx(F,{icon:"play",title:"Run",onClick:()=>D(u),disabled:!!l&&!l.completed}),n.jsx(F,{icon:"go-to-file",title:"Show source",onClick:h,style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!a&&n.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{g.value.has(u.id)?g.value.delete(u.id):g.value.add(u.id),r({...g})},toggled:g.value.has(u.id)})]})]}),icon:u=>Kt(u.status),selectedItem:C,onAccepted:D,onSelected:u=>{l&&(l.itemSelectedByUser=!0),E(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:o?5:1,noItemsMessage:m?"Loading…":"No tests"})};function we(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 _e(o){return`.playwright-artifacts-${o}`}const ve=({item:o,rootDir:t,onOpenExternally:e,revealSource:s})=>{var f,S;const[i,l]=c.useState(),[a,g]=c.useState(0),r=c.useRef(null),{outputDir:m}=c.useMemo(()=>({outputDir:o.testCase?Se(o.testCase):void 0}),[o]),[d,p]=c.useState(),j=c.useCallback(T=>p(ht(T)),[p]),h=d?i==null?void 0:i.model.actions.find(T=>ht(T)===d):void 0;return c.useEffect(()=>{var A,C;r.current&&clearTimeout(r.current);const T=(A=o.testCase)==null?void 0:A.results[0];if(!T){l(void 0);return}const E=T&&T.duration>=0&&T.attachments.find(D=>D.name==="trace");if(E&&E.path){pt(E.path).then(D=>l({model:D,isLive:!1}));return}if(!m){l(void 0);return}const R=`${m}/${_e(T.workerIndex)}/traces/${(C=o.testCase)==null?void 0:C.id}.json`;return r.current=setTimeout(async()=>{try{const D=await pt(R);l({model:D,isLive:!0})}catch{l(void 0)}finally{g(a+1)}},500),()=>{r.current&&clearTimeout(r.current)}},[m,o,l,a,g]),n.jsx(Ht,{model:i==null?void 0:i.model,showSourcesFirst:!0,rootDir:t,initialSelection:h,onSelectionChanged:j,fallbackLocation:o.testFile,isLive:i==null?void 0:i.isLive,status:(f=o.treeItem)==null?void 0:f.status,annotations:((S=o.testCase)==null?void 0:S.annotations)||[],onOpenExternally:e,revealSource:s},"workbench")},Se=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 pt(o){const t=new URLSearchParams;t.set("trace",o);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new qt(s)}const G=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";let gt={cols:80,rows:24};const U={pending:[],clear:()=>{},write:o=>U.pending.push(o),resize:()=>{}},M=new URLSearchParams(window.location.search),xe=M.get("ws"),vt=new URL(`../${xe}`,window.location.toString());vt.protocol=window.location.protocol==="https:"?"wss:":"ws:";const b={args:M.getAll("arg"),grep:M.get("grep")||void 0,grepInvert:M.get("grepInvert")||void 0,projects:M.getAll("project"),workers:M.get("workers")||void 0,timeout:M.has("timeout")?+M.get("timeout"):void 0,headed:M.has("headed"),outputDir:M.get("outputDir")||void 0,updateSnapshots:M.get("updateSnapshots")||void 0,reporters:M.has("reporter")?M.getAll("reporter"):void 0};b.updateSnapshots&&!["all","none","missing"].includes(b.updateSnapshots)&&(b.updateSnapshots=void 0);const mt=navigator.platform==="MacIntel",be=({})=>{var dt;const[o,t]=c.useState(""),[e,s]=c.useState(!1),[i,l]=c.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[a,g]=c.useState(new Map),[r,m]=c.useState(),[d,p]=c.useState(),[j,h]=c.useState({}),[f,S]=c.useState(new Set),[T,E]=c.useState(!1),[R,A]=c.useState(),C=R&&!R.completed,[D,J]=ft("watch-all",!1),[u,B]=c.useState({value:new Set}),x=c.useRef(Promise.resolve()),L=c.useRef(new Set),[ot,St]=c.useState(0),[xt,bt]=c.useState(!1),[rt,nt]=c.useState(!0),[v,Tt]=c.useState(),[q,kt]=c.useState(),[Y,jt]=c.useState(!1);c.useState(!1);const[Et,at]=c.useState(!1),yt=c.useCallback(()=>at(!0),[at]),It=!1,[lt,Te]=c.useState(b.workers==="1"),[ct,ke]=c.useState(b.headed),[ut,je]=c.useState(b.updateSnapshots==="all"),[Rt,Bt]=ft("show-route-actions",!0),[Ct,Nt]=Yt(),Dt=c.useRef(null),Q=c.useCallback(()=>{Tt(new Zt(new te(vt)))},[]);c.useEffect(()=>{var _;(_=Dt.current)==null||_.focus(),E(!0),Q()},[Q]),c.useEffect(()=>{if(!v)return;const _=[v.onStdio(w=>{if(w.buffer){const k=atob(w.buffer);U.write(k)}else U.write(w.text)}),v.onClose(()=>bt(!0))];return U.resize=(w,k)=>{gt={cols:w,rows:k},v.resizeTerminalNoReply({cols:w,rows:k})},()=>{for(const w of _)w.dispose()}},[v]),c.useEffect(()=>{if(!v)return;let _;const w=new le({onUpdate:k=>{clearTimeout(_),_=void 0,k?m(w.asModel()):_||(_=setTimeout(()=>{m(w.asModel())},250))},onError:k=>{U.write((k.stack||k.value||"")+`
|
|
3
|
-
`)},pathSeparator:G});return kt(w),m(void 0),E(!0),B({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:k,report:I}=await v.runGlobalSetup({outputDir:b.outputDir});if(w.processGlobalReport(I),k!=="passed")return;const N=await v.listTests({projects:b.projects,locations:b.args,grep:b.grep,grepInvert:b.grepInvert,outputDir:b.outputDir});w.processListReport(N.report),v.onReport(P=>{w.processTestReportEvent(P)});const{hasBrowsers:O}=await v.checkBrowsers({});nt(O)}finally{E(!1)}})(),()=>{clearTimeout(_)}},[v]),c.useEffect(()=>{if(!r)return;const{config:_,rootSuite:w}=r,k=_.configFile?wt.getObject(_.configFile+":projects",void 0):void 0,I=new Map(a);for(const N of I.keys())w.suites.find(O=>O.title===N)||I.delete(N);for(const N of w.suites)I.has(N.title)||I.set(N.title,!!(k!=null&&k.includes(N.title)));!k&&I.size&&![...I.values()].includes(!0)&&I.set(I.entries().next().value[0],!0),(a.size!==I.size||[...a].some(([N,O])=>I.get(N)!==O))&&g(I)},[a,r]),c.useEffect(()=>{C&&(r!=null&&r.progress)?p(r.progress):r||p(void 0)},[r,C]);const{testTree:Pt}=c.useMemo(()=>{if(!r)return{testTree:new st("",new $("","root"),[],a,G)};const _=new st("",r.rootSuite,r.loadErrors,a,G);return _.filterTree(o,i,C?R==null?void 0:R.testIds:void 0),_.sortAndPropagateStatus(),_.shortenRoot(),_.flattenForSingleProject(),S(_.testIds()),{testTree:_}},[o,r,i,a,S,R,C]),z=c.useCallback((_,w)=>{!v||!r||_==="bounce-if-busy"&&C||(L.current=new Set([...L.current,...w]),x.current=x.current.then(async()=>{var N,O,P;const k=L.current;if(L.current=new Set,!k.size)return;{for(const y of((N=r.rootSuite)==null?void 0:N.allTests())||[])if(k.has(y.id)){y.results=[];const W=y._createTestResult("pending");W[H]="scheduled"}m({...r})}const I=" ["+new Date().toLocaleTimeString()+"]";U.write("\x1B[2m—".repeat(Math.max(0,gt.cols-I.length))+I+"\x1B[22m"),p({total:0,passed:0,failed:0,skipped:0}),A({testIds:k}),await v.runTests({locations:b.args,grep:b.grep,grepInvert:b.grepInvert,testIds:[...k],projects:[...a].filter(([y,W])=>W).map(([y])=>y),workers:lt?"1":b.workers==="1"?void 0:b.workers,timeout:b.timeout,headed:ct,outputDir:b.outputDir,updateSnapshots:ut?"all":b.updateSnapshots,reporters:b.reporters,trace:"on"});for(const y of((O=r.rootSuite)==null?void 0:O.allTests())||[])((P=y.results[0])==null?void 0:P.duration)===-1&&(y.results=[]);m({...r}),A(y=>y?{...y,completed:!0}:void 0)}))},[a,C,r,v,lt,ct,ut]);c.useEffect(()=>{if(!v||!q)return;const _=v.onTestFilesChanged(async w=>{if(x.current=x.current.then(async()=>{E(!0);try{const P=await v.listTests({projects:b.projects,locations:b.args,grep:b.grep,grepInvert:b.grepInvert,outputDir:b.outputDir});q.processListReport(P.report)}catch(P){console.log(P)}finally{E(!1)}}),await x.current,w.testFiles.length===0)return;const k=q.asModel(),I=new st("",k.rootSuite,k.loadErrors,a,G),N=[],O=new Set(w.testFiles);if(D){const P=y=>{const W=y.location.file;W&&O.has(W)&&N.push(...I.collectTestIds(y)),y.kind==="group"&&y.subKind==="folder"&&y.children.forEach(P)};P(I.rootItem)}else for(const P of u.value){const y=I.treeItemById(P),W=y==null?void 0:y.location.file;W&&O.has(W)&&N.push(...I.collectTestIds(y))}z("queue-if-busy",new Set(N))});return()=>_.dispose()},[z,v,D,u,q,a]),c.useEffect(()=>{if(!v)return;const _=w=>{w.code==="Backquote"&&w.ctrlKey?(w.preventDefault(),s(!e)):w.code==="F5"&&w.shiftKey?(w.preventDefault(),v==null||v.stopTestsNoReply({})):w.code==="F5"&&(w.preventDefault(),z("bounce-if-busy",f))};return addEventListener("keydown",_),()=>{removeEventListener("keydown",_)}},[z,Q,v,f,e]);const Z=c.useRef(null),Mt=c.useCallback(_=>{var w;_.preventDefault(),_.stopPropagation(),(w=Z.current)==null||w.showModal()},[]),tt=c.useCallback(_=>{var w;_.preventDefault(),_.stopPropagation(),(w=Z.current)==null||w.close()},[]),Lt=c.useCallback(_=>{tt(_),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:w}=await(v==null?void 0:v.checkBrowsers({}));nt(w)})},[tt,v]);return n.jsxs("div",{className:"vbox ui-mode",children:[!rt&&n.jsxs("dialog",{ref:Z,children:[n.jsxs("div",{className:"title",children:[n.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),n.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",n.jsx("br",{}),"Would you like to run `playwright install`?",n.jsx("br",{}),n.jsx("button",{className:"button",onClick:Lt,children:"Install"}),n.jsx("button",{className:"button secondary",onClick:tt,children:"Dismiss"})]})]}),xt&&n.jsxs("div",{className:"disconnected",children:[n.jsx("div",{className:"title",children:"UI Mode disconnected"}),n.jsxs("div",{children:[n.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),n.jsx(Qt,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:n.jsxs("div",{className:"vbox",children:[n.jsxs("div",{className:it("vbox",!e&&"hidden"),children:[n.jsxs(K,{children:[n.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),n.jsx(F,{icon:"circle-slash",title:"Clear output",onClick:()=>U.clear()}),n.jsx("div",{className:"spacer"}),n.jsx(F,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),n.jsx(ce,{source:U})]}),n.jsx("div",{className:it("vbox",e&&"hidden"),children:n.jsx(ve,{item:j,rootDir:(dt=r==null?void 0:r.config)==null?void 0:dt.rootDir,revealSource:Et,onOpenExternally:_=>v==null?void 0:v.openNoReply({location:{file:_.file,line:_.line,column:_.column}})})})]}),sidebar:n.jsxs("div",{className:"vbox ui-mode-sidebar",children:[n.jsxs(K,{noShadow:!0,noMinHeight:!0,children:[n.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),n.jsx("div",{className:"section-title",children:"Playwright"}),n.jsx(F,{icon:"refresh",title:"Reload",onClick:()=>Q(),disabled:C||T}),n.jsx(F,{icon:"terminal",title:"Toggle output — "+(mt?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),!rt&&n.jsx(F,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Mt})]}),n.jsx(he,{filterText:o,setFilterText:t,statusFilters:i,setStatusFilters:l,projectFilters:a,setProjectFilters:g,testModel:r,runTests:()=>z("bounce-if-busy",f)}),n.jsxs(K,{noMinHeight:!0,children:[!C&&!d&&n.jsx("div",{className:"section-title",children:"Tests"}),!C&&d&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:[d.passed,"/",d.total," passed (",d.passed/d.total*100|0,"%)"]})}),C&&d&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:["Running ",d.passed,"/",R.testIds.size," passed (",d.passed/R.testIds.size*100|0,"%)"]})}),n.jsx(F,{icon:"play",title:"Run all — F5",onClick:()=>z("bounce-if-busy",f),disabled:C||T}),n.jsx(F,{icon:"debug-stop",title:"Stop — "+(mt?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!C||T}),n.jsx(F,{icon:"eye",title:"Watch all",toggled:D,onClick:()=>{B({value:new Set}),J(!D)}}),n.jsx(F,{icon:"collapse-all",title:"Collapse all",onClick:()=>{St(ot+1)}})]}),n.jsx(me,{filterText:o,testModel:r,testTree:Pt,testServerConnection:v,runningState:R,runTests:z,onItemSelected:h,watchAll:D,watchedTreeIds:u,setWatchedTreeIds:B,isLoading:T,requestedCollapseAllCount:ot,setFilterText:t,onRevealSource:yt}),It,n.jsxs(K,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>jt(!Y),children:[n.jsx("span",{className:`codicon codicon-${Y?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:Y?"Hide Settings":"Show Settings"}),n.jsx("div",{className:"section-title",children:"Settings"})]}),Y&&n.jsx(Xt,{settings:[{value:Ct,set:Nt,title:"Dark mode"},{value:Rt,set:Bt,title:"Show route actions"}]})]})})]})};(async()=>{if(Gt(),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
|
-
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)}Jt(document.querySelector("#root")).render(n.jsx(be,{}))})();
|
|
5
1
|
function __vite__mapDeps(indexes) {
|
|
6
2
|
if (!__vite__mapDeps.viteFileDeps) {
|
|
7
|
-
__vite__mapDeps.viteFileDeps = ["./assets/xtermModule-
|
|
3
|
+
__vite__mapDeps.viteFileDeps = ["./assets/xtermModule-BeNbaIVa.js","./xtermModule.DSXBckUd.css"]
|
|
8
4
|
}
|
|
9
5
|
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
10
6
|
}
|
|
7
|
+
import{u as Ft,r as V,b as Ot,_ as At,d as Wt,e as Ut,j as n,R as c,E as zt,s as wt,f as it,m as Vt,g as K,T as F,h as Kt,i as $t,k as ht,W as Ht,M as qt,l as ft,n as Yt,S as Qt,o as Xt,a as Gt,c as Jt}from"./assets/workbench-caTaZnzx.js";import{T as Zt,W as te}from"./assets/testServerConnection-DeE2kSzz.js";var ee={};class et{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new $("","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==="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 $(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 l,a;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),(a=(l=this._reporter).onTestBegin)==null||a.call(l,s,i)}_onTestEnd(t,e){var l,a,g;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus,s.annotations=t.annotations;const i=s.results.find(r=>r._id===e.id);i.duration=e.duration,i.status=e.status,i.errors=e.errors,i.error=(l=i.errors)==null?void 0:l[0],i.attachments=this._parseAttachments(e.attachments),(g=(a=this._reporter).onTestEnd)==null||g.call(a,s,i),i._stepMap=new Map}_onStepBegin(t,e,s){var m,d;const i=this._tests.get(t),l=i.results.find(p=>p._id===e),a=s.parentStepId?l._stepMap.get(s.parentStepId):void 0,g=this._absoluteLocation(s.location),r=new ie(s,a,g);a?a.steps.push(r):l.steps.push(r),l._stepMap.set(s.id,r),(d=(m=this._reporter).onStepBegin)==null||d.call(m,i,l,r)}_onStepEnd(t,e,s){var g,r;const i=this._tests.get(t),l=i.results.find(m=>m._id===e),a=l._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(r=(g=this._reporter).onStepEnd)==null||r.call(g,i,l,a)}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,l){var m,d,p,j;const a=l?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,g=e?this._tests.get(e):void 0,r=g&&s?g.results.find(h=>h._id===s):void 0;t==="stdout"?(r==null||r.stdout.push(a),(d=(m=this._reporter).onStdOut)==null||d.call(m,a,g,r)):(r==null||r.stderr.push(a),(j=(p=this._reporter).onStdErr)==null||j.call(p,a,g,r))}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={...re,...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:X(t.testIgnore),testMatch:X(t.testMatch),timeout:t.timeout,grep:X(t.grep),grepInvert:X(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}))}_mergeSuiteInto(t,e){let s=e.suites.find(i=>i.title===t.title);s||(s=new $(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 se(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??[],e}_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 ${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 se{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 ne(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new oe(this.results.length,t);return this.results.push(e),e}}class ie{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 oe{constructor(t,e){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._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 re={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[ee.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function X(o){return o.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function ne(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 st{constructor(t,e,s,i,l){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=i&&[...i.values()].some(Boolean);this.pathSeparator=l,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 g=(r,m,d)=>{for(const p of m.suites){const j=p.title||"<anonymous>";let h=d.children.find(f=>f.kind==="group"&&f.title===j);h||(h={kind:"group",subKind:"describe",id:"suite:"+m.titlePath().join("")+""+j,title:j,location:p.location,duration:0,parent:d,children:[],status:"none",hasLoadErrors:!1},this._addChild(d,h)),g(r,p,h)}for(const p of m.tests){const j=p.title;let h=d.children.find(E=>E.kind!=="group"&&E.title===j);h||(h={kind:"case",id:"test:"+p.titlePath().join(""),title:j,parent:d,children:[],tests:[],location:p.location,duration:0,status:"none",project:void 0,test:void 0,tags:p.tags},this._addChild(d,h));const f=p.results[0];let S="none";(f==null?void 0:f[H])==="scheduled"?S="scheduled":(f==null?void 0:f[H])==="running"?S="running":(f==null?void 0:f.status)==="skipped"?S="skipped":(f==null?void 0:f.status)==="interrupted"?S="none":f&&p.outcome()!=="expected"?S="failed":f&&p.outcome()==="expected"&&(S="passed"),h.tests.push(p);const T={kind:"test",id:p.id,title:r.name,location:p.location,test:p,parent:h,children:[],status:S,duration:p.results.length?Math.max(0,p.results[0].duration):0,project:r};this._addChild(h,T),this._treeItemByTestId.set(p.id,T),h.duration=h.children.reduce((E,R)=>E+R.duration,0)}};for(const r of(e==null?void 0:e.suites)||[])if(!(a&&!i.get(r.title)))for(const m of r.suites){const d=this._fileItem(m.location.file.split(l),!0);g(r.project(),m,d)}for(const r of s){if(!r.location)continue;const m=this._fileItem(r.location.file.split(l),!0);m.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(" "),l=[...e.values()].some(Boolean),a=r=>{const m=[...r.tests[0].titlePath(),...r.tests[0].tags].join(" ").toLowerCase();return!i.every(d=>m.includes(d))&&!r.tests.some(d=>s==null?void 0:s.has(d.id))?!1:(r.children=r.children.filter(d=>!l||(s==null?void 0:s.has(d.test.id))||e.get(d.status)),r.tests=r.children.map(d=>d.test),!!r.children.length)},g=r=>{const m=[];for(const d of r.children)d.kind==="case"?a(d)&&m.push(d):(g(d),(d.children.length||d.hasLoadErrors)&&m.push(d));r.children=m};g(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 l=this._fileItem(t.slice(0,t.length-1),!1),a={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:l,children:[],status:"none",hasLoadErrors:!1};return this._addChild(l,a),a}sortAndPropagateStatus(){_t(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?ae(t):new Set}}function _t(o){for(const a of o.children)_t(a);o.kind==="group"&&o.children.sort((a,g)=>a.location.file.localeCompare(g.location.file)||a.location.line-g.location.line);let t=o.children.length>0,e=o.children.length>0,s=!1,i=!1,l=!1;for(const a of o.children)e=e&&a.status==="skipped",t=t&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",i=i||a.status==="running",l=l||a.status==="scheduled";i?o.status="running":l?o.status="scheduled":s?o.status="failed":e?o.status="skipped":t&&(o.status="passed")}function ae(o){const t=new Set,e=s=>{var i;s.kind==="case"?s.tests.map(l=>l.id).forEach(l=>t.add(l)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(o),t}const H=Symbol("statusEx");class le{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new et(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 et({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[H]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[H]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}}}processGlobalReport(t){const e=new et({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 $("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const ce=({source:o})=>{const[t,e]=Ft(),[s,i]=V.useState(Ot()),[l]=V.useState(At(()=>import("./assets/xtermModule-BeNbaIVa.js"),__vite__mapDeps([0,1]),import.meta.url).then(g=>g.default)),a=V.useRef(null);return V.useEffect(()=>(Wt(i),()=>Ut(i)),[]),V.useEffect(()=>{const g=o.write,r=o.clear;return(async()=>{const{Terminal:m,FitAddon:d}=await l,p=e.current;if(!p)return;const j=s==="dark-mode"?de:ue;if(a.current&&a.current.terminal.options.theme===j)return;a.current&&(p.textContent="");const h=new m({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:j}),f=new d;h.loadAddon(f);for(const S of o.pending)h.write(S);o.write=S=>{o.pending.push(S),h.write(S)},o.clear=()=>{o.pending=[],h.clear()},h.open(p),f.fit(),a.current={terminal:h,fitAddon:f}})(),()=>{o.clear=r,o.write=g}},[l,a,e,o,s]),V.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),o.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[t,o]),n.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"},de={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"},he=({filterText:o,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:l,testModel:a,runTests:g})=>{const[r,m]=c.useState(!1),d=c.useRef(null);c.useEffect(()=>{var h;(h=d.current)==null||h.focus()},[]);const p=[...e.entries()].filter(([h,f])=>f).map(([h])=>h).join(" ")||"all",j=[...i.entries()].filter(([h,f])=>f).map(([h])=>h).join(" ")||"all";return n.jsxs("div",{className:"filters",children:[n.jsx(zt,{expanded:r,setExpanded:m,title:n.jsx("input",{ref:d,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:o,onChange:h=>{t(h.target.value)},onKeyDown:h=>{h.key==="Enter"&&g()}})}),n.jsxs("div",{className:"filter-summary",title:"Status: "+p+`
|
|
8
|
+
Projects: `+j,onClick:()=>m(!r),children:[n.jsx("span",{className:"filter-label",children:"Status:"})," ",p,n.jsx("span",{className:"filter-label",children:"Projects:"})," ",j]}),r&&n.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[n.jsx("div",{className:"filter-list",children:[...e.entries()].map(([h,f])=>n.jsx("div",{className:"filter-entry",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:f,onClick:()=>{const S=new Map(e);S.set(h,!S.get(h)),s(S)}}),n.jsx("div",{children:h})]})},h))}),n.jsx("div",{className:"filter-list",children:[...i.entries()].map(([h,f])=>n.jsx("div",{className:"filter-entry",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:f,onClick:()=>{var E;const S=new Map(i);S.set(h,!S.get(h)),l(S);const T=(E=a==null?void 0:a.config)==null?void 0:E.configFile;T&&wt.setObject(T+":projects",[...S.entries()].filter(([R,A])=>A).map(([R])=>R))}}),n.jsx("div",{children:h||"untitled"})]})},h))})]})]})},fe=({tag:o,style:t,onClick:e})=>n.jsx("span",{className:it("tag",`tag-color-${pe(o)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${o}`,children:o});function pe(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 ge=$t,me=({filterText:o,testModel:t,testServerConnection:e,testTree:s,runTests:i,runningState:l,watchAll:a,watchedTreeIds:g,setWatchedTreeIds:r,isLoading:m,onItemSelected:d,requestedCollapseAllCount:p,setFilterText:j,onRevealSource:h})=>{const[f,S]=c.useState({expandedItems:new Map}),[T,E]=c.useState(),[R,A]=c.useState(p);c.useEffect(()=>{if(R!==p){f.expandedItems.clear();for(const x of s.flatTreeItems())f.expandedItems.set(x.id,!1);A(p),E(void 0),S({...f});return}if(!l||l.itemSelectedByUser)return;let u;const B=x=>{var L;x.children.forEach(B),!u&&x.status==="failed"&&(x.kind==="test"&&l.testIds.has(x.test.id)||x.kind==="case"&&l.testIds.has((L=x.tests[0])==null?void 0:L.id))&&(u=x)};B(s.rootItem),u&&E(u.id)},[l,E,s,R,A,p,f,S]);const{selectedTreeItem:C}=c.useMemo(()=>{if(!t)return{selectedTreeItem:void 0};const u=T?s.treeItemById(T):void 0,B=we(u,t);let x;return(u==null?void 0:u.kind)==="test"?x=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(x=u.tests[0]),d({treeItem:u,testCase:x,testFile:B}),{selectedTreeItem:u}},[d,T,t,s]);c.useEffect(()=>{if(!m)if(a)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const u=new Set;for(const B of g.value){const x=s.treeItemById(B),L=x==null?void 0:x.location.file;L&&u.add(L)}e==null||e.watchNoReply({fileNames:[...u]})}},[m,s,a,g,e]);const D=u=>{E(u.id),i("bounce-if-busy",s.collectTestIds(u))},J=(u,B)=>{if(u.preventDefault(),u.stopPropagation(),u.metaKey||u.ctrlKey){const x=o.split(" ");x.includes(B)?j(x.filter(L=>L!==B).join(" ").trim()):j((o+" "+B).trim())}else j((o.split(" ").filter(x=>!x.startsWith("@")).join(" ")+" "+B).trim())};return n.jsx(ge,{name:"tests",treeState:f,setTreeState:S,rootItem:s.rootItem,dataTestId:"test-tree",render:u=>n.jsxs("div",{className:"hbox ui-mode-list-item",children:[n.jsxs("div",{className:"ui-mode-list-item-title",children:[n.jsx("span",{title:u.title,children:u.title}),u.kind==="case"?u.tags.map(B=>n.jsx(fe,{tag:B.slice(1),onClick:x=>J(x,B)},B)):null]}),!!u.duration&&u.status!=="skipped"&&n.jsx("div",{className:"ui-mode-list-item-time",children:Vt(u.duration)}),n.jsxs(K,{noMinHeight:!0,noShadow:!0,children:[n.jsx(F,{icon:"play",title:"Run",onClick:()=>D(u),disabled:!!l&&!l.completed}),n.jsx(F,{icon:"go-to-file",title:"Show source",onClick:h,style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!a&&n.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{g.value.has(u.id)?g.value.delete(u.id):g.value.add(u.id),r({...g})},toggled:g.value.has(u.id)})]})]}),icon:u=>Kt(u.status),selectedItem:C,onAccepted:D,onSelected:u=>{l&&(l.itemSelectedByUser=!0),E(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:o?5:1,noItemsMessage:m?"Loading…":"No tests"})};function we(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 _e(o){return`.playwright-artifacts-${o}`}const ve=({item:o,rootDir:t,onOpenExternally:e,revealSource:s})=>{var f,S;const[i,l]=c.useState(),[a,g]=c.useState(0),r=c.useRef(null),{outputDir:m}=c.useMemo(()=>({outputDir:o.testCase?Se(o.testCase):void 0}),[o]),[d,p]=c.useState(),j=c.useCallback(T=>p(ht(T)),[p]),h=d?i==null?void 0:i.model.actions.find(T=>ht(T)===d):void 0;return c.useEffect(()=>{var A,C;r.current&&clearTimeout(r.current);const T=(A=o.testCase)==null?void 0:A.results[0];if(!T){l(void 0);return}const E=T&&T.duration>=0&&T.attachments.find(D=>D.name==="trace");if(E&&E.path){pt(E.path).then(D=>l({model:D,isLive:!1}));return}if(!m){l(void 0);return}const R=`${m}/${_e(T.workerIndex)}/traces/${(C=o.testCase)==null?void 0:C.id}.json`;return r.current=setTimeout(async()=>{try{const D=await pt(R);l({model:D,isLive:!0})}catch{l(void 0)}finally{g(a+1)}},500),()=>{r.current&&clearTimeout(r.current)}},[m,o,l,a,g]),n.jsx(Ht,{model:i==null?void 0:i.model,showSourcesFirst:!0,rootDir:t,initialSelection:h,onSelectionChanged:j,fallbackLocation:o.testFile,isLive:i==null?void 0:i.isLive,status:(f=o.treeItem)==null?void 0:f.status,annotations:((S=o.testCase)==null?void 0:S.annotations)||[],onOpenExternally:e,revealSource:s},"workbench")},Se=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 pt(o){const t=new URLSearchParams;t.set("trace",o);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new qt(s)}const G=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";let gt={cols:80,rows:24};const U={pending:[],clear:()=>{},write:o=>U.pending.push(o),resize:()=>{}},M=new URLSearchParams(window.location.search),xe=M.get("ws"),vt=new URL(`../${xe}`,window.location.toString());vt.protocol=window.location.protocol==="https:"?"wss:":"ws:";const b={args:M.getAll("arg"),grep:M.get("grep")||void 0,grepInvert:M.get("grepInvert")||void 0,projects:M.getAll("project"),workers:M.get("workers")||void 0,timeout:M.has("timeout")?+M.get("timeout"):void 0,headed:M.has("headed"),outputDir:M.get("outputDir")||void 0,updateSnapshots:M.get("updateSnapshots")||void 0,reporters:M.has("reporter")?M.getAll("reporter"):void 0};b.updateSnapshots&&!["all","none","missing"].includes(b.updateSnapshots)&&(b.updateSnapshots=void 0);const mt=navigator.platform==="MacIntel",be=({})=>{var dt;const[o,t]=c.useState(""),[e,s]=c.useState(!1),[i,l]=c.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[a,g]=c.useState(new Map),[r,m]=c.useState(),[d,p]=c.useState(),[j,h]=c.useState({}),[f,S]=c.useState(new Set),[T,E]=c.useState(!1),[R,A]=c.useState(),C=R&&!R.completed,[D,J]=ft("watch-all",!1),[u,B]=c.useState({value:new Set}),x=c.useRef(Promise.resolve()),L=c.useRef(new Set),[ot,St]=c.useState(0),[xt,bt]=c.useState(!1),[rt,nt]=c.useState(!0),[v,Tt]=c.useState(),[q,kt]=c.useState(),[Y,jt]=c.useState(!1);c.useState(!1);const[Et,at]=c.useState(!1),yt=c.useCallback(()=>at(!0),[at]),It=!1,[lt,Te]=c.useState(b.workers==="1"),[ct,ke]=c.useState(b.headed),[ut,je]=c.useState(b.updateSnapshots==="all"),[Rt,Bt]=ft("show-route-actions",!0),[Ct,Nt]=Yt(),Dt=c.useRef(null),Q=c.useCallback(()=>{Tt(new Zt(new te(vt)))},[]);c.useEffect(()=>{var _;(_=Dt.current)==null||_.focus(),E(!0),Q()},[Q]),c.useEffect(()=>{if(!v)return;const _=[v.onStdio(w=>{if(w.buffer){const k=atob(w.buffer);U.write(k)}else U.write(w.text)}),v.onClose(()=>bt(!0))];return U.resize=(w,k)=>{gt={cols:w,rows:k},v.resizeTerminalNoReply({cols:w,rows:k})},()=>{for(const w of _)w.dispose()}},[v]),c.useEffect(()=>{if(!v)return;let _;const w=new le({onUpdate:k=>{clearTimeout(_),_=void 0,k?m(w.asModel()):_||(_=setTimeout(()=>{m(w.asModel())},250))},onError:k=>{U.write((k.stack||k.value||"")+`
|
|
9
|
+
`)},pathSeparator:G});return kt(w),m(void 0),E(!0),B({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:k,report:I}=await v.runGlobalSetup({outputDir:b.outputDir});if(w.processGlobalReport(I),k!=="passed")return;const N=await v.listTests({projects:b.projects,locations:b.args,grep:b.grep,grepInvert:b.grepInvert,outputDir:b.outputDir});w.processListReport(N.report),v.onReport(P=>{w.processTestReportEvent(P)});const{hasBrowsers:O}=await v.checkBrowsers({});nt(O)}finally{E(!1)}})(),()=>{clearTimeout(_)}},[v]),c.useEffect(()=>{if(!r)return;const{config:_,rootSuite:w}=r,k=_.configFile?wt.getObject(_.configFile+":projects",void 0):void 0,I=new Map(a);for(const N of I.keys())w.suites.find(O=>O.title===N)||I.delete(N);for(const N of w.suites)I.has(N.title)||I.set(N.title,!!(k!=null&&k.includes(N.title)));!k&&I.size&&![...I.values()].includes(!0)&&I.set(I.entries().next().value[0],!0),(a.size!==I.size||[...a].some(([N,O])=>I.get(N)!==O))&&g(I)},[a,r]),c.useEffect(()=>{C&&(r!=null&&r.progress)?p(r.progress):r||p(void 0)},[r,C]);const{testTree:Pt}=c.useMemo(()=>{if(!r)return{testTree:new st("",new $("","root"),[],a,G)};const _=new st("",r.rootSuite,r.loadErrors,a,G);return _.filterTree(o,i,C?R==null?void 0:R.testIds:void 0),_.sortAndPropagateStatus(),_.shortenRoot(),_.flattenForSingleProject(),S(_.testIds()),{testTree:_}},[o,r,i,a,S,R,C]),z=c.useCallback((_,w)=>{!v||!r||_==="bounce-if-busy"&&C||(L.current=new Set([...L.current,...w]),x.current=x.current.then(async()=>{var N,O,P;const k=L.current;if(L.current=new Set,!k.size)return;{for(const y of((N=r.rootSuite)==null?void 0:N.allTests())||[])if(k.has(y.id)){y.results=[];const W=y._createTestResult("pending");W[H]="scheduled"}m({...r})}const I=" ["+new Date().toLocaleTimeString()+"]";U.write("\x1B[2m—".repeat(Math.max(0,gt.cols-I.length))+I+"\x1B[22m"),p({total:0,passed:0,failed:0,skipped:0}),A({testIds:k}),await v.runTests({locations:b.args,grep:b.grep,grepInvert:b.grepInvert,testIds:[...k],projects:[...a].filter(([y,W])=>W).map(([y])=>y),workers:lt?"1":b.workers==="1"?void 0:b.workers,timeout:b.timeout,headed:ct,outputDir:b.outputDir,updateSnapshots:ut?"all":b.updateSnapshots,reporters:b.reporters,trace:"on"});for(const y of((O=r.rootSuite)==null?void 0:O.allTests())||[])((P=y.results[0])==null?void 0:P.duration)===-1&&(y.results=[]);m({...r}),A(y=>y?{...y,completed:!0}:void 0)}))},[a,C,r,v,lt,ct,ut]);c.useEffect(()=>{if(!v||!q)return;const _=v.onTestFilesChanged(async w=>{if(x.current=x.current.then(async()=>{E(!0);try{const P=await v.listTests({projects:b.projects,locations:b.args,grep:b.grep,grepInvert:b.grepInvert,outputDir:b.outputDir});q.processListReport(P.report)}catch(P){console.log(P)}finally{E(!1)}}),await x.current,w.testFiles.length===0)return;const k=q.asModel(),I=new st("",k.rootSuite,k.loadErrors,a,G),N=[],O=new Set(w.testFiles);if(D){const P=y=>{const W=y.location.file;W&&O.has(W)&&N.push(...I.collectTestIds(y)),y.kind==="group"&&y.subKind==="folder"&&y.children.forEach(P)};P(I.rootItem)}else for(const P of u.value){const y=I.treeItemById(P),W=y==null?void 0:y.location.file;W&&O.has(W)&&N.push(...I.collectTestIds(y))}z("queue-if-busy",new Set(N))});return()=>_.dispose()},[z,v,D,u,q,a]),c.useEffect(()=>{if(!v)return;const _=w=>{w.code==="Backquote"&&w.ctrlKey?(w.preventDefault(),s(!e)):w.code==="F5"&&w.shiftKey?(w.preventDefault(),v==null||v.stopTestsNoReply({})):w.code==="F5"&&(w.preventDefault(),z("bounce-if-busy",f))};return addEventListener("keydown",_),()=>{removeEventListener("keydown",_)}},[z,Q,v,f,e]);const Z=c.useRef(null),Mt=c.useCallback(_=>{var w;_.preventDefault(),_.stopPropagation(),(w=Z.current)==null||w.showModal()},[]),tt=c.useCallback(_=>{var w;_.preventDefault(),_.stopPropagation(),(w=Z.current)==null||w.close()},[]),Lt=c.useCallback(_=>{tt(_),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:w}=await(v==null?void 0:v.checkBrowsers({}));nt(w)})},[tt,v]);return n.jsxs("div",{className:"vbox ui-mode",children:[!rt&&n.jsxs("dialog",{ref:Z,children:[n.jsxs("div",{className:"title",children:[n.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),n.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",n.jsx("br",{}),"Would you like to run `playwright install`?",n.jsx("br",{}),n.jsx("button",{className:"button",onClick:Lt,children:"Install"}),n.jsx("button",{className:"button secondary",onClick:tt,children:"Dismiss"})]})]}),xt&&n.jsxs("div",{className:"disconnected",children:[n.jsx("div",{className:"title",children:"UI Mode disconnected"}),n.jsxs("div",{children:[n.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),n.jsx(Qt,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:n.jsxs("div",{className:"vbox",children:[n.jsxs("div",{className:it("vbox",!e&&"hidden"),children:[n.jsxs(K,{children:[n.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),n.jsx(F,{icon:"circle-slash",title:"Clear output",onClick:()=>U.clear()}),n.jsx("div",{className:"spacer"}),n.jsx(F,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),n.jsx(ce,{source:U})]}),n.jsx("div",{className:it("vbox",e&&"hidden"),children:n.jsx(ve,{item:j,rootDir:(dt=r==null?void 0:r.config)==null?void 0:dt.rootDir,revealSource:Et,onOpenExternally:_=>v==null?void 0:v.openNoReply({location:{file:_.file,line:_.line,column:_.column}})})})]}),sidebar:n.jsxs("div",{className:"vbox ui-mode-sidebar",children:[n.jsxs(K,{noShadow:!0,noMinHeight:!0,children:[n.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),n.jsx("div",{className:"section-title",children:"Playwright"}),n.jsx(F,{icon:"refresh",title:"Reload",onClick:()=>Q(),disabled:C||T}),n.jsx(F,{icon:"terminal",title:"Toggle output — "+(mt?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),!rt&&n.jsx(F,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Mt})]}),n.jsx(he,{filterText:o,setFilterText:t,statusFilters:i,setStatusFilters:l,projectFilters:a,setProjectFilters:g,testModel:r,runTests:()=>z("bounce-if-busy",f)}),n.jsxs(K,{noMinHeight:!0,children:[!C&&!d&&n.jsx("div",{className:"section-title",children:"Tests"}),!C&&d&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:[d.passed,"/",d.total," passed (",d.passed/d.total*100|0,"%)"]})}),C&&d&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:["Running ",d.passed,"/",R.testIds.size," passed (",d.passed/R.testIds.size*100|0,"%)"]})}),n.jsx(F,{icon:"play",title:"Run all — F5",onClick:()=>z("bounce-if-busy",f),disabled:C||T}),n.jsx(F,{icon:"debug-stop",title:"Stop — "+(mt?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!C||T}),n.jsx(F,{icon:"eye",title:"Watch all",toggled:D,onClick:()=>{B({value:new Set}),J(!D)}}),n.jsx(F,{icon:"collapse-all",title:"Collapse all",onClick:()=>{St(ot+1)}})]}),n.jsx(me,{filterText:o,testModel:r,testTree:Pt,testServerConnection:v,runningState:R,runTests:z,onItemSelected:h,watchAll:D,watchedTreeIds:u,setWatchedTreeIds:B,isLoading:T,requestedCollapseAllCount:ot,setFilterText:t,onRevealSource:yt}),It,n.jsxs(K,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>jt(!Y),children:[n.jsx("span",{className:`codicon codicon-${Y?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:Y?"Hide Settings":"Show Settings"}),n.jsx("div",{className:"section-title",children:"Settings"})]}),Y&&n.jsx(Xt,{settings:[{value:Ct,set:Nt,title:"Dark mode"},{value:Rt,set:Bt,title:"Show route actions"}]})]})})]})};(async()=>{if(Gt(),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.
|
|
10
|
+
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)}Jt(document.querySelector("#root")).render(n.jsx(be,{}))})();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-BeNbaIVa.js","./xtermModule.DSXBckUd.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as Me,r as V,b as De,_ as Le,d as Fe,e as Oe,j as o,R as h,s as me,f as re,m as We,g as $,T as M,M as Ue,h as Ae,i as ze,S as Ve,a as Ke,c as He}from"./assets/inspectorTab-DhBbZz8I.js";import{T as $e,W as qe}from"./assets/testServerConnection-DeE2kSzz.js";import{E as Ye,t as Qe,T as Xe,W as Ge}from"./assets/workbench-B13nfocr.js";var Je={};class se{constructor(e,t={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new q("","root"),this._options=t,this._reporter=e}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(e){const{method:t,params:s}=e;if(t==="onConfigure"){this._onConfigure(s.config);return}if(t==="onProject"){this._onProject(s.project);return}if(t==="onBegin"){this._onBegin();return}if(t==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(t==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(t==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(t==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(t==="onError"){this._onError(s.error);return}if(t==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(t==="onEnd")return this._onEnd(s.result);if(t==="onExit")return this._onExit()}_onConfigure(e){var t,s;this._rootDir=e.rootDir,this._config=this._parseConfig(e),(s=(t=this._reporter).onConfigure)==null||s.call(t,this._config)}_onProject(e){let t=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===e.name):void 0;t||(t=new q(e.name,"project"),this._rootSuite._addSuite(t)),t._project=this._parseProject(e);for(const s of e.suites)this._mergeSuiteInto(s,t)}_onBegin(){var e,t;(t=(e=this._reporter).onBegin)==null||t.call(e,this._rootSuite)}_onTestBegin(e,t){var c,a;const s=this._tests.get(e);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const r=s._createTestResult(t.id);r.retry=t.retry,r.workerIndex=t.workerIndex,r.parallelIndex=t.parallelIndex,r.setStartTimeNumber(t.startTime),(a=(c=this._reporter).onTestBegin)==null||a.call(c,s,r)}_onTestEnd(e,t){var c,a,m;const s=this._tests.get(e.testId);s.timeout=e.timeout,s.expectedStatus=e.expectedStatus,s.annotations=e.annotations;const r=s.results.find(l=>l._id===t.id);r.duration=t.duration,r.status=t.status,r.errors=t.errors,r.error=(c=r.errors)==null?void 0:c[0],r.attachments=this._parseAttachments(t.attachments),(m=(a=this._reporter).onTestEnd)==null||m.call(a,s,r),r._stepMap=new Map}_onStepBegin(e,t,s){var _,n;const r=this._tests.get(e),c=r.results.find(f=>f._id===t),a=s.parentStepId?c._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),l=new et(s,a,m);a?a.steps.push(l):c.steps.push(l),c._stepMap.set(s.id,l),(n=(_=this._reporter).onStepBegin)==null||n.call(_,r,c,l)}_onStepEnd(e,t,s){var m,l;const r=this._tests.get(e),c=r.results.find(_=>_._id===t),a=c._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(l=(m=this._reporter).onStepEnd)==null||l.call(m,r,c,a)}_onError(e){var t,s;(s=(t=this._reporter).onError)==null||s.call(t,e)}_onStdIO(e,t,s,r,c){var _,n,f,S;const a=c?globalThis.Buffer?Buffer.from(r,"base64"):atob(r):r,m=t?this._tests.get(t):void 0,l=m&&s?m.results.find(d=>d._id===s):void 0;e==="stdout"?(l==null||l.stdout.push(a),(n=(_=this._reporter).onStdOut)==null||n.call(_,a,m,l)):(l==null||l.stderr.push(a),(S=(f=this._reporter).onStdErr)==null||S.call(f,a,m,l))}async _onEnd(e){var t,s;await((s=(t=this._reporter).onEnd)==null?void 0:s.call(t,{status:e.status,startTime:new Date(e.startTime),duration:e.duration}))}_onExit(){var e,t;return(t=(e=this._reporter).onExit)==null?void 0:t.call(e)}_parseConfig(e){const t={...st,...e};return this._options.configOverrides&&(t.configFile=this._options.configOverrides.configFile,t.reportSlowTests=this._options.configOverrides.reportSlowTests,t.quiet=this._options.configOverrides.quiet,t.reporter=[...this._options.configOverrides.reporter]),t}_parseProject(e){return{metadata:e.metadata,name:e.name,outputDir:this._absolutePath(e.outputDir),repeatEach:e.repeatEach,retries:e.retries,testDir:this._absolutePath(e.testDir),testIgnore:Z(e.testIgnore),testMatch:Z(e.testMatch),timeout:e.timeout,grep:Z(e.grep),grepInvert:Z(e.grepInvert),dependencies:e.dependencies,teardown:e.teardown,snapshotDir:this._absolutePath(e.snapshotDir),use:{}}}_parseAttachments(e){return e.map(t=>({...t,body:t.base64&&globalThis.Buffer?Buffer.from(t.base64,"base64"):void 0}))}_mergeSuiteInto(e,t){let s=t.suites.find(r=>r.title===e.title);s||(s=new q(e.title,t.type==="project"?"file":"describe"),t._addSuite(s)),s.location=this._absoluteLocation(e.location),e.entries.forEach(r=>{"testId"in r?this._mergeTestInto(r,s):this._mergeSuiteInto(r,s)})}_mergeTestInto(e,t){let s=this._options.mergeTestCases?t.tests.find(r=>r.title===e.title&&r.repeatEachIndex===e.repeatEachIndex):void 0;s||(s=new Ze(e.testId,e.title,this._absoluteLocation(e.location),e.repeatEachIndex),t._addTest(s),this._tests.set(s.id,s)),this._updateTest(e,s)}_updateTest(e,t){return t.id=e.testId,t.location=this._absoluteLocation(e.location),t.retries=e.retries,t.tags=e.tags??[],t.annotations=e.annotations??[],t}_absoluteLocation(e){return e&&{...e,file:this._absolutePath(e.file)}}_absolutePath(e){if(e!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,e):this._rootDir+"/"+e}}class q{constructor(e,t){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=e,this._type=t}get type(){return this._type}get suites(){return this._entries.filter(e=>e.type!=="test")}get tests(){return this._entries.filter(e=>e.type==="test")}entries(){return this._entries}allTests(){const e=[],t=s=>{for(const r of s.entries())r.type==="test"?e.push(r):t(r)};return t(this),e}titlePath(){const e=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&e.push(this.title),e}project(){var e;return this._project??((e=this.parent)==null?void 0:e.project())}_addTest(e){e.parent=this,this._entries.push(e)}_addSuite(e){e.parent=this,this._entries.push(e)}}class Ze{constructor(e,t,s,r){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=e,this.title=t,this.location=s,this.repeatEachIndex=r}titlePath(){const e=this.parent?this.parent.titlePath():[];return e.push(this.title),e}outcome(){return it(this)}ok(){const e=this.outcome();return e==="expected"||e==="flaky"||e==="skipped"}_createTestResult(e){const t=new tt(this.results.length,e);return this.results.push(t),t}}class et{constructor(e,t,s){this.duration=-1,this.steps=[],this._startTime=0,this.title=e.title,this.category=e.category,this.location=s,this.parent=t,this._startTime=e.startTime}titlePath(){var t;return[...((t=this.parent)==null?void 0:t.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}class tt{constructor(e,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._startTime=0,this.retry=e,this._id=t}setStartTimeNumber(e){this._startTime=e}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}const st={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[Je.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function Z(i){return i.map(e=>e.s!==void 0?e.s:new RegExp(e.r.source,e.r.flags))}function it(i){let e=0,t=0,s=0;for(const r of i.results)r.status==="interrupted"||(r.status==="skipped"&&i.expectedStatus==="skipped"?++e:r.status==="skipped"||(r.status===i.expectedStatus?++t:++s));return t===0&&s===0?"skipped":s===0?"expected":t===0&&e===0?"unexpected":"flaky"}class ie{constructor(e,t,s,r,c){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=r&&[...r.values()].some(Boolean);this.pathSeparator=c,this.rootItem={kind:"group",subKind:"folder",id:e,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(e,this.rootItem);const m=(l,_,n)=>{for(const f of _.suites){const S=f.title||"<anonymous>";let d=n.children.find(p=>p.kind==="group"&&p.title===S);d||(d={kind:"group",subKind:"describe",id:"suite:"+_.titlePath().join("")+""+S,title:S,location:f.location,duration:0,parent:n,children:[],status:"none",hasLoadErrors:!1},this._addChild(n,d)),m(l,f,d)}for(const f of _.tests){const S=f.title;let d=n.children.find(E=>E.kind!=="group"&&E.title===S);d||(d={kind:"case",id:"test:"+f.titlePath().join(""),title:S,parent:n,children:[],tests:[],location:f.location,duration:0,status:"none",project:void 0,test:void 0,tags:f.tags},this._addChild(n,d));const p=f.results[0];let x="none";(p==null?void 0:p[Y])==="scheduled"?x="scheduled":(p==null?void 0:p[Y])==="running"?x="running":(p==null?void 0:p.status)==="skipped"?x="skipped":(p==null?void 0:p.status)==="interrupted"?x="none":p&&f.outcome()!=="expected"?x="failed":p&&f.outcome()==="expected"&&(x="passed"),d.tests.push(f);const R={kind:"test",id:f.id,title:l.name,location:f.location,test:f,parent:d,children:[],status:x,duration:f.results.length?Math.max(0,f.results[0].duration):0,project:l};this._addChild(d,R),this._treeItemByTestId.set(f.id,R),d.duration=d.children.reduce((E,I)=>E+I.duration,0)}};for(const l of(t==null?void 0:t.suites)||[])if(!(a&&!r.get(l.title)))for(const _ of l.suites){const n=this._fileItem(_.location.file.split(c),!0);m(l.project(),_,n)}for(const l of s){if(!l.location)continue;const _=this._fileItem(l.location.file.split(c),!0);_.hasLoadErrors=!0}}_addChild(e,t){e.children.push(t),t.parent=e,this._treeItemById.set(t.id,t)}filterTree(e,t,s){const r=e.trim().toLowerCase().split(" "),c=[...t.values()].some(Boolean),a=l=>{const _=[...l.tests[0].titlePath(),...l.tests[0].tags].join(" ").toLowerCase();return!r.every(n=>_.includes(n))&&!l.tests.some(n=>s==null?void 0:s.has(n.id))?!1:(l.children=l.children.filter(n=>!c||(s==null?void 0:s.has(n.test.id))||t.get(n.status)),l.tests=l.children.map(n=>n.test),!!l.children.length)},m=l=>{const _=[];for(const n of l.children)n.kind==="case"?a(n)&&_.push(n):(m(n),(n.children.length||n.hasLoadErrors)&&_.push(n));l.children=_};m(this.rootItem)}_fileItem(e,t){if(e.length===0)return this.rootItem;const s=e.join(this.pathSeparator),r=this._treeItemById.get(s);if(r)return r;const c=this._fileItem(e.slice(0,e.length-1),!1),a={kind:"group",subKind:t?"file":"folder",id:s,title:e[e.length-1],location:{file:s,line:0,column:0},duration:0,parent:c,children:[],status:"none",hasLoadErrors:!1};return this._addChild(c,a),a}sortAndPropagateStatus(){_e(this.rootItem)}flattenForSingleProject(){const e=t=>{t.kind==="case"&&t.children.length===1?(t.project=t.children[0].project,t.test=t.children[0].test,t.children=[],this._treeItemByTestId.set(t.test.id,t)):t.children.forEach(e)};e(this.rootItem)}shortenRoot(){let e=this.rootItem;for(;e.children.length===1&&e.children[0].kind==="group"&&e.children[0].subKind==="folder";)e=e.children[0];e.location=this.rootItem.location,this.rootItem=e}testIds(){const e=new Set,t=s=>{s.kind==="case"&&s.tests.forEach(r=>e.add(r.id)),s.children.forEach(t)};return t(this.rootItem),e}fileNames(){const e=new Set,t=s=>{s.kind==="group"&&s.subKind==="file"?e.add(s.id):s.children.forEach(t)};return t(this.rootItem),[...e]}flatTreeItems(){const e=[],t=s=>{e.push(s),s.children.forEach(t)};return t(this.rootItem),e}treeItemById(e){return this._treeItemById.get(e)}collectTestIds(e){return e?rt(e):new Set}}function _e(i){for(const a of i.children)_e(a);i.kind==="group"&&i.children.sort((a,m)=>a.location.file.localeCompare(m.location.file)||a.location.line-m.location.line);let e=i.children.length>0,t=i.children.length>0,s=!1,r=!1,c=!1;for(const a of i.children)t=t&&a.status==="skipped",e=e&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",r=r||a.status==="running",c=c||a.status==="scheduled";r?i.status="running":c?i.status="scheduled":s?i.status="failed":t?i.status="skipped":e&&(i.status="passed")}function rt(i){const e=new Set,t=s=>{var r;s.kind==="case"?s.tests.map(c=>c.id).forEach(c=>e.add(c)):s.kind==="test"?e.add(s.id):(r=s.children)==null||r.forEach(t)};return t(i),e}const Y=Symbol("statusEx");class ot{constructor(e){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new se(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:(t,s)=>t+e.pathSeparator+s,clearPreviousResultsWhenTestBegins:!0}),this._options=e}_createReporter(){return{version:()=>"v2",onConfigure:e=>{this.config=e,this._lastRunReceiver=new se({version:()=>"v2",onBegin:t=>{this._lastRunTestCount=t.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:(t,s)=>t+this._options.pathSeparator+s})},onBegin:e=>{var t;if(this.rootSuite||(this.rootSuite=e),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((t=this._testResultsSnapshot)==null?void 0:t.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:(e,t)=>{t[Y]="running",this._options.onUpdate()},onTestEnd:(e,t)=>{e.outcome()==="skipped"?++this.progress.skipped:e.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,t[Y]=t.status,this._options.onUpdate()},onError:e=>this._handleOnError(e),printsToStdio:()=>!1}}processGlobalReport(e){const t=new se({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of e)t.dispatch(s)}processListReport(e){var s;const t=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(t.map(r=>[r.id,r.results])),this._receiver.reset();for(const r of e)this._receiver.dispatch(r)}processTestReportEvent(e){var t,s,r;(s=(t=this._lastRunReceiver)==null?void 0:t.dispatch(e))==null||s.catch(()=>{}),(r=this._receiver.dispatch(e))==null||r.catch(()=>{})}_handleOnError(e){var t,s;this.loadErrors.push(e),(s=(t=this._options).onError)==null||s.call(t,e),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new q("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const nt=({source:i})=>{const[e,t]=Me(),[s,r]=V.useState(De()),[c]=V.useState(Le(()=>import("./assets/xtermModule-BeNbaIVa.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),a=V.useRef(null);return V.useEffect(()=>(Fe(r),()=>Oe(r)),[]),V.useEffect(()=>{const m=i.write,l=i.clear;return(async()=>{const{Terminal:_,FitAddon:n}=await c,f=t.current;if(!f)return;const S=s==="dark-mode"?lt:at;if(a.current&&a.current.terminal.options.theme===S)return;a.current&&(f.textContent="");const d=new _({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:S}),p=new n;d.loadAddon(p);for(const x of i.pending)d.write(x);i.write=x=>{i.pending.push(x),d.write(x)},i.clear=()=>{i.pending=[],d.clear()},d.open(f),p.fit(),a.current={terminal:d,fitAddon:p}})(),()=>{i.clear=l,i.write=m}},[c,a,t,i,s]),V.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),i.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[e,i]),o.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:t})},at={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"},lt={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"},ct=({filterText:i,setFilterText:e,statusFilters:t,setStatusFilters:s,projectFilters:r,setProjectFilters:c,testModel:a,runTests:m})=>{const[l,_]=h.useState(!1),n=h.useRef(null);h.useEffect(()=>{var d;(d=n.current)==null||d.focus()},[]);const f=[...t.entries()].filter(([d,p])=>p).map(([d])=>d).join(" ")||"all",S=[...r.entries()].filter(([d,p])=>p).map(([d])=>d).join(" ")||"all";return o.jsxs("div",{className:"filters",children:[o.jsx(Ye,{expanded:l,setExpanded:_,title:o.jsx("input",{ref:n,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:d=>{e(d.target.value)},onKeyDown:d=>{d.key==="Enter"&&m()}})}),o.jsxs("div",{className:"filter-summary",title:"Status: "+f+`
|
|
3
|
+
Projects: `+S,onClick:()=>_(!l),children:[o.jsx("span",{className:"filter-label",children:"Status:"})," ",f,o.jsx("span",{className:"filter-label",children:"Projects:"})," ",S]}),l&&o.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[o.jsx("div",{className:"filter-list",children:[...t.entries()].map(([d,p])=>o.jsx("div",{className:"filter-entry",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:p,onClick:()=>{const x=new Map(t);x.set(d,!x.get(d)),s(x)}}),o.jsx("div",{children:d})]})},d))}),o.jsx("div",{className:"filter-list",children:[...r.entries()].map(([d,p])=>o.jsx("div",{className:"filter-entry",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:p,onClick:()=>{var E;const x=new Map(r);x.set(d,!x.get(d)),c(x);const R=(E=a==null?void 0:a.config)==null?void 0:E.configFile;R&&me.setObject(R+":projects",[...x.entries()].filter(([I,W])=>W).map(([I])=>I))}}),o.jsx("div",{children:d||"untitled"})]})},d))})]})]})},dt=({tag:i,style:e,onClick:t})=>o.jsx("span",{className:re("tag",`tag-color-${ut(i)}`),onClick:t,style:{margin:"6px 0 0 6px",...e},title:`Click to filter by tag: ${i}`,children:i});function ut(i){let e=0;for(let t=0;t<i.length;t++)e=i.charCodeAt(t)+((e<<8)-e);return Math.abs(e%6)}const ht=Xe,ft=({filterText:i,testModel:e,testServerConnection:t,testTree:s,runTests:r,runningState:c,watchAll:a,watchedTreeIds:m,setWatchedTreeIds:l,isLoading:_,onItemSelected:n,requestedCollapseAllCount:f,setFilterText:S,onRevealSource:d})=>{const[p,x]=h.useState({expandedItems:new Map}),[R,E]=h.useState(),[I,W]=h.useState(f);h.useEffect(()=>{if(I!==f){p.expandedItems.clear();for(const b of s.flatTreeItems())p.expandedItems.set(b.id,!1);W(f),E(void 0),x({...p});return}if(!c||c.itemSelectedByUser)return;let u;const B=b=>{var L;b.children.forEach(B),!u&&b.status==="failed"&&(b.kind==="test"&&c.testIds.has(b.test.id)||b.kind==="case"&&c.testIds.has((L=b.tests[0])==null?void 0:L.id))&&(u=b)};B(s.rootItem),u&&E(u.id)},[c,E,s,I,W,f,p,x]);const{selectedTreeItem:D}=h.useMemo(()=>{if(!e)return{selectedTreeItem:void 0};const u=R?s.treeItemById(R):void 0,B=pt(u,e);let b;return(u==null?void 0:u.kind)==="test"?b=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(b=u.tests[0]),n({treeItem:u,testCase:b,testFile:B}),{selectedTreeItem:u}},[n,R,e,s]);h.useEffect(()=>{if(!_)if(a)t==null||t.watchNoReply({fileNames:s.fileNames()});else{const u=new Set;for(const B of m.value){const b=s.treeItemById(B),L=b==null?void 0:b.location.file;L&&u.add(L)}t==null||t.watchNoReply({fileNames:[...u]})}},[_,s,a,m,t]);const K=u=>{E(u.id),r("bounce-if-busy",s.collectTestIds(u))},N=(u,B)=>{if(u.preventDefault(),u.stopPropagation(),u.metaKey||u.ctrlKey){const b=i.split(" ");b.includes(B)?S(b.filter(L=>L!==B).join(" ").trim()):S((i+" "+B).trim())}else S((i.split(" ").filter(b=>!b.startsWith("@")).join(" ")+" "+B).trim())};return o.jsx(ht,{name:"tests",treeState:p,setTreeState:x,rootItem:s.rootItem,dataTestId:"test-tree",render:u=>o.jsxs("div",{className:"hbox ui-mode-list-item",children:[o.jsxs("div",{className:"ui-mode-list-item-title",children:[o.jsx("span",{title:u.title,children:u.title}),u.kind==="case"?u.tags.map(B=>o.jsx(dt,{tag:B.slice(1),onClick:b=>N(b,B)},B)):null]}),!!u.duration&&u.status!=="skipped"&&o.jsx("div",{className:"ui-mode-list-item-time",children:We(u.duration)}),o.jsxs($,{noMinHeight:!0,noShadow:!0,children:[o.jsx(M,{icon:"play",title:"Run",onClick:()=>K(u),disabled:!!c&&!c.completed}),o.jsx(M,{icon:"go-to-file",title:"Show source",onClick:d,style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!a&&o.jsx(M,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(u.id)?m.value.delete(u.id):m.value.add(u.id),l({...m})},toggled:m.value.has(u.id)})]})]}),icon:u=>Qe(u.status),selectedItem:D,onAccepted:K,onSelected:u=>{c&&(c.itemSelectedByUser=!0),E(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:i?5:1,noItemsMessage:_?"Loading…":"No tests"})};function pt(i,e){if(!(!i||!e))return{file:i.location.file,line:i.location.line,column:i.location.column,source:{errors:e.loadErrors.filter(t=>{var s;return((s=t.location)==null?void 0:s.file)===i.location.file}).map(t=>({line:t.location.line,message:t.message})),content:void 0}}}function gt(i){return`.playwright-artifacts-${i}`}const mt=({item:i,rootDir:e,onOpenExternally:t,revealSource:s,pathSeparator:r})=>{var f,S;const[c,a]=h.useState(),[m,l]=h.useState(0),_=h.useRef(null),{outputDir:n}=h.useMemo(()=>({outputDir:i.testCase?_t(i.testCase):void 0}),[i]);return h.useEffect(()=>{var R,E;_.current&&clearTimeout(_.current);const d=(R=i.testCase)==null?void 0:R.results[0];if(!d){a(void 0);return}const p=d&&d.duration>=0&&d.attachments.find(I=>I.name==="trace");if(p&&p.path){fe(p.path).then(I=>a({model:I,isLive:!1}));return}if(!n){a(void 0);return}const x=[n,gt(d.workerIndex),"traces",`${(E=i.testCase)==null?void 0:E.id}.json`].join(r);return _.current=setTimeout(async()=>{try{const I=await fe(x);a({model:I,isLive:!0})}catch{a(void 0)}finally{l(m+1)}},500),()=>{_.current&&clearTimeout(_.current)}},[n,i,a,m,l,r]),o.jsx(Ge,{model:c==null?void 0:c.model,showSourcesFirst:!0,rootDir:e,fallbackLocation:i.testFile,isLive:c==null?void 0:c.isLive,status:(f=i.treeItem)==null?void 0:f.status,annotations:((S=i.testCase)==null?void 0:S.annotations)||[],onOpenExternally:t,revealSource:s},"workbench")},_t=i=>{var e;for(let t=i.parent;t;t=t.parent)if(t.project())return(e=t.project())==null?void 0:e.outputDir};async function fe(i){const e=new URLSearchParams;e.set("trace",i);const s=await(await fetch(`contexts?${e.toString()}`)).json();return new Ue(s)}const wt=({settings:i})=>o.jsx("div",{className:"vbox settings-view",children:i.map(({value:e,set:t,title:s})=>o.jsx("div",{className:"setting",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e,onClick:()=>t(!e)}),s]})},s))});let pe={cols:80,rows:24};const A={pending:[],clear:()=>{},write:i=>A.pending.push(i),resize:()=>{}},O=new URLSearchParams(window.location.search),vt=O.get("ws"),we=new URL(`../${vt}`,window.location.toString());we.protocol=window.location.protocol==="https:"?"wss:":"ws:";const y={args:O.getAll("arg"),grep:O.get("grep")||void 0,grepInvert:O.get("grepInvert")||void 0,projects:O.getAll("project"),workers:O.get("workers")||void 0,headed:O.has("headed"),updateSnapshots:O.get("updateSnapshots")||void 0,reporters:O.has("reporter")?O.getAll("reporter"):void 0,pathSeparator:O.get("pathSeparator")||"/"};y.updateSnapshots&&!["all","none","missing"].includes(y.updateSnapshots)&&(y.updateSnapshots=void 0);const ge=navigator.platform==="MacIntel",St=({})=>{var he;const[i,e]=h.useState(""),[t,s]=h.useState(!1),[r,c]=h.useState(!1),[a,m]=h.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[l,_]=h.useState(new Map),[n,f]=h.useState(),[S,d]=h.useState(),[p,x]=h.useState({}),[R,E]=h.useState(new Set),[I,W]=h.useState(!1),[D,K]=h.useState(),N=D&&!D.completed,[u,B]=Ae("watch-all",!1),[b,L]=h.useState({value:new Set}),H=h.useRef(Promise.resolve()),Q=h.useRef(new Set),[oe,ve]=h.useState(0),[Se,xe]=h.useState(!1),[ne,ae]=h.useState(!0),[v,be]=h.useState(),[X,Te]=h.useState(),[G,ke]=h.useState(!1);h.useState(!1);const[je,le]=h.useState(!1),ye=h.useCallback(()=>le(!0),[le]),Ee=!1,[ce,xt]=h.useState(!1),[de,bt]=h.useState(!1),[ue,Tt]=h.useState(!1),[Ie,Re]=ze(),Be=h.useRef(null),J=h.useCallback(()=>{be(new $e(new qe(we)))},[]);h.useEffect(()=>{var w;(w=Be.current)==null||w.focus(),W(!0),J()},[J]),h.useEffect(()=>{if(!v)return;const w=[v.onStdio(g=>{if(g.buffer){const T=atob(g.buffer);A.write(T)}else A.write(g.text);g.type==="stderr"&&c(!0)}),v.onClose(()=>xe(!0))];return A.resize=(g,T)=>{pe={cols:g,rows:T},v.resizeTerminalNoReply({cols:g,rows:T})},()=>{for(const g of w)g.dispose()}},[v]),h.useEffect(()=>{if(!v)return;let w;const g=new ot({onUpdate:T=>{clearTimeout(w),w=void 0,T?f(g.asModel()):w||(w=setTimeout(()=>{f(g.asModel())},250))},onError:T=>{A.write((T.stack||T.value||"")+`
|
|
4
|
+
`),c(!0)},pathSeparator:y.pathSeparator});return Te(g),f(void 0),W(!0),L({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:T,report:j}=await v.runGlobalSetup({});if(g.processGlobalReport(j),T!=="passed")return;const C=await v.listTests({projects:y.projects,locations:y.args,grep:y.grep,grepInvert:y.grepInvert});g.processListReport(C.report),v.onReport(P=>{g.processTestReportEvent(P)});const{hasBrowsers:F}=await v.checkBrowsers({});ae(F)}finally{W(!1)}})(),()=>{clearTimeout(w)}},[v]),h.useEffect(()=>{if(!n)return;const{config:w,rootSuite:g}=n,T=w.configFile?me.getObject(w.configFile+":projects",void 0):void 0,j=new Map(l);for(const C of j.keys())g.suites.find(F=>F.title===C)||j.delete(C);for(const C of g.suites)j.has(C.title)||j.set(C.title,!!(T!=null&&T.includes(C.title)));!T&&j.size&&![...j.values()].includes(!0)&&j.set(j.entries().next().value[0],!0),(l.size!==j.size||[...l].some(([C,F])=>j.get(C)!==F))&&_(j)},[l,n]),h.useEffect(()=>{N&&(n!=null&&n.progress)?d(n.progress):n||d(void 0)},[n,N]);const{testTree:Ce}=h.useMemo(()=>{if(!n)return{testTree:new ie("",new q("","root"),[],l,y.pathSeparator)};const w=new ie("",n.rootSuite,n.loadErrors,l,y.pathSeparator);return w.filterTree(i,a,N?D==null?void 0:D.testIds:void 0),w.sortAndPropagateStatus(),w.shortenRoot(),w.flattenForSingleProject(),E(w.testIds()),{testTree:w}},[i,n,a,l,E,D,N]),z=h.useCallback((w,g)=>{!v||!n||w==="bounce-if-busy"&&N||(Q.current=new Set([...Q.current,...g]),H.current=H.current.then(async()=>{var C,F,P;const T=Q.current;if(Q.current=new Set,!T.size)return;{for(const k of((C=n.rootSuite)==null?void 0:C.allTests())||[])if(T.has(k.id)){k.results=[];const U=k._createTestResult("pending");U[Y]="scheduled"}f({...n})}const j=" ["+new Date().toLocaleTimeString()+"]";A.write("\x1B[2m—".repeat(Math.max(0,pe.cols-j.length))+j+"\x1B[22m"),d({total:0,passed:0,failed:0,skipped:0}),K({testIds:T}),await v.runTests({locations:y.args,grep:y.grep,grepInvert:y.grepInvert,testIds:[...T],projects:[...l].filter(([k,U])=>U).map(([k])=>k),...ce?{workers:"1"}:{},...de?{headed:!0}:{},...ue?{updateSnapshots:"all"}:{},reporters:y.reporters,trace:"on"});for(const k of((F=n.rootSuite)==null?void 0:F.allTests())||[])((P=k.results[0])==null?void 0:P.duration)===-1&&(k.results=[]);f({...n}),K(k=>k?{...k,completed:!0}:void 0)}))},[l,N,n,v,ce,de,ue]);h.useEffect(()=>{if(!v||!X)return;const w=v.onTestFilesChanged(async g=>{if(H.current=H.current.then(async()=>{W(!0);try{const P=await v.listTests({projects:y.projects,locations:y.args,grep:y.grep,grepInvert:y.grepInvert});X.processListReport(P.report)}catch(P){console.log(P)}finally{W(!1)}}),await H.current,g.testFiles.length===0)return;const T=X.asModel(),j=new ie("",T.rootSuite,T.loadErrors,l,y.pathSeparator),C=[],F=new Set(g.testFiles);if(u){const P=k=>{const U=k.location.file;U&&F.has(U)&&C.push(...j.collectTestIds(k)),k.kind==="group"&&k.subKind==="folder"&&k.children.forEach(P)};P(j.rootItem)}else for(const P of b.value){const k=j.treeItemById(P),U=k==null?void 0:k.location.file;U&&F.has(U)&&C.push(...j.collectTestIds(k))}z("queue-if-busy",new Set(C))});return()=>w.dispose()},[z,v,u,b,X,l]),h.useEffect(()=>{if(!v)return;const w=g=>{g.code==="Backquote"&&g.ctrlKey?(g.preventDefault(),s(!t)):g.code==="F5"&&g.shiftKey?(g.preventDefault(),v==null||v.stopTestsNoReply({})):g.code==="F5"&&(g.preventDefault(),z("bounce-if-busy",R))};return addEventListener("keydown",w),()=>{removeEventListener("keydown",w)}},[z,J,v,R,t]);const ee=h.useRef(null),Ne=h.useCallback(w=>{var g;w.preventDefault(),w.stopPropagation(),(g=ee.current)==null||g.showModal()},[]),te=h.useCallback(w=>{var g;w.preventDefault(),w.stopPropagation(),(g=ee.current)==null||g.close()},[]),Pe=h.useCallback(w=>{te(w),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));ae(g)})},[te,v]);return o.jsxs("div",{className:"vbox ui-mode",children:[!ne&&o.jsxs("dialog",{ref:ee,children:[o.jsxs("div",{className:"title",children:[o.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),o.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",o.jsx("br",{}),"Would you like to run `playwright install`?",o.jsx("br",{}),o.jsx("button",{className:"button",onClick:Pe,children:"Install"}),o.jsx("button",{className:"button secondary",onClick:te,children:"Dismiss"})]})]}),Se&&o.jsxs("div",{className:"disconnected",children:[o.jsx("div",{className:"title",children:"UI Mode disconnected"}),o.jsxs("div",{children:[o.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),o.jsx(Ve,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:o.jsxs("div",{className:"vbox",children:[o.jsxs("div",{className:re("vbox",!t&&"hidden"),children:[o.jsxs($,{children:[o.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),o.jsx(M,{icon:"circle-slash",title:"Clear output",onClick:()=>{A.clear(),c(!1)}}),o.jsx("div",{className:"spacer"}),o.jsx(M,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),o.jsx(nt,{source:A})]}),o.jsx("div",{className:re("vbox",t&&"hidden"),children:o.jsx(mt,{pathSeparator:y.pathSeparator,item:p,rootDir:(he=n==null?void 0:n.config)==null?void 0:he.rootDir,revealSource:je,onOpenExternally:w=>v==null?void 0:v.openNoReply({location:{file:w.file,line:w.line,column:w.column}})})})]}),sidebar:o.jsxs("div",{className:"vbox ui-mode-sidebar",children:[o.jsxs($,{noShadow:!0,noMinHeight:!0,children:[o.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),o.jsx("div",{className:"section-title",children:"Playwright"}),o.jsx(M,{icon:"refresh",title:"Reload",onClick:()=>J(),disabled:N||I}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx(M,{icon:"terminal",title:"Toggle output — "+(ge?"⌃`":"Ctrl + `"),toggled:t,onClick:()=>{s(!t)}}),r&&o.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!ne&&o.jsx(M,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Ne})]}),o.jsx(ct,{filterText:i,setFilterText:e,statusFilters:a,setStatusFilters:m,projectFilters:l,setProjectFilters:_,testModel:n,runTests:()=>z("bounce-if-busy",R)}),o.jsxs($,{noMinHeight:!0,children:[!N&&!S&&o.jsx("div",{className:"section-title",children:"Tests"}),!N&&S&&o.jsx("div",{"data-testid":"status-line",className:"status-line",children:o.jsxs("div",{children:[S.passed,"/",S.total," passed (",S.passed/S.total*100|0,"%)"]})}),N&&S&&o.jsx("div",{"data-testid":"status-line",className:"status-line",children:o.jsxs("div",{children:["Running ",S.passed,"/",D.testIds.size," passed (",S.passed/D.testIds.size*100|0,"%)"]})}),o.jsx(M,{icon:"play",title:"Run all — F5",onClick:()=>z("bounce-if-busy",R),disabled:N||I}),o.jsx(M,{icon:"debug-stop",title:"Stop — "+(ge?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!N||I}),o.jsx(M,{icon:"eye",title:"Watch all",toggled:u,onClick:()=>{L({value:new Set}),B(!u)}}),o.jsx(M,{icon:"collapse-all",title:"Collapse all",onClick:()=>{ve(oe+1)}})]}),o.jsx(ft,{filterText:i,testModel:n,testTree:Ce,testServerConnection:v,runningState:D,runTests:z,onItemSelected:x,watchAll:u,watchedTreeIds:b,setWatchedTreeIds:L,isLoading:I,requestedCollapseAllCount:oe,setFilterText:e,onRevealSource:ye}),Ee,o.jsxs($,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>ke(!G),children:[o.jsx("span",{className:`codicon codicon-${G?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:G?"Hide Settings":"Show Settings"}),o.jsx("div",{className:"section-title",children:"Settings"})]}),G&&o.jsx(wt,{settings:[{value:Ie,set:Re,title:"Dark mode"}]})]})})]})};(async()=>{if(Ke(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
5
|
+
Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}He(document.querySelector("#root")).render(o.jsx(St,{}))})();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function __vite__mapDeps(indexes) {
|
|
2
|
+
if (!__vite__mapDeps.viteFileDeps) {
|
|
3
|
+
__vite__mapDeps.viteFileDeps = ["./assets/xtermModule-BeNbaIVa.js","./xtermModule.DSXBckUd.css"]
|
|
4
|
+
}
|
|
5
|
+
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
6
|
+
}
|
|
7
|
+
import{u as Ft,r as V,b as Ot,_ as At,d as Wt,e as Ut,j as n,R as c,E as zt,s as wt,f as it,m as Vt,g as K,T as F,h as Kt,i as $t,k as ht,W as Ht,M as qt,l as ft,n as Yt,S as Qt,o as Xt,a as Gt,c as Jt}from"./assets/workbench-u2lRPMOT.js";import{T as Zt,W as te}from"./assets/testServerConnection-DeE2kSzz.js";var ee={};class et{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new $("","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==="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 $(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 l,a;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),(a=(l=this._reporter).onTestBegin)==null||a.call(l,s,i)}_onTestEnd(t,e){var l,a,g;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus,s.annotations=t.annotations;const i=s.results.find(r=>r._id===e.id);i.duration=e.duration,i.status=e.status,i.errors=e.errors,i.error=(l=i.errors)==null?void 0:l[0],i.attachments=this._parseAttachments(e.attachments),(g=(a=this._reporter).onTestEnd)==null||g.call(a,s,i),i._stepMap=new Map}_onStepBegin(t,e,s){var m,d;const i=this._tests.get(t),l=i.results.find(p=>p._id===e),a=s.parentStepId?l._stepMap.get(s.parentStepId):void 0,g=this._absoluteLocation(s.location),r=new ie(s,a,g);a?a.steps.push(r):l.steps.push(r),l._stepMap.set(s.id,r),(d=(m=this._reporter).onStepBegin)==null||d.call(m,i,l,r)}_onStepEnd(t,e,s){var g,r;const i=this._tests.get(t),l=i.results.find(m=>m._id===e),a=l._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(r=(g=this._reporter).onStepEnd)==null||r.call(g,i,l,a)}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,l){var m,d,p,j;const a=l?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,g=e?this._tests.get(e):void 0,r=g&&s?g.results.find(h=>h._id===s):void 0;t==="stdout"?(r==null||r.stdout.push(a),(d=(m=this._reporter).onStdOut)==null||d.call(m,a,g,r)):(r==null||r.stderr.push(a),(j=(p=this._reporter).onStdErr)==null||j.call(p,a,g,r))}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={...re,...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:X(t.testIgnore),testMatch:X(t.testMatch),timeout:t.timeout,grep:X(t.grep),grepInvert:X(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}))}_mergeSuiteInto(t,e){let s=e.suites.find(i=>i.title===t.title);s||(s=new $(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 se(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??[],e}_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 ${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 se{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 ne(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new oe(this.results.length,t);return this.results.push(e),e}}class ie{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 oe{constructor(t,e){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._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 re={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[ee.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function X(o){return o.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function ne(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 st{constructor(t,e,s,i,l){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=i&&[...i.values()].some(Boolean);this.pathSeparator=l,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 g=(r,m,d)=>{for(const p of m.suites){const j=p.title||"<anonymous>";let h=d.children.find(f=>f.kind==="group"&&f.title===j);h||(h={kind:"group",subKind:"describe",id:"suite:"+m.titlePath().join("")+""+j,title:j,location:p.location,duration:0,parent:d,children:[],status:"none",hasLoadErrors:!1},this._addChild(d,h)),g(r,p,h)}for(const p of m.tests){const j=p.title;let h=d.children.find(E=>E.kind!=="group"&&E.title===j);h||(h={kind:"case",id:"test:"+p.titlePath().join(""),title:j,parent:d,children:[],tests:[],location:p.location,duration:0,status:"none",project:void 0,test:void 0,tags:p.tags},this._addChild(d,h));const f=p.results[0];let S="none";(f==null?void 0:f[H])==="scheduled"?S="scheduled":(f==null?void 0:f[H])==="running"?S="running":(f==null?void 0:f.status)==="skipped"?S="skipped":(f==null?void 0:f.status)==="interrupted"?S="none":f&&p.outcome()!=="expected"?S="failed":f&&p.outcome()==="expected"&&(S="passed"),h.tests.push(p);const T={kind:"test",id:p.id,title:r.name,location:p.location,test:p,parent:h,children:[],status:S,duration:p.results.length?Math.max(0,p.results[0].duration):0,project:r};this._addChild(h,T),this._treeItemByTestId.set(p.id,T),h.duration=h.children.reduce((E,R)=>E+R.duration,0)}};for(const r of(e==null?void 0:e.suites)||[])if(!(a&&!i.get(r.title)))for(const m of r.suites){const d=this._fileItem(m.location.file.split(l),!0);g(r.project(),m,d)}for(const r of s){if(!r.location)continue;const m=this._fileItem(r.location.file.split(l),!0);m.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(" "),l=[...e.values()].some(Boolean),a=r=>{const m=[...r.tests[0].titlePath(),...r.tests[0].tags].join(" ").toLowerCase();return!i.every(d=>m.includes(d))&&!r.tests.some(d=>s==null?void 0:s.has(d.id))?!1:(r.children=r.children.filter(d=>!l||(s==null?void 0:s.has(d.test.id))||e.get(d.status)),r.tests=r.children.map(d=>d.test),!!r.children.length)},g=r=>{const m=[];for(const d of r.children)d.kind==="case"?a(d)&&m.push(d):(g(d),(d.children.length||d.hasLoadErrors)&&m.push(d));r.children=m};g(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 l=this._fileItem(t.slice(0,t.length-1),!1),a={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:l,children:[],status:"none",hasLoadErrors:!1};return this._addChild(l,a),a}sortAndPropagateStatus(){_t(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?ae(t):new Set}}function _t(o){for(const a of o.children)_t(a);o.kind==="group"&&o.children.sort((a,g)=>a.location.file.localeCompare(g.location.file)||a.location.line-g.location.line);let t=o.children.length>0,e=o.children.length>0,s=!1,i=!1,l=!1;for(const a of o.children)e=e&&a.status==="skipped",t=t&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",i=i||a.status==="running",l=l||a.status==="scheduled";i?o.status="running":l?o.status="scheduled":s?o.status="failed":e?o.status="skipped":t&&(o.status="passed")}function ae(o){const t=new Set,e=s=>{var i;s.kind==="case"?s.tests.map(l=>l.id).forEach(l=>t.add(l)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(o),t}const H=Symbol("statusEx");class le{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new et(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 et({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[H]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[H]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}}}processGlobalReport(t){const e=new et({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 $("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const ce=({source:o})=>{const[t,e]=Ft(),[s,i]=V.useState(Ot()),[l]=V.useState(At(()=>import("./assets/xtermModule-BeNbaIVa.js"),__vite__mapDeps([0,1]),import.meta.url).then(g=>g.default)),a=V.useRef(null);return V.useEffect(()=>(Wt(i),()=>Ut(i)),[]),V.useEffect(()=>{const g=o.write,r=o.clear;return(async()=>{const{Terminal:m,FitAddon:d}=await l,p=e.current;if(!p)return;const j=s==="dark-mode"?de:ue;if(a.current&&a.current.terminal.options.theme===j)return;a.current&&(p.textContent="");const h=new m({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:j}),f=new d;h.loadAddon(f);for(const S of o.pending)h.write(S);o.write=S=>{o.pending.push(S),h.write(S)},o.clear=()=>{o.pending=[],h.clear()},h.open(p),f.fit(),a.current={terminal:h,fitAddon:f}})(),()=>{o.clear=r,o.write=g}},[l,a,e,o,s]),V.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),o.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[t,o]),n.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"},de={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"},he=({filterText:o,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:l,testModel:a,runTests:g})=>{const[r,m]=c.useState(!1),d=c.useRef(null);c.useEffect(()=>{var h;(h=d.current)==null||h.focus()},[]);const p=[...e.entries()].filter(([h,f])=>f).map(([h])=>h).join(" ")||"all",j=[...i.entries()].filter(([h,f])=>f).map(([h])=>h).join(" ")||"all";return n.jsxs("div",{className:"filters",children:[n.jsx(zt,{expanded:r,setExpanded:m,title:n.jsx("input",{ref:d,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:o,onChange:h=>{t(h.target.value)},onKeyDown:h=>{h.key==="Enter"&&g()}})}),n.jsxs("div",{className:"filter-summary",title:"Status: "+p+`
|
|
8
|
+
Projects: `+j,onClick:()=>m(!r),children:[n.jsx("span",{className:"filter-label",children:"Status:"})," ",p,n.jsx("span",{className:"filter-label",children:"Projects:"})," ",j]}),r&&n.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[n.jsx("div",{className:"filter-list",children:[...e.entries()].map(([h,f])=>n.jsx("div",{className:"filter-entry",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:f,onClick:()=>{const S=new Map(e);S.set(h,!S.get(h)),s(S)}}),n.jsx("div",{children:h})]})},h))}),n.jsx("div",{className:"filter-list",children:[...i.entries()].map(([h,f])=>n.jsx("div",{className:"filter-entry",children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:f,onClick:()=>{var E;const S=new Map(i);S.set(h,!S.get(h)),l(S);const T=(E=a==null?void 0:a.config)==null?void 0:E.configFile;T&&wt.setObject(T+":projects",[...S.entries()].filter(([R,A])=>A).map(([R])=>R))}}),n.jsx("div",{children:h||"untitled"})]})},h))})]})]})},fe=({tag:o,style:t,onClick:e})=>n.jsx("span",{className:it("tag",`tag-color-${pe(o)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${o}`,children:o});function pe(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 ge=$t,me=({filterText:o,testModel:t,testServerConnection:e,testTree:s,runTests:i,runningState:l,watchAll:a,watchedTreeIds:g,setWatchedTreeIds:r,isLoading:m,onItemSelected:d,requestedCollapseAllCount:p,setFilterText:j,onRevealSource:h})=>{const[f,S]=c.useState({expandedItems:new Map}),[T,E]=c.useState(),[R,A]=c.useState(p);c.useEffect(()=>{if(R!==p){f.expandedItems.clear();for(const x of s.flatTreeItems())f.expandedItems.set(x.id,!1);A(p),E(void 0),S({...f});return}if(!l||l.itemSelectedByUser)return;let u;const B=x=>{var L;x.children.forEach(B),!u&&x.status==="failed"&&(x.kind==="test"&&l.testIds.has(x.test.id)||x.kind==="case"&&l.testIds.has((L=x.tests[0])==null?void 0:L.id))&&(u=x)};B(s.rootItem),u&&E(u.id)},[l,E,s,R,A,p,f,S]);const{selectedTreeItem:C}=c.useMemo(()=>{if(!t)return{selectedTreeItem:void 0};const u=T?s.treeItemById(T):void 0,B=we(u,t);let x;return(u==null?void 0:u.kind)==="test"?x=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(x=u.tests[0]),d({treeItem:u,testCase:x,testFile:B}),{selectedTreeItem:u}},[d,T,t,s]);c.useEffect(()=>{if(!m)if(a)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const u=new Set;for(const B of g.value){const x=s.treeItemById(B),L=x==null?void 0:x.location.file;L&&u.add(L)}e==null||e.watchNoReply({fileNames:[...u]})}},[m,s,a,g,e]);const D=u=>{E(u.id),i("bounce-if-busy",s.collectTestIds(u))},J=(u,B)=>{if(u.preventDefault(),u.stopPropagation(),u.metaKey||u.ctrlKey){const x=o.split(" ");x.includes(B)?j(x.filter(L=>L!==B).join(" ").trim()):j((o+" "+B).trim())}else j((o.split(" ").filter(x=>!x.startsWith("@")).join(" ")+" "+B).trim())};return n.jsx(ge,{name:"tests",treeState:f,setTreeState:S,rootItem:s.rootItem,dataTestId:"test-tree",render:u=>n.jsxs("div",{className:"hbox ui-mode-list-item",children:[n.jsxs("div",{className:"ui-mode-list-item-title",children:[n.jsx("span",{title:u.title,children:u.title}),u.kind==="case"?u.tags.map(B=>n.jsx(fe,{tag:B.slice(1),onClick:x=>J(x,B)},B)):null]}),!!u.duration&&u.status!=="skipped"&&n.jsx("div",{className:"ui-mode-list-item-time",children:Vt(u.duration)}),n.jsxs(K,{noMinHeight:!0,noShadow:!0,children:[n.jsx(F,{icon:"play",title:"Run",onClick:()=>D(u),disabled:!!l&&!l.completed}),n.jsx(F,{icon:"go-to-file",title:"Show source",onClick:h,style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!a&&n.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{g.value.has(u.id)?g.value.delete(u.id):g.value.add(u.id),r({...g})},toggled:g.value.has(u.id)})]})]}),icon:u=>Kt(u.status),selectedItem:C,onAccepted:D,onSelected:u=>{l&&(l.itemSelectedByUser=!0),E(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:o?5:1,noItemsMessage:m?"Loading…":"No tests"})};function we(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 _e(o){return`.playwright-artifacts-${o}`}const ve=({item:o,rootDir:t,onOpenExternally:e,revealSource:s})=>{var f,S;const[i,l]=c.useState(),[a,g]=c.useState(0),r=c.useRef(null),{outputDir:m}=c.useMemo(()=>({outputDir:o.testCase?Se(o.testCase):void 0}),[o]),[d,p]=c.useState(),j=c.useCallback(T=>p(ht(T)),[p]),h=d?i==null?void 0:i.model.actions.find(T=>ht(T)===d):void 0;return c.useEffect(()=>{var A,C;r.current&&clearTimeout(r.current);const T=(A=o.testCase)==null?void 0:A.results[0];if(!T){l(void 0);return}const E=T&&T.duration>=0&&T.attachments.find(D=>D.name==="trace");if(E&&E.path){pt(E.path).then(D=>l({model:D,isLive:!1}));return}if(!m){l(void 0);return}const R=`${m}/${_e(T.workerIndex)}/traces/${(C=o.testCase)==null?void 0:C.id}.json`;return r.current=setTimeout(async()=>{try{const D=await pt(R);l({model:D,isLive:!0})}catch{l(void 0)}finally{g(a+1)}},500),()=>{r.current&&clearTimeout(r.current)}},[m,o,l,a,g]),n.jsx(Ht,{model:i==null?void 0:i.model,showSourcesFirst:!0,rootDir:t,initialSelection:h,onSelectionChanged:j,fallbackLocation:o.testFile,isLive:i==null?void 0:i.isLive,status:(f=o.treeItem)==null?void 0:f.status,annotations:((S=o.testCase)==null?void 0:S.annotations)||[],onOpenExternally:e,revealSource:s},"workbench")},Se=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 pt(o){const t=new URLSearchParams;t.set("trace",o);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new qt(s)}const G=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";let gt={cols:80,rows:24};const U={pending:[],clear:()=>{},write:o=>U.pending.push(o),resize:()=>{}},M=new URLSearchParams(window.location.search),xe=M.get("ws"),vt=new URL(`../${xe}`,window.location.toString());vt.protocol=window.location.protocol==="https:"?"wss:":"ws:";const b={args:M.getAll("arg"),grep:M.get("grep")||void 0,grepInvert:M.get("grepInvert")||void 0,projects:M.getAll("project"),workers:M.get("workers")||void 0,timeout:M.has("timeout")?+M.get("timeout"):void 0,headed:M.has("headed"),outputDir:M.get("outputDir")||void 0,updateSnapshots:M.get("updateSnapshots")||void 0,reporters:M.has("reporter")?M.getAll("reporter"):void 0};b.updateSnapshots&&!["all","none","missing"].includes(b.updateSnapshots)&&(b.updateSnapshots=void 0);const mt=navigator.platform==="MacIntel",be=({})=>{var dt;const[o,t]=c.useState(""),[e,s]=c.useState(!1),[i,l]=c.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[a,g]=c.useState(new Map),[r,m]=c.useState(),[d,p]=c.useState(),[j,h]=c.useState({}),[f,S]=c.useState(new Set),[T,E]=c.useState(!1),[R,A]=c.useState(),C=R&&!R.completed,[D,J]=ft("watch-all",!1),[u,B]=c.useState({value:new Set}),x=c.useRef(Promise.resolve()),L=c.useRef(new Set),[ot,St]=c.useState(0),[xt,bt]=c.useState(!1),[rt,nt]=c.useState(!0),[v,Tt]=c.useState(),[q,kt]=c.useState(),[Y,jt]=c.useState(!1);c.useState(!1);const[Et,at]=c.useState(!1),yt=c.useCallback(()=>at(!0),[at]),It=!1,[lt,Te]=c.useState(b.workers==="1"),[ct,ke]=c.useState(b.headed),[ut,je]=c.useState(b.updateSnapshots==="all"),[Rt,Bt]=ft("show-route-actions",!0),[Ct,Nt]=Yt(),Dt=c.useRef(null),Q=c.useCallback(()=>{Tt(new Zt(new te(vt)))},[]);c.useEffect(()=>{var _;(_=Dt.current)==null||_.focus(),E(!0),Q()},[Q]),c.useEffect(()=>{if(!v)return;const _=[v.onStdio(w=>{if(w.buffer){const k=atob(w.buffer);U.write(k)}else U.write(w.text)}),v.onClose(()=>bt(!0))];return U.resize=(w,k)=>{gt={cols:w,rows:k},v.resizeTerminalNoReply({cols:w,rows:k})},()=>{for(const w of _)w.dispose()}},[v]),c.useEffect(()=>{if(!v)return;let _;const w=new le({onUpdate:k=>{clearTimeout(_),_=void 0,k?m(w.asModel()):_||(_=setTimeout(()=>{m(w.asModel())},250))},onError:k=>{U.write((k.stack||k.value||"")+`
|
|
9
|
+
`)},pathSeparator:G});return kt(w),m(void 0),E(!0),B({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:k,report:I}=await v.runGlobalSetup({outputDir:b.outputDir});if(w.processGlobalReport(I),k!=="passed")return;const N=await v.listTests({projects:b.projects,locations:b.args,grep:b.grep,grepInvert:b.grepInvert,outputDir:b.outputDir});w.processListReport(N.report),v.onReport(P=>{w.processTestReportEvent(P)});const{hasBrowsers:O}=await v.checkBrowsers({});nt(O)}finally{E(!1)}})(),()=>{clearTimeout(_)}},[v]),c.useEffect(()=>{if(!r)return;const{config:_,rootSuite:w}=r,k=_.configFile?wt.getObject(_.configFile+":projects",void 0):void 0,I=new Map(a);for(const N of I.keys())w.suites.find(O=>O.title===N)||I.delete(N);for(const N of w.suites)I.has(N.title)||I.set(N.title,!!(k!=null&&k.includes(N.title)));!k&&I.size&&![...I.values()].includes(!0)&&I.set(I.entries().next().value[0],!0),(a.size!==I.size||[...a].some(([N,O])=>I.get(N)!==O))&&g(I)},[a,r]),c.useEffect(()=>{C&&(r!=null&&r.progress)?p(r.progress):r||p(void 0)},[r,C]);const{testTree:Pt}=c.useMemo(()=>{if(!r)return{testTree:new st("",new $("","root"),[],a,G)};const _=new st("",r.rootSuite,r.loadErrors,a,G);return _.filterTree(o,i,C?R==null?void 0:R.testIds:void 0),_.sortAndPropagateStatus(),_.shortenRoot(),_.flattenForSingleProject(),S(_.testIds()),{testTree:_}},[o,r,i,a,S,R,C]),z=c.useCallback((_,w)=>{!v||!r||_==="bounce-if-busy"&&C||(L.current=new Set([...L.current,...w]),x.current=x.current.then(async()=>{var N,O,P;const k=L.current;if(L.current=new Set,!k.size)return;{for(const y of((N=r.rootSuite)==null?void 0:N.allTests())||[])if(k.has(y.id)){y.results=[];const W=y._createTestResult("pending");W[H]="scheduled"}m({...r})}const I=" ["+new Date().toLocaleTimeString()+"]";U.write("\x1B[2m—".repeat(Math.max(0,gt.cols-I.length))+I+"\x1B[22m"),p({total:0,passed:0,failed:0,skipped:0}),A({testIds:k}),await v.runTests({locations:b.args,grep:b.grep,grepInvert:b.grepInvert,testIds:[...k],projects:[...a].filter(([y,W])=>W).map(([y])=>y),workers:lt?"1":b.workers==="1"?void 0:b.workers,timeout:b.timeout,headed:ct,outputDir:b.outputDir,updateSnapshots:ut?"all":b.updateSnapshots,reporters:b.reporters,trace:"on"});for(const y of((O=r.rootSuite)==null?void 0:O.allTests())||[])((P=y.results[0])==null?void 0:P.duration)===-1&&(y.results=[]);m({...r}),A(y=>y?{...y,completed:!0}:void 0)}))},[a,C,r,v,lt,ct,ut]);c.useEffect(()=>{if(!v||!q)return;const _=v.onTestFilesChanged(async w=>{if(x.current=x.current.then(async()=>{E(!0);try{const P=await v.listTests({projects:b.projects,locations:b.args,grep:b.grep,grepInvert:b.grepInvert,outputDir:b.outputDir});q.processListReport(P.report)}catch(P){console.log(P)}finally{E(!1)}}),await x.current,w.testFiles.length===0)return;const k=q.asModel(),I=new st("",k.rootSuite,k.loadErrors,a,G),N=[],O=new Set(w.testFiles);if(D){const P=y=>{const W=y.location.file;W&&O.has(W)&&N.push(...I.collectTestIds(y)),y.kind==="group"&&y.subKind==="folder"&&y.children.forEach(P)};P(I.rootItem)}else for(const P of u.value){const y=I.treeItemById(P),W=y==null?void 0:y.location.file;W&&O.has(W)&&N.push(...I.collectTestIds(y))}z("queue-if-busy",new Set(N))});return()=>_.dispose()},[z,v,D,u,q,a]),c.useEffect(()=>{if(!v)return;const _=w=>{w.code==="Backquote"&&w.ctrlKey?(w.preventDefault(),s(!e)):w.code==="F5"&&w.shiftKey?(w.preventDefault(),v==null||v.stopTestsNoReply({})):w.code==="F5"&&(w.preventDefault(),z("bounce-if-busy",f))};return addEventListener("keydown",_),()=>{removeEventListener("keydown",_)}},[z,Q,v,f,e]);const Z=c.useRef(null),Mt=c.useCallback(_=>{var w;_.preventDefault(),_.stopPropagation(),(w=Z.current)==null||w.showModal()},[]),tt=c.useCallback(_=>{var w;_.preventDefault(),_.stopPropagation(),(w=Z.current)==null||w.close()},[]),Lt=c.useCallback(_=>{tt(_),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:w}=await(v==null?void 0:v.checkBrowsers({}));nt(w)})},[tt,v]);return n.jsxs("div",{className:"vbox ui-mode",children:[!rt&&n.jsxs("dialog",{ref:Z,children:[n.jsxs("div",{className:"title",children:[n.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),n.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",n.jsx("br",{}),"Would you like to run `playwright install`?",n.jsx("br",{}),n.jsx("button",{className:"button",onClick:Lt,children:"Install"}),n.jsx("button",{className:"button secondary",onClick:tt,children:"Dismiss"})]})]}),xt&&n.jsxs("div",{className:"disconnected",children:[n.jsx("div",{className:"title",children:"UI Mode disconnected"}),n.jsxs("div",{children:[n.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),n.jsx(Qt,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:n.jsxs("div",{className:"vbox",children:[n.jsxs("div",{className:it("vbox",!e&&"hidden"),children:[n.jsxs(K,{children:[n.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),n.jsx(F,{icon:"circle-slash",title:"Clear output",onClick:()=>U.clear()}),n.jsx("div",{className:"spacer"}),n.jsx(F,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),n.jsx(ce,{source:U})]}),n.jsx("div",{className:it("vbox",e&&"hidden"),children:n.jsx(ve,{item:j,rootDir:(dt=r==null?void 0:r.config)==null?void 0:dt.rootDir,revealSource:Et,onOpenExternally:_=>v==null?void 0:v.openNoReply({location:{file:_.file,line:_.line,column:_.column}})})})]}),sidebar:n.jsxs("div",{className:"vbox ui-mode-sidebar",children:[n.jsxs(K,{noShadow:!0,noMinHeight:!0,children:[n.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),n.jsx("div",{className:"section-title",children:"Playwright"}),n.jsx(F,{icon:"refresh",title:"Reload",onClick:()=>Q(),disabled:C||T}),n.jsx(F,{icon:"terminal",title:"Toggle output — "+(mt?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),!rt&&n.jsx(F,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Mt})]}),n.jsx(he,{filterText:o,setFilterText:t,statusFilters:i,setStatusFilters:l,projectFilters:a,setProjectFilters:g,testModel:r,runTests:()=>z("bounce-if-busy",f)}),n.jsxs(K,{noMinHeight:!0,children:[!C&&!d&&n.jsx("div",{className:"section-title",children:"Tests"}),!C&&d&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:[d.passed,"/",d.total," passed (",d.passed/d.total*100|0,"%)"]})}),C&&d&&n.jsx("div",{"data-testid":"status-line",className:"status-line",children:n.jsxs("div",{children:["Running ",d.passed,"/",R.testIds.size," passed (",d.passed/R.testIds.size*100|0,"%)"]})}),n.jsx(F,{icon:"play",title:"Run all — F5",onClick:()=>z("bounce-if-busy",f),disabled:C||T}),n.jsx(F,{icon:"debug-stop",title:"Stop — "+(mt?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!C||T}),n.jsx(F,{icon:"eye",title:"Watch all",toggled:D,onClick:()=>{B({value:new Set}),J(!D)}}),n.jsx(F,{icon:"collapse-all",title:"Collapse all",onClick:()=>{St(ot+1)}})]}),n.jsx(me,{filterText:o,testModel:r,testTree:Pt,testServerConnection:v,runningState:R,runTests:z,onItemSelected:h,watchAll:D,watchedTreeIds:u,setWatchedTreeIds:B,isLoading:T,requestedCollapseAllCount:ot,setFilterText:t,onRevealSource:yt}),It,n.jsxs(K,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>jt(!Y),children:[n.jsx("span",{className:`codicon codicon-${Y?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:Y?"Hide Settings":"Show Settings"}),n.jsx("div",{className:"section-title",children:"Settings"})]}),Y&&n.jsx(Xt,{settings:[{value:Ct,set:Nt,title:"Dark mode"},{value:Rt,set:Bt,title:"Show route actions"}]})]})})]})};(async()=>{if(Gt(),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.
|
|
10
|
+
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)}Jt(document.querySelector("#root")).render(n.jsx(be,{}))})();
|