@checkly/playwright-core 1.41.25 → 1.41.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import{M as b,r as a,c as U,j as e,T as D,t as R,W as M,a as C,b as F}from"./assets/wsPort-sh0wpjYp.js";const O=()=>{const[l,k]=a.useState(!1),[c,d]=a.useState([]),[u,E]=a.useState([]),[p,j]=a.useState(N),[v,m]=a.useState({done:0,total:0}),[T,h]=a.useState(!1),[y,f]=a.useState(null),[w,L]=a.useState(null),g=a.useCallback(r=>{const o=[],t=[],s=new URL(window.location.href);for(let i=0;i<r.length;i++){const n=r.item(i);if(!n)continue;const S=URL.createObjectURL(n);o.push(S),t.push(n.name),s.searchParams.append("trace",S),s.searchParams.append("traceFileName",n.name)}const x=s.toString();window.history.pushState({},"",x),d(o),E(t),h(!1),f(null)},[]),P=a.useCallback(r=>{r.preventDefault(),g(r.dataTransfer.files)},[g]),W=a.useCallback(r=>{r.preventDefault(),r.target.files&&g(r.target.files)},[g]);return a.useEffect(()=>{const r=new URL(window.location.href).searchParams,o=r.getAll("trace");k(r.has("isServer"));for(const t of o)if(t.startsWith("file:")){L(t||null);return}r.has("isServer")?U({onEvent(t,s){t==="loadTrace"&&(d(s.url?[s.url]:[]),h(!1),f(null))},onClose(){}}).then(t=>{t("ready")}):o.some(t=>t.startsWith("blob:"))||d(o)},[]),a.useEffect(()=>{(async()=>{if(c.length){const r=s=>{s.data.method==="progress"&&m(s.data.params)};navigator.serviceWorker.addEventListener("message",r),m({done:0,total:1});const o=[];for(let s=0;s<c.length;s++){const x=c[s],i=new URLSearchParams;i.set("trace",x),u.length&&i.set("traceFileName",u[s]);const n=await fetch(`contexts?${i.toString()}`);if(!n.ok){l||d([]),f((await n.json()).error);return}o.push(...await n.json())}navigator.serviceWorker.removeEventListener("message",r);const t=new b(o);m({done:0,total:0}),j(t)}else j(N)})()},[l,c,u]),e.jsxs("div",{className:"vbox workbench-loader",onDragOver:r=>{r.preventDefault(),h(!0)},children:[e.jsxs("div",{className:"hbox header",children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),p.title&&e.jsx("div",{className:"title",children:p.title}),e.jsx("div",{className:"spacer"}),e.jsx(D,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>R()})]}),e.jsx("div",{className:"progress",children:e.jsx("div",{className:"inner-progress",style:{width:v.total?100*v.done/v.total+"%":0}})}),e.jsx(M,{model:p}),w&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),e.jsxs("div",{style:{paddingTop:20},children:[e.jsxs("div",{children:["1. Click ",e.jsx("a",{href:w,children:"here"})," to put your trace into the download shelf"]}),e.jsxs("div",{children:["2. Go to ",e.jsx("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),e.jsx("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),!l&&!T&&!w&&(!c.length||y)&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",children:y}),e.jsx("div",{className:"title",children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const r=document.createElement("input");r.type="file",r.multiple=!0,r.click(),r.addEventListener("change",o=>W(o))},children:"Select file(s)"}),e.jsx("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),l&&!c.length&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),T&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{h(!1)},onDrop:r=>P(r),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},N=new b([]);(async()=>{if(C(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(l=>setTimeout(l,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
+ Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(l=>{navigator.serviceWorker.oncontrollerchange=()=>l()}),setInterval(function(){fetch("ping")},1e4)}F.render(e.jsx(O,{}),document.querySelector("#root"))})();
@@ -0,0 +1,10 @@
1
+ import{u as Ce,r as V,d as ye,_ as Be,e as Me,f as Ne,j as l,R as f,g as Re,c as Pe,s as we,S as De,h as G,T as y,t as Le,m as Fe,i as Ie,k as de,W as We,M as Oe,l as Ae,a as ze,b as Ve}from"./assets/wsPort-sh0wpjYp.js";class he{constructor(){this._stringCache=new Map}internString(e){let t=this._stringCache.get(e);return t||(this._stringCache.set(e,e),t=e),t}}var Ke={};class fe{constructor(e,t,s,i){this._tests=new Map,this._listOnly=!1,this._clearPreviousResultsWhenTestBegins=!1,this._stringPool=new he,this._rootSuite=new W("","root"),this._pathSeparator=e,this._reporter=t,this._reuseTestCases=s,this._reportConfig=i}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()}_setClearPreviousResultsWhenTestBegins(){this._clearPreviousResultsWhenTestBegins=!0}_onConfigure(e){var t,s;this._rootDir=e.rootDir,this._listOnly=e.listOnly,this._config=this._parseConfig(e),(s=(t=this._reporter).onConfigure)==null||s.call(t,this._config)}_onProject(e){let t=this._rootSuite.suites.find(i=>i.project().__projectId===e.id);t||(t=new W(e.name,"project"),this._rootSuite.suites.push(t),t.parent=this._rootSuite);const s=this._parseProject(e);if(t.project=()=>s,this._mergeSuitesInto(e.suites,t),this._listOnly){const i=new Set,r=u=>{u.tests.map(c=>c.testId).forEach(c=>i.add(c)),u.suites.forEach(r)};e.suites.forEach(r);const o=u=>{u.tests=u.tests.filter(c=>i.has(c.id)),u.suites.forEach(o)};o(t)}}_onBegin(){var e,t;(t=(e=this._reporter).onBegin)==null||t.call(e,this._rootSuite)}_onTestBegin(e,t){var r,o;const s=this._tests.get(e);this._clearPreviousResultsWhenTestBegins&&s._clearResults();const i=s._createTestResult(t.id);i.retry=t.retry,i.workerIndex=t.workerIndex,i.parallelIndex=t.parallelIndex,i.setStartTimeNumber(t.startTime),i.statusEx="running",(o=(r=this._reporter).onTestBegin)==null||o.call(r,s,i)}_onTestEnd(e,t){var r,o,u;const s=this._tests.get(e.testId);s.timeout=e.timeout,s.expectedStatus=e.expectedStatus,s.annotations=e.annotations;const i=s.resultsMap.get(t.id);i.duration=t.duration,i.status=t.status,i.statusEx=t.status,i.errors=t.errors,i.error=(r=i.errors)==null?void 0:r[0],i.attachments=this._parseAttachments(t.attachments),(u=(o=this._reporter).onTestEnd)==null||u.call(o,s,i),i.stepMap=new Map}_onStepBegin(e,t,s){var p,h;const i=this._tests.get(e),r=i.resultsMap.get(t),o=s.parentStepId?r.stepMap.get(s.parentStepId):void 0,u=this._absoluteLocation(s.location),c=new He(s,o,u);o?o.steps.push(c):r.steps.push(c),r.stepMap.set(s.id,c),(h=(p=this._reporter).onStepBegin)==null||h.call(p,i,r,c)}_onStepEnd(e,t,s){var u,c;const i=this._tests.get(e),r=i.resultsMap.get(t),o=r.stepMap.get(s.id);o.duration=s.duration,o.error=s.error,(c=(u=this._reporter).onStepEnd)==null||c.call(u,i,r,o)}_onError(e){var t,s;(s=(t=this._reporter).onError)==null||s.call(t,e)}_onStdIO(e,t,s,i,r){var p,h,v,g;const o=r?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,u=t?this._tests.get(t):void 0,c=u&&s?u.resultsMap.get(s):void 0;e==="stdout"?(c==null||c.stdout.push(o),(h=(p=this._reporter).onStdOut)==null||h.call(p,o,u,c)):(c==null||c.stderr.push(o),(g=(v=this._reporter).onStdErr)==null||g.call(v,o,u,c))}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 this._stringPool=new he,(t=(e=this._reporter).onExit)==null?void 0:t.call(e)}_parseConfig(e){const t={...xe,...e};return this._reportConfig&&(t.configFile=this._reportConfig.configFile,t.reportSlowTests=this._reportConfig.reportSlowTests,t.quiet=this._reportConfig.quiet,t.reporter=[...this._reportConfig.reporter]),t}_parseProject(e){return{__projectId:e.id,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}))}_mergeSuitesInto(e,t){for(const s of e){let i=t.suites.find(r=>r.title===s.title);i||(i=new W(s.title,s.type),i.parent=t,t.suites.push(i)),i.location=this._absoluteLocation(s.location),i._fileId=s.fileId,i._parallelMode=s.parallelMode,this._mergeSuitesInto(s.suites,i),this._mergeTestsInto(s.tests,i)}}_mergeTestsInto(e,t){for(const s of e){let i=this._reuseTestCases?t.tests.find(r=>r.title===s.title):void 0;i||(i=new Ue(s.testId,s.title,this._absoluteLocation(s.location)),i.parent=t,t.tests.push(i),this._tests.set(i.id,i)),this._updateTest(s,i)}}_updateTest(e,t){return t.id=e.testId,t.location=this._absoluteLocation(e.location),t.retries=e.retries,t}_absoluteLocation(e){return e&&{...e,file:this._absolutePath(e.file)}}_absolutePath(e){return e&&this._stringPool.internString(this._rootDir+this._pathSeparator+e)}}class W{constructor(e,t){this._requireFile="",this.suites=[],this.tests=[],this._parallelMode="none",this.title=e,this._type=t}allTests(){const e=[],t=s=>{for(const i of[...s.suites,...s.tests])i instanceof W?t(i):e.push(i)};return t(this),e}titlePath(){const e=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&e.push(this.title),e}project(){}}class Ue{constructor(e,t,s){this.fn=()=>{},this.results=[],this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.repeatEachIndex=0,this.resultsMap=new Map,this.id=e,this.title=t,this.location=s}titlePath(){const e=this.parent?this.parent.titlePath():[];return e.push(this.title),e}outcome(){var s,i;const e=[...this.results];for(;((s=e[0])==null?void 0:s.status)==="skipped"||((i=e[0])==null?void 0:i.status)==="interrupted";)e.shift();if(!e.length)return"skipped";const t=e.filter(r=>r.status!=="skipped"&&r.status!=="interrupted"&&r.status!==this.expectedStatus);return t.length?t.length===e.length?"unexpected":"flaky":"expected"}ok(){const e=this.outcome();return e==="expected"||e==="flaky"||e==="skipped"}_clearResults(){this.results=[],this.resultsMap.clear()}_createTestResult(e){const t=new $e(this.results.length);return this.results.push(t),this.resultsMap.set(e,t),t}}class He{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 $e{constructor(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.statusEx="scheduled",this._startTime=0,this.retry=e}setStartTimeNumber(e){this._startTime=e}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}const xe={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[Ke.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function Z(n){return n.map(e=>e.s?e.s:new RegExp(e.r.source,e.r.flags))}const qe=({source:n})=>{const[e,t]=Ce(),[s,i]=V.useState(ye()),[r]=V.useState(Be(()=>import("./assets/xtermModule-Yt6xwiJ_.js"),__vite__mapDeps([0,1]),import.meta.url).then(u=>u.default)),o=V.useRef(null);return V.useEffect(()=>(Me(i),()=>Ne(i)),[]),V.useEffect(()=>{const u=n.write,c=n.clear;return(async()=>{const{Terminal:p,FitAddon:h}=await r,v=t.current;if(!v)return;const g=s==="dark-mode"?Xe:Ye;if(o.current&&o.current.terminal.options.theme===g)return;o.current&&(v.textContent="");const a=new p({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:g}),m=new h;a.loadAddon(m);for(const x of n.pending)a.write(x);n.write=x=>{n.pending.push(x),a.write(x)},n.clear=()=>{n.pending=[],a.clear()},a.open(v),m.fit(),o.current={terminal:a,fitAddon:m}})(),()=>{n.clear=c,n.write=u}},[r,o,t,n,s]),V.useEffect(()=>{setTimeout(()=>{o.current&&(o.current.fitAddon.fit(),n.resize(o.current.terminal.cols,o.current.terminal.rows))},250)},[e,n]),l.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:t})},Ye={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"},Xe={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"},Je=({title:n,children:e,setExpanded:t,expanded:s,expandOnTitleClick:i})=>l.jsxs("div",{className:"expandable"+(s?" expanded":""),children:[l.jsxs("div",{className:"expandable-title",onClick:()=>i&&t(!s),children:[l.jsx("div",{className:"codicon codicon-"+(s?"chevron-down":"chevron-right"),style:{cursor:"pointer",color:"var(--vscode-foreground)",marginLeft:"5px"},onClick:()=>!i&&t(!s)}),n]}),s&&l.jsx("div",{style:{marginLeft:25},children:e})]});function Qe(n){return`.playwright-artifacts-${n}`}let le=()=>{},ve=n=>{},_e={cols:80,rows:24},I=async()=>{};const O={pending:[],clear:()=>{},write:n=>O.pending.push(n),resize:(n,e)=>{_e={cols:n,rows:e},q("resizeTerminal",{cols:n,rows:e})}},Ze=({})=>{var ue;const[n,e]=f.useState(""),[t,s]=f.useState(!1),[i,r]=f.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[o,u]=f.useState(new Map),[c,p]=f.useState({config:void 0,rootSuite:void 0,loadErrors:[]}),[h,v]=f.useState(),[g,a]=f.useState({}),[m,x]=f.useState(new Set),[T,B]=f.useState(!1),[_,R]=f.useState(),[M,X]=Re("watch-all",!1),[te,A]=f.useState({value:new Set}),d=f.useRef(Promise.resolve()),S=f.useRef(new Set),[w,b]=f.useState(0),[k,E]=f.useState(!1),[J,ce]=f.useState(!0),Te=f.useRef(null),se=f.useCallback(()=>{B(!0),A({value:new Set}),le(xe,new W("","root"),[],void 0),be(!0).then(async()=>{B(!1);const{hasBrowsers:j}=await I("checkBrowsers");ce(j)})},[]);f.useEffect(()=>{var j;(j=Te.current)==null||j.focus(),B(!0),Pe({onEvent:it,onClose:()=>E(!0)}).then(C=>{I=async(P,D)=>{const N=window.__logForTest;N==null||N({method:P,params:D}),await C(P,D)},se()})},[se]),le=f.useCallback((j,C,P,D)=>{const N=j.configFile?we.getObject(j.configFile+":projects",void 0):void 0;for(const L of o.keys())C.suites.find(Q=>Q.title===L)||o.delete(L);for(const L of C.suites)o.has(L.title)||o.set(L.title,!!(N!=null&&N.includes(L.title)));!N&&o.size&&![...o.values()].includes(!0)&&o.set(o.entries().next().value[0],!0),p({config:j,rootSuite:C,loadErrors:P}),u(new Map(o)),_&&D?v(D):D||v(void 0)},[o,_]);const ie=f.useCallback((j,C)=>{j==="bounce-if-busy"&&_||(S.current=new Set([...S.current,...C]),d.current=d.current.then(async()=>{var N,L,Q;const P=S.current;if(S.current=new Set,!P.size)return;{for(const F of((N=c.rootSuite)==null?void 0:N.allTests())||[])P.has(F.id)&&(F._clearResults(),F._createTestResult("pending"));p({...c})}const D=" ["+new Date().toLocaleTimeString()+"]";O.write("\x1B[2m—".repeat(Math.max(0,_e.cols-D.length))+D+"\x1B[22m"),v({total:0,passed:0,failed:0,skipped:0}),R({testIds:P}),await I("run",{testIds:[...P],projects:[...o].filter(([F,Ee])=>Ee).map(([F])=>F)});for(const F of((L=c.rootSuite)==null?void 0:L.allTests())||[])((Q=F.results[0])==null?void 0:Q.duration)===-1&&F._clearResults();p({...c}),R(void 0)}))},[o,_,c]),z=!!_,ne=f.useRef(null),ke=f.useCallback(j=>{var C;j.preventDefault(),j.stopPropagation(),(C=ne.current)==null||C.showModal()},[]),oe=f.useCallback(j=>{var C;j.preventDefault(),j.stopPropagation(),(C=ne.current)==null||C.close()},[]),je=f.useCallback(j=>{oe(j),s(!0),I("installBrowsers").then(async()=>{s(!1);const{hasBrowsers:C}=await I("checkBrowsers");ce(C)})},[oe]);return l.jsxs("div",{className:"vbox ui-mode",children:[!J&&l.jsxs("dialog",{ref:ne,children:[l.jsxs("div",{className:"title",children:[l.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),l.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",l.jsx("br",{}),"Would you like to run `playwright install`?",l.jsx("br",{}),l.jsx("button",{className:"button",onClick:je,children:"Install"}),l.jsx("button",{className:"button secondary",onClick:oe,children:"Dismiss"})]})]}),k&&l.jsxs("div",{className:"disconnected",children:[l.jsx("div",{className:"title",children:"UI Mode disconnected"}),l.jsxs("div",{children:[l.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),l.jsxs(De,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",children:[l.jsxs("div",{className:"vbox",children:[l.jsxs("div",{className:"vbox"+(t?"":" hidden"),children:[l.jsxs(G,{children:[l.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),l.jsx(y,{icon:"circle-slash",title:"Clear output",onClick:()=>O.clear()}),l.jsx("div",{className:"spacer"}),l.jsx(y,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),l.jsx(qe,{source:O})]}),l.jsx("div",{className:"vbox"+(t?" hidden":""),children:l.jsx(st,{item:g,rootDir:(ue=c.config)==null?void 0:ue.rootDir})})]}),l.jsxs("div",{className:"vbox ui-mode-sidebar",children:[l.jsxs(G,{noShadow:!0,noMinHeight:!0,children:[l.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),l.jsx("div",{className:"section-title",children:"Playwright"}),l.jsx(y,{icon:"color-mode",title:"Toggle color mode",onClick:()=>Le()}),l.jsx(y,{icon:"refresh",title:"Reload",onClick:()=>se(),disabled:z||T}),l.jsx(y,{icon:"terminal",title:"Toggle output",toggled:t,onClick:()=>{s(!t)}}),!J&&l.jsx(y,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:ke})]}),l.jsx(Ge,{filterText:n,setFilterText:e,statusFilters:i,setStatusFilters:r,projectFilters:o,setProjectFilters:u,testModel:c,runTests:()=>ie("bounce-if-busy",m)}),l.jsxs(G,{noMinHeight:!0,children:[!z&&!h&&l.jsx("div",{className:"section-title",children:"Tests"}),!z&&h&&l.jsx("div",{"data-testid":"status-line",className:"status-line",children:l.jsxs("div",{children:[h.passed,"/",h.total," passed (",h.passed/h.total*100|0,"%)"]})}),z&&h&&l.jsx("div",{"data-testid":"status-line",className:"status-line",children:l.jsxs("div",{children:["Running ",h.passed,"/",_.testIds.size," passed (",h.passed/_.testIds.size*100|0,"%)"]})}),l.jsx(y,{icon:"play",title:"Run all",onClick:()=>ie("bounce-if-busy",m),disabled:z||T}),l.jsx(y,{icon:"debug-stop",title:"Stop",onClick:()=>q("stop"),disabled:!z||T}),l.jsx(y,{icon:"eye",title:"Watch all",toggled:M,onClick:()=>{A({value:new Set}),X(!M)}}),l.jsx(y,{icon:"collapse-all",title:"Collapse all",onClick:()=>{b(w+1)}})]}),l.jsx(tt,{statusFilters:i,projectFilters:o,filterText:n,testModel:c,runningState:_,runTests:ie,onItemSelected:a,setVisibleTestIds:x,watchAll:M,watchedTreeIds:te,setWatchedTreeIds:A,isLoading:T,requestedCollapseAllCount:w})]})]})]})},Ge=({filterText:n,setFilterText:e,statusFilters:t,setStatusFilters:s,projectFilters:i,setProjectFilters:r,testModel:o,runTests:u})=>{const[c,p]=f.useState(!1),h=f.useRef(null);f.useEffect(()=>{var a;(a=h.current)==null||a.focus()},[]);const v=[...t.entries()].filter(([a,m])=>m).map(([a])=>a).join(" ")||"all",g=[...i.entries()].filter(([a,m])=>m).map(([a])=>a).join(" ")||"all";return l.jsxs("div",{className:"filters",children:[l.jsx(Je,{expanded:c,setExpanded:p,title:l.jsx("input",{ref:h,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:n,onChange:a=>{e(a.target.value)},onKeyDown:a=>{a.key==="Enter"&&u()}})}),l.jsxs("div",{className:"filter-summary",title:"Status: "+v+`
2
+ Projects: `+g,onClick:()=>p(!c),children:[l.jsx("span",{className:"filter-label",children:"Status:"})," ",v,l.jsx("span",{className:"filter-label",children:"Projects:"})," ",g]}),c&&l.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[l.jsx("div",{className:"filter-list",children:[...t.entries()].map(([a,m])=>l.jsx("div",{className:"filter-entry",children:l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:m,onClick:()=>{const x=new Map(t);x.set(a,!x.get(a)),s(x)}}),l.jsx("div",{children:a})]})}))}),l.jsx("div",{className:"filter-list",children:[...i.entries()].map(([a,m])=>l.jsx("div",{className:"filter-entry",children:l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:m,onClick:()=>{var B;const x=new Map(i);x.set(a,!x.get(a)),r(x);const T=(B=o==null?void 0:o.config)==null?void 0:B.configFile;T&&we.setObject(T+":projects",[...x.entries()].filter(([_,R])=>R).map(([_])=>_))}}),l.jsx("div",{children:a||"untitled"})]})}))})]})]})},et=Ae,tt=({statusFilters:n,projectFilters:e,filterText:t,testModel:s,runTests:i,runningState:r,watchAll:o,watchedTreeIds:u,setWatchedTreeIds:c,isLoading:p,onItemSelected:h,setVisibleTestIds:v,requestedCollapseAllCount:g})=>{const[a,m]=f.useState({expandedItems:new Map}),[x,T]=f.useState(),[B,_]=f.useState(g),{rootItem:R,treeItemMap:M,fileNames:X}=f.useMemo(()=>{let d=rt(s.rootSuite,s.loadErrors,e);lt(d,t,n,r==null?void 0:r.testIds),Se(d),d=at(d),ct(d);const S=new Map,w=new Set,b=new Set,k=E=>{E.kind==="group"&&E.location.file&&b.add(E.location.file),E.kind==="case"&&E.tests.forEach(J=>w.add(J.id)),E.children.forEach(k),S.set(E.id,E)};return k(d),v(w),{rootItem:d,treeItemMap:S,fileNames:b}},[t,s,n,e,v,r]);f.useEffect(()=>{if(B!==g){a.expandedItems.clear();for(const w of M.keys())a.expandedItems.set(w,!1);_(g),T(void 0),m({...a});return}if(!r||r.itemSelectedByUser)return;let d;const S=w=>{var b;w.children.forEach(S),!d&&w.status==="failed"&&(w.kind==="test"&&r.testIds.has(w.test.id)||w.kind==="case"&&r.testIds.has((b=w.tests[0])==null?void 0:b.id))&&(d=w)};S(R),d&&T(d.id)},[r,T,R,B,_,g,a,m,M]);const{selectedTreeItem:te}=f.useMemo(()=>{const d=x?M.get(x):void 0;let S;d&&(S={file:d.location.file,line:d.location.line,source:{errors:s.loadErrors.filter(b=>{var k;return((k=b.location)==null?void 0:k.file)===d.location.file}).map(b=>({line:b.location.line,message:b.message})),content:void 0}});let w;return(d==null?void 0:d.kind)==="test"?w=d.test:(d==null?void 0:d.kind)==="case"&&d.tests.length===1&&(w=d.tests[0]),h({treeItem:d,testCase:w,testFile:S}),{selectedTreeItem:d}},[h,x,s,M]);f.useEffect(()=>{if(!p)if(o)q("watch",{fileNames:[...X]});else{const d=new Set;for(const S of u.value){const w=M.get(S),b=w==null?void 0:w.location.file;b&&d.add(b)}q("watch",{fileNames:[...d]})}},[p,R,X,o,u,M]);const A=d=>{T(d.id),i("bounce-if-busy",re(d))};return ve=d=>{const S=[],w=new Set(d);if(o){const b=k=>{const E=k.location.file;E&&w.has(E)&&S.push(...re(k)),k.kind==="group"&&k.subKind==="folder"&&k.children.forEach(b)};b(R)}else for(const b of u.value){const k=M.get(b),E=k==null?void 0:k.location.file;E&&w.has(E)&&S.push(...re(k))}i("queue-if-busy",new Set(S))},l.jsx(et,{name:"tests",treeState:a,setTreeState:m,rootItem:R,dataTestId:"test-tree",render:d=>l.jsxs("div",{className:"hbox ui-mode-list-item",children:[l.jsx("div",{className:"ui-mode-list-item-title",title:d.title,children:d.title}),!!d.duration&&d.status!=="skipped"&&l.jsx("div",{className:"ui-mode-list-item-time",children:Fe(d.duration)}),l.jsxs(G,{noMinHeight:!0,noShadow:!0,children:[l.jsx(y,{icon:"play",title:"Run",onClick:()=>A(d),disabled:!!r}),l.jsx(y,{icon:"go-to-file",title:"Open in VS Code",onClick:()=>q("open",{location:ot(d)}),style:d.kind==="group"&&d.subKind==="folder"?{visibility:"hidden"}:{}}),!o&&l.jsx(y,{icon:"eye",title:"Watch",onClick:()=>{u.value.has(d.id)?u.value.delete(d.id):u.value.add(d.id),c({...u})},toggled:u.value.has(d.id)})]})]}),icon:d=>Ie(d.status),selectedItem:te,onAccepted:A,onSelected:d=>{r&&(r.itemSelectedByUser=!0),T(d.id)},isError:d=>d.kind==="group"?d.hasLoadErrors:!1,autoExpandDepth:t?5:1,noItemsMessage:p?"Loading…":"No tests"})},st=({item:n,rootDir:e})=>{var g;const[t,s]=f.useState(),[i,r]=f.useState(0),o=f.useRef(null),{outputDir:u}=f.useMemo(()=>({outputDir:n.testCase?nt(n.testCase):void 0}),[n]),[c,p]=f.useState(),h=f.useCallback(a=>p(de(a)),[p]),v=c?t==null?void 0:t.model.actions.find(a=>de(a)===c):void 0;return f.useEffect(()=>{var T,B;o.current&&clearTimeout(o.current);const a=(T=n.testCase)==null?void 0:T.results[0];if(!a){s(void 0);return}const m=a&&a.duration>=0&&a.attachments.find(_=>_.name==="trace");if(m&&m.path){me(m.path).then(_=>s({model:_,isLive:!1}));return}if(!u){s(void 0);return}const x=`${u}/${Qe(a.workerIndex)}/traces/${(B=n.testCase)==null?void 0:B.id}.json`;return o.current=setTimeout(async()=>{try{const _=await me(x);s({model:_,isLive:!0})}catch{s(void 0)}finally{r(i+1)}},500),()=>{o.current&&clearTimeout(o.current)}},[u,n,s,i,r]),l.jsx(We,{model:t==null?void 0:t.model,hideStackFrames:!0,showSourcesFirst:!0,rootDir:e,initialSelection:v,onSelectionChanged:h,fallbackLocation:n.testFile,isLive:t==null?void 0:t.isLive,status:(g=n.treeItem)==null?void 0:g.status},"workbench")};let H,$,pe,ee,U;const ge=()=>{clearTimeout(ee),ee=void 0,le(U.config,U.rootSuite,U.loadErrors,U.progress)},K=(n,e,t,s,i=!1)=>{U={config:n,rootSuite:e,loadErrors:t,progress:s},i?ge():ee||(ee=setTimeout(ge,250))},be=n=>{if(!n)return I("list",{});let e;const t=[],s={total:0,passed:0,failed:0,skipped:0};let i;return H=new fe(Y,{version:()=>"v2",onConfigure:r=>{i=r,$=new fe(Y,{onBegin:o=>{pe=o.allTests().length,$=void 0}},!1)},onBegin:r=>{e||(e=r),s.total=pe,s.passed=0,s.failed=0,s.skipped=0,K(i,e,t,s,!0)},onEnd:()=>{K(i,e,t,s,!0)},onTestBegin:()=>{K(i,e,t,s)},onTestEnd:r=>{r.outcome()==="skipped"?++s.skipped:r.outcome()==="unexpected"?++s.failed:++s.passed,K(i,e,t,s)},onError:r=>{O.write((r.stack||r.value||"")+`
3
+ `),t.push(r),K(i,e??new W("","root"),t,s)},printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}},!0),H._setClearPreviousResultsWhenTestBegins(),I("list",{})},q=(n,e)=>{if(window._overrideProtocolForTest){window._overrideProtocolForTest({method:n,params:e}).catch(()=>{});return}I(n,e).catch(t=>{console.error(t)})},it=(n,e)=>{var t,s;if(n==="listChanged"){be(!1).catch(()=>{});return}if(n==="testFilesChanged"){ve(e.testFileNames);return}if(n==="stdio"){if(e.buffer){const i=atob(e.buffer);O.write(i)}else O.write(e.text);return}(t=$==null?void 0:$.dispatch({method:n,params:e}))==null||t.catch(()=>{}),(s=H==null?void 0:H.dispatch({method:n,params:e}))==null||s.catch(()=>{})},nt=n=>{var e;for(let t=n.parent;t;t=t.parent)if(t.project())return(e=t.project())==null?void 0:e.outputDir},ot=n=>{if(n)return n.location.file+":"+n.location.line},re=n=>{const e=new Set;if(!n)return e;const t=s=>{var i;s.kind==="case"?s.tests.map(r=>r.id).forEach(r=>e.add(r)):s.kind==="test"?e.add(s.id):(i=s.children)==null||i.forEach(t)};return t(n),e};function ae(n,e,t,s){if(e.length===0)return n;const i=e.join(Y),r=s.get(i);if(r)return r;const o=ae(n,e.slice(0,e.length-1),!1,s),u={kind:"group",subKind:t?"file":"folder",id:i,title:e[e.length-1],location:{file:i,line:0,column:0},duration:0,parent:o,children:[],status:"none",hasLoadErrors:!1};return o.children.push(u),s.set(i,u),u}function rt(n,e,t){const s=[...t.values()].some(Boolean),i={kind:"group",subKind:"folder",id:"root",title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},r=(u,c,p)=>{for(const h of c.suites){const v=h.title||"<anonymous>";let g=p.children.find(a=>a.kind==="group"&&a.title===v);g||(g={kind:"group",subKind:"describe",id:"suite:"+c.titlePath().join("")+""+v,title:v,location:h.location,duration:0,parent:p,children:[],status:"none",hasLoadErrors:!1},p.children.push(g)),r(u,h,g)}for(const h of c.tests){const v=h.title;let g=p.children.find(x=>x.kind!=="group"&&x.title===v);g||(g={kind:"case",id:"test:"+h.titlePath().join(""),title:v,parent:p,children:[],tests:[],location:h.location,duration:0,status:"none"},p.children.push(g));const a=h.results[0];let m="none";(a==null?void 0:a.statusEx)==="scheduled"?m="scheduled":(a==null?void 0:a.statusEx)==="running"?m="running":(a==null?void 0:a.status)==="skipped"?m="skipped":(a==null?void 0:a.status)==="interrupted"?m="none":a&&h.outcome()!=="expected"?m="failed":a&&h.outcome()==="expected"&&(m="passed"),g.tests.push(h),g.children.push({kind:"test",id:h.id,title:u,location:h.location,test:h,parent:g,children:[],status:m,duration:h.results.length?Math.max(0,h.results[0].duration):0,project:u}),g.duration=g.children.reduce((x,T)=>x+T.duration,0)}},o=new Map;for(const u of(n==null?void 0:n.suites)||[])if(!(s&&!t.get(u.title)))for(const c of u.suites){const p=ae(i,c.location.file.split(Y),!0,o);r(u.title,c,p)}for(const u of e){if(!u.location)continue;const c=ae(i,u.location.file.split(Y),!0,o);c.hasLoadErrors=!0}return i}function lt(n,e,t,s){const i=e.trim().toLowerCase().split(" "),r=[...t.values()].some(Boolean),o=c=>{const p=c.tests[0].titlePath().join(" ").toLowerCase();return!i.every(h=>p.includes(h))&&!c.tests.some(h=>s==null?void 0:s.has(h.id))?!1:(c.children=c.children.filter(h=>!r||(s==null?void 0:s.has(h.test.id))||t.get(h.status)),c.tests=c.children.map(h=>h.test),!!c.children.length)},u=c=>{const p=[];for(const h of c.children)h.kind==="case"?o(h)&&p.push(h):(u(h),(h.children.length||h.hasLoadErrors)&&p.push(h));c.children=p};u(n)}function Se(n){for(const o of n.children)Se(o);n.kind==="group"&&n.children.sort((o,u)=>o.location.file.localeCompare(u.location.file)||o.location.line-u.location.line);let e=n.children.length>0,t=n.children.length>0,s=!1,i=!1,r=!1;for(const o of n.children)t=t&&o.status==="skipped",e=e&&(o.status==="passed"||o.status==="skipped"),s=s||o.status==="failed",i=i||o.status==="running",r=r||o.status==="scheduled";i?n.status="running":r?n.status="scheduled":s?n.status="failed":t?n.status="skipped":e&&(n.status="passed")}function at(n){let e=n;for(;e.children.length===1&&e.children[0].kind==="group"&&e.children[0].subKind==="folder";)e=e.children[0];return e.location=n.location,e}function ct(n){const e=t=>{t.kind==="case"&&t.children.length===1?t.children=[]:t.children.forEach(e)};e(n)}async function me(n){const e=new URLSearchParams;e.set("trace",n);const s=await(await fetch(`contexts?${e.toString()}`)).json();return new Oe(s)}const Y=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";(async()=>{if(ze(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(n=>setTimeout(n,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
4
+ Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(n=>{navigator.serviceWorker.oncontrollerchange=()=>n()}),setInterval(function(){fetch("ping")},1e4)}Ve.render(l.jsx(Ze,{}),document.querySelector("#root"))})();
5
+ function __vite__mapDeps(indexes) {
6
+ if (!__vite__mapDeps.viteFileDeps) {
7
+ __vite__mapDeps.viteFileDeps = ["./assets/xtermModule-Yt6xwiJ_.js","./xtermModule.0lwXJFHT.css"]
8
+ }
9
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkly/playwright-core",
3
- "version": "1.41.25",
3
+ "version": "1.41.26",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",