playwright-ws-trace 1.0.0
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/LICENSE +22 -0
- package/README.md +151 -0
- package/dist/traceViewer/assets/codeMirrorModule-4q8rQ10u.js +32 -0
- package/dist/traceViewer/assets/codeMirrorModule-C8IrGpNa.js +32 -0
- package/dist/traceViewer/assets/codeMirrorModule-CMV0Xve7.js +32 -0
- package/dist/traceViewer/assets/defaultSettingsView-BSyixIDP.js +267 -0
- package/dist/traceViewer/assets/defaultSettingsView-D-F27Sf_.js +267 -0
- package/dist/traceViewer/assets/defaultSettingsView-Dfy_AxQA.js +267 -0
- package/dist/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/dist/traceViewer/codeMirrorModule.DYBRYzYX.css +1 -0
- package/dist/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/dist/traceViewer/defaultSettingsView.26324PFb.css +1 -0
- package/dist/traceViewer/defaultSettingsView.8SsIZrFV.css +1 -0
- package/dist/traceViewer/defaultSettingsView.CFXgZVUo.css +1 -0
- package/dist/traceViewer/index.C4Y3Aw8n.css +1 -0
- package/dist/traceViewer/index.DHUPn3i0.js +2 -0
- package/dist/traceViewer/index.Ddar81JJ.js +2 -0
- package/dist/traceViewer/index.DyW3Fq0z.js +2 -0
- package/dist/traceViewer/index.html +43 -0
- package/dist/traceViewer/manifest.webmanifest +16 -0
- package/dist/traceViewer/playwright-logo.svg +9 -0
- package/dist/traceViewer/snapshot.html +21 -0
- package/dist/traceViewer/sw.bundle.js +3 -0
- package/dist/traceViewer/uiMode.BCiLqXdB.js +5 -0
- package/dist/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/dist/traceViewer/uiMode.DccP-sCl.js +5 -0
- package/dist/traceViewer/uiMode.hG-ABF1X.js +5 -0
- package/dist/traceViewer/uiMode.html +17 -0
- package/dist/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- package/package.json +42 -0
- package/scripts/postinstall.js +327 -0
- package/src/index.js +15 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-CsJ4vdCR.js","./xtermModule.DYP7pi_n.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as zt,r as H,g as Kt,_ as Vt,h as $t,i as Ht,j as r,R as u,E as qt,s as It,k as mt,l as Yt,t as Qt,m as Xt,n as q,o as F,T as yt,c as Jt,p as at,a as Zt,W as Gt,S as te,q as ee,b as se,e as ie,f as oe}from"./assets/defaultSettingsView-BSyixIDP.js";var re={};class pt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new Z("","root"),this._options=e,this._reporter=t}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onAttach"){this._onAttach(s.testId,s.resultId,s.attachments);return}if(e==="onTestError"){this._onTestError(s.testId,s.resultId,s.error);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===t.name):void 0;e||(e=new Z(t.name,"project"),this._rootSuite._addSuite(e)),e._project=this._parseProject(t);for(const s of t.suites)this._mergeSuiteInto(s,e)}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var l,n;const s=this._tests.get(t);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const o=s._createTestResult(e.id);o.retry=e.retry,o.workerIndex=e.workerIndex,o.parallelIndex=e.parallelIndex,o.setStartTimeNumber(e.startTime),(n=(l=this._reporter).onTestBegin)==null||n.call(l,s,o)}_onTestEnd(t,e){var l,n;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const o=s.results.find(m=>m._id===e.id);o.duration=e.duration,o.status=e.status,e.errors&&(o.errors=e.errors,o.error=o.errors[0]),e.attachments&&(o.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),o.annotations=e.annotations,s.annotations=e.annotations),(n=(l=this._reporter).onTestEnd)==null||n.call(l,s,o),o._stepMap=new Map}_onStepBegin(t,e,s){var f,a;const o=this._tests.get(t),l=o.results.find(w=>w._id===e),n=s.parentStepId?l._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),d=new ae(s,n,m,l);n?n.steps.push(d):l.steps.push(d),l._stepMap.set(s.id,d),(a=(f=this._reporter).onStepBegin)==null||a.call(f,o,l,d)}_onStepEnd(t,e,s){var m,d;const o=this._tests.get(t),l=o.results.find(f=>f._id===e),n=l._stepMap.get(s.id);n._endPayload=s,n.duration=s.duration,n.error=s.error,(d=(m=this._reporter).onStepEnd)==null||d.call(m,o,l,n)}_onAttach(t,e,s){this._tests.get(t).results.find(n=>n._id===e).attachments.push(...s.map(n=>({name:n.name,contentType:n.contentType,path:n.path,body:n.base64&&globalThis.Buffer?Buffer.from(n.base64,"base64"):void 0})))}_onTestError(t,e,s){const l=this._tests.get(t).results.find(n=>n._id===e);l.errors.push(s),l.error=l.errors[0]}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,o,l){var f,a,w,S;const n=l?globalThis.Buffer?Buffer.from(o,"base64"):atob(o):o,m=e?this._tests.get(e):void 0,d=m&&s?m.results.find(c=>c._id===s):void 0;t==="stdout"?(d==null||d.stdout.push(n),(a=(f=this._reporter).onStdOut)==null||a.call(f,n,m,d)):(d==null||d.stderr.push(n),(S=(w=this._reporter).onStdErr)==null||S.call(w,n,m,d))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,{status:t.status,startTime:new Date(t.startTime),duration:t.duration}))}_onExit(){var t,e;return(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...ce,...t};return this._options.configOverrides&&(e.configFile=this._options.configOverrides.configFile,e.reportSlowTests=this._options.configOverrides.reportSlowTests,e.quiet=this._options.configOverrides.quiet,e.reporter=[...this._options.configOverrides.reporter]),e}_parseProject(t){return{metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:lt(t.testIgnore),testMatch:lt(t.testMatch),timeout:t.timeout,grep:lt(t.grep),grepInvert:lt(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:t.use}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuiteInto(t,e){let s=e.suites.find(o=>o.title===t.title);s||(s=new Z(t.title,e.type==="project"?"file":"describe"),e._addSuite(s)),s.location=this._absoluteLocation(t.location),t.entries.forEach(o=>{"testId"in o?this._mergeTestInto(o,s):this._mergeSuiteInto(o,s)})}_mergeTestInto(t,e){let s=this._options.mergeTestCases?e.tests.find(o=>o.title===t.title&&o.repeatEachIndex===t.repeatEachIndex):void 0;s||(s=new ne(t.testId,t.title,this._absoluteLocation(t.location),t.repeatEachIndex),e._addTest(s),this._tests.set(s.id,s)),this._updateTest(t,s)}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e.tags=t.tags??[],e.annotations=t.annotations??[],this._absoluteAnnotationLocationsInplace(e.annotations),e}_absoluteAnnotationLocationsInplace(t){for(const e of t)e.location&&(e.location=this._absoluteLocation(e.location))}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){if(t!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,t):this._rootDir+"/"+t}}class Z{constructor(t,e){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=t,this._type=e}get type(){return this._type}get suites(){return this._entries.filter(t=>t.type!=="test")}get tests(){return this._entries.filter(t=>t.type==="test")}entries(){return this._entries}allTests(){const t=[],e=s=>{for(const o of s.entries())o.type==="test"?t.push(o):e(o)};return e(this),t}titlePath(){const t=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&t.push(this.title),t}project(){var t;return this._project??((t=this.parent)==null?void 0:t.project())}_addTest(t){t.parent=this,this._entries.push(t)}_addSuite(t){t.parent=this,this._entries.push(t)}}class ne{constructor(t,e,s,o){this.fn=()=>{},this.results=[],this.type="test",this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.id=t,this.title=e,this.location=s,this.repeatEachIndex=o}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){return de(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new le(this.results.length,t);return this.results.push(e),e}}class ae{constructor(t,e,s,o){this.duration=-1,this.steps=[],this._startTime=0,this.title=t.title,this.category=t.category,this.location=s,this.parent=e,this._startTime=t.startTime,this._result=o}titlePath(){var e;return[...((e=this.parent)==null?void 0:e.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}get attachments(){var t,e;return((e=(t=this._endPayload)==null?void 0:t.attachments)==null?void 0:e.map(s=>this._result.attachments[s]))??[]}get annotations(){var t;return((t=this._endPayload)==null?void 0:t.annotations)??[]}}class le{constructor(t,e){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.annotations=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=t,this._id=e}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const ce={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[re.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:3e5},configFile:"",rootDir:"",quiet:!1,shard:null,tags:[],updateSnapshots:"missing",updateSourceMethod:"patch",version:"",workers:0,webServer:null};function lt(i){return i.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function de(i){let t=0,e=0,s=0;for(const o of i.results)o.status==="interrupted"||(o.status==="skipped"&&i.expectedStatus==="skipped"?++t:o.status==="skipped"||(o.status===i.expectedStatus?++e:++s));return e===0&&s===0?"skipped":s===0?"expected":e===0&&t===0?"unexpected":"flaky"}class gt{constructor(t,e,s,o,l,n){this._treeItemById=new Map,this._treeItemByTestId=new Map;const m=o&&[...o.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 d=(f,a,w,S)=>{for(const c of S==="tests"?[]:a.suites){if(!c.title){d(f,c,w,"all");continue}let k=w.children.find(_=>_.kind==="group"&&_.title===c.title);k||(k={kind:"group",subKind:"describe",id:"suite:"+a.titlePath().join("")+""+c.title,title:c.title,location:c.location,duration:0,parent:w,children:[],status:"none",hasLoadErrors:!1},this._addChild(w,k)),d(f,c,k,"all")}for(const c of S==="suites"?[]:a.tests){const k=c.title;let _=w.children.find(D=>D.kind!=="group"&&D.title===k);_||(_={kind:"case",id:"test:"+c.titlePath().join(""),title:k,parent:w,children:[],tests:[],location:c.location,duration:0,status:"none",project:void 0,test:void 0,tags:c.tags},this._addChild(w,_));const x=c.results[0];let E="none";(x==null?void 0:x[G])==="scheduled"?E="scheduled":(x==null?void 0:x[G])==="running"?E="running":(x==null?void 0:x.status)==="skipped"?E="skipped":(x==null?void 0:x.status)==="interrupted"?E="none":x&&c.outcome()!=="expected"?E="failed":x&&c.outcome()==="expected"&&(E="passed"),_.tests.push(c);const b={kind:"test",id:c.id,title:f.name,location:c.location,test:c,parent:_,children:[],status:E,duration:c.results.length?Math.max(0,c.results[0].duration):0,project:f};this._addChild(_,b),this._treeItemByTestId.set(c.id,b),_.duration=_.children.reduce((D,C)=>D+C.duration,0)}};for(const f of(e==null?void 0:e.suites)||[])if(!(m&&!o.get(f.title)))for(const a of f.suites)if(n){if(d(f.project(),a,this.rootItem,"suites"),a.tests.length){const w=this._defaultDescribeItem();d(f.project(),a,w,"tests")}}else{const w=this._fileItem(a.location.file.split(l),!0);d(f.project(),a,w,"all")}for(const f of s){if(!f.location)continue;const a=this._fileItem(f.location.file.split(l),!0);a.hasLoadErrors=!0}}_addChild(t,e){t.children.push(e),e.parent=t,this._treeItemById.set(e.id,e)}filterTree(t,e,s){const o=t.trim().toLowerCase().split(" "),l=[...e.values()].some(Boolean),n=d=>{const f=[...d.tests[0].titlePath(),...d.tests[0].tags].join(" ").toLowerCase();return!o.every(a=>f.includes(a))&&!d.tests.some(a=>s==null?void 0:s.has(a.id))?!1:(d.children=d.children.filter(a=>!l||(s==null?void 0:s.has(a.test.id))||e.get(a.status)),d.tests=d.children.map(a=>a.test),!!d.children.length)},m=d=>{const f=[];for(const a of d.children)a.kind==="case"?n(a)&&f.push(a):(m(a),(a.children.length||a.hasLoadErrors)&&f.push(a));d.children=f};m(this.rootItem)}_fileItem(t,e){if(t.length===0)return this.rootItem;const s=t.join(this.pathSeparator),o=this._treeItemById.get(s);if(o)return o;const l=this._fileItem(t.slice(0,t.length-1),!1),n={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:l,children:[],status:"none",hasLoadErrors:!1};return this._addChild(l,n),n}_defaultDescribeItem(){let t=this._treeItemById.get("<anonymous>");return t||(t={kind:"group",subKind:"describe",id:"<anonymous>",title:"<anonymous>",location:{file:"",line:0,column:0},duration:0,parent:this.rootItem,children:[],status:"none",hasLoadErrors:!1},this._addChild(this.rootItem,t)),t}sortAndPropagateStatus(){Rt(this.rootItem)}flattenForSingleProject(){const t=e=>{e.kind==="case"&&e.children.length===1?(e.project=e.children[0].project,e.test=e.children[0].test,e.children=[],this._treeItemByTestId.set(e.test.id,e)):e.children.forEach(t)};t(this.rootItem)}shortenRoot(){let t=this.rootItem;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];t.location=this.rootItem.location,this.rootItem=t}fileNames(){const t=new Set,e=s=>{s.kind==="group"&&s.subKind==="file"?t.add(s.id):s.children.forEach(e)};return e(this.rootItem),[...t]}flatTreeItems(){const t=[],e=s=>{t.push(s),s.children.forEach(e)};return e(this.rootItem),t}treeItemById(t){return this._treeItemById.get(t)}collectTestIds(t){return ue(t)}}function Rt(i){for(const n of i.children)Rt(n);i.kind==="group"&&i.children.sort((n,m)=>n.location.file.localeCompare(m.location.file)||n.location.line-m.location.line);let t=i.children.length>0,e=i.children.length>0,s=!1,o=!1,l=!1;for(const n of i.children)e=e&&n.status==="skipped",t=t&&(n.status==="passed"||n.status==="skipped"),s=s||n.status==="failed",o=o||n.status==="running",l=l||n.status==="scheduled";o?i.status="running":l?i.status="scheduled":s?i.status="failed":e?i.status="skipped":t&&(i.status="passed")}function ue(i){const t=new Set,e=new Set,s=o=>{if(o.kind!=="test"&&o.kind!=="case"){o.children.forEach(s);return}let l=o;for(;l&&l.parent&&!(l.kind==="group"&&l.subKind==="file");)l=l.parent;e.add(l.location.file),o.kind==="case"?o.tests.forEach(n=>t.add(n.id)):t.add(o.id)};return s(i),{testIds:t,locations:e}}const G=Symbol("statusEx");class he{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new pt(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:Tt(t.pathSeparator),clearPreviousResultsWhenTestBegins:!0}),this._options=t}_createReporter(){return{version:()=>"v2",onConfigure:t=>{this.config=t,this._lastRunReceiver=new pt({version:()=>"v2",onBegin:e=>{this._lastRunTestCount=e.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:Tt(this._options.pathSeparator)}),this._lastRunReceiver.dispatch({method:"onConfigure",params:{config:t}})},onBegin:t=>{var e;if(this.rootSuite||(this.rootSuite=t),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((e=this._testResultsSnapshot)==null?void 0:e.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(t,e)=>{e[G]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[G]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1}}processGlobalReport(t){const e=new pt({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of t)e.dispatch(s)}processListReport(t){var s;const e=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(e.map(o=>[o.id,o.results])),this._receiver.reset();for(const o of t)this._receiver.dispatch(o)}processTestReportEvent(t){var e,s,o;(s=(e=this._lastRunReceiver)==null?void 0:e.dispatch(t))==null||s.catch(()=>{}),(o=this._receiver.dispatch(t))==null||o.catch(()=>{})}_handleOnError(t){var e,s;this.loadErrors.push(t),(s=(e=this._options).onError)==null||s.call(e,t),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new Z("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}function Tt(i){return(t,e)=>{const s=[];for(const o of[...t.split(i),...e.split(i)]){const l=i==="\\"&&s.length===1&&s[0].endsWith(":"),n=!s.length;if(!(!o&&!n&&!l)&&o!=="."){if(o===".."){s.pop();continue}s.push(o)}}return s.join(i)}}const fe=({source:i})=>{const[t,e]=zt(),[s,o]=H.useState(Kt()),[l]=H.useState(Vt(()=>import("./assets/xtermModule-CsJ4vdCR.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),n=H.useRef(null);return H.useEffect(()=>($t(o),()=>Ht(o)),[]),H.useEffect(()=>{const m=i.write,d=i.clear;return(async()=>{const{Terminal:f,FitAddon:a}=await l,w=e.current;if(!w)return;const S=s==="dark-mode"?ge:pe;if(n.current&&n.current.terminal.options.theme===S)return;n.current&&(w.textContent="");const c=new f({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"monospace",theme:S}),k=new a;c.loadAddon(k);for(const _ of i.pending)c.write(_);i.write=(_=>{i.pending.push(_),c.write(_)}),i.clear=()=>{i.pending=[],c.clear()},c.open(w),k.fit(),n.current={terminal:c,fitAddon:k}})(),()=>{i.clear=d,i.write=m}},[l,n,e,i,s]),H.useEffect(()=>{setTimeout(()=>{n.current&&(n.current.fitAddon.fit(),i.resize(n.current.terminal.cols,n.current.terminal.rows))},250)},[t,i]),r.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},pe={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},ge={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"},me=({filterText:i,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:o,setProjectFilters:l,testModel:n,runTests:m})=>{const[d,f]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>{var c;(c=a.current)==null||c.focus()},[]);const w=[...e.entries()].filter(([c,k])=>k).map(([c])=>c).join(" ")||"all",S=[...o.entries()].filter(([c,k])=>k).map(([c])=>c).join(" ")||"all";return r.jsxs("div",{className:"filters",children:[r.jsx(qt,{expanded:d,setExpanded:f,title:r.jsx("input",{ref:a,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:c=>{t(c.target.value)},onKeyDown:c=>{c.key==="Enter"&&m()}})}),r.jsxs("div",{className:"filter-summary",title:"Status: "+w+`
|
|
3
|
+
Projects: `+S,onClick:()=>f(!d),children:[r.jsx("span",{className:"filter-label",children:"Status:"})," ",w,r.jsx("span",{className:"filter-label",children:"Projects:"})," ",S]}),d&&r.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[r.jsx("div",{className:"filter-list",role:"list","data-testid":"status-filters",children:[...e.entries()].map(([c,k])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>{const _=new Map(e);_.set(c,!_.get(c)),s(_)}}),r.jsx("div",{children:c})]})},c))}),r.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...o.entries()].map(([c,k])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>{var E;const _=new Map(o);_.set(c,!_.get(c)),l(_);const x=(E=n==null?void 0:n.config)==null?void 0:E.configFile;x&&It.setObject(x+":projects",[..._.entries()].filter(([b,D])=>D).map(([b])=>b))}}),r.jsx("div",{children:c||"untitled"})]})},c))})]})]})},_e=({tag:i,style:t,onClick:e})=>r.jsx("span",{className:mt("tag",`tag-color-${ve(i)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${i}`,children:i});function ve(i){let t=0;for(let e=0;e<i.length;e++)t=i.charCodeAt(e)+((t<<8)-t);return Math.abs(t%6)}const we=Yt,be=({filterText:i,testModel:t,testServerConnection:e,testTree:s,runTests:o,runningState:l,watchAll:n,watchedTreeIds:m,setWatchedTreeIds:d,isLoading:f,onItemSelected:a,requestedCollapseAllCount:w,requestedExpandAllCount:S,setFilterText:c,onRevealSource:k})=>{const[_,x]=u.useState({expandedItems:new Map}),[E,b]=u.useState(),[D,C]=u.useState(w),[U,tt]=u.useState(S);u.useEffect(()=>{if(D!==w){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!1);C(w),b(void 0),x({..._});return}if(U!==S){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!0);tt(S),b(void 0),x({..._});return}if(!l||l.itemSelectedByUser)return;let h;const R=j=>{var M;j.children.forEach(R),!h&&j.status==="failed"&&(j.kind==="test"&&l.testIds.has(j.test.id)||j.kind==="case"&&l.testIds.has((M=j.tests[0])==null?void 0:M.id))&&(h=j)};R(s.rootItem),h&&b(h.id)},[l,b,s,D,C,w,U,tt,S,_,x]);const N=u.useMemo(()=>{if(E)return s.treeItemById(E)},[E,s]);u.useEffect(()=>{if(!t)return;const h=xe(N,t);let R;(N==null?void 0:N.kind)==="test"?R=N.test:(N==null?void 0:N.kind)==="case"&&N.tests.length===1&&(R=N.tests[0]),a({treeItem:N,testCase:R,testFile:h})},[t,N,a]),u.useEffect(()=>{if(!f)if(n)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const h=new Set;for(const R of m.value){const j=s.treeItemById(R),M=j==null?void 0:j.location.file;M&&h.add(M)}e==null||e.watchNoReply({fileNames:[...h]})}},[f,s,n,m,e]);const $=h=>{b(h.id),o("bounce-if-busy",s.collectTestIds(h))},K=(h,R)=>{if(h.preventDefault(),h.stopPropagation(),h.metaKey||h.ctrlKey){const j=i.split(" ");j.includes(R)?c(j.filter(M=>M!==R).join(" ").trim()):c((i+" "+R).trim())}else c((i.split(" ").filter(j=>!j.startsWith("@")).join(" ")+" "+R).trim())};return r.jsx(we,{name:"tests",treeState:_,setTreeState:x,rootItem:s.rootItem,dataTestId:"test-tree",render:h=>{const R=h.id.replace(/[^\w\d-_]/g,"-"),j=R+"-label",M=R+"-time";return r.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${j} ${M}`,children:[r.jsxs("div",{id:j,className:"ui-mode-tree-item-title",children:[r.jsx("span",{children:h.title}),h.kind==="case"?h.tags.map(Y=>r.jsx(_e,{tag:Y.slice(1),onClick:ct=>K(ct,Y)},Y)):null]}),!!h.duration&&h.status!=="skipped"&&r.jsx("div",{id:M,className:"ui-mode-tree-item-time",children:Xt(h.duration)}),r.jsxs(q,{noMinHeight:!0,noShadow:!0,children:[r.jsx(F,{icon:"play",title:"Run",onClick:()=>$(h),disabled:!!l&&!l.completed}),r.jsx(F,{icon:"go-to-file",title:"Show source",onClick:k,style:h.kind==="group"&&h.subKind==="folder"?{visibility:"hidden"}:{}}),!n&&r.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(h.id)?m.value.delete(h.id):m.value.add(h.id),d({...m})},toggled:m.value.has(h.id)})]})]})},icon:h=>Qt(h.status),title:h=>h.title,selectedItem:N,onAccepted:$,onSelected:h=>{l&&(l.itemSelectedByUser=!0),b(h.id)},isError:h=>h.kind==="group"?h.hasLoadErrors:!1,autoExpandDepth:i?5:1,noItemsMessage:f?"Loading…":"No tests"})};function xe(i,t){if(!(!i||!t))return{file:i.location.file,line:i.location.line,column:i.location.column,source:{errors:t.loadErrors.filter(e=>{var s;return((s=e.location)==null?void 0:s.file)===i.location.file}).map(e=>({line:e.location.line,message:e.message})),content:void 0}}}function Se(i){return`.playwright-artifacts-${i}`}const Te=({item:i,rootDir:t,onOpenExternally:e,revealSource:s,pathSeparator:o})=>{var w,S;const[l,n]=u.useState(void 0),[m,d]=u.useState(0),f=u.useRef(null),{outputDir:a}=u.useMemo(()=>({outputDir:i.testCase?ke(i.testCase):void 0}),[i]);return u.useEffect(()=>{var x,E;f.current&&clearTimeout(f.current);const c=(x=i.testCase)==null?void 0:x.results[0];if(!c){n(void 0);return}const k=c&&c.duration>=0&&c.attachments.find(b=>b.name==="trace");if(k&&k.path){kt(k.path).then(b=>n({model:b,isLive:!1}));return}if(!a){n(void 0);return}const _=[a,Se(c.workerIndex),"traces",`${(E=i.testCase)==null?void 0:E.id}.json`].join(o);return f.current=setTimeout(async()=>{try{const b=await kt(_);n({model:b,isLive:!0})}catch{const b=new yt("",[]);b.errorDescriptors.push(...c.errors.flatMap(D=>D.message?[{message:D.message}]:[])),n({model:b,isLive:!1})}finally{d(m+1)}},500),()=>{f.current&&clearTimeout(f.current)}},[a,i,n,m,d,o]),r.jsx(Jt,{model:l==null?void 0:l.model,showSourcesFirst:!0,rootDir:t,fallbackLocation:i.testFile,isLive:l==null?void 0:l.isLive,status:(w=i.treeItem)==null?void 0:w.status,annotations:((S=i.testCase)==null?void 0:S.annotations)??[],onOpenExternally:e,revealSource:s},"workbench")},ke=i=>{var t;for(let e=i.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir};async function kt(i){const t=new URLSearchParams;t.set("trace",i);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new yt(i,s)}let jt={cols:80};const z={pending:[],clear:()=>{},write:i=>z.pending.push(i),resize:()=>{}},A=new URLSearchParams(window.location.search),je=new URL(A.get("server")??"../",window.location.href),_t=new URL(A.get("ws"),je);_t.protocol=_t.protocol==="https:"?"wss:":"ws:";const B={args:A.getAll("arg"),grep:A.get("grep")||void 0,grepInvert:A.get("grepInvert")||void 0,projects:A.getAll("project"),workers:A.get("workers")||void 0,headed:A.has("headed"),updateSnapshots:A.get("updateSnapshots")||void 0,reporters:A.has("reporter")?A.getAll("reporter"):void 0,pathSeparator:A.get("pathSeparator")||"/"};B.updateSnapshots&&!["all","changed","none","missing"].includes(B.updateSnapshots)&&(B.updateSnapshots=void 0);const Et=navigator.platform==="MacIntel";function Ee(i){return i.startsWith("/")&&(i=i.substring(1)),i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ie=({})=>{var xt;const[i,t]=u.useState(""),[e,s]=u.useState(!1),[o,l]=u.useState(!1),[n,m]=u.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[d,f]=u.useState(new Map),[a,w]=u.useState(),[S,c]=u.useState(),[k,_]=u.useState({}),[x,E]=u.useState(!1),[b,D]=u.useState(),C=b&&!b.completed,[U,tt]=at("watch-all",!1),[N,$]=u.useState({value:new Set}),K=u.useRef(Promise.resolve()),h=u.useRef({testIds:new Set,locations:new Set}),[R,j]=u.useState(0),[M,Y]=u.useState(0),[ct,Bt]=u.useState(!1),[vt,wt]=u.useState(!0),[v,Ct]=u.useState(),[et,Nt]=u.useState(),[st,Pt]=u.useState(!1),[it,Lt]=u.useState(!1),[Dt,bt]=u.useState(!1),Mt=u.useCallback(()=>bt(!0),[bt]),[dt,Ft]=at("single-worker",!1),[ut,Ot]=at("updateSnapshots","missing"),[Q]=at("mergeFiles",!1),At=u.useRef(null),ot=u.useCallback(()=>{Ct(p=>(p==null||p.close(),new Zt(new Gt(_t))))},[]);u.useEffect(()=>{var p;(p=At.current)==null||p.focus(),E(!0),ot()},[ot]),u.useEffect(()=>{if(!v)return;const p=[v.onStdio(g=>{if(g.buffer){const T=atob(g.buffer);z.write(T)}else z.write(g.text);g.type==="stderr"&&l(!0)}),v.onClose(()=>Bt(!0))];return z.resize=(g,T)=>{jt={cols:g,rows:T},v.resizeTerminalNoReply({cols:g,rows:T})},()=>{for(const g of p)g.dispose()}},[v]),u.useEffect(()=>{if(!v)return;let p;const g=new he({onUpdate:T=>{clearTimeout(p),p=void 0,T?w(g.asModel()):p||(p=setTimeout(()=>{w(g.asModel())},250))},onError:T=>{z.write((T.stack||T.value||"")+`
|
|
4
|
+
`),l(!0)},pathSeparator:B.pathSeparator});return Nt(g),w(void 0),E(!0),$({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:T,report:y}=await v.runGlobalSetup({});if(g.processGlobalReport(y),T!=="passed")return;const P=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});g.processListReport(P.report),v.onReport(V=>{g.processTestReportEvent(V)});const{hasBrowsers:O}=await v.checkBrowsers({});wt(O)}finally{E(!1)}})(),()=>{clearTimeout(p)}},[v]),u.useEffect(()=>{if(!a)return;const{config:p,rootSuite:g}=a,T=p.configFile?It.getObject(p.configFile+":projects",void 0):void 0,y=new Map(d);for(const P of y.keys())g.suites.find(O=>O.title===P)||y.delete(P);for(const P of g.suites)y.has(P.title)||y.set(P.title,!!(T!=null&&T.includes(P.title)));!T&&y.size&&![...y.values()].includes(!0)&&y.set(y.entries().next().value[0],!0),(d.size!==y.size||[...d].some(([P,O])=>y.get(P)!==O))&&f(y)},[d,a]),u.useEffect(()=>{C&&(a!=null&&a.progress)?c(a.progress):a||c(void 0)},[a,C]);const{testTree:rt}=u.useMemo(()=>{if(!a)return{testTree:new gt("",new Z("","root"),[],d,B.pathSeparator,Q)};const p=new gt("",a.rootSuite,a.loadErrors,d,B.pathSeparator,Q);return p.filterTree(i,n,C?b==null?void 0:b.testIds:void 0),p.sortAndPropagateStatus(),p.shortenRoot(),p.flattenForSingleProject(),{testTree:p}},[i,a,n,d,b,C,Q]),X=u.useCallback((p,g)=>{if(!(!v||!a)&&!(p==="bounce-if-busy"&&C)){for(const T of g.testIds)h.current.testIds.add(T);for(const T of g.locations)h.current.locations.add(T);K.current=K.current.then(async()=>{var O,V,W;const{testIds:T,locations:y}=h.current;if(h.current={testIds:new Set,locations:new Set},!T.size)return;{for(const I of((O=a.rootSuite)==null?void 0:O.allTests())||[])if(T.has(I.id)){I.results=[];const L=I._createTestResult("pending");L[G]="scheduled"}w({...a})}const P=" ["+new Date().toLocaleTimeString()+"]";z.write("\x1B[2m—".repeat(Math.max(0,jt.cols-P.length))+P+"\x1B[22m"),c({total:0,passed:0,failed:0,skipped:0}),D({testIds:T}),await v.runTests({locations:[...y].map(Ee),grep:B.grep,grepInvert:B.grepInvert,testIds:[...T],projects:[...d].filter(([I,L])=>L).map(([I])=>I),updateSnapshots:ut,reporters:B.reporters,workers:dt?1:void 0,trace:"on"});for(const I of((V=a.rootSuite)==null?void 0:V.allTests())||[])((W=I.results[0])==null?void 0:W.duration)===-1&&(I.results=[]);w({...a}),D(I=>I?{...I,completed:!0}:void 0)})}},[d,C,a,v,ut,dt]),nt=u.useCallback(()=>X("bounce-if-busy",rt.collectTestIds(rt.rootItem)),[X,rt]);u.useEffect(()=>{if(!v||!et)return;const p=v.onTestFilesChanged(async g=>{if(K.current=K.current.then(async()=>{E(!0);try{const W=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});et.processListReport(W.report)}catch(W){console.log(W)}finally{E(!1)}}),await K.current,g.testFiles.length===0)return;const T=et.asModel(),y=new gt("",T.rootSuite,T.loadErrors,d,B.pathSeparator,Q),P=[],O=[],V=new Set(g.testFiles);if(U){const W=I=>{const L=I.location.file;if(L&&V.has(L)){const J=y.collectTestIds(I);P.push(...J.locations),O.push(...J.testIds)}I.kind==="group"&&I.subKind==="folder"&&I.children.forEach(W)};W(y.rootItem)}else for(const W of N.value){const I=y.treeItemById(W);if(!I)continue;let L=I;for(;!(L.kind==="group"&&(L.subKind==="file"||L.subKind==="folder"))&&L.parent;)L=L.parent;const J=L==null?void 0:L.location.file;if(J&&V.has(J)){const St=y.collectTestIds(I);P.push(...St.locations),O.push(...St.testIds)}}X("queue-if-busy",{locations:P,testIds:O})});return()=>p.dispose()},[X,v,U,N,et,d,Q]),u.useEffect(()=>{if(!v)return;const p=g=>{g.code==="Backquote"&&g.ctrlKey?(g.preventDefault(),s(!e)):g.code==="F5"&&g.shiftKey?(g.preventDefault(),v==null||v.stopTestsNoReply({})):g.code==="F5"&&(g.preventDefault(),nt())};return addEventListener("keydown",p),()=>{removeEventListener("keydown",p)}},[nt,ot,v,e]);const ht=u.useRef(null),Wt=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.showModal()},[]),ft=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.close()},[]),Ut=u.useCallback(p=>{ft(p),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));wt(g)})},[ft,v]);return r.jsxs("div",{className:"vbox ui-mode",children:[!vt&&r.jsxs("dialog",{ref:ht,children:[r.jsxs("div",{className:"title",children:[r.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),r.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",r.jsx("br",{}),"Would you like to run `playwright install`?",r.jsx("br",{}),r.jsx("button",{className:"button",onClick:Ut,children:"Install"}),r.jsx("button",{className:"button secondary",onClick:ft,children:"Dismiss"})]})]}),ct&&r.jsxs("div",{className:"disconnected",children:[r.jsx("div",{className:"title",children:"UI Mode disconnected"}),r.jsxs("div",{children:[r.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),r.jsx(te,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:r.jsxs("div",{className:"vbox",children:[r.jsxs("div",{className:mt("vbox",!e&&"hidden"),children:[r.jsxs(q,{children:[r.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),r.jsx(F,{icon:"circle-slash",title:"Clear output",onClick:()=>{z.clear(),l(!1)}}),r.jsx("div",{className:"spacer"}),r.jsx(F,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),r.jsx(fe,{source:z})]}),r.jsx("div",{className:mt("vbox",e&&"hidden"),children:r.jsx(Te,{pathSeparator:B.pathSeparator,item:k,rootDir:(xt=a==null?void 0:a.config)==null?void 0:xt.rootDir,revealSource:Dt,onOpenExternally:p=>v==null?void 0:v.openNoReply({location:{file:p.file,line:p.line,column:p.column}})})})]}),sidebar:r.jsxs("div",{className:"vbox ui-mode-sidebar",children:[r.jsxs(q,{noShadow:!0,noMinHeight:!0,children:[r.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),r.jsx("div",{className:"section-title",children:"Playwright"}),r.jsx(F,{icon:"refresh",title:"Reload",onClick:()=>ot(),disabled:C||x}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(F,{icon:"terminal",title:"Toggle output — "+(Et?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),o&&r.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!vt&&r.jsx(F,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Wt})]}),r.jsx(me,{filterText:i,setFilterText:t,statusFilters:n,setStatusFilters:m,projectFilters:d,setProjectFilters:f,testModel:a,runTests:nt}),r.jsxs(q,{className:"section-toolbar",noMinHeight:!0,children:[!C&&!S&&r.jsx("div",{className:"section-title",children:"Tests"}),!C&&S&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:[S.passed,"/",S.total," passed (",S.passed/S.total*100|0,"%)"]})}),C&&S&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:["Running ",S.passed,"/",b.testIds.size," passed (",S.passed/b.testIds.size*100|0,"%)"]})}),r.jsx(F,{icon:"play",title:"Run all — F5",onClick:nt,disabled:C||x}),r.jsx(F,{icon:"debug-stop",title:"Stop — "+(Et?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!C||x}),r.jsx(F,{icon:"eye",title:"Watch all",toggled:U,onClick:()=>{$({value:new Set}),tt(!U)}}),r.jsx(F,{icon:"collapse-all",title:"Collapse all",onClick:()=>{j(R+1)}}),r.jsx(F,{icon:"expand-all",title:"Expand all",onClick:()=>{Y(M+1)}})]}),r.jsx(be,{filterText:i,testModel:a,testTree:rt,testServerConnection:v,runningState:b,runTests:X,onItemSelected:_,watchAll:U,watchedTreeIds:N,setWatchedTreeIds:$,isLoading:x,requestedCollapseAllCount:R,requestedExpandAllCount:M,setFilterText:t,onRevealSource:Mt}),r.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Lt(!it),children:[r.jsx("span",{className:`codicon codicon-${it?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:it?"Hide Testing Options":"Show Testing Options"}),r.jsx("div",{className:"section-title",children:"Testing Options"})]}),it&&r.jsx(ee,{settings:[{type:"check",value:dt,set:Ft,name:"Single worker"},{type:"select",options:[{label:"All",value:"all"},{label:"Changed",value:"changed"},{label:"Missing",value:"missing"},{label:"None",value:"none"}],value:ut,set:Ot,name:"Update snapshots"}]}),r.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Pt(!st),children:[r.jsx("span",{className:`codicon codicon-${st?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:st?"Hide Settings":"Show Settings"}),r.jsx("div",{className:"section-title",children:"Settings"})]}),st&&r.jsx(se,{location:"ui-mode"})]})})]})};(async()=>{if(ie(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
5
|
+
Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}oe.createRoot(document.querySelector("#root")).render(r.jsx(Ie,{}))})();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-CsJ4vdCR.js","./xtermModule.DYP7pi_n.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as zt,r as H,g as Kt,_ as Vt,h as $t,i as Ht,j as r,R as u,E as qt,s as It,k as mt,l as Yt,t as Qt,m as Xt,n as q,o as F,T as yt,c as Jt,p as at,a as Zt,W as Gt,S as te,q as ee,b as se,e as ie,f as oe}from"./assets/defaultSettingsView-Dfy_AxQA.js";var re={};class pt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new Z("","root"),this._options=e,this._reporter=t}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onAttach"){this._onAttach(s.testId,s.resultId,s.attachments);return}if(e==="onTestError"){this._onTestError(s.testId,s.resultId,s.error);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===t.name):void 0;e||(e=new Z(t.name,"project"),this._rootSuite._addSuite(e)),e._project=this._parseProject(t);for(const s of t.suites)this._mergeSuiteInto(s,e)}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var l,n;const s=this._tests.get(t);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const o=s._createTestResult(e.id);o.retry=e.retry,o.workerIndex=e.workerIndex,o.parallelIndex=e.parallelIndex,o.setStartTimeNumber(e.startTime),(n=(l=this._reporter).onTestBegin)==null||n.call(l,s,o)}_onTestEnd(t,e){var l,n;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const o=s.results.find(m=>m._id===e.id);o.duration=e.duration,o.status=e.status,e.errors&&(o.errors=e.errors,o.error=o.errors[0]),e.attachments&&(o.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),o.annotations=e.annotations,s.annotations=e.annotations),(n=(l=this._reporter).onTestEnd)==null||n.call(l,s,o),o._stepMap=new Map}_onStepBegin(t,e,s){var f,a;const o=this._tests.get(t),l=o.results.find(w=>w._id===e),n=s.parentStepId?l._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),d=new ae(s,n,m,l);n?n.steps.push(d):l.steps.push(d),l._stepMap.set(s.id,d),(a=(f=this._reporter).onStepBegin)==null||a.call(f,o,l,d)}_onStepEnd(t,e,s){var m,d;const o=this._tests.get(t),l=o.results.find(f=>f._id===e),n=l._stepMap.get(s.id);n._endPayload=s,n.duration=s.duration,n.error=s.error,(d=(m=this._reporter).onStepEnd)==null||d.call(m,o,l,n)}_onAttach(t,e,s){this._tests.get(t).results.find(n=>n._id===e).attachments.push(...s.map(n=>({name:n.name,contentType:n.contentType,path:n.path,body:n.base64&&globalThis.Buffer?Buffer.from(n.base64,"base64"):void 0})))}_onTestError(t,e,s){const l=this._tests.get(t).results.find(n=>n._id===e);l.errors.push(s),l.error=l.errors[0]}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,o,l){var f,a,w,S;const n=l?globalThis.Buffer?Buffer.from(o,"base64"):atob(o):o,m=e?this._tests.get(e):void 0,d=m&&s?m.results.find(c=>c._id===s):void 0;t==="stdout"?(d==null||d.stdout.push(n),(a=(f=this._reporter).onStdOut)==null||a.call(f,n,m,d)):(d==null||d.stderr.push(n),(S=(w=this._reporter).onStdErr)==null||S.call(w,n,m,d))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,{status:t.status,startTime:new Date(t.startTime),duration:t.duration}))}_onExit(){var t,e;return(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...ce,...t};return this._options.configOverrides&&(e.configFile=this._options.configOverrides.configFile,e.reportSlowTests=this._options.configOverrides.reportSlowTests,e.quiet=this._options.configOverrides.quiet,e.reporter=[...this._options.configOverrides.reporter]),e}_parseProject(t){return{metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:lt(t.testIgnore),testMatch:lt(t.testMatch),timeout:t.timeout,grep:lt(t.grep),grepInvert:lt(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:t.use}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuiteInto(t,e){let s=e.suites.find(o=>o.title===t.title);s||(s=new Z(t.title,e.type==="project"?"file":"describe"),e._addSuite(s)),s.location=this._absoluteLocation(t.location),t.entries.forEach(o=>{"testId"in o?this._mergeTestInto(o,s):this._mergeSuiteInto(o,s)})}_mergeTestInto(t,e){let s=this._options.mergeTestCases?e.tests.find(o=>o.title===t.title&&o.repeatEachIndex===t.repeatEachIndex):void 0;s||(s=new ne(t.testId,t.title,this._absoluteLocation(t.location),t.repeatEachIndex),e._addTest(s),this._tests.set(s.id,s)),this._updateTest(t,s)}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e.tags=t.tags??[],e.annotations=t.annotations??[],this._absoluteAnnotationLocationsInplace(e.annotations),e}_absoluteAnnotationLocationsInplace(t){for(const e of t)e.location&&(e.location=this._absoluteLocation(e.location))}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){if(t!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,t):this._rootDir+"/"+t}}class Z{constructor(t,e){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=t,this._type=e}get type(){return this._type}get suites(){return this._entries.filter(t=>t.type!=="test")}get tests(){return this._entries.filter(t=>t.type==="test")}entries(){return this._entries}allTests(){const t=[],e=s=>{for(const o of s.entries())o.type==="test"?t.push(o):e(o)};return e(this),t}titlePath(){const t=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&t.push(this.title),t}project(){var t;return this._project??((t=this.parent)==null?void 0:t.project())}_addTest(t){t.parent=this,this._entries.push(t)}_addSuite(t){t.parent=this,this._entries.push(t)}}class ne{constructor(t,e,s,o){this.fn=()=>{},this.results=[],this.type="test",this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.id=t,this.title=e,this.location=s,this.repeatEachIndex=o}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){return de(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new le(this.results.length,t);return this.results.push(e),e}}class ae{constructor(t,e,s,o){this.duration=-1,this.steps=[],this._startTime=0,this.title=t.title,this.category=t.category,this.location=s,this.parent=e,this._startTime=t.startTime,this._result=o}titlePath(){var e;return[...((e=this.parent)==null?void 0:e.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}get attachments(){var t,e;return((e=(t=this._endPayload)==null?void 0:t.attachments)==null?void 0:e.map(s=>this._result.attachments[s]))??[]}get annotations(){var t;return((t=this._endPayload)==null?void 0:t.annotations)??[]}}class le{constructor(t,e){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.annotations=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=t,this._id=e}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const ce={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[re.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:3e5},configFile:"",rootDir:"",quiet:!1,shard:null,tags:[],updateSnapshots:"missing",updateSourceMethod:"patch",version:"",workers:0,webServer:null};function lt(i){return i.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function de(i){let t=0,e=0,s=0;for(const o of i.results)o.status==="interrupted"||(o.status==="skipped"&&i.expectedStatus==="skipped"?++t:o.status==="skipped"||(o.status===i.expectedStatus?++e:++s));return e===0&&s===0?"skipped":s===0?"expected":e===0&&t===0?"unexpected":"flaky"}class gt{constructor(t,e,s,o,l,n){this._treeItemById=new Map,this._treeItemByTestId=new Map;const m=o&&[...o.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 d=(f,a,w,S)=>{for(const c of S==="tests"?[]:a.suites){if(!c.title){d(f,c,w,"all");continue}let k=w.children.find(_=>_.kind==="group"&&_.title===c.title);k||(k={kind:"group",subKind:"describe",id:"suite:"+a.titlePath().join("")+""+c.title,title:c.title,location:c.location,duration:0,parent:w,children:[],status:"none",hasLoadErrors:!1},this._addChild(w,k)),d(f,c,k,"all")}for(const c of S==="suites"?[]:a.tests){const k=c.title;let _=w.children.find(D=>D.kind!=="group"&&D.title===k);_||(_={kind:"case",id:"test:"+c.titlePath().join(""),title:k,parent:w,children:[],tests:[],location:c.location,duration:0,status:"none",project:void 0,test:void 0,tags:c.tags},this._addChild(w,_));const x=c.results[0];let E="none";(x==null?void 0:x[G])==="scheduled"?E="scheduled":(x==null?void 0:x[G])==="running"?E="running":(x==null?void 0:x.status)==="skipped"?E="skipped":(x==null?void 0:x.status)==="interrupted"?E="none":x&&c.outcome()!=="expected"?E="failed":x&&c.outcome()==="expected"&&(E="passed"),_.tests.push(c);const b={kind:"test",id:c.id,title:f.name,location:c.location,test:c,parent:_,children:[],status:E,duration:c.results.length?Math.max(0,c.results[0].duration):0,project:f};this._addChild(_,b),this._treeItemByTestId.set(c.id,b),_.duration=_.children.reduce((D,C)=>D+C.duration,0)}};for(const f of(e==null?void 0:e.suites)||[])if(!(m&&!o.get(f.title)))for(const a of f.suites)if(n){if(d(f.project(),a,this.rootItem,"suites"),a.tests.length){const w=this._defaultDescribeItem();d(f.project(),a,w,"tests")}}else{const w=this._fileItem(a.location.file.split(l),!0);d(f.project(),a,w,"all")}for(const f of s){if(!f.location)continue;const a=this._fileItem(f.location.file.split(l),!0);a.hasLoadErrors=!0}}_addChild(t,e){t.children.push(e),e.parent=t,this._treeItemById.set(e.id,e)}filterTree(t,e,s){const o=t.trim().toLowerCase().split(" "),l=[...e.values()].some(Boolean),n=d=>{const f=[...d.tests[0].titlePath(),...d.tests[0].tags].join(" ").toLowerCase();return!o.every(a=>f.includes(a))&&!d.tests.some(a=>s==null?void 0:s.has(a.id))?!1:(d.children=d.children.filter(a=>!l||(s==null?void 0:s.has(a.test.id))||e.get(a.status)),d.tests=d.children.map(a=>a.test),!!d.children.length)},m=d=>{const f=[];for(const a of d.children)a.kind==="case"?n(a)&&f.push(a):(m(a),(a.children.length||a.hasLoadErrors)&&f.push(a));d.children=f};m(this.rootItem)}_fileItem(t,e){if(t.length===0)return this.rootItem;const s=t.join(this.pathSeparator),o=this._treeItemById.get(s);if(o)return o;const l=this._fileItem(t.slice(0,t.length-1),!1),n={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:l,children:[],status:"none",hasLoadErrors:!1};return this._addChild(l,n),n}_defaultDescribeItem(){let t=this._treeItemById.get("<anonymous>");return t||(t={kind:"group",subKind:"describe",id:"<anonymous>",title:"<anonymous>",location:{file:"",line:0,column:0},duration:0,parent:this.rootItem,children:[],status:"none",hasLoadErrors:!1},this._addChild(this.rootItem,t)),t}sortAndPropagateStatus(){Rt(this.rootItem)}flattenForSingleProject(){const t=e=>{e.kind==="case"&&e.children.length===1?(e.project=e.children[0].project,e.test=e.children[0].test,e.children=[],this._treeItemByTestId.set(e.test.id,e)):e.children.forEach(t)};t(this.rootItem)}shortenRoot(){let t=this.rootItem;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];t.location=this.rootItem.location,this.rootItem=t}fileNames(){const t=new Set,e=s=>{s.kind==="group"&&s.subKind==="file"?t.add(s.id):s.children.forEach(e)};return e(this.rootItem),[...t]}flatTreeItems(){const t=[],e=s=>{t.push(s),s.children.forEach(e)};return e(this.rootItem),t}treeItemById(t){return this._treeItemById.get(t)}collectTestIds(t){return ue(t)}}function Rt(i){for(const n of i.children)Rt(n);i.kind==="group"&&i.children.sort((n,m)=>n.location.file.localeCompare(m.location.file)||n.location.line-m.location.line);let t=i.children.length>0,e=i.children.length>0,s=!1,o=!1,l=!1;for(const n of i.children)e=e&&n.status==="skipped",t=t&&(n.status==="passed"||n.status==="skipped"),s=s||n.status==="failed",o=o||n.status==="running",l=l||n.status==="scheduled";o?i.status="running":l?i.status="scheduled":s?i.status="failed":e?i.status="skipped":t&&(i.status="passed")}function ue(i){const t=new Set,e=new Set,s=o=>{if(o.kind!=="test"&&o.kind!=="case"){o.children.forEach(s);return}let l=o;for(;l&&l.parent&&!(l.kind==="group"&&l.subKind==="file");)l=l.parent;e.add(l.location.file),o.kind==="case"?o.tests.forEach(n=>t.add(n.id)):t.add(o.id)};return s(i),{testIds:t,locations:e}}const G=Symbol("statusEx");class he{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new pt(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:Tt(t.pathSeparator),clearPreviousResultsWhenTestBegins:!0}),this._options=t}_createReporter(){return{version:()=>"v2",onConfigure:t=>{this.config=t,this._lastRunReceiver=new pt({version:()=>"v2",onBegin:e=>{this._lastRunTestCount=e.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:Tt(this._options.pathSeparator)}),this._lastRunReceiver.dispatch({method:"onConfigure",params:{config:t}})},onBegin:t=>{var e;if(this.rootSuite||(this.rootSuite=t),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((e=this._testResultsSnapshot)==null?void 0:e.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(t,e)=>{e[G]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[G]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1}}processGlobalReport(t){const e=new pt({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of t)e.dispatch(s)}processListReport(t){var s;const e=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(e.map(o=>[o.id,o.results])),this._receiver.reset();for(const o of t)this._receiver.dispatch(o)}processTestReportEvent(t){var e,s,o;(s=(e=this._lastRunReceiver)==null?void 0:e.dispatch(t))==null||s.catch(()=>{}),(o=this._receiver.dispatch(t))==null||o.catch(()=>{})}_handleOnError(t){var e,s;this.loadErrors.push(t),(s=(e=this._options).onError)==null||s.call(e,t),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new Z("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}function Tt(i){return(t,e)=>{const s=[];for(const o of[...t.split(i),...e.split(i)]){const l=i==="\\"&&s.length===1&&s[0].endsWith(":"),n=!s.length;if(!(!o&&!n&&!l)&&o!=="."){if(o===".."){s.pop();continue}s.push(o)}}return s.join(i)}}const fe=({source:i})=>{const[t,e]=zt(),[s,o]=H.useState(Kt()),[l]=H.useState(Vt(()=>import("./assets/xtermModule-CsJ4vdCR.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),n=H.useRef(null);return H.useEffect(()=>($t(o),()=>Ht(o)),[]),H.useEffect(()=>{const m=i.write,d=i.clear;return(async()=>{const{Terminal:f,FitAddon:a}=await l,w=e.current;if(!w)return;const S=s==="dark-mode"?ge:pe;if(n.current&&n.current.terminal.options.theme===S)return;n.current&&(w.textContent="");const c=new f({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"monospace",theme:S}),k=new a;c.loadAddon(k);for(const _ of i.pending)c.write(_);i.write=(_=>{i.pending.push(_),c.write(_)}),i.clear=()=>{i.pending=[],c.clear()},c.open(w),k.fit(),n.current={terminal:c,fitAddon:k}})(),()=>{i.clear=d,i.write=m}},[l,n,e,i,s]),H.useEffect(()=>{setTimeout(()=>{n.current&&(n.current.fitAddon.fit(),i.resize(n.current.terminal.cols,n.current.terminal.rows))},250)},[t,i]),r.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},pe={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},ge={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"},me=({filterText:i,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:o,setProjectFilters:l,testModel:n,runTests:m})=>{const[d,f]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>{var c;(c=a.current)==null||c.focus()},[]);const w=[...e.entries()].filter(([c,k])=>k).map(([c])=>c).join(" ")||"all",S=[...o.entries()].filter(([c,k])=>k).map(([c])=>c).join(" ")||"all";return r.jsxs("div",{className:"filters",children:[r.jsx(qt,{expanded:d,setExpanded:f,title:r.jsx("input",{ref:a,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:c=>{t(c.target.value)},onKeyDown:c=>{c.key==="Enter"&&m()}})}),r.jsxs("div",{className:"filter-summary",title:"Status: "+w+`
|
|
3
|
+
Projects: `+S,onClick:()=>f(!d),children:[r.jsx("span",{className:"filter-label",children:"Status:"})," ",w,r.jsx("span",{className:"filter-label",children:"Projects:"})," ",S]}),d&&r.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[r.jsx("div",{className:"filter-list",role:"list","data-testid":"status-filters",children:[...e.entries()].map(([c,k])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>{const _=new Map(e);_.set(c,!_.get(c)),s(_)}}),r.jsx("div",{children:c})]})},c))}),r.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...o.entries()].map(([c,k])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>{var E;const _=new Map(o);_.set(c,!_.get(c)),l(_);const x=(E=n==null?void 0:n.config)==null?void 0:E.configFile;x&&It.setObject(x+":projects",[..._.entries()].filter(([b,D])=>D).map(([b])=>b))}}),r.jsx("div",{children:c||"untitled"})]})},c))})]})]})},_e=({tag:i,style:t,onClick:e})=>r.jsx("span",{className:mt("tag",`tag-color-${ve(i)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${i}`,children:i});function ve(i){let t=0;for(let e=0;e<i.length;e++)t=i.charCodeAt(e)+((t<<8)-t);return Math.abs(t%6)}const we=Yt,be=({filterText:i,testModel:t,testServerConnection:e,testTree:s,runTests:o,runningState:l,watchAll:n,watchedTreeIds:m,setWatchedTreeIds:d,isLoading:f,onItemSelected:a,requestedCollapseAllCount:w,requestedExpandAllCount:S,setFilterText:c,onRevealSource:k})=>{const[_,x]=u.useState({expandedItems:new Map}),[E,b]=u.useState(),[D,C]=u.useState(w),[U,tt]=u.useState(S);u.useEffect(()=>{if(D!==w){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!1);C(w),b(void 0),x({..._});return}if(U!==S){_.expandedItems.clear();for(const j of s.flatTreeItems())_.expandedItems.set(j.id,!0);tt(S),b(void 0),x({..._});return}if(!l||l.itemSelectedByUser)return;let h;const R=j=>{var M;j.children.forEach(R),!h&&j.status==="failed"&&(j.kind==="test"&&l.testIds.has(j.test.id)||j.kind==="case"&&l.testIds.has((M=j.tests[0])==null?void 0:M.id))&&(h=j)};R(s.rootItem),h&&b(h.id)},[l,b,s,D,C,w,U,tt,S,_,x]);const N=u.useMemo(()=>{if(E)return s.treeItemById(E)},[E,s]);u.useEffect(()=>{if(!t)return;const h=xe(N,t);let R;(N==null?void 0:N.kind)==="test"?R=N.test:(N==null?void 0:N.kind)==="case"&&N.tests.length===1&&(R=N.tests[0]),a({treeItem:N,testCase:R,testFile:h})},[t,N,a]),u.useEffect(()=>{if(!f)if(n)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const h=new Set;for(const R of m.value){const j=s.treeItemById(R),M=j==null?void 0:j.location.file;M&&h.add(M)}e==null||e.watchNoReply({fileNames:[...h]})}},[f,s,n,m,e]);const $=h=>{b(h.id),o("bounce-if-busy",s.collectTestIds(h))},K=(h,R)=>{if(h.preventDefault(),h.stopPropagation(),h.metaKey||h.ctrlKey){const j=i.split(" ");j.includes(R)?c(j.filter(M=>M!==R).join(" ").trim()):c((i+" "+R).trim())}else c((i.split(" ").filter(j=>!j.startsWith("@")).join(" ")+" "+R).trim())};return r.jsx(we,{name:"tests",treeState:_,setTreeState:x,rootItem:s.rootItem,dataTestId:"test-tree",render:h=>{const R=h.id.replace(/[^\w\d-_]/g,"-"),j=R+"-label",M=R+"-time";return r.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${j} ${M}`,children:[r.jsxs("div",{id:j,className:"ui-mode-tree-item-title",children:[r.jsx("span",{children:h.title}),h.kind==="case"?h.tags.map(Y=>r.jsx(_e,{tag:Y.slice(1),onClick:ct=>K(ct,Y)},Y)):null]}),!!h.duration&&h.status!=="skipped"&&r.jsx("div",{id:M,className:"ui-mode-tree-item-time",children:Xt(h.duration)}),r.jsxs(q,{noMinHeight:!0,noShadow:!0,children:[r.jsx(F,{icon:"play",title:"Run",onClick:()=>$(h),disabled:!!l&&!l.completed}),r.jsx(F,{icon:"go-to-file",title:"Show source",onClick:k,style:h.kind==="group"&&h.subKind==="folder"?{visibility:"hidden"}:{}}),!n&&r.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(h.id)?m.value.delete(h.id):m.value.add(h.id),d({...m})},toggled:m.value.has(h.id)})]})]})},icon:h=>Qt(h.status),title:h=>h.title,selectedItem:N,onAccepted:$,onSelected:h=>{l&&(l.itemSelectedByUser=!0),b(h.id)},isError:h=>h.kind==="group"?h.hasLoadErrors:!1,autoExpandDepth:i?5:1,noItemsMessage:f?"Loading…":"No tests"})};function xe(i,t){if(!(!i||!t))return{file:i.location.file,line:i.location.line,column:i.location.column,source:{errors:t.loadErrors.filter(e=>{var s;return((s=e.location)==null?void 0:s.file)===i.location.file}).map(e=>({line:e.location.line,message:e.message})),content:void 0}}}function Se(i){return`.playwright-artifacts-${i}`}const Te=({item:i,rootDir:t,onOpenExternally:e,revealSource:s,pathSeparator:o})=>{var w,S;const[l,n]=u.useState(void 0),[m,d]=u.useState(0),f=u.useRef(null),{outputDir:a}=u.useMemo(()=>({outputDir:i.testCase?ke(i.testCase):void 0}),[i]);return u.useEffect(()=>{var x,E;f.current&&clearTimeout(f.current);const c=(x=i.testCase)==null?void 0:x.results[0];if(!c){n(void 0);return}const k=c&&c.duration>=0&&c.attachments.find(b=>b.name==="trace");if(k&&k.path){kt(k.path).then(b=>n({model:b,isLive:!1}));return}if(!a){n(void 0);return}const _=[a,Se(c.workerIndex),"traces",`${(E=i.testCase)==null?void 0:E.id}.json`].join(o);return f.current=setTimeout(async()=>{try{const b=await kt(_);n({model:b,isLive:!0})}catch{const b=new yt("",[]);b.errorDescriptors.push(...c.errors.flatMap(D=>D.message?[{message:D.message}]:[])),n({model:b,isLive:!1})}finally{d(m+1)}},500),()=>{f.current&&clearTimeout(f.current)}},[a,i,n,m,d,o]),r.jsx(Jt,{model:l==null?void 0:l.model,showSourcesFirst:!0,rootDir:t,fallbackLocation:i.testFile,isLive:l==null?void 0:l.isLive,status:(w=i.treeItem)==null?void 0:w.status,annotations:((S=i.testCase)==null?void 0:S.annotations)??[],onOpenExternally:e,revealSource:s},"workbench")},ke=i=>{var t;for(let e=i.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir};async function kt(i){const t=new URLSearchParams;t.set("trace",i);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new yt(i,s)}let jt={cols:80};const z={pending:[],clear:()=>{},write:i=>z.pending.push(i),resize:()=>{}},A=new URLSearchParams(window.location.search),je=new URL(A.get("server")??"../",window.location.href),_t=new URL(A.get("ws"),je);_t.protocol=_t.protocol==="https:"?"wss:":"ws:";const B={args:A.getAll("arg"),grep:A.get("grep")||void 0,grepInvert:A.get("grepInvert")||void 0,projects:A.getAll("project"),workers:A.get("workers")||void 0,headed:A.has("headed"),updateSnapshots:A.get("updateSnapshots")||void 0,reporters:A.has("reporter")?A.getAll("reporter"):void 0,pathSeparator:A.get("pathSeparator")||"/"};B.updateSnapshots&&!["all","changed","none","missing"].includes(B.updateSnapshots)&&(B.updateSnapshots=void 0);const Et=navigator.platform==="MacIntel";function Ee(i){return i.startsWith("/")&&(i=i.substring(1)),i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ie=({})=>{var xt;const[i,t]=u.useState(""),[e,s]=u.useState(!1),[o,l]=u.useState(!1),[n,m]=u.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[d,f]=u.useState(new Map),[a,w]=u.useState(),[S,c]=u.useState(),[k,_]=u.useState({}),[x,E]=u.useState(!1),[b,D]=u.useState(),C=b&&!b.completed,[U,tt]=at("watch-all",!1),[N,$]=u.useState({value:new Set}),K=u.useRef(Promise.resolve()),h=u.useRef({testIds:new Set,locations:new Set}),[R,j]=u.useState(0),[M,Y]=u.useState(0),[ct,Bt]=u.useState(!1),[vt,wt]=u.useState(!0),[v,Ct]=u.useState(),[et,Nt]=u.useState(),[st,Pt]=u.useState(!1),[it,Lt]=u.useState(!1),[Dt,bt]=u.useState(!1),Mt=u.useCallback(()=>bt(!0),[bt]),[dt,Ft]=at("single-worker",!1),[ut,Ot]=at("updateSnapshots","missing"),[Q]=at("mergeFiles",!1),At=u.useRef(null),ot=u.useCallback(()=>{Ct(p=>(p==null||p.close(),new Zt(new Gt(_t))))},[]);u.useEffect(()=>{var p;(p=At.current)==null||p.focus(),E(!0),ot()},[ot]),u.useEffect(()=>{if(!v)return;const p=[v.onStdio(g=>{if(g.buffer){const T=atob(g.buffer);z.write(T)}else z.write(g.text);g.type==="stderr"&&l(!0)}),v.onClose(()=>Bt(!0))];return z.resize=(g,T)=>{jt={cols:g,rows:T},v.resizeTerminalNoReply({cols:g,rows:T})},()=>{for(const g of p)g.dispose()}},[v]),u.useEffect(()=>{if(!v)return;let p;const g=new he({onUpdate:T=>{clearTimeout(p),p=void 0,T?w(g.asModel()):p||(p=setTimeout(()=>{w(g.asModel())},250))},onError:T=>{z.write((T.stack||T.value||"")+`
|
|
4
|
+
`),l(!0)},pathSeparator:B.pathSeparator});return Nt(g),w(void 0),E(!0),$({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:T,report:y}=await v.runGlobalSetup({});if(g.processGlobalReport(y),T!=="passed")return;const P=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});g.processListReport(P.report),v.onReport(V=>{g.processTestReportEvent(V)});const{hasBrowsers:O}=await v.checkBrowsers({});wt(O)}finally{E(!1)}})(),()=>{clearTimeout(p)}},[v]),u.useEffect(()=>{if(!a)return;const{config:p,rootSuite:g}=a,T=p.configFile?It.getObject(p.configFile+":projects",void 0):void 0,y=new Map(d);for(const P of y.keys())g.suites.find(O=>O.title===P)||y.delete(P);for(const P of g.suites)y.has(P.title)||y.set(P.title,!!(T!=null&&T.includes(P.title)));!T&&y.size&&![...y.values()].includes(!0)&&y.set(y.entries().next().value[0],!0),(d.size!==y.size||[...d].some(([P,O])=>y.get(P)!==O))&&f(y)},[d,a]),u.useEffect(()=>{C&&(a!=null&&a.progress)?c(a.progress):a||c(void 0)},[a,C]);const{testTree:rt}=u.useMemo(()=>{if(!a)return{testTree:new gt("",new Z("","root"),[],d,B.pathSeparator,Q)};const p=new gt("",a.rootSuite,a.loadErrors,d,B.pathSeparator,Q);return p.filterTree(i,n,C?b==null?void 0:b.testIds:void 0),p.sortAndPropagateStatus(),p.shortenRoot(),p.flattenForSingleProject(),{testTree:p}},[i,a,n,d,b,C,Q]),X=u.useCallback((p,g)=>{if(!(!v||!a)&&!(p==="bounce-if-busy"&&C)){for(const T of g.testIds)h.current.testIds.add(T);for(const T of g.locations)h.current.locations.add(T);K.current=K.current.then(async()=>{var O,V,W;const{testIds:T,locations:y}=h.current;if(h.current={testIds:new Set,locations:new Set},!T.size)return;{for(const I of((O=a.rootSuite)==null?void 0:O.allTests())||[])if(T.has(I.id)){I.results=[];const L=I._createTestResult("pending");L[G]="scheduled"}w({...a})}const P=" ["+new Date().toLocaleTimeString()+"]";z.write("\x1B[2m—".repeat(Math.max(0,jt.cols-P.length))+P+"\x1B[22m"),c({total:0,passed:0,failed:0,skipped:0}),D({testIds:T}),await v.runTests({locations:[...y].map(Ee),grep:B.grep,grepInvert:B.grepInvert,testIds:[...T],projects:[...d].filter(([I,L])=>L).map(([I])=>I),updateSnapshots:ut,reporters:B.reporters,workers:dt?1:void 0,trace:"on"});for(const I of((V=a.rootSuite)==null?void 0:V.allTests())||[])((W=I.results[0])==null?void 0:W.duration)===-1&&(I.results=[]);w({...a}),D(I=>I?{...I,completed:!0}:void 0)})}},[d,C,a,v,ut,dt]),nt=u.useCallback(()=>X("bounce-if-busy",rt.collectTestIds(rt.rootItem)),[X,rt]);u.useEffect(()=>{if(!v||!et)return;const p=v.onTestFilesChanged(async g=>{if(K.current=K.current.then(async()=>{E(!0);try{const W=await v.listTests({projects:B.projects,locations:B.args,grep:B.grep,grepInvert:B.grepInvert});et.processListReport(W.report)}catch(W){console.log(W)}finally{E(!1)}}),await K.current,g.testFiles.length===0)return;const T=et.asModel(),y=new gt("",T.rootSuite,T.loadErrors,d,B.pathSeparator,Q),P=[],O=[],V=new Set(g.testFiles);if(U){const W=I=>{const L=I.location.file;if(L&&V.has(L)){const J=y.collectTestIds(I);P.push(...J.locations),O.push(...J.testIds)}I.kind==="group"&&I.subKind==="folder"&&I.children.forEach(W)};W(y.rootItem)}else for(const W of N.value){const I=y.treeItemById(W);if(!I)continue;let L=I;for(;!(L.kind==="group"&&(L.subKind==="file"||L.subKind==="folder"))&&L.parent;)L=L.parent;const J=L==null?void 0:L.location.file;if(J&&V.has(J)){const St=y.collectTestIds(I);P.push(...St.locations),O.push(...St.testIds)}}X("queue-if-busy",{locations:P,testIds:O})});return()=>p.dispose()},[X,v,U,N,et,d,Q]),u.useEffect(()=>{if(!v)return;const p=g=>{g.code==="Backquote"&&g.ctrlKey?(g.preventDefault(),s(!e)):g.code==="F5"&&g.shiftKey?(g.preventDefault(),v==null||v.stopTestsNoReply({})):g.code==="F5"&&(g.preventDefault(),nt())};return addEventListener("keydown",p),()=>{removeEventListener("keydown",p)}},[nt,ot,v,e]);const ht=u.useRef(null),Wt=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.showModal()},[]),ft=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.close()},[]),Ut=u.useCallback(p=>{ft(p),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));wt(g)})},[ft,v]);return r.jsxs("div",{className:"vbox ui-mode",children:[!vt&&r.jsxs("dialog",{ref:ht,children:[r.jsxs("div",{className:"title",children:[r.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),r.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",r.jsx("br",{}),"Would you like to run `playwright install`?",r.jsx("br",{}),r.jsx("button",{className:"button",onClick:Ut,children:"Install"}),r.jsx("button",{className:"button secondary",onClick:ft,children:"Dismiss"})]})]}),ct&&r.jsxs("div",{className:"disconnected",children:[r.jsx("div",{className:"title",children:"UI Mode disconnected"}),r.jsxs("div",{children:[r.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),r.jsx(te,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:r.jsxs("div",{className:"vbox",children:[r.jsxs("div",{className:mt("vbox",!e&&"hidden"),children:[r.jsxs(q,{children:[r.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),r.jsx(F,{icon:"circle-slash",title:"Clear output",onClick:()=>{z.clear(),l(!1)}}),r.jsx("div",{className:"spacer"}),r.jsx(F,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),r.jsx(fe,{source:z})]}),r.jsx("div",{className:mt("vbox",e&&"hidden"),children:r.jsx(Te,{pathSeparator:B.pathSeparator,item:k,rootDir:(xt=a==null?void 0:a.config)==null?void 0:xt.rootDir,revealSource:Dt,onOpenExternally:p=>v==null?void 0:v.openNoReply({location:{file:p.file,line:p.line,column:p.column}})})})]}),sidebar:r.jsxs("div",{className:"vbox ui-mode-sidebar",children:[r.jsxs(q,{noShadow:!0,noMinHeight:!0,children:[r.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),r.jsx("div",{className:"section-title",children:"Playwright"}),r.jsx(F,{icon:"refresh",title:"Reload",onClick:()=>ot(),disabled:C||x}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(F,{icon:"terminal",title:"Toggle output — "+(Et?"⌃`":"Ctrl + `"),toggled:e,onClick:()=>{s(!e)}}),o&&r.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!vt&&r.jsx(F,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Wt})]}),r.jsx(me,{filterText:i,setFilterText:t,statusFilters:n,setStatusFilters:m,projectFilters:d,setProjectFilters:f,testModel:a,runTests:nt}),r.jsxs(q,{className:"section-toolbar",noMinHeight:!0,children:[!C&&!S&&r.jsx("div",{className:"section-title",children:"Tests"}),!C&&S&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:[S.passed,"/",S.total," passed (",S.passed/S.total*100|0,"%)"]})}),C&&S&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:["Running ",S.passed,"/",b.testIds.size," passed (",S.passed/b.testIds.size*100|0,"%)"]})}),r.jsx(F,{icon:"play",title:"Run all — F5",onClick:nt,disabled:C||x}),r.jsx(F,{icon:"debug-stop",title:"Stop — "+(Et?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!C||x}),r.jsx(F,{icon:"eye",title:"Watch all",toggled:U,onClick:()=>{$({value:new Set}),tt(!U)}}),r.jsx(F,{icon:"collapse-all",title:"Collapse all",onClick:()=>{j(R+1)}}),r.jsx(F,{icon:"expand-all",title:"Expand all",onClick:()=>{Y(M+1)}})]}),r.jsx(be,{filterText:i,testModel:a,testTree:rt,testServerConnection:v,runningState:b,runTests:X,onItemSelected:_,watchAll:U,watchedTreeIds:N,setWatchedTreeIds:$,isLoading:x,requestedCollapseAllCount:R,requestedExpandAllCount:M,setFilterText:t,onRevealSource:Mt}),r.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Lt(!it),children:[r.jsx("span",{className:`codicon codicon-${it?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:it?"Hide Testing Options":"Show Testing Options"}),r.jsx("div",{className:"section-title",children:"Testing Options"})]}),it&&r.jsx(ee,{settings:[{type:"check",value:dt,set:Ft,name:"Single worker"},{type:"select",options:[{label:"All",value:"all"},{label:"Changed",value:"changed"},{label:"Missing",value:"missing"},{label:"None",value:"none"}],value:ut,set:Ot,name:"Update snapshots"}]}),r.jsxs(q,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Pt(!st),children:[r.jsx("span",{className:`codicon codicon-${st?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:st?"Hide Settings":"Show Settings"}),r.jsx("div",{className:"section-title",children:"Settings"})]}),st&&r.jsx(se,{location:"ui-mode"})]})})]})};(async()=>{if(ie(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
5
|
+
Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}oe.createRoot(document.querySelector("#root")).render(r.jsx(Ie,{}))})();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
<!DOCTYPE html>
|
|
3
|
+
<html lang="en" translate="no">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
|
+
<title>Playwright Test</title>
|
|
9
|
+
<script type="module" crossorigin src="./uiMode.DccP-sCl.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/defaultSettingsView-BSyixIDP.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="./defaultSettingsView.26324PFb.css">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="./uiMode.Btcz36p_.css">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
3
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
4
|
+
* https://github.com/chjj/term.js
|
|
5
|
+
* @license MIT
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
* Originally forked from (with the author's permission):
|
|
26
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
27
|
+
* http://bellard.org/jslinux/
|
|
28
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
29
|
+
* The original design remains. The terminal itself
|
|
30
|
+
* has been extended to include xterm CSI codes, among
|
|
31
|
+
* other features.
|
|
32
|
+
*/.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "playwright-ws-trace",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Adds WebSocket frame tracing to Playwright trace viewer",
|
|
5
|
+
"author": "kabaneridev",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/kabaneridev/playwright-ws-trace"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/kabaneridev/playwright-ws-trace#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/kabaneridev/playwright-ws-trace/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"playwright",
|
|
17
|
+
"websocket",
|
|
18
|
+
"trace",
|
|
19
|
+
"tracing",
|
|
20
|
+
"debugging",
|
|
21
|
+
"testing",
|
|
22
|
+
"e2e",
|
|
23
|
+
"automation"
|
|
24
|
+
],
|
|
25
|
+
"main": "src/index.js",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"postinstall": "node scripts/postinstall.js"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@playwright/test": ">=1.40.0"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"scripts/postinstall.js",
|
|
37
|
+
"dist/",
|
|
38
|
+
"src/",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall script for playwright-ws-trace
|
|
4
|
+
* Patches Playwright to add WebSocket frame tracing support
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const PACKAGE_ROOT = path.join(__dirname, '..');
|
|
11
|
+
|
|
12
|
+
// Colors for console output
|
|
13
|
+
const colors = {
|
|
14
|
+
green: '\x1b[32m',
|
|
15
|
+
yellow: '\x1b[33m',
|
|
16
|
+
red: '\x1b[31m',
|
|
17
|
+
cyan: '\x1b[36m',
|
|
18
|
+
reset: '\x1b[0m',
|
|
19
|
+
bold: '\x1b[1m',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function log(msg, color = 'reset') {
|
|
23
|
+
console.log(`${colors[color]}${msg}${colors.reset}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function findPlaywrightCore() {
|
|
27
|
+
const possiblePaths = [
|
|
28
|
+
path.join(process.cwd(), 'node_modules', 'playwright-core'),
|
|
29
|
+
path.join(process.cwd(), 'node_modules', '@playwright', 'test', 'node_modules', 'playwright-core'),
|
|
30
|
+
path.join(process.cwd(), '..', 'node_modules', 'playwright-core'),
|
|
31
|
+
path.join(process.cwd(), '..', '..', 'node_modules', 'playwright-core'),
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
for (const p of possiblePaths) {
|
|
35
|
+
if (fs.existsSync(p)) {
|
|
36
|
+
return p;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
const resolved = require.resolve('playwright-core/package.json', { paths: [process.cwd()] });
|
|
42
|
+
return path.dirname(resolved);
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function patchTracingJs(playwrightCorePath) {
|
|
49
|
+
const tracingPath = path.join(playwrightCorePath, 'lib', 'server', 'trace', 'recorder', 'tracing.js');
|
|
50
|
+
|
|
51
|
+
if (!fs.existsSync(tracingPath)) {
|
|
52
|
+
log(` File not found: ${tracingPath}`, 'red');
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let content = fs.readFileSync(tracingPath, 'utf-8');
|
|
57
|
+
|
|
58
|
+
// Check if already patched
|
|
59
|
+
if (content.includes('_startWebSocketTracing')) {
|
|
60
|
+
log(' tracing.js already patched ✓', 'cyan');
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 1. Add import for network module (after import_page)
|
|
65
|
+
const importMarker = 'var import_page = require("../../page");';
|
|
66
|
+
if (!content.includes(importMarker)) {
|
|
67
|
+
log(' Could not find import_page marker', 'red');
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
content = content.replace(
|
|
71
|
+
importMarker,
|
|
72
|
+
`${importMarker}\nvar import_network = require("../../network");`
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// 2. Add call to _startWebSocketTracing after _snapshotter?.start()
|
|
76
|
+
// Handle different formatting styles
|
|
77
|
+
const patterns = [
|
|
78
|
+
{
|
|
79
|
+
find: /await this\._snapshotter\?\.start\(\);\s*\n\s*return \{ traceName: this\._state\.traceName \};/,
|
|
80
|
+
replace: `await this._snapshotter?.start();
|
|
81
|
+
this._startWebSocketTracing();
|
|
82
|
+
return { traceName: this._state.traceName };`
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
let patched = false;
|
|
87
|
+
for (const pattern of patterns) {
|
|
88
|
+
if (pattern.find.test(content)) {
|
|
89
|
+
content = content.replace(pattern.find, pattern.replace);
|
|
90
|
+
patched = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!patched) {
|
|
96
|
+
log(' Could not find startChunk return statement', 'red');
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 3. Add WebSocket tracing methods before _allocateNewTraceFile
|
|
101
|
+
const wsTracingCode = `
|
|
102
|
+
_startWebSocketTracing() {
|
|
103
|
+
if (!(this._context instanceof import_browserContext.BrowserContext))
|
|
104
|
+
return;
|
|
105
|
+
for (const page of this._context.pages())
|
|
106
|
+
this._startWebSocketTracingInPage(page);
|
|
107
|
+
this._eventListeners.push(
|
|
108
|
+
import_eventsHelper.eventsHelper.addEventListener(this._context, import_browserContext.BrowserContext.Events.Page, this._startWebSocketTracingInPage.bind(this))
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
_startWebSocketTracingInPage(page) {
|
|
112
|
+
this._eventListeners.push(
|
|
113
|
+
import_eventsHelper.eventsHelper.addEventListener(page, import_page.Page.Events.WebSocket, (ws) => {
|
|
114
|
+
this._onWebSocketCreated(ws, page);
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
_onWebSocketCreated(ws, page) {
|
|
119
|
+
const wsGuid = ws.guid;
|
|
120
|
+
const event = {
|
|
121
|
+
type: "websocket-created",
|
|
122
|
+
wsGuid,
|
|
123
|
+
timestamp: (0, import_time.monotonicTime)(),
|
|
124
|
+
url: ws.url(),
|
|
125
|
+
pageId: page.guid
|
|
126
|
+
};
|
|
127
|
+
this._appendTraceEvent(event);
|
|
128
|
+
const frameListener = (frameEvent, direction) => {
|
|
129
|
+
const frameTraceEvent = {
|
|
130
|
+
type: "websocket-frame",
|
|
131
|
+
wsGuid,
|
|
132
|
+
timestamp: (0, import_time.monotonicTime)(),
|
|
133
|
+
opcode: frameEvent.opcode,
|
|
134
|
+
data: frameEvent.data,
|
|
135
|
+
direction
|
|
136
|
+
};
|
|
137
|
+
this._appendTraceEvent(frameTraceEvent);
|
|
138
|
+
};
|
|
139
|
+
this._eventListeners.push(
|
|
140
|
+
import_eventsHelper.eventsHelper.addEventListener(ws, import_network.WebSocket.Events.FrameSent, (e) => frameListener(e, "sent")),
|
|
141
|
+
import_eventsHelper.eventsHelper.addEventListener(ws, import_network.WebSocket.Events.FrameReceived, (e) => frameListener(e, "received")),
|
|
142
|
+
import_eventsHelper.eventsHelper.addEventListener(ws, import_network.WebSocket.Events.SocketError, (error) => {
|
|
143
|
+
const errorEvent = {
|
|
144
|
+
type: "websocket-error",
|
|
145
|
+
wsGuid,
|
|
146
|
+
timestamp: (0, import_time.monotonicTime)(),
|
|
147
|
+
error
|
|
148
|
+
};
|
|
149
|
+
this._appendTraceEvent(errorEvent);
|
|
150
|
+
}),
|
|
151
|
+
import_eventsHelper.eventsHelper.addEventListener(ws, import_network.WebSocket.Events.Close, () => {
|
|
152
|
+
const closeEvent = {
|
|
153
|
+
type: "websocket-closed",
|
|
154
|
+
wsGuid,
|
|
155
|
+
timestamp: (0, import_time.monotonicTime)()
|
|
156
|
+
};
|
|
157
|
+
this._appendTraceEvent(closeEvent);
|
|
158
|
+
})
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
|
|
163
|
+
const allocateMarker = '_allocateNewTraceFile(state) {';
|
|
164
|
+
if (content.includes(allocateMarker)) {
|
|
165
|
+
content = content.replace(
|
|
166
|
+
allocateMarker,
|
|
167
|
+
wsTracingCode + '\n ' + allocateMarker
|
|
168
|
+
);
|
|
169
|
+
} else {
|
|
170
|
+
log(' Could not find _allocateNewTraceFile marker', 'red');
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
fs.writeFileSync(tracingPath, content, 'utf-8');
|
|
175
|
+
log(' ✓ Patched tracing.js (WebSocket recording enabled)', 'green');
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function copyBuiltViewer(playwrightCorePath) {
|
|
180
|
+
// Copy pre-built trace viewer from our package if available
|
|
181
|
+
const prebuiltDir = path.join(PACKAGE_ROOT, 'dist', 'traceViewer');
|
|
182
|
+
const targetDir = path.join(playwrightCorePath, 'lib', 'vite', 'traceViewer');
|
|
183
|
+
|
|
184
|
+
if (fs.existsSync(prebuiltDir)) {
|
|
185
|
+
log(' Copying pre-built trace viewer with WebSocket support...', 'cyan');
|
|
186
|
+
copyDirRecursive(prebuiltDir, targetDir);
|
|
187
|
+
log(' ✓ Installed custom trace viewer', 'green');
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function patchTraceViewerBundle(playwrightCorePath) {
|
|
195
|
+
const assetsDir = path.join(playwrightCorePath, 'lib', 'vite', 'traceViewer', 'assets');
|
|
196
|
+
|
|
197
|
+
if (!fs.existsSync(assetsDir)) {
|
|
198
|
+
log(' Trace viewer assets not found', 'yellow');
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const files = fs.readdirSync(assetsDir);
|
|
203
|
+
const bundleFile = files.find(f => f.startsWith('defaultSettingsView-') && f.endsWith('.js'));
|
|
204
|
+
|
|
205
|
+
if (!bundleFile) {
|
|
206
|
+
log(' Bundle file not found', 'yellow');
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const bundlePath = path.join(assetsDir, bundleFile);
|
|
211
|
+
let content = fs.readFileSync(bundlePath, 'utf-8');
|
|
212
|
+
|
|
213
|
+
if (content.includes('"WS"')) {
|
|
214
|
+
log(' Trace viewer already has WS filter ✓', 'cyan');
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Add WS to resource types filter
|
|
219
|
+
const resourceTypesMarker = '"Fetch","HTML","JS","CSS","Font","Image"';
|
|
220
|
+
if (content.includes(resourceTypesMarker)) {
|
|
221
|
+
content = content.replace(
|
|
222
|
+
resourceTypesMarker,
|
|
223
|
+
'"Fetch","HTML","JS","CSS","Font","Image","WS"'
|
|
224
|
+
);
|
|
225
|
+
log(' ✓ Added WS filter to trace viewer', 'green');
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Add WS content type predicate
|
|
229
|
+
const predicatesPattern = /(Font:\w+=>\w+\.includes\("font"\),Image:\w+=>\w+\.includes\("image"\))/;
|
|
230
|
+
const match = content.match(predicatesPattern);
|
|
231
|
+
if (match) {
|
|
232
|
+
content = content.replace(
|
|
233
|
+
predicatesPattern,
|
|
234
|
+
'$1,WS:e=>e==="websocket"'
|
|
235
|
+
);
|
|
236
|
+
log(' ✓ Added WS type predicate', 'green');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
fs.writeFileSync(bundlePath, content, 'utf-8');
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function copyDirRecursive(src, dest) {
|
|
244
|
+
if (!fs.existsSync(dest)) {
|
|
245
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
249
|
+
|
|
250
|
+
for (const entry of entries) {
|
|
251
|
+
const srcPath = path.join(src, entry.name);
|
|
252
|
+
const destPath = path.join(dest, entry.name);
|
|
253
|
+
|
|
254
|
+
if (entry.isDirectory()) {
|
|
255
|
+
copyDirRecursive(srcPath, destPath);
|
|
256
|
+
} else {
|
|
257
|
+
fs.copyFileSync(srcPath, destPath);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function main() {
|
|
263
|
+
console.log('');
|
|
264
|
+
log('╔══════════════════════════════════════════════════════════════╗', 'cyan');
|
|
265
|
+
log('║ playwright-ws-trace - WebSocket Tracing ║', 'cyan');
|
|
266
|
+
log('╚══════════════════════════════════════════════════════════════╝', 'cyan');
|
|
267
|
+
console.log('');
|
|
268
|
+
|
|
269
|
+
const isPostInstall = process.env.npm_lifecycle_event === 'postinstall';
|
|
270
|
+
|
|
271
|
+
if (!isPostInstall && !process.argv.includes('--force')) {
|
|
272
|
+
log('Not running as postinstall. Use --force to run manually.', 'yellow');
|
|
273
|
+
log('Example: node scripts/postinstall.js --force', 'yellow');
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const playwrightCorePath = findPlaywrightCore();
|
|
278
|
+
|
|
279
|
+
if (!playwrightCorePath) {
|
|
280
|
+
log('⚠️ No Playwright installation found.', 'yellow');
|
|
281
|
+
log(' Install @playwright/test first, then reinstall this package.', 'yellow');
|
|
282
|
+
console.log('');
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
log(`Found playwright-core: ${playwrightCorePath}`, 'green');
|
|
287
|
+
console.log('');
|
|
288
|
+
log('Applying patches...', 'bold');
|
|
289
|
+
console.log('');
|
|
290
|
+
|
|
291
|
+
// Step 1: Patch recording (tracing.js) - this is the main feature
|
|
292
|
+
log('1. Patching WebSocket recording...', 'cyan');
|
|
293
|
+
const tracingSuccess = patchTracingJs(playwrightCorePath);
|
|
294
|
+
|
|
295
|
+
// Step 2: Try to install pre-built viewer, or patch the bundle minimally
|
|
296
|
+
log('2. Patching trace viewer...', 'cyan');
|
|
297
|
+
const viewerSuccess = copyBuiltViewer(playwrightCorePath) || patchTraceViewerBundle(playwrightCorePath);
|
|
298
|
+
|
|
299
|
+
console.log('');
|
|
300
|
+
|
|
301
|
+
if (tracingSuccess) {
|
|
302
|
+
log('═══════════════════════════════════════════════════════════════', 'green');
|
|
303
|
+
log('✓ Playwright WebSocket tracing enabled!', 'green');
|
|
304
|
+
log('═══════════════════════════════════════════════════════════════', 'green');
|
|
305
|
+
console.log('');
|
|
306
|
+
log('WebSocket frames will now be recorded in your traces.', 'cyan');
|
|
307
|
+
console.log('');
|
|
308
|
+
|
|
309
|
+
if (!viewerSuccess) {
|
|
310
|
+
log('ℹ️ Trace viewer: WS filter added, but full WebSocket panel requires', 'yellow');
|
|
311
|
+
log(' the custom-built viewer. Run: npx playwright-ws-trace view <trace.zip>', 'yellow');
|
|
312
|
+
} else {
|
|
313
|
+
log('ℹ️ Use npx playwright show-trace <trace.zip> to view traces', 'cyan');
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
log('═══════════════════════════════════════════════════════════════', 'red');
|
|
317
|
+
log('✗ Failed to patch Playwright', 'red');
|
|
318
|
+
log('═══════════════════════════════════════════════════════════════', 'red');
|
|
319
|
+
console.log('');
|
|
320
|
+
log('Your Playwright version may not be compatible.', 'yellow');
|
|
321
|
+
log('Tested with: @playwright/test ^1.40.0', 'yellow');
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
console.log('');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
main();
|
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* playwright-ws-trace
|
|
3
|
+
*
|
|
4
|
+
* Adds WebSocket frame tracing to Playwright.
|
|
5
|
+
* This package patches Playwright on postinstall to:
|
|
6
|
+
* - Record WebSocket frames during test execution
|
|
7
|
+
* - Display them in the trace viewer
|
|
8
|
+
*
|
|
9
|
+
* @see https://github.com/kabaneridev/playwright-ws-trace
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
name: 'playwright-ws-trace',
|
|
14
|
+
version: require('../package.json').version,
|
|
15
|
+
};
|