patchright-core 1.49.0 → 1.49.1
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/lib/server/chromium/crNetworkManager.js +1 -1
- package/lib/server/chromium/crPage.js +0 -4
- package/lib/server/frames.js +12 -35
- package/lib/vite/{traceViewer/assets/codeMirrorModule-KatbITLF.js → recorder/assets/codeMirrorModule-AFvV6hAs.js} +1 -1
- package/lib/vite/recorder/assets/{index-CqeZmzx8.js → index-_cTWgVuJ.js} +2 -2
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/{recorder/assets/codeMirrorModule-DUzBrnvO.js → traceViewer/assets/codeMirrorModule-BWCrdKft.js} +1 -1
- package/lib/vite/traceViewer/assets/{inspectorTab-DdpLd2bb.js → inspectorTab-C_9qyxv5.js} +3 -3
- package/lib/vite/traceViewer/assets/{workbench-CdYbzWFD.js → workbench-DsQEOQud.js} +1 -1
- package/lib/vite/traceViewer/{embedded.6m3UZh7r.js → embedded.D4x_-tXl.js} +1 -1
- package/lib/vite/traceViewer/embedded.html +3 -3
- package/lib/vite/traceViewer/{index.WUV-8boJ.js → index.BskMikzx.js} +1 -1
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/{recorder.OT2tVHgn.js → recorder.Dsk1wX5k.js} +1 -1
- package/lib/vite/traceViewer/recorder.html +2 -2
- package/lib/vite/traceViewer/{uiMode.BZBTyvGn.js → uiMode.CzKr-TMc.js} +1 -1
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as h,j as e,f as O,k as qt,l as Yt,n as Jt,o as St,m as B,T as ot,P as Q,C as Kt,L as Qt,p as Zt,u as dt,q as Ct,G as te,v as ee,w as se,x as ie,y as ne,h as wt,z as ae,A as re,B as ce,N as le,S as Nt,D as oe,E as bt,I as he,F as de}from"./inspectorTab-DdpLd2bb.js";const yt=new Map;function ue({name:t,rootItem:s,render:i,title:a,icon:u,isError:c,isVisible:r,selectedItem:n,onAccepted:d,onSelected:l,onHighlighted:o,treeState:x,setTreeState:m,noItemsMessage:j,dataTestId:N,autoExpandDepth:y}){const T=h.useMemo(()=>me(s,n,x.expandedItems,y||0,r),[s,n,x,y,r]),C=h.useRef(null),[k,L]=h.useState(),[S,w]=h.useState(!1);h.useEffect(()=>{o==null||o(k)},[o,k]),h.useEffect(()=>{const v=C.current;if(!v)return;const b=()=>{yt.set(t,v.scrollTop)};return v.addEventListener("scroll",b,{passive:!0}),()=>v.removeEventListener("scroll",b)},[t]),h.useEffect(()=>{C.current&&(C.current.scrollTop=yt.get(t)||0)},[t]);const R=h.useCallback(v=>{const{expanded:b}=T.get(v);if(b){for(let M=n;M;M=M.parent)if(M===v){l==null||l(v);break}x.expandedItems.set(v.id,!1)}else x.expandedItems.set(v.id,!0);m({...x})},[T,n,l,x,m]);return e.jsx("div",{className:O("tree-view vbox",t+"-tree-view"),role:"tree","data-testid":N||t+"-tree",children:e.jsxs("div",{className:O("tree-view-content"),tabIndex:0,onKeyDown:v=>{if(n&&v.key==="Enter"){d==null||d(n);return}if(v.key!=="ArrowDown"&&v.key!=="ArrowUp"&&v.key!=="ArrowLeft"&&v.key!=="ArrowRight")return;if(v.stopPropagation(),v.preventDefault(),n&&v.key==="ArrowLeft"){const{expanded:M,parent:p}=T.get(n);M?(x.expandedItems.set(n.id,!1),m({...x})):p&&(l==null||l(p));return}if(n&&v.key==="ArrowRight"){n.children.length&&(x.expandedItems.set(n.id,!0),m({...x}));return}let b=n;if(v.key==="ArrowDown"&&(n?b=T.get(n).next:T.size&&(b=[...T.keys()][0])),v.key==="ArrowUp"){if(n)b=T.get(n).prev;else if(T.size){const M=[...T.keys()];b=M[M.length-1]}}o==null||o(void 0),b&&(w(!0),l==null||l(b)),L(void 0)},ref:C,children:[j&&T.size===0&&e.jsx("div",{className:"tree-view-empty",children:j}),s.children.map(v=>T.get(v)&&e.jsx(Lt,{item:v,treeItems:T,selectedItem:n,onSelected:l,onAccepted:d,isError:c,toggleExpanded:R,highlightedItem:k,setHighlightedItem:L,render:i,icon:u,title:a,isKeyboardNavigation:S,setIsKeyboardNavigation:w},v.id))]})})}function Lt({item:t,treeItems:s,selectedItem:i,onSelected:a,highlightedItem:u,setHighlightedItem:c,isError:r,onAccepted:n,toggleExpanded:d,render:l,title:o,icon:x,isKeyboardNavigation:m,setIsKeyboardNavigation:j}){const N=h.useId(),y=h.useRef(null);h.useEffect(()=>{i===t&&m&&y.current&&(qt(y.current),j(!1))},[t,i,m,j]);const T=s.get(t),C=T.depth,k=T.expanded;let L="codicon-blank";typeof k=="boolean"&&(L=k?"codicon-chevron-down":"codicon-chevron-right");const S=l(t),w=k&&t.children.length?t.children:[],R=o==null?void 0:o(t),v=(x==null?void 0:x(t))||"codicon-blank";return e.jsxs("div",{ref:y,role:"treeitem","aria-selected":t===i,"aria-expanded":k,"aria-controls":N,title:R,className:"vbox",style:{flex:"none"},children:[e.jsxs("div",{onDoubleClick:()=>n==null?void 0:n(t),className:O("tree-view-entry",i===t&&"selected",u===t&&"highlighted",(r==null?void 0:r(t))&&"error"),onClick:()=>a==null?void 0:a(t),onMouseEnter:()=>c(t),onMouseLeave:()=>c(void 0),children:[C?new Array(C).fill(0).map((b,M)=>e.jsx("div",{className:"tree-view-indent"},"indent-"+M)):void 0,e.jsx("div",{"aria-hidden":"true",className:"codicon "+L,style:{minWidth:16,marginRight:4},onDoubleClick:b=>{b.preventDefault(),b.stopPropagation()},onClick:b=>{b.stopPropagation(),b.preventDefault(),d(t)}}),x&&e.jsx("div",{className:"codicon "+v,style:{minWidth:16,marginRight:4},"aria-label":"["+v.replace("codicon","icon")+"]"}),typeof S=="string"?e.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden"},children:S}):S]}),!!w.length&&e.jsx("div",{id:N,role:"group",children:w.map(b=>s.get(b)&&e.jsx(Lt,{item:b,treeItems:s,selectedItem:i,onSelected:a,onAccepted:n,isError:r,toggleExpanded:d,highlightedItem:u,setHighlightedItem:c,render:l,title:o,icon:x,isKeyboardNavigation:m,setIsKeyboardNavigation:j},b.id))})]})}function me(t,s,i,a,u){const c=new Map,r=new Set;for(let l=s==null?void 0:s.parent;l;l=l.parent)r.add(l.id);let n=null;const d=(l,o)=>{if(!(u&&!u(l)))for(const x of l.children){const m=r.has(x.id)||i.get(x.id),j=a>o&&c.size<25&&m!==!1,N=x.children.length?m??j:void 0,y={depth:o,expanded:N,parent:t===l?null:l,next:null,prev:n};n&&(c.get(n).next=x),n=x,c.set(x,y),N&&d(x,o+1)}};return d(t,0),c}const xe=ue,fe=({actions:t,selectedAction:s,selectedTime:i,setSelectedTime:a,sdkLanguage:u,onSelected:c,onHighlighted:r,revealConsole:n,revealAttachment:d,isLive:l})=>{const[o,x]=h.useState({expandedItems:new Map}),{rootItem:m,itemMap:j}=h.useMemo(()=>Yt(t),[t]),{selectedItem:N}=h.useMemo(()=>({selectedItem:s?j.get(s.callId):void 0}),[j,s]),y=h.useCallback(w=>{var R,v;return!!((v=(R=w.action)==null?void 0:R.error)!=null&&v.message)},[]),T=h.useCallback(w=>a({minimum:w.action.startTime,maximum:w.action.endTime}),[a]),C=h.useCallback(w=>ut(w.action,{sdkLanguage:u,revealConsole:n,revealAttachment:d,isLive:l,showDuration:!0,showBadges:!0}),[l,n,d,u]),k=h.useCallback(w=>!i||!w.action||w.action.startTime<=i.maximum&&w.action.endTime>=i.minimum,[i]),L=h.useCallback(w=>{c==null||c(w.action)},[c]),S=h.useCallback(w=>{r==null||r(w==null?void 0:w.action)},[r]);return e.jsxs("div",{className:"vbox",children:[i&&e.jsxs("div",{className:"action-list-show-all",onClick:()=>a(void 0),children:[e.jsx("span",{className:"codicon codicon-triangle-left"}),"Show all"]}),e.jsx(xe,{name:"actions",rootItem:m,treeState:o,setTreeState:x,selectedItem:N,onSelected:L,onHighlighted:S,onAccepted:T,isError:y,isVisible:k,render:C})]})},ut=(t,s)=>{var j;const{sdkLanguage:i,revealConsole:a,revealAttachment:u,isLive:c,showDuration:r,showBadges:n}=s,{errors:d,warnings:l}=Jt(t),o=t.params.selector?St(i||"javascript",t.params.selector):void 0,x=!!((j=t.attachments)!=null&&j.length)&&!!u;let m="";return t.endTime?m=B(t.endTime-t.startTime):t.error?m="Timed out":c||(m="-"),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"action-title",title:t.apiName,children:[e.jsx("span",{children:t.apiName}),o&&e.jsx("div",{className:"action-selector",title:o,children:o}),t.method==="goto"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:t.params.url}),t.class==="APIRequestContext"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:pe(t.params.url)})]}),(r||n||x)&&e.jsx("div",{className:"spacer"}),x&&e.jsx(ot,{icon:"attach",title:"Open Attachment",onClick:()=>u(t.attachments[0])}),r&&e.jsx("div",{className:"action-duration",children:m||e.jsx("span",{className:"codicon codicon-loading"})}),n&&e.jsxs("div",{className:"action-icons",onClick:()=>a==null?void 0:a(),children:[!!d&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-error"}),e.jsx("span",{className:"action-icon-value",children:d})]}),!!l&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-warning"}),e.jsx("span",{className:"action-icon-value",children:l})]})]})]})};function pe(t){try{const s=new URL(t);return s.pathname+s.search}catch{return t}}const ge=({action:t,sdkLanguage:s})=>{if(!t)return e.jsx(Q,{text:"No action selected"});const i={...t.params};delete i.info;const a=Object.keys(i),u=t.startTime+(t.context.wallTime-t.context.startTime),c=new Date(u).toLocaleString(),r=t.endTime?B(t.endTime-t.startTime):"Timed Out";return e.jsxs("div",{className:"call-tab",children:[e.jsx("div",{className:"call-line",children:t.apiName}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",children:"Time"}),c&&e.jsxs("div",{className:"call-line",children:["wall time:",e.jsx("span",{className:"call-value datetime",title:c,children:c})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value datetime",title:r,children:r})]})]}),!!a.length&&e.jsx("div",{className:"call-section",children:"Parameters"}),!!a.length&&a.map((n,d)=>Tt(kt(t,n,i[n],s),"param-"+d)),!!t.result&&e.jsx("div",{className:"call-section",children:"Return value"}),!!t.result&&Object.keys(t.result).map((n,d)=>Tt(kt(t,n,t.result[n],s),"result-"+d))]})};function Tt(t,s){let i=t.text.replace(/\n/g,"↵");return t.type==="string"&&(i=`"${i}"`),e.jsxs("div",{className:"call-line",children:[t.name,":",e.jsx("span",{className:O("call-value",t.type),title:t.text,children:i}),["string","number","object","locator"].includes(t.type)&&e.jsx(Kt,{value:t.text})]},s)}function kt(t,s,i,a){const u=t.method.includes("eval")||t.method==="waitForFunction";if(s==="files")return{text:"<files>",type:"string",name:s};if((s==="eventInit"||s==="expectedValue"||s==="arg"&&u)&&(i=et(i.value,new Array(10).fill({handle:"<handle>"}))),(s==="value"&&u||s==="received"&&t.method==="expect")&&(i=et(i,new Array(10).fill({handle:"<handle>"}))),s==="selector")return{text:St(a||"javascript",t.params.selector),type:"locator",name:"locator"};const c=typeof i;return c!=="object"||i===null?{text:String(i),type:c,name:s}:i.guid?{text:"<handle>",type:"handle",name:s}:{text:JSON.stringify(i).slice(0,1e3),type:"object",name:s}}function et(t,s){if(t.n!==void 0)return t.n;if(t.s!==void 0)return t.s;if(t.b!==void 0)return t.b;if(t.v!==void 0){if(t.v==="undefined")return;if(t.v==="null")return null;if(t.v==="NaN")return NaN;if(t.v==="Infinity")return 1/0;if(t.v==="-Infinity")return-1/0;if(t.v==="-0")return-0}if(t.d!==void 0)return new Date(t.d);if(t.r!==void 0)return new RegExp(t.r.p,t.r.f);if(t.a!==void 0)return t.a.map(i=>et(i,s));if(t.o!==void 0){const i={};for(const{k:a,v:u}of t.o)i[a]=et(u,s);return i}return t.h!==void 0?s===void 0?"<object>":s[t.h]:"<object>"}const ve=Qt,je=({action:t,isLive:s})=>{const i=h.useMemo(()=>{var r;if(!t||!t.log.length)return[];const a=t.log,u=t.context.wallTime-t.context.startTime,c=[];for(let n=0;n<a.length;++n){let d="";if(a[n].time!==-1){const l=(r=a[n])==null?void 0:r.time;n+1<a.length?d=B(a[n+1].time-l):t.endTime>0?d=B(t.endTime-l):s?d=B(Date.now()-u-l):d="-"}c.push({message:a[n].message,time:d})}return c},[t,s]);return i.length?e.jsx(ve,{name:"log",items:i,render:a=>e.jsxs("div",{className:"log-list-item",children:[e.jsx("span",{className:"log-list-duration",children:a.time}),a.message]}),notSelectable:!0}):e.jsx(Q,{text:"No log entries"})},we=({error:t})=>{const s=h.useMemo(()=>Zt(t),[t]);return e.jsx("div",{className:"error-message",dangerouslySetInnerHTML:{__html:s||""}})};function Ne(t){return h.useMemo(()=>{if(!t)return{errors:new Map};const s=new Map;for(const i of t.errorDescriptors)s.set(i.message,i);return{errors:s}},[t])}const be=({errorsModel:t,sdkLanguage:s,revealInSource:i})=>t.errors.size?e.jsx("div",{className:"fill",style:{overflow:"auto"},children:[...t.errors.entries()].map(([a,u])=>{var d;let c,r;const n=(d=u.stack)==null?void 0:d[0];return n&&(c=n.file.replace(/.*[/\\](.*)/,"$1")+":"+n.line,r=n.file+":"+n.line),e.jsxs("div",{children:[e.jsxs("div",{className:"hbox",style:{alignItems:"center",padding:"5px 10px",minHeight:36,fontWeight:"bold",color:"var(--vscode-errorForeground)"},children:[u.action&&ut(u.action,{sdkLanguage:s}),c&&e.jsxs("div",{className:"action-location",children:["@ ",e.jsx("span",{title:r,onClick:()=>i(u),children:c})]})]}),e.jsx(we,{error:a})]},a)})}):e.jsx(Q,{text:"No errors"}),zt={width:200,height:45},q=2.5,ye=zt.height+q*2,Te=({model:t,boundaries:s,previewPoint:i})=>{var o,x;const[a,u]=dt(),c=h.useRef(null);let r=0;if(c.current&&i){const m=c.current.getBoundingClientRect();r=(i.clientY-m.top+c.current.scrollTop)/ye|0}const n=(x=(o=t==null?void 0:t.pages)==null?void 0:o[r])==null?void 0:x.screencastFrames;let d,l;if(i!==void 0&&n&&n.length){const m=s.minimum+(s.maximum-s.minimum)*i.x/a.width;d=n[Ct(n,m,Rt)-1];const j={width:Math.min(800,window.innerWidth/2|0),height:Math.min(800,window.innerHeight/2|0)};l=d?Dt({width:d.width,height:d.height},j):void 0}return e.jsxs("div",{className:"film-strip",ref:u,children:[e.jsx("div",{className:"film-strip-lanes",ref:c,children:t==null?void 0:t.pages.map((m,j)=>m.screencastFrames.length?e.jsx(ke,{boundaries:s,page:m,width:a.width},j):null)}),(i==null?void 0:i.x)!==void 0&&e.jsxs("div",{className:"film-strip-hover",style:{top:a.bottom+5,left:Math.min(i.x,a.width-(l?l.width:0)-10)},children:[i.action&&e.jsx("div",{className:"film-strip-hover-title",children:ut(i.action,i)}),d&&l&&e.jsx("div",{style:{width:l.width,height:l.height},children:e.jsx("img",{src:`sha1/${d.sha1}`,width:l.width,height:l.height})})]})]})},ke=({boundaries:t,page:s,width:i})=>{const a={width:0,height:0},u=s.screencastFrames;for(const y of u)a.width=Math.max(a.width,y.width),a.height=Math.max(a.height,y.height);const c=Dt(a,zt),r=u[0].timestamp,n=u[u.length-1].timestamp,d=t.maximum-t.minimum,l=(r-t.minimum)/d*i,o=(t.maximum-n)/d*i,m=(n-r)/d*i/(c.width+2*q)|0,j=(n-r)/m,N=[];for(let y=0;r&&j&&y<m;++y){const T=r+j*y,C=Ct(u,T,Rt)-1;N.push(e.jsx("div",{className:"film-strip-frame",style:{width:c.width,height:c.height,backgroundImage:`url(sha1/${u[C].sha1})`,backgroundSize:`${c.width}px ${c.height}px`,margin:q,marginRight:q}},y))}return N.push(e.jsx("div",{className:"film-strip-frame",style:{width:c.width,height:c.height,backgroundImage:`url(sha1/${u[u.length-1].sha1})`,backgroundSize:`${c.width}px ${c.height}px`,margin:q,marginRight:q}},N.length)),e.jsx("div",{className:"film-strip-lane",style:{marginLeft:l+"px",marginRight:o+"px"},children:N})};function Rt(t,s){return t-s.timestamp}function Dt(t,s){const i=Math.max(t.width/s.width,t.height/s.height);return{width:t.width/i|0,height:t.height/i|0}}const Me=({model:t,boundaries:s,consoleEntries:i,onSelected:a,highlightedAction:u,highlightedEntry:c,highlightedConsoleEntry:r,selectedTime:n,setSelectedTime:d,sdkLanguage:l})=>{const[o,x]=dt(),[m,j]=h.useState(),[N,y]=h.useState(),{offsets:T,curtainLeft:C,curtainRight:k}=h.useMemo(()=>{let p=n||s;if(m&&m.startX!==m.endX){const W=X(o.width,s,m.startX),P=X(o.width,s,m.endX);p={minimum:Math.min(W,P),maximum:Math.max(W,P)}}const f=A(o.width,s,p.minimum),D=A(o.width,s,s.maximum)-A(o.width,s,p.maximum);return{offsets:Se(o.width,s),curtainLeft:f,curtainRight:D}},[n,s,m,o]),L=h.useMemo(()=>{const p=[];for(const f of(t==null?void 0:t.actions)||[])f.class!=="Test"&&p.push({action:f,leftTime:f.startTime,rightTime:f.endTime||s.maximum,leftPosition:A(o.width,s,f.startTime),rightPosition:A(o.width,s,f.endTime||s.maximum),active:!1,error:!!f.error});for(const f of(t==null?void 0:t.resources)||[]){const z=f._monotonicTime,D=f._monotonicTime+f.time;p.push({resource:f,leftTime:z,rightTime:D,leftPosition:A(o.width,s,z),rightPosition:A(o.width,s,D),active:!1,error:!1})}for(const f of i||[])p.push({consoleMessage:f,leftTime:f.timestamp,rightTime:f.timestamp,leftPosition:A(o.width,s,f.timestamp),rightPosition:A(o.width,s,f.timestamp),active:!1,error:f.isError});return p},[t,i,s,o]);h.useMemo(()=>{for(const p of L)u?p.active=p.action===u:c?p.active=p.resource===c:r?p.active=p.consoleMessage===r:p.active=!1},[L,u,c,r]);const S=h.useCallback(p=>{if(y(void 0),!x.current)return;const f=p.clientX-x.current.getBoundingClientRect().left,z=X(o.width,s,f),D=n?A(o.width,s,n.minimum):0,W=n?A(o.width,s,n.maximum):0;n&&Math.abs(f-D)<10?j({startX:W,endX:f,type:"resize"}):n&&Math.abs(f-W)<10?j({startX:D,endX:f,type:"resize"}):n&&z>n.minimum&&z<n.maximum&&p.clientY-x.current.getBoundingClientRect().top<20?j({startX:D,endX:W,pivot:f,type:"move"}):j({startX:f,endX:f,type:"resize"})},[s,o,x,n]),w=h.useCallback(p=>{if(!x.current)return;const f=p.clientX-x.current.getBoundingClientRect().left,z=X(o.width,s,f),D=t==null?void 0:t.actions.findLast(F=>F.startTime<=z);if(!p.buttons){j(void 0);return}if(D&&a(D),!m)return;let W=m;if(m.type==="resize")W={...m,endX:f};else{const F=f-m.pivot;let I=m.startX+F,$=m.endX+F;I<0&&(I=0,$=I+(m.endX-m.startX)),$>o.width&&($=o.width,I=$-(m.endX-m.startX)),W={...m,startX:I,endX:$,pivot:f}}j(W);const P=X(o.width,s,W.startX),H=X(o.width,s,W.endX);P!==H&&d({minimum:Math.min(P,H),maximum:Math.max(P,H)})},[s,m,o,t,a,x,d]),R=h.useCallback(()=>{if(y(void 0),!!m){if(m.startX!==m.endX){const p=X(o.width,s,m.startX),f=X(o.width,s,m.endX);d({minimum:Math.min(p,f),maximum:Math.max(p,f)})}else{const p=X(o.width,s,m.startX),f=t==null?void 0:t.actions.findLast(z=>z.startTime<=p);f&&a(f),d(void 0)}j(void 0)}},[s,m,o,t,d,a]),v=h.useCallback(p=>{if(!x.current)return;const f=p.clientX-x.current.getBoundingClientRect().left,z=X(o.width,s,f),D=t==null?void 0:t.actions.findLast(W=>W.startTime<=z);y({x:f,clientY:p.clientY,action:D,sdkLanguage:l})},[s,o,t,x,l]),b=h.useCallback(()=>{y(void 0)},[]),M=h.useCallback(()=>{d(void 0)},[d]);return e.jsxs("div",{style:{flex:"none",borderBottom:"1px solid var(--vscode-panel-border)"},children:[!!m&&e.jsx(te,{cursor:(m==null?void 0:m.type)==="resize"?"ew-resize":"grab",onPaneMouseUp:R,onPaneMouseMove:w,onPaneDoubleClick:M}),e.jsxs("div",{ref:x,className:"timeline-view",onMouseDown:S,onMouseMove:v,onMouseLeave:b,children:[e.jsx("div",{className:"timeline-grid",children:T.map((p,f)=>e.jsx("div",{className:"timeline-divider",style:{left:p.position+"px"},children:e.jsx("div",{className:"timeline-time",children:B(p.time-s.minimum)})},f))}),e.jsx("div",{style:{height:8}}),e.jsx(Te,{model:t,boundaries:s,previewPoint:N}),e.jsx("div",{className:"timeline-bars",children:L.map((p,f)=>e.jsx("div",{className:O("timeline-bar",p.action&&"action",p.resource&&"network",p.consoleMessage&&"console-message",p.active&&"active",p.error&&"error"),style:{left:p.leftPosition,width:Math.max(5,p.rightPosition-p.leftPosition),top:Ce(p),bottom:0}},f))}),e.jsx("div",{className:"timeline-marker",style:{display:N!==void 0?"block":"none",left:((N==null?void 0:N.x)||0)+"px"}}),n&&e.jsxs("div",{className:"timeline-window",children:[e.jsx("div",{className:"timeline-window-curtain left",style:{width:C}}),e.jsx("div",{className:"timeline-window-resizer",style:{left:-5}}),e.jsx("div",{className:"timeline-window-center",children:e.jsx("div",{className:"timeline-window-drag"})}),e.jsx("div",{className:"timeline-window-resizer",style:{left:5}}),e.jsx("div",{className:"timeline-window-curtain right",style:{width:k}})]})]})]})};function Se(t,s){let a=t/64;const u=s.maximum-s.minimum,c=t/u;let r=u/a;const n=Math.ceil(Math.log(r)/Math.LN10);r=Math.pow(10,n),r*c>=5*64&&(r=r/5),r*c>=2*64&&(r=r/2);const d=s.minimum;let l=s.maximum;l+=64/c,a=Math.ceil((l-d)/r),r||(a=0);const o=[];for(let x=0;x<a;++x){const m=d+r*x;o.push({position:A(t,s,m),time:m})}return o}function A(t,s,i){return(i-s.minimum)/(s.maximum-s.minimum)*t}function X(t,s,i){return i/t*(s.maximum-s.minimum)+s.minimum}function Ce(t){return t.resource?25:20}const Le=({model:t})=>{var s,i;return t?e.jsxs("div",{"data-testid":"metadata-view",className:"vbox",style:{flexShrink:0},children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Time"}),!!t.wallTime&&e.jsxs("div",{className:"call-line",children:["start time:",e.jsx("span",{className:"call-value datetime",title:new Date(t.wallTime).toLocaleString(),children:new Date(t.wallTime).toLocaleString()})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value number",title:B(t.endTime-t.startTime),children:B(t.endTime-t.startTime)})]}),e.jsx("div",{className:"call-section",children:"Browser"}),e.jsxs("div",{className:"call-line",children:["engine:",e.jsx("span",{className:"call-value string",title:t.browserName,children:t.browserName})]}),t.channel&&e.jsxs("div",{className:"call-line",children:["channel:",e.jsx("span",{className:"call-value string",title:t.channel,children:t.channel})]}),t.platform&&e.jsxs("div",{className:"call-line",children:["platform:",e.jsx("span",{className:"call-value string",title:t.platform,children:t.platform})]}),t.options.userAgent&&e.jsxs("div",{className:"call-line",children:["user agent:",e.jsx("span",{className:"call-value datetime",title:t.options.userAgent,children:t.options.userAgent})]}),t.options.baseURL&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Config"}),e.jsxs("div",{className:"call-line",children:["baseURL:",e.jsx("a",{className:"call-value string",href:t.options.baseURL,title:t.options.baseURL,target:"_blank",rel:"noopener noreferrer",children:t.options.baseURL})]})]}),e.jsx("div",{className:"call-section",children:"Viewport"}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["width:",e.jsx("span",{className:"call-value number",title:String(!!((s=t.options.viewport)!=null&&s.width)),children:t.options.viewport.width})]}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["height:",e.jsx("span",{className:"call-value number",title:String(!!((i=t.options.viewport)!=null&&i.height)),children:t.options.viewport.height})]}),e.jsxs("div",{className:"call-line",children:["is mobile:",e.jsx("span",{className:"call-value boolean",title:String(!!t.options.isMobile),children:String(!!t.options.isMobile)})]}),t.options.deviceScaleFactor&&e.jsxs("div",{className:"call-line",children:["device scale:",e.jsx("span",{className:"call-value number",title:String(t.options.deviceScaleFactor),children:String(t.options.deviceScaleFactor)})]}),e.jsx("div",{className:"call-section",children:"Counts"}),e.jsxs("div",{className:"call-line",children:["pages:",e.jsx("span",{className:"call-value number",children:t.pages.length})]}),e.jsxs("div",{className:"call-line",children:["actions:",e.jsx("span",{className:"call-value number",children:t.actions.length})]}),e.jsxs("div",{className:"call-line",children:["events:",e.jsx("span",{className:"call-value number",children:t.events.length})]})]}):e.jsx(e.Fragment,{})};async function lt(t){const s=new Image;return t&&(s.src=t,await new Promise((i,a)=>{s.onload=i,s.onerror=i})),s}const ht={backgroundImage:`linear-gradient(45deg, #80808020 25%, transparent 25%),
|
|
1
|
+
import{r as h,j as e,f as O,k as qt,l as Yt,n as Jt,o as St,m as B,T as ot,P as Q,C as Kt,L as Qt,p as Zt,u as dt,q as Ct,G as te,v as ee,w as se,x as ie,y as ne,h as wt,z as ae,A as re,B as ce,N as le,S as Nt,D as oe,E as bt,I as he,F as de}from"./inspectorTab-C_9qyxv5.js";const yt=new Map;function ue({name:t,rootItem:s,render:i,title:a,icon:u,isError:c,isVisible:r,selectedItem:n,onAccepted:d,onSelected:l,onHighlighted:o,treeState:x,setTreeState:m,noItemsMessage:j,dataTestId:N,autoExpandDepth:y}){const T=h.useMemo(()=>me(s,n,x.expandedItems,y||0,r),[s,n,x,y,r]),C=h.useRef(null),[k,L]=h.useState(),[S,w]=h.useState(!1);h.useEffect(()=>{o==null||o(k)},[o,k]),h.useEffect(()=>{const v=C.current;if(!v)return;const b=()=>{yt.set(t,v.scrollTop)};return v.addEventListener("scroll",b,{passive:!0}),()=>v.removeEventListener("scroll",b)},[t]),h.useEffect(()=>{C.current&&(C.current.scrollTop=yt.get(t)||0)},[t]);const R=h.useCallback(v=>{const{expanded:b}=T.get(v);if(b){for(let M=n;M;M=M.parent)if(M===v){l==null||l(v);break}x.expandedItems.set(v.id,!1)}else x.expandedItems.set(v.id,!0);m({...x})},[T,n,l,x,m]);return e.jsx("div",{className:O("tree-view vbox",t+"-tree-view"),role:"tree","data-testid":N||t+"-tree",children:e.jsxs("div",{className:O("tree-view-content"),tabIndex:0,onKeyDown:v=>{if(n&&v.key==="Enter"){d==null||d(n);return}if(v.key!=="ArrowDown"&&v.key!=="ArrowUp"&&v.key!=="ArrowLeft"&&v.key!=="ArrowRight")return;if(v.stopPropagation(),v.preventDefault(),n&&v.key==="ArrowLeft"){const{expanded:M,parent:p}=T.get(n);M?(x.expandedItems.set(n.id,!1),m({...x})):p&&(l==null||l(p));return}if(n&&v.key==="ArrowRight"){n.children.length&&(x.expandedItems.set(n.id,!0),m({...x}));return}let b=n;if(v.key==="ArrowDown"&&(n?b=T.get(n).next:T.size&&(b=[...T.keys()][0])),v.key==="ArrowUp"){if(n)b=T.get(n).prev;else if(T.size){const M=[...T.keys()];b=M[M.length-1]}}o==null||o(void 0),b&&(w(!0),l==null||l(b)),L(void 0)},ref:C,children:[j&&T.size===0&&e.jsx("div",{className:"tree-view-empty",children:j}),s.children.map(v=>T.get(v)&&e.jsx(Lt,{item:v,treeItems:T,selectedItem:n,onSelected:l,onAccepted:d,isError:c,toggleExpanded:R,highlightedItem:k,setHighlightedItem:L,render:i,icon:u,title:a,isKeyboardNavigation:S,setIsKeyboardNavigation:w},v.id))]})})}function Lt({item:t,treeItems:s,selectedItem:i,onSelected:a,highlightedItem:u,setHighlightedItem:c,isError:r,onAccepted:n,toggleExpanded:d,render:l,title:o,icon:x,isKeyboardNavigation:m,setIsKeyboardNavigation:j}){const N=h.useId(),y=h.useRef(null);h.useEffect(()=>{i===t&&m&&y.current&&(qt(y.current),j(!1))},[t,i,m,j]);const T=s.get(t),C=T.depth,k=T.expanded;let L="codicon-blank";typeof k=="boolean"&&(L=k?"codicon-chevron-down":"codicon-chevron-right");const S=l(t),w=k&&t.children.length?t.children:[],R=o==null?void 0:o(t),v=(x==null?void 0:x(t))||"codicon-blank";return e.jsxs("div",{ref:y,role:"treeitem","aria-selected":t===i,"aria-expanded":k,"aria-controls":N,title:R,className:"vbox",style:{flex:"none"},children:[e.jsxs("div",{onDoubleClick:()=>n==null?void 0:n(t),className:O("tree-view-entry",i===t&&"selected",u===t&&"highlighted",(r==null?void 0:r(t))&&"error"),onClick:()=>a==null?void 0:a(t),onMouseEnter:()=>c(t),onMouseLeave:()=>c(void 0),children:[C?new Array(C).fill(0).map((b,M)=>e.jsx("div",{className:"tree-view-indent"},"indent-"+M)):void 0,e.jsx("div",{"aria-hidden":"true",className:"codicon "+L,style:{minWidth:16,marginRight:4},onDoubleClick:b=>{b.preventDefault(),b.stopPropagation()},onClick:b=>{b.stopPropagation(),b.preventDefault(),d(t)}}),x&&e.jsx("div",{className:"codicon "+v,style:{minWidth:16,marginRight:4},"aria-label":"["+v.replace("codicon","icon")+"]"}),typeof S=="string"?e.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden"},children:S}):S]}),!!w.length&&e.jsx("div",{id:N,role:"group",children:w.map(b=>s.get(b)&&e.jsx(Lt,{item:b,treeItems:s,selectedItem:i,onSelected:a,onAccepted:n,isError:r,toggleExpanded:d,highlightedItem:u,setHighlightedItem:c,render:l,title:o,icon:x,isKeyboardNavigation:m,setIsKeyboardNavigation:j},b.id))})]})}function me(t,s,i,a,u){const c=new Map,r=new Set;for(let l=s==null?void 0:s.parent;l;l=l.parent)r.add(l.id);let n=null;const d=(l,o)=>{if(!(u&&!u(l)))for(const x of l.children){const m=r.has(x.id)||i.get(x.id),j=a>o&&c.size<25&&m!==!1,N=x.children.length?m??j:void 0,y={depth:o,expanded:N,parent:t===l?null:l,next:null,prev:n};n&&(c.get(n).next=x),n=x,c.set(x,y),N&&d(x,o+1)}};return d(t,0),c}const xe=ue,fe=({actions:t,selectedAction:s,selectedTime:i,setSelectedTime:a,sdkLanguage:u,onSelected:c,onHighlighted:r,revealConsole:n,revealAttachment:d,isLive:l})=>{const[o,x]=h.useState({expandedItems:new Map}),{rootItem:m,itemMap:j}=h.useMemo(()=>Yt(t),[t]),{selectedItem:N}=h.useMemo(()=>({selectedItem:s?j.get(s.callId):void 0}),[j,s]),y=h.useCallback(w=>{var R,v;return!!((v=(R=w.action)==null?void 0:R.error)!=null&&v.message)},[]),T=h.useCallback(w=>a({minimum:w.action.startTime,maximum:w.action.endTime}),[a]),C=h.useCallback(w=>ut(w.action,{sdkLanguage:u,revealConsole:n,revealAttachment:d,isLive:l,showDuration:!0,showBadges:!0}),[l,n,d,u]),k=h.useCallback(w=>!i||!w.action||w.action.startTime<=i.maximum&&w.action.endTime>=i.minimum,[i]),L=h.useCallback(w=>{c==null||c(w.action)},[c]),S=h.useCallback(w=>{r==null||r(w==null?void 0:w.action)},[r]);return e.jsxs("div",{className:"vbox",children:[i&&e.jsxs("div",{className:"action-list-show-all",onClick:()=>a(void 0),children:[e.jsx("span",{className:"codicon codicon-triangle-left"}),"Show all"]}),e.jsx(xe,{name:"actions",rootItem:m,treeState:o,setTreeState:x,selectedItem:N,onSelected:L,onHighlighted:S,onAccepted:T,isError:y,isVisible:k,render:C})]})},ut=(t,s)=>{var j;const{sdkLanguage:i,revealConsole:a,revealAttachment:u,isLive:c,showDuration:r,showBadges:n}=s,{errors:d,warnings:l}=Jt(t),o=t.params.selector?St(i||"javascript",t.params.selector):void 0,x=!!((j=t.attachments)!=null&&j.length)&&!!u;let m="";return t.endTime?m=B(t.endTime-t.startTime):t.error?m="Timed out":c||(m="-"),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"action-title",title:t.apiName,children:[e.jsx("span",{children:t.apiName}),o&&e.jsx("div",{className:"action-selector",title:o,children:o}),t.method==="goto"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:t.params.url}),t.class==="APIRequestContext"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:pe(t.params.url)})]}),(r||n||x)&&e.jsx("div",{className:"spacer"}),x&&e.jsx(ot,{icon:"attach",title:"Open Attachment",onClick:()=>u(t.attachments[0])}),r&&e.jsx("div",{className:"action-duration",children:m||e.jsx("span",{className:"codicon codicon-loading"})}),n&&e.jsxs("div",{className:"action-icons",onClick:()=>a==null?void 0:a(),children:[!!d&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-error"}),e.jsx("span",{className:"action-icon-value",children:d})]}),!!l&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-warning"}),e.jsx("span",{className:"action-icon-value",children:l})]})]})]})};function pe(t){try{const s=new URL(t);return s.pathname+s.search}catch{return t}}const ge=({action:t,sdkLanguage:s})=>{if(!t)return e.jsx(Q,{text:"No action selected"});const i={...t.params};delete i.info;const a=Object.keys(i),u=t.startTime+(t.context.wallTime-t.context.startTime),c=new Date(u).toLocaleString(),r=t.endTime?B(t.endTime-t.startTime):"Timed Out";return e.jsxs("div",{className:"call-tab",children:[e.jsx("div",{className:"call-line",children:t.apiName}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",children:"Time"}),c&&e.jsxs("div",{className:"call-line",children:["wall time:",e.jsx("span",{className:"call-value datetime",title:c,children:c})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value datetime",title:r,children:r})]})]}),!!a.length&&e.jsx("div",{className:"call-section",children:"Parameters"}),!!a.length&&a.map((n,d)=>Tt(kt(t,n,i[n],s),"param-"+d)),!!t.result&&e.jsx("div",{className:"call-section",children:"Return value"}),!!t.result&&Object.keys(t.result).map((n,d)=>Tt(kt(t,n,t.result[n],s),"result-"+d))]})};function Tt(t,s){let i=t.text.replace(/\n/g,"↵");return t.type==="string"&&(i=`"${i}"`),e.jsxs("div",{className:"call-line",children:[t.name,":",e.jsx("span",{className:O("call-value",t.type),title:t.text,children:i}),["string","number","object","locator"].includes(t.type)&&e.jsx(Kt,{value:t.text})]},s)}function kt(t,s,i,a){const u=t.method.includes("eval")||t.method==="waitForFunction";if(s==="files")return{text:"<files>",type:"string",name:s};if((s==="eventInit"||s==="expectedValue"||s==="arg"&&u)&&(i=et(i.value,new Array(10).fill({handle:"<handle>"}))),(s==="value"&&u||s==="received"&&t.method==="expect")&&(i=et(i,new Array(10).fill({handle:"<handle>"}))),s==="selector")return{text:St(a||"javascript",t.params.selector),type:"locator",name:"locator"};const c=typeof i;return c!=="object"||i===null?{text:String(i),type:c,name:s}:i.guid?{text:"<handle>",type:"handle",name:s}:{text:JSON.stringify(i).slice(0,1e3),type:"object",name:s}}function et(t,s){if(t.n!==void 0)return t.n;if(t.s!==void 0)return t.s;if(t.b!==void 0)return t.b;if(t.v!==void 0){if(t.v==="undefined")return;if(t.v==="null")return null;if(t.v==="NaN")return NaN;if(t.v==="Infinity")return 1/0;if(t.v==="-Infinity")return-1/0;if(t.v==="-0")return-0}if(t.d!==void 0)return new Date(t.d);if(t.r!==void 0)return new RegExp(t.r.p,t.r.f);if(t.a!==void 0)return t.a.map(i=>et(i,s));if(t.o!==void 0){const i={};for(const{k:a,v:u}of t.o)i[a]=et(u,s);return i}return t.h!==void 0?s===void 0?"<object>":s[t.h]:"<object>"}const ve=Qt,je=({action:t,isLive:s})=>{const i=h.useMemo(()=>{var r;if(!t||!t.log.length)return[];const a=t.log,u=t.context.wallTime-t.context.startTime,c=[];for(let n=0;n<a.length;++n){let d="";if(a[n].time!==-1){const l=(r=a[n])==null?void 0:r.time;n+1<a.length?d=B(a[n+1].time-l):t.endTime>0?d=B(t.endTime-l):s?d=B(Date.now()-u-l):d="-"}c.push({message:a[n].message,time:d})}return c},[t,s]);return i.length?e.jsx(ve,{name:"log",items:i,render:a=>e.jsxs("div",{className:"log-list-item",children:[e.jsx("span",{className:"log-list-duration",children:a.time}),a.message]}),notSelectable:!0}):e.jsx(Q,{text:"No log entries"})},we=({error:t})=>{const s=h.useMemo(()=>Zt(t),[t]);return e.jsx("div",{className:"error-message",dangerouslySetInnerHTML:{__html:s||""}})};function Ne(t){return h.useMemo(()=>{if(!t)return{errors:new Map};const s=new Map;for(const i of t.errorDescriptors)s.set(i.message,i);return{errors:s}},[t])}const be=({errorsModel:t,sdkLanguage:s,revealInSource:i})=>t.errors.size?e.jsx("div",{className:"fill",style:{overflow:"auto"},children:[...t.errors.entries()].map(([a,u])=>{var d;let c,r;const n=(d=u.stack)==null?void 0:d[0];return n&&(c=n.file.replace(/.*[/\\](.*)/,"$1")+":"+n.line,r=n.file+":"+n.line),e.jsxs("div",{children:[e.jsxs("div",{className:"hbox",style:{alignItems:"center",padding:"5px 10px",minHeight:36,fontWeight:"bold",color:"var(--vscode-errorForeground)"},children:[u.action&&ut(u.action,{sdkLanguage:s}),c&&e.jsxs("div",{className:"action-location",children:["@ ",e.jsx("span",{title:r,onClick:()=>i(u),children:c})]})]}),e.jsx(we,{error:a})]},a)})}):e.jsx(Q,{text:"No errors"}),zt={width:200,height:45},q=2.5,ye=zt.height+q*2,Te=({model:t,boundaries:s,previewPoint:i})=>{var o,x;const[a,u]=dt(),c=h.useRef(null);let r=0;if(c.current&&i){const m=c.current.getBoundingClientRect();r=(i.clientY-m.top+c.current.scrollTop)/ye|0}const n=(x=(o=t==null?void 0:t.pages)==null?void 0:o[r])==null?void 0:x.screencastFrames;let d,l;if(i!==void 0&&n&&n.length){const m=s.minimum+(s.maximum-s.minimum)*i.x/a.width;d=n[Ct(n,m,Rt)-1];const j={width:Math.min(800,window.innerWidth/2|0),height:Math.min(800,window.innerHeight/2|0)};l=d?Dt({width:d.width,height:d.height},j):void 0}return e.jsxs("div",{className:"film-strip",ref:u,children:[e.jsx("div",{className:"film-strip-lanes",ref:c,children:t==null?void 0:t.pages.map((m,j)=>m.screencastFrames.length?e.jsx(ke,{boundaries:s,page:m,width:a.width},j):null)}),(i==null?void 0:i.x)!==void 0&&e.jsxs("div",{className:"film-strip-hover",style:{top:a.bottom+5,left:Math.min(i.x,a.width-(l?l.width:0)-10)},children:[i.action&&e.jsx("div",{className:"film-strip-hover-title",children:ut(i.action,i)}),d&&l&&e.jsx("div",{style:{width:l.width,height:l.height},children:e.jsx("img",{src:`sha1/${d.sha1}`,width:l.width,height:l.height})})]})]})},ke=({boundaries:t,page:s,width:i})=>{const a={width:0,height:0},u=s.screencastFrames;for(const y of u)a.width=Math.max(a.width,y.width),a.height=Math.max(a.height,y.height);const c=Dt(a,zt),r=u[0].timestamp,n=u[u.length-1].timestamp,d=t.maximum-t.minimum,l=(r-t.minimum)/d*i,o=(t.maximum-n)/d*i,m=(n-r)/d*i/(c.width+2*q)|0,j=(n-r)/m,N=[];for(let y=0;r&&j&&y<m;++y){const T=r+j*y,C=Ct(u,T,Rt)-1;N.push(e.jsx("div",{className:"film-strip-frame",style:{width:c.width,height:c.height,backgroundImage:`url(sha1/${u[C].sha1})`,backgroundSize:`${c.width}px ${c.height}px`,margin:q,marginRight:q}},y))}return N.push(e.jsx("div",{className:"film-strip-frame",style:{width:c.width,height:c.height,backgroundImage:`url(sha1/${u[u.length-1].sha1})`,backgroundSize:`${c.width}px ${c.height}px`,margin:q,marginRight:q}},N.length)),e.jsx("div",{className:"film-strip-lane",style:{marginLeft:l+"px",marginRight:o+"px"},children:N})};function Rt(t,s){return t-s.timestamp}function Dt(t,s){const i=Math.max(t.width/s.width,t.height/s.height);return{width:t.width/i|0,height:t.height/i|0}}const Me=({model:t,boundaries:s,consoleEntries:i,onSelected:a,highlightedAction:u,highlightedEntry:c,highlightedConsoleEntry:r,selectedTime:n,setSelectedTime:d,sdkLanguage:l})=>{const[o,x]=dt(),[m,j]=h.useState(),[N,y]=h.useState(),{offsets:T,curtainLeft:C,curtainRight:k}=h.useMemo(()=>{let p=n||s;if(m&&m.startX!==m.endX){const W=X(o.width,s,m.startX),P=X(o.width,s,m.endX);p={minimum:Math.min(W,P),maximum:Math.max(W,P)}}const f=A(o.width,s,p.minimum),D=A(o.width,s,s.maximum)-A(o.width,s,p.maximum);return{offsets:Se(o.width,s),curtainLeft:f,curtainRight:D}},[n,s,m,o]),L=h.useMemo(()=>{const p=[];for(const f of(t==null?void 0:t.actions)||[])f.class!=="Test"&&p.push({action:f,leftTime:f.startTime,rightTime:f.endTime||s.maximum,leftPosition:A(o.width,s,f.startTime),rightPosition:A(o.width,s,f.endTime||s.maximum),active:!1,error:!!f.error});for(const f of(t==null?void 0:t.resources)||[]){const z=f._monotonicTime,D=f._monotonicTime+f.time;p.push({resource:f,leftTime:z,rightTime:D,leftPosition:A(o.width,s,z),rightPosition:A(o.width,s,D),active:!1,error:!1})}for(const f of i||[])p.push({consoleMessage:f,leftTime:f.timestamp,rightTime:f.timestamp,leftPosition:A(o.width,s,f.timestamp),rightPosition:A(o.width,s,f.timestamp),active:!1,error:f.isError});return p},[t,i,s,o]);h.useMemo(()=>{for(const p of L)u?p.active=p.action===u:c?p.active=p.resource===c:r?p.active=p.consoleMessage===r:p.active=!1},[L,u,c,r]);const S=h.useCallback(p=>{if(y(void 0),!x.current)return;const f=p.clientX-x.current.getBoundingClientRect().left,z=X(o.width,s,f),D=n?A(o.width,s,n.minimum):0,W=n?A(o.width,s,n.maximum):0;n&&Math.abs(f-D)<10?j({startX:W,endX:f,type:"resize"}):n&&Math.abs(f-W)<10?j({startX:D,endX:f,type:"resize"}):n&&z>n.minimum&&z<n.maximum&&p.clientY-x.current.getBoundingClientRect().top<20?j({startX:D,endX:W,pivot:f,type:"move"}):j({startX:f,endX:f,type:"resize"})},[s,o,x,n]),w=h.useCallback(p=>{if(!x.current)return;const f=p.clientX-x.current.getBoundingClientRect().left,z=X(o.width,s,f),D=t==null?void 0:t.actions.findLast(F=>F.startTime<=z);if(!p.buttons){j(void 0);return}if(D&&a(D),!m)return;let W=m;if(m.type==="resize")W={...m,endX:f};else{const F=f-m.pivot;let I=m.startX+F,$=m.endX+F;I<0&&(I=0,$=I+(m.endX-m.startX)),$>o.width&&($=o.width,I=$-(m.endX-m.startX)),W={...m,startX:I,endX:$,pivot:f}}j(W);const P=X(o.width,s,W.startX),H=X(o.width,s,W.endX);P!==H&&d({minimum:Math.min(P,H),maximum:Math.max(P,H)})},[s,m,o,t,a,x,d]),R=h.useCallback(()=>{if(y(void 0),!!m){if(m.startX!==m.endX){const p=X(o.width,s,m.startX),f=X(o.width,s,m.endX);d({minimum:Math.min(p,f),maximum:Math.max(p,f)})}else{const p=X(o.width,s,m.startX),f=t==null?void 0:t.actions.findLast(z=>z.startTime<=p);f&&a(f),d(void 0)}j(void 0)}},[s,m,o,t,d,a]),v=h.useCallback(p=>{if(!x.current)return;const f=p.clientX-x.current.getBoundingClientRect().left,z=X(o.width,s,f),D=t==null?void 0:t.actions.findLast(W=>W.startTime<=z);y({x:f,clientY:p.clientY,action:D,sdkLanguage:l})},[s,o,t,x,l]),b=h.useCallback(()=>{y(void 0)},[]),M=h.useCallback(()=>{d(void 0)},[d]);return e.jsxs("div",{style:{flex:"none",borderBottom:"1px solid var(--vscode-panel-border)"},children:[!!m&&e.jsx(te,{cursor:(m==null?void 0:m.type)==="resize"?"ew-resize":"grab",onPaneMouseUp:R,onPaneMouseMove:w,onPaneDoubleClick:M}),e.jsxs("div",{ref:x,className:"timeline-view",onMouseDown:S,onMouseMove:v,onMouseLeave:b,children:[e.jsx("div",{className:"timeline-grid",children:T.map((p,f)=>e.jsx("div",{className:"timeline-divider",style:{left:p.position+"px"},children:e.jsx("div",{className:"timeline-time",children:B(p.time-s.minimum)})},f))}),e.jsx("div",{style:{height:8}}),e.jsx(Te,{model:t,boundaries:s,previewPoint:N}),e.jsx("div",{className:"timeline-bars",children:L.map((p,f)=>e.jsx("div",{className:O("timeline-bar",p.action&&"action",p.resource&&"network",p.consoleMessage&&"console-message",p.active&&"active",p.error&&"error"),style:{left:p.leftPosition,width:Math.max(5,p.rightPosition-p.leftPosition),top:Ce(p),bottom:0}},f))}),e.jsx("div",{className:"timeline-marker",style:{display:N!==void 0?"block":"none",left:((N==null?void 0:N.x)||0)+"px"}}),n&&e.jsxs("div",{className:"timeline-window",children:[e.jsx("div",{className:"timeline-window-curtain left",style:{width:C}}),e.jsx("div",{className:"timeline-window-resizer",style:{left:-5}}),e.jsx("div",{className:"timeline-window-center",children:e.jsx("div",{className:"timeline-window-drag"})}),e.jsx("div",{className:"timeline-window-resizer",style:{left:5}}),e.jsx("div",{className:"timeline-window-curtain right",style:{width:k}})]})]})]})};function Se(t,s){let a=t/64;const u=s.maximum-s.minimum,c=t/u;let r=u/a;const n=Math.ceil(Math.log(r)/Math.LN10);r=Math.pow(10,n),r*c>=5*64&&(r=r/5),r*c>=2*64&&(r=r/2);const d=s.minimum;let l=s.maximum;l+=64/c,a=Math.ceil((l-d)/r),r||(a=0);const o=[];for(let x=0;x<a;++x){const m=d+r*x;o.push({position:A(t,s,m),time:m})}return o}function A(t,s,i){return(i-s.minimum)/(s.maximum-s.minimum)*t}function X(t,s,i){return i/t*(s.maximum-s.minimum)+s.minimum}function Ce(t){return t.resource?25:20}const Le=({model:t})=>{var s,i;return t?e.jsxs("div",{"data-testid":"metadata-view",className:"vbox",style:{flexShrink:0},children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Time"}),!!t.wallTime&&e.jsxs("div",{className:"call-line",children:["start time:",e.jsx("span",{className:"call-value datetime",title:new Date(t.wallTime).toLocaleString(),children:new Date(t.wallTime).toLocaleString()})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value number",title:B(t.endTime-t.startTime),children:B(t.endTime-t.startTime)})]}),e.jsx("div",{className:"call-section",children:"Browser"}),e.jsxs("div",{className:"call-line",children:["engine:",e.jsx("span",{className:"call-value string",title:t.browserName,children:t.browserName})]}),t.channel&&e.jsxs("div",{className:"call-line",children:["channel:",e.jsx("span",{className:"call-value string",title:t.channel,children:t.channel})]}),t.platform&&e.jsxs("div",{className:"call-line",children:["platform:",e.jsx("span",{className:"call-value string",title:t.platform,children:t.platform})]}),t.options.userAgent&&e.jsxs("div",{className:"call-line",children:["user agent:",e.jsx("span",{className:"call-value datetime",title:t.options.userAgent,children:t.options.userAgent})]}),t.options.baseURL&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Config"}),e.jsxs("div",{className:"call-line",children:["baseURL:",e.jsx("a",{className:"call-value string",href:t.options.baseURL,title:t.options.baseURL,target:"_blank",rel:"noopener noreferrer",children:t.options.baseURL})]})]}),e.jsx("div",{className:"call-section",children:"Viewport"}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["width:",e.jsx("span",{className:"call-value number",title:String(!!((s=t.options.viewport)!=null&&s.width)),children:t.options.viewport.width})]}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["height:",e.jsx("span",{className:"call-value number",title:String(!!((i=t.options.viewport)!=null&&i.height)),children:t.options.viewport.height})]}),e.jsxs("div",{className:"call-line",children:["is mobile:",e.jsx("span",{className:"call-value boolean",title:String(!!t.options.isMobile),children:String(!!t.options.isMobile)})]}),t.options.deviceScaleFactor&&e.jsxs("div",{className:"call-line",children:["device scale:",e.jsx("span",{className:"call-value number",title:String(t.options.deviceScaleFactor),children:String(t.options.deviceScaleFactor)})]}),e.jsx("div",{className:"call-section",children:"Counts"}),e.jsxs("div",{className:"call-line",children:["pages:",e.jsx("span",{className:"call-value number",children:t.pages.length})]}),e.jsxs("div",{className:"call-line",children:["actions:",e.jsx("span",{className:"call-value number",children:t.actions.length})]}),e.jsxs("div",{className:"call-line",children:["events:",e.jsx("span",{className:"call-value number",children:t.events.length})]})]}):e.jsx(e.Fragment,{})};async function lt(t){const s=new Image;return t&&(s.src=t,await new Promise((i,a)=>{s.onload=i,s.onerror=i})),s}const ht={backgroundImage:`linear-gradient(45deg, #80808020 25%, transparent 25%),
|
|
2
2
|
linear-gradient(-45deg, #80808020 25%, transparent 25%),
|
|
3
3
|
linear-gradient(45deg, transparent 75%, #80808020 75%),
|
|
4
4
|
linear-gradient(-45deg, transparent 75%, #80808020 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px",boxShadow:`rgb(0 0 0 / 10%) 0px 1.8px 1.9px,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{M as f,r,b as y,t as E,j as o,a as k,c as x}from"./assets/inspectorTab-
|
|
1
|
+
import{M as f,r,b as y,t as E,j as o,a as k,c as x}from"./assets/inspectorTab-C_9qyxv5.js";import{W as M}from"./assets/workbench-DsQEOQud.js";function S(t,e){t&&window.parent.postMessage({method:"openExternal",params:{url:t,target:e}},"*")}function j({file:t,line:e,column:a}){window.parent.postMessage({method:"openSourceLocation",params:{file:t,line:e,column:a}},"*")}const L=()=>{const[t,e]=r.useState([]),[a,g]=r.useState(h),[c,l]=r.useState({done:0,total:0}),[d,m]=r.useState(null);return r.useEffect(()=>{window.addEventListener("message",async({data:{method:s,params:n}})=>{s==="loadTraceRequested"?(e(n.traceUrl?[n.traceUrl]:[]),m(null)):s==="applyTheme"&&y()!==n.theme&&E()}),window.parent.postMessage({type:"loaded"},"*")},[]),r.useEffect(()=>{(async()=>{if(t.length){const s=i=>{i.data.method==="progress"&&l(i.data.params)};navigator.serviceWorker.addEventListener("message",s),l({done:0,total:1});const n=[];for(let i=0;i<t.length;i++){const v=t[i],p=new URLSearchParams;p.set("trace",v),p.set("limit",String(t.length));const w=await fetch(`contexts?${p.toString()}`);if(!w.ok){m((await w.json()).error);return}n.push(...await w.json())}navigator.serviceWorker.removeEventListener("message",s);const u=new f(n);l({done:0,total:0}),g(u)}else g(h)})()},[t]),r.useEffect(()=>{var s;d&&((s=window.parent)==null||s.postMessage({method:"showErrorMessage",params:{message:d}},"*"))},[d]),o.jsxs("div",{className:"vbox workbench-loader",children:[o.jsx("div",{className:"progress",children:o.jsx("div",{className:"inner-progress",style:{width:c.total?100*c.done/c.total+"%":0}})}),o.jsx(M,{model:a,openPage:S,onOpenExternally:j}),!t.length&&o.jsx("div",{className:"empty-state",children:o.jsx("div",{className:"title",children:"Select test to see the trace"})})]})},h=new f([]);(async()=>{k();const t=e=>{var a;e.isTrusted&&((a=window.parent)==null||a.postMessage({type:e.type,key:e.key,keyCode:e.keyCode,code:e.code,shiftKey:e.shiftKey,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,repeat:e.repeat},"*"))};if(window.addEventListener("keydown",t),window.addEventListener("keyup",t),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
2
2
|
Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(e=>{navigator.serviceWorker.oncontrollerchange=()=>e()}),setInterval(function(){fetch("ping")},1e4)}x(document.querySelector("#root")).render(o.jsx(L,{}))})();
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Playwright Trace Viewer for VS Code</title>
|
|
8
|
-
<script type="module" crossorigin src="./embedded.
|
|
9
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/workbench-
|
|
8
|
+
<script type="module" crossorigin src="./embedded.D4x_-tXl.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-C_9qyxv5.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/workbench-DsQEOQud.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DEOUW62d.css">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./workbench.C-zR9ysA.css">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="./embedded.w7WN2u1R.css">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{M as k,r as o,j as e,T as W,t as D,a as M,c as C}from"./assets/inspectorTab-
|
|
1
|
+
import{M as k,r as o,j as e,T as W,t as D,a as M,c as C}from"./assets/inspectorTab-C_9qyxv5.js";import{W as F}from"./assets/workbench-DsQEOQud.js";import{T as O,W as A}from"./assets/testServerConnection-DeE2kSzz.js";const I=()=>{const[i,N]=o.useState(!1),[c,p]=o.useState([]),[u,E]=o.useState([]),[f,S]=o.useState(L),[v,m]=o.useState({done:0,total:0}),[T,g]=o.useState(!1),[y,w]=o.useState(null),[x,U]=o.useState(null),h=o.useCallback(t=>{const r=[],a=[],s=new URL(window.location.href);for(let n=0;n<t.length;n++){const l=t.item(n);if(!l)continue;const b=URL.createObjectURL(l);r.push(b),a.push(l.name),s.searchParams.append("trace",b),s.searchParams.append("traceFileName",l.name)}const d=s.toString();window.history.pushState({},"",d),p(r),E(a),g(!1),w(null)},[]);o.useEffect(()=>{const t=async r=>{var a;if((a=r.clipboardData)!=null&&a.files.length){for(const s of r.clipboardData.files)if(s.type!=="application/zip")return;r.preventDefault(),h(r.clipboardData.files)}};return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)});const P=o.useCallback(t=>{t.preventDefault(),h(t.dataTransfer.files)},[h]),R=o.useCallback(t=>{t.preventDefault(),t.target.files&&h(t.target.files)},[h]);o.useEffect(()=>{const t=new URL(window.location.href).searchParams,r=t.getAll("trace");N(t.has("isServer"));for(const a of r)if(a.startsWith("file:")){U(a||null);return}if(t.has("isServer")){const a=new URLSearchParams(window.location.search).get("ws"),s=new URL(`../${a}`,window.location.toString());s.protocol=window.location.protocol==="https:"?"wss:":"ws:";const d=new O(new A(s));d.onLoadTraceRequested(async n=>{p(n.traceUrl?[n.traceUrl]:[]),g(!1),w(null)}),d.initialize({}).catch(()=>{})}else r.some(a=>a.startsWith("blob:"))||p(r)},[]),o.useEffect(()=>{(async()=>{if(c.length){const t=s=>{s.data.method==="progress"&&m(s.data.params)};navigator.serviceWorker.addEventListener("message",t),m({done:0,total:1});const r=[];for(let s=0;s<c.length;s++){const d=c[s],n=new URLSearchParams;n.set("trace",d),u.length&&n.set("traceFileName",u[s]),n.set("limit",String(c.length));const l=await fetch(`contexts?${n.toString()}`);if(!l.ok){i||p([]),w((await l.json()).error);return}r.push(...await l.json())}navigator.serviceWorker.removeEventListener("message",t);const a=new k(r);m({done:0,total:0}),S(a)}else S(L)})()},[i,c,u]);const j=!!(!i&&!T&&!x&&(!c.length||y));return e.jsxs("div",{className:"vbox workbench-loader",onDragOver:t=>{t.preventDefault(),g(!0)},children:[e.jsxs("div",{className:"hbox header",...j?{inert:"true"}:{},children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),f.title&&e.jsx("div",{className:"title",children:f.title}),e.jsx("div",{className:"spacer"}),e.jsx(W,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>D()})]}),e.jsx("div",{className:"progress",children:e.jsx("div",{className:"inner-progress",style:{width:v.total?100*v.done/v.total+"%":0}})}),e.jsx(F,{model:f,inert:j}),x&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),e.jsxs("div",{style:{paddingTop:20},children:[e.jsxs("div",{children:["1. Click ",e.jsx("a",{href:x,children:"here"})," to put your trace into the download shelf"]}),e.jsxs("div",{children:["2. Go to ",e.jsx("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),e.jsx("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),j&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",role:"alert",children:y}),e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const t=document.createElement("input");t.type="file",t.multiple=!0,t.click(),t.addEventListener("change",r=>R(r))},type:"button",children:"Select file(s)"}),e.jsx("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),i&&!c.length&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),T&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{g(!1)},onDrop:t=>P(t),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},L=new k([]);(async()=>{if(M(),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.
|
|
2
2
|
Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}C(document.querySelector("#root")).render(e.jsx(I,{}))})();
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
8
|
<link rel="manifest" href="./manifest.webmanifest">
|
|
9
9
|
<title>Playwright Trace Viewer</title>
|
|
10
|
-
<script type="module" crossorigin src="./index.
|
|
11
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/workbench-
|
|
10
|
+
<script type="module" crossorigin src="./index.BskMikzx.js"></script>
|
|
11
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-C_9qyxv5.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/workbench-DsQEOQud.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="./assets/testServerConnection-DeE2kSzz.js">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DEOUW62d.css">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="./workbench.C-zR9ysA.css">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var H=Object.defineProperty;var U=(t,e,s)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var w=(t,e,s)=>U(t,typeof e!="symbol"?e+"":e,s);import{j as a,r as n,M as W,H as z,o as D,L as $,g as J,T as f,J as K,K as q,t as G,S as C,E as y,z as Q,A as X,h as Y,B as Z,N as ee,O as te,Q as se,U as oe,I as re,F as ae,a as ce,c as ne}from"./assets/inspectorTab-DdpLd2bb.js";const ie=({sources:t,fileId:e,setFileId:s})=>a.jsx("select",{className:"source-chooser",hidden:!t.length,title:"Source chooser",value:e,onChange:r=>{s(r.target.selectedOptions[0].value)},children:le(t)});function le(t){const e=o=>o.replace(/.*[/\\]([^/\\]+)/,"$1"),s=o=>a.jsx("option",{value:o.id,children:e(o.label)},o.id),r=new Map;for(const o of t){let i=r.get(o.group||"Debugger");i||(i=[],r.set(o.group||"Debugger",i)),i.push(o)}return[...r.entries()].map(([o,i])=>a.jsx("optgroup",{label:o,children:i.filter(c=>(c.group||"Debugger")===o).map(c=>s(c))},o))}const v=n.createContext(void 0),ue=({trace:t,children:e})=>{const[s,r]=n.useState(),[o,i]=n.useState(0),c=n.useRef(null);return n.useEffect(()=>(c.current&&clearTimeout(c.current),c.current=setTimeout(async()=>{try{const u=await de(t);u.sha1!==(s==null?void 0:s.sha1)&&r(u)}catch{r(void 0)}finally{i(o+1)}},500),()=>{c.current&&clearTimeout(c.current)}),[o,s,t]),a.jsx(v.Provider,{value:s==null?void 0:s.model,children:e})};async function de(t){const e=new URLSearchParams;e.set("trace",t),e.set("limit","1");const r=await(await fetch(`contexts?${e.toString()}`)).json(),o=[];for(const i of r)i.actions.forEach(c=>o.push(c.type+"@"+c.startTime+"-"+c.endTime)),i.events.forEach(c=>o.push(c.type+"@"+c.time));return{model:new W(r),sha1:await z(o.join("|"))}}function me(t,e){return[...t,e].join(" >> internal:control=enter-frame >> ")}const b=5e3;function pe(t){const{action:e}=t;switch(e.name){case"navigate":return{method:"goto",apiName:"page.goto",params:{url:e.url}};case"openPage":case"closePage":throw new Error("Not reached")}const s=me(t.frame.framePath,e.selector);switch(e.name){case"click":return{method:"click",apiName:"locator.click",params:{selector:s,strict:!0,modifiers:P(e.modifiers),button:e.button,clickCount:e.clickCount,position:e.position}};case"press":return{method:"press",apiName:"locator.press",params:{selector:s,strict:!0,key:[...P(e.modifiers),e.key].join("+")}};case"fill":return{method:"fill",apiName:"locator.fill",params:{selector:s,strict:!0,value:e.text}};case"setInputFiles":return{method:"setInputFiles",apiName:"locator.setInputFiles",params:{selector:s,strict:!0,localPaths:e.files}};case"check":return{method:"check",apiName:"locator.check",params:{selector:s,strict:!0}};case"uncheck":return{method:"uncheck",apiName:"locator.uncheck",params:{selector:s,strict:!0}};case"select":return{method:"selectOption",apiName:"locator.selectOption",params:{selector:s,strict:!0,options:e.options.map(o=>({value:o}))}};case"assertChecked":return{method:"expect",apiName:"expect.toBeChecked",params:{selector:e.selector,expression:"to.be.checked",isNot:!e.checked,timeout:b}};case"assertText":return{method:"expect",apiName:"expect.toContainText",params:{selector:s,expression:"to.have.text",expectedText:[],isNot:!1,timeout:b}};case"assertValue":return{method:"expect",apiName:"expect.toHaveValue",params:{selector:s,expression:"to.have.value",expectedValue:void 0,isNot:!1,timeout:b}};case"assertVisible":return{method:"expect",apiName:"expect.toBeVisible",params:{selector:s,expression:"to.be.visible",isNot:!1,timeout:b}};case"assertSnapshot":return{method:"expect",apiName:"expect.toMatchAriaSnapshot",params:{selector:s,expression:"to.match.snapshot",expectedText:[],isNot:!1,timeout:b}}}}function P(t){const e=[];return t&1&&e.push("Alt"),t&2&&e.push("ControlOrMeta"),t&4&&e.push("ControlOrMeta"),t&8&&e.push("Shift"),e}const he=$,xe=({sdkLanguage:t,actions:e,selectedAction:s,onSelectedAction:r})=>{const o=n.useCallback(i=>ge(t,i),[t]);return a.jsx("div",{className:"vbox",children:a.jsx(he,{name:"actions",items:e,selectedItem:s,onSelected:r,render:o})})},ge=(t,e)=>{const{method:s,apiName:r,params:o}=pe(e),i=o.selector?D(t||"javascript",o.selector):void 0;return a.jsx(a.Fragment,{children:a.jsxs("div",{className:"action-title",title:r,children:[a.jsx("span",{children:r}),i&&a.jsx("div",{className:"action-selector",title:i,children:i}),s==="goto"&&o.url&&a.jsx("div",{className:"action-url",title:o.url,children:o.url})]})})},I=n.createContext(void 0),fe=({guid:t,children:e})=>{const[s,r]=n.useState(void 0),[o,i]=n.useState("none"),[c,u]=n.useState({actions:[],sources:[]}),p=n.useRef({setMode:i,setActions:u});n.useEffect(()=>{const d=new URL(`../${t}`,window.location.toString());d.protocol=window.location.protocol==="https:"?"wss:":"ws:";const x=new WebSocket(d.toString());return r(new we(x,p.current)),()=>{x.close()}},[t]);const h=n.useMemo(()=>s?{mode:o,actions:c.actions,sources:c.sources,connection:s}:void 0,[c,o,s]);return a.jsx(I.Provider,{value:h,children:e})};class we{constructor(e,s){w(this,"_lastId",0);w(this,"_webSocket");w(this,"_callbacks",new Map);w(this,"_options");this._webSocket=e,this._callbacks=new Map,this._options=s,this._webSocket.addEventListener("message",r=>{const o=JSON.parse(r.data),{id:i,result:c,error:u,method:p,params:h}=o;if(i){const d=this._callbacks.get(i);if(!d)return;this._callbacks.delete(i),u?d.reject(new Error(u)):d.resolve(c)}else this._dispatchEvent(p,h)})}setMode(e){this._sendMessageNoReply("setMode",{mode:e})}async _sendMessage(e,s){const r=++this._lastId,o={id:r,method:e,params:s};return this._webSocket.send(JSON.stringify(o)),new Promise((i,c)=>{this._callbacks.set(r,{resolve:i,reject:c})})}_sendMessageNoReply(e,s){this._sendMessage(e,s).catch(()=>{})}_dispatchEvent(e,s){if(e==="setMode"){const{mode:r}=s;this._options.setMode(r)}if(e==="setActions"){const{actions:r,sources:o}=s;this._options.setActions({actions:r.filter(i=>i.action.name!=="openPage"&&i.action.name!=="closePage"),sources:o}),window.playwrightSourcesEchoForTest=o}}}const be=()=>{const t=new URLSearchParams(window.location.search),e=t.get("ws"),s=t.get("trace")+".json";return a.jsx(fe,{guid:e,children:a.jsx(ue,{trace:s,children:a.jsx(ve,{})})})},ve=()=>{const t=n.useContext(I),e=n.useContext(v),[s,r]=n.useState(),[o,i]=n.useState(void 0),[c,u]=n.useState(!1),[p,h]=n.useState(""),[d,x]=n.useState(""),[T,S]=n.useState(),j=n.useCallback(l=>{i(l==null?void 0:l.startTime)},[]),g=n.useMemo(()=>t==null?void 0:t.actions.find(l=>l.startTime===o),[t==null?void 0:t.actions,o]);n.useEffect(()=>{var N;const l=(N=e==null?void 0:e.actions.find(M=>M.endTime&&M.endTime===(g==null?void 0:g.endTime)))==null?void 0:N.callId;l&&S(l)},[e,g]);const m=n.useMemo(()=>(t==null?void 0:t.sources.find(l=>l.id===s))||(t==null?void 0:t.sources[0]),[t==null?void 0:t.sources,s]),L=n.useMemo(()=>m?{file:"",line:0,column:0,source:{errors:[],content:m.text}}:void 0,[m]),k=(m==null?void 0:m.language)||"javascript",{boundaries:_}=n.useMemo(()=>{const l={minimum:(e==null?void 0:e.startTime)||0,maximum:(e==null?void 0:e.endTime)||3e4};return l.minimum>l.maximum&&(l.minimum=0,l.maximum=3e4),l.maximum+=(l.maximum-l.minimum)/20,{boundaries:l}},[e]),A=n.useCallback(l=>{h(l),x(""),u(!1)},[]),E=n.useCallback(l=>{x(l),h(l)},[]),V={id:"actions",title:"Actions",component:a.jsx(xe,{sdkLanguage:k,actions:(t==null?void 0:t.actions)||[],selectedAction:g,onSelectedAction:j})},F=a.jsxs(J,{sidebarBackground:!0,children:[a.jsx("div",{style:{width:4}}),a.jsx(f,{icon:"inspect",title:"Pick locator",toggled:c,onClick:()=>{u(!c)}}),a.jsx(f,{icon:"eye",title:"Assert visibility",onClick:()=>{}}),a.jsx(f,{icon:"whole-word",title:"Assert text",onClick:()=>{}}),a.jsx(f,{icon:"symbol-constant",title:"Assert value",onClick:()=>{}}),a.jsx(K,{}),a.jsx(f,{icon:"files",title:"Copy",disabled:!m||!m.text,onClick:()=>{m!=null&&m.text&&q(m.text)}}),a.jsx("div",{style:{flex:"auto"}}),a.jsx("div",{children:"Target:"}),a.jsx(ie,{fileId:s,sources:(t==null?void 0:t.sources)||[],setFileId:l=>{r(l)}}),a.jsx(f,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>G()})]}),R=a.jsx(y,{tabs:[V]}),O=a.jsx(Se,{sdkLanguage:k,callId:T,isInspecting:c,setIsInspecting:u,highlightedLocator:d,setHighlightedLocator:A}),B=a.jsx(Te,{sdkLanguage:k,boundaries:_,setIsInspecting:u,highlightedLocator:p,setHighlightedLocator:E,sourceLocation:L});return a.jsx("div",{className:"vbox workbench",children:a.jsx(C,{sidebarSize:250,orientation:"horizontal",settingName:"recorderActionListSidebar",sidebarIsFirst:!0,main:a.jsx(C,{sidebarSize:250,orientation:"vertical",settingName:"recorderPropertiesSidebar",main:a.jsxs("div",{className:"vbox",children:[F,O]}),sidebar:B}),sidebar:R})})},Te=({sdkLanguage:t,boundaries:e,setIsInspecting:s,highlightedLocator:r,setHighlightedLocator:o,sourceLocation:i})=>{const c=n.useContext(v),u=Q(c,e),p=X(c,e),h=n.useRef(new Map),[d,x]=Y("recorderPropertiesTab","source"),T={id:"inspector",title:"Locator",render:()=>a.jsx(re,{sdkLanguage:t,setIsInspecting:s,highlightedLocator:r,setHighlightedLocator:o})},S={id:"source",title:"Source",render:()=>a.jsx(ae,{sources:h.current,stackFrameLocation:"right",fallbackLocation:i})},j={id:"console",title:"Console",count:u.entries.length,render:()=>a.jsx(Z,{boundaries:e,consoleModel:u})},g={id:"network",title:"Network",count:p.resources.length,render:()=>a.jsx(ee,{boundaries:e,networkModel:p})},m=[S,T,j,g];return a.jsx(y,{tabs:m,selectedTab:d,setSelectedTab:x})},Se=({sdkLanguage:t,callId:e,isInspecting:s,setIsInspecting:r,highlightedLocator:o,setHighlightedLocator:i})=>{const c=n.useContext(v),u=n.useMemo(()=>c==null?void 0:c.actions.find(d=>d.callId===e),[c,e]),p=n.useMemo(()=>{const d=te(u);return d.action||d.after||d.before},[u]),h=n.useMemo(()=>p?se(p):void 0,[p]);return a.jsx(oe,{sdkLanguage:t,testIdAttributeName:"data-testid",isInspecting:s,setIsInspecting:r,highlightedLocator:o,setHighlightedLocator:i,snapshotUrls:h})};(async()=>{if(ce(),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
1
|
+
var H=Object.defineProperty;var U=(t,e,s)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var w=(t,e,s)=>U(t,typeof e!="symbol"?e+"":e,s);import{j as a,r as n,M as W,H as z,o as D,L as $,g as J,T as f,J as K,K as q,t as G,S as C,E as y,z as Q,A as X,h as Y,B as Z,N as ee,O as te,Q as se,U as oe,I as re,F as ae,a as ce,c as ne}from"./assets/inspectorTab-C_9qyxv5.js";const ie=({sources:t,fileId:e,setFileId:s})=>a.jsx("select",{className:"source-chooser",hidden:!t.length,title:"Source chooser",value:e,onChange:r=>{s(r.target.selectedOptions[0].value)},children:le(t)});function le(t){const e=o=>o.replace(/.*[/\\]([^/\\]+)/,"$1"),s=o=>a.jsx("option",{value:o.id,children:e(o.label)},o.id),r=new Map;for(const o of t){let i=r.get(o.group||"Debugger");i||(i=[],r.set(o.group||"Debugger",i)),i.push(o)}return[...r.entries()].map(([o,i])=>a.jsx("optgroup",{label:o,children:i.filter(c=>(c.group||"Debugger")===o).map(c=>s(c))},o))}const v=n.createContext(void 0),ue=({trace:t,children:e})=>{const[s,r]=n.useState(),[o,i]=n.useState(0),c=n.useRef(null);return n.useEffect(()=>(c.current&&clearTimeout(c.current),c.current=setTimeout(async()=>{try{const u=await de(t);u.sha1!==(s==null?void 0:s.sha1)&&r(u)}catch{r(void 0)}finally{i(o+1)}},500),()=>{c.current&&clearTimeout(c.current)}),[o,s,t]),a.jsx(v.Provider,{value:s==null?void 0:s.model,children:e})};async function de(t){const e=new URLSearchParams;e.set("trace",t),e.set("limit","1");const r=await(await fetch(`contexts?${e.toString()}`)).json(),o=[];for(const i of r)i.actions.forEach(c=>o.push(c.type+"@"+c.startTime+"-"+c.endTime)),i.events.forEach(c=>o.push(c.type+"@"+c.time));return{model:new W(r),sha1:await z(o.join("|"))}}function me(t,e){return[...t,e].join(" >> internal:control=enter-frame >> ")}const b=5e3;function pe(t){const{action:e}=t;switch(e.name){case"navigate":return{method:"goto",apiName:"page.goto",params:{url:e.url}};case"openPage":case"closePage":throw new Error("Not reached")}const s=me(t.frame.framePath,e.selector);switch(e.name){case"click":return{method:"click",apiName:"locator.click",params:{selector:s,strict:!0,modifiers:P(e.modifiers),button:e.button,clickCount:e.clickCount,position:e.position}};case"press":return{method:"press",apiName:"locator.press",params:{selector:s,strict:!0,key:[...P(e.modifiers),e.key].join("+")}};case"fill":return{method:"fill",apiName:"locator.fill",params:{selector:s,strict:!0,value:e.text}};case"setInputFiles":return{method:"setInputFiles",apiName:"locator.setInputFiles",params:{selector:s,strict:!0,localPaths:e.files}};case"check":return{method:"check",apiName:"locator.check",params:{selector:s,strict:!0}};case"uncheck":return{method:"uncheck",apiName:"locator.uncheck",params:{selector:s,strict:!0}};case"select":return{method:"selectOption",apiName:"locator.selectOption",params:{selector:s,strict:!0,options:e.options.map(o=>({value:o}))}};case"assertChecked":return{method:"expect",apiName:"expect.toBeChecked",params:{selector:e.selector,expression:"to.be.checked",isNot:!e.checked,timeout:b}};case"assertText":return{method:"expect",apiName:"expect.toContainText",params:{selector:s,expression:"to.have.text",expectedText:[],isNot:!1,timeout:b}};case"assertValue":return{method:"expect",apiName:"expect.toHaveValue",params:{selector:s,expression:"to.have.value",expectedValue:void 0,isNot:!1,timeout:b}};case"assertVisible":return{method:"expect",apiName:"expect.toBeVisible",params:{selector:s,expression:"to.be.visible",isNot:!1,timeout:b}};case"assertSnapshot":return{method:"expect",apiName:"expect.toMatchAriaSnapshot",params:{selector:s,expression:"to.match.snapshot",expectedText:[],isNot:!1,timeout:b}}}}function P(t){const e=[];return t&1&&e.push("Alt"),t&2&&e.push("ControlOrMeta"),t&4&&e.push("ControlOrMeta"),t&8&&e.push("Shift"),e}const he=$,xe=({sdkLanguage:t,actions:e,selectedAction:s,onSelectedAction:r})=>{const o=n.useCallback(i=>ge(t,i),[t]);return a.jsx("div",{className:"vbox",children:a.jsx(he,{name:"actions",items:e,selectedItem:s,onSelected:r,render:o})})},ge=(t,e)=>{const{method:s,apiName:r,params:o}=pe(e),i=o.selector?D(t||"javascript",o.selector):void 0;return a.jsx(a.Fragment,{children:a.jsxs("div",{className:"action-title",title:r,children:[a.jsx("span",{children:r}),i&&a.jsx("div",{className:"action-selector",title:i,children:i}),s==="goto"&&o.url&&a.jsx("div",{className:"action-url",title:o.url,children:o.url})]})})},I=n.createContext(void 0),fe=({guid:t,children:e})=>{const[s,r]=n.useState(void 0),[o,i]=n.useState("none"),[c,u]=n.useState({actions:[],sources:[]}),p=n.useRef({setMode:i,setActions:u});n.useEffect(()=>{const d=new URL(`../${t}`,window.location.toString());d.protocol=window.location.protocol==="https:"?"wss:":"ws:";const x=new WebSocket(d.toString());return r(new we(x,p.current)),()=>{x.close()}},[t]);const h=n.useMemo(()=>s?{mode:o,actions:c.actions,sources:c.sources,connection:s}:void 0,[c,o,s]);return a.jsx(I.Provider,{value:h,children:e})};class we{constructor(e,s){w(this,"_lastId",0);w(this,"_webSocket");w(this,"_callbacks",new Map);w(this,"_options");this._webSocket=e,this._callbacks=new Map,this._options=s,this._webSocket.addEventListener("message",r=>{const o=JSON.parse(r.data),{id:i,result:c,error:u,method:p,params:h}=o;if(i){const d=this._callbacks.get(i);if(!d)return;this._callbacks.delete(i),u?d.reject(new Error(u)):d.resolve(c)}else this._dispatchEvent(p,h)})}setMode(e){this._sendMessageNoReply("setMode",{mode:e})}async _sendMessage(e,s){const r=++this._lastId,o={id:r,method:e,params:s};return this._webSocket.send(JSON.stringify(o)),new Promise((i,c)=>{this._callbacks.set(r,{resolve:i,reject:c})})}_sendMessageNoReply(e,s){this._sendMessage(e,s).catch(()=>{})}_dispatchEvent(e,s){if(e==="setMode"){const{mode:r}=s;this._options.setMode(r)}if(e==="setActions"){const{actions:r,sources:o}=s;this._options.setActions({actions:r.filter(i=>i.action.name!=="openPage"&&i.action.name!=="closePage"),sources:o}),window.playwrightSourcesEchoForTest=o}}}const be=()=>{const t=new URLSearchParams(window.location.search),e=t.get("ws"),s=t.get("trace")+".json";return a.jsx(fe,{guid:e,children:a.jsx(ue,{trace:s,children:a.jsx(ve,{})})})},ve=()=>{const t=n.useContext(I),e=n.useContext(v),[s,r]=n.useState(),[o,i]=n.useState(void 0),[c,u]=n.useState(!1),[p,h]=n.useState(""),[d,x]=n.useState(""),[T,S]=n.useState(),j=n.useCallback(l=>{i(l==null?void 0:l.startTime)},[]),g=n.useMemo(()=>t==null?void 0:t.actions.find(l=>l.startTime===o),[t==null?void 0:t.actions,o]);n.useEffect(()=>{var N;const l=(N=e==null?void 0:e.actions.find(M=>M.endTime&&M.endTime===(g==null?void 0:g.endTime)))==null?void 0:N.callId;l&&S(l)},[e,g]);const m=n.useMemo(()=>(t==null?void 0:t.sources.find(l=>l.id===s))||(t==null?void 0:t.sources[0]),[t==null?void 0:t.sources,s]),L=n.useMemo(()=>m?{file:"",line:0,column:0,source:{errors:[],content:m.text}}:void 0,[m]),k=(m==null?void 0:m.language)||"javascript",{boundaries:_}=n.useMemo(()=>{const l={minimum:(e==null?void 0:e.startTime)||0,maximum:(e==null?void 0:e.endTime)||3e4};return l.minimum>l.maximum&&(l.minimum=0,l.maximum=3e4),l.maximum+=(l.maximum-l.minimum)/20,{boundaries:l}},[e]),A=n.useCallback(l=>{h(l),x(""),u(!1)},[]),E=n.useCallback(l=>{x(l),h(l)},[]),V={id:"actions",title:"Actions",component:a.jsx(xe,{sdkLanguage:k,actions:(t==null?void 0:t.actions)||[],selectedAction:g,onSelectedAction:j})},F=a.jsxs(J,{sidebarBackground:!0,children:[a.jsx("div",{style:{width:4}}),a.jsx(f,{icon:"inspect",title:"Pick locator",toggled:c,onClick:()=>{u(!c)}}),a.jsx(f,{icon:"eye",title:"Assert visibility",onClick:()=>{}}),a.jsx(f,{icon:"whole-word",title:"Assert text",onClick:()=>{}}),a.jsx(f,{icon:"symbol-constant",title:"Assert value",onClick:()=>{}}),a.jsx(K,{}),a.jsx(f,{icon:"files",title:"Copy",disabled:!m||!m.text,onClick:()=>{m!=null&&m.text&&q(m.text)}}),a.jsx("div",{style:{flex:"auto"}}),a.jsx("div",{children:"Target:"}),a.jsx(ie,{fileId:s,sources:(t==null?void 0:t.sources)||[],setFileId:l=>{r(l)}}),a.jsx(f,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>G()})]}),R=a.jsx(y,{tabs:[V]}),O=a.jsx(Se,{sdkLanguage:k,callId:T,isInspecting:c,setIsInspecting:u,highlightedLocator:d,setHighlightedLocator:A}),B=a.jsx(Te,{sdkLanguage:k,boundaries:_,setIsInspecting:u,highlightedLocator:p,setHighlightedLocator:E,sourceLocation:L});return a.jsx("div",{className:"vbox workbench",children:a.jsx(C,{sidebarSize:250,orientation:"horizontal",settingName:"recorderActionListSidebar",sidebarIsFirst:!0,main:a.jsx(C,{sidebarSize:250,orientation:"vertical",settingName:"recorderPropertiesSidebar",main:a.jsxs("div",{className:"vbox",children:[F,O]}),sidebar:B}),sidebar:R})})},Te=({sdkLanguage:t,boundaries:e,setIsInspecting:s,highlightedLocator:r,setHighlightedLocator:o,sourceLocation:i})=>{const c=n.useContext(v),u=Q(c,e),p=X(c,e),h=n.useRef(new Map),[d,x]=Y("recorderPropertiesTab","source"),T={id:"inspector",title:"Locator",render:()=>a.jsx(re,{sdkLanguage:t,setIsInspecting:s,highlightedLocator:r,setHighlightedLocator:o})},S={id:"source",title:"Source",render:()=>a.jsx(ae,{sources:h.current,stackFrameLocation:"right",fallbackLocation:i})},j={id:"console",title:"Console",count:u.entries.length,render:()=>a.jsx(Z,{boundaries:e,consoleModel:u})},g={id:"network",title:"Network",count:p.resources.length,render:()=>a.jsx(ee,{boundaries:e,networkModel:p})},m=[S,T,j,g];return a.jsx(y,{tabs:m,selectedTab:d,setSelectedTab:x})},Se=({sdkLanguage:t,callId:e,isInspecting:s,setIsInspecting:r,highlightedLocator:o,setHighlightedLocator:i})=>{const c=n.useContext(v),u=n.useMemo(()=>c==null?void 0:c.actions.find(d=>d.callId===e),[c,e]),p=n.useMemo(()=>{const d=te(u);return d.action||d.after||d.before},[u]),h=n.useMemo(()=>p?se(p):void 0,[p]);return a.jsx(oe,{sdkLanguage:t,testIdAttributeName:"data-testid",isInspecting:s,setIsInspecting:r,highlightedLocator:o,setHighlightedLocator:i,snapshotUrls:h})};(async()=>{if(ce(),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
2
2
|
Make sure to serve the Recorder (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(t=>{navigator.serviceWorker.oncontrollerchange=()=>t()}),setInterval(function(){fetch("ping")},1e4)}ne(document.querySelector("#root")).render(a.jsx(be,{}))})();
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
8
|
<title>Playwright Recorder</title>
|
|
9
|
-
<script type="module" crossorigin src="./recorder.
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
9
|
+
<script type="module" crossorigin src="./recorder.Dsk1wX5k.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-C_9qyxv5.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DEOUW62d.css">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./recorder.B_SY1GJM.css">
|
|
13
13
|
</head>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-BeNbaIVa.js","./xtermModule.DSXBckUd.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as Le,r as K,b as Fe,_ as Oe,d as We,e as Ue,j as r,R as h,s as we,f as ae,m as Ae,g as Y,T as D,M as ze,h as Ve,i as Ke,S as $e,a as He,c as qe}from"./assets/inspectorTab-DdpLd2bb.js";import{T as Ye,W as Qe}from"./assets/testServerConnection-DeE2kSzz.js";import{E as Xe,t as Ge,T as Je,W as Ze}from"./assets/workbench-CdYbzWFD.js";var et={};class oe{constructor(e,t={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new Q("","root"),this._options=t,this._reporter=e}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(e){const{method:t,params:s}=e;if(t==="onConfigure"){this._onConfigure(s.config);return}if(t==="onProject"){this._onProject(s.project);return}if(t==="onBegin"){this._onBegin();return}if(t==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(t==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(t==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(t==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(t==="onError"){this._onError(s.error);return}if(t==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(t==="onEnd")return this._onEnd(s.result);if(t==="onExit")return this._onExit()}_onConfigure(e){var t,s;this._rootDir=e.rootDir,this._config=this._parseConfig(e),(s=(t=this._reporter).onConfigure)==null||s.call(t,this._config)}_onProject(e){let t=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===e.name):void 0;t||(t=new Q(e.name,"project"),this._rootSuite._addSuite(t)),t._project=this._parseProject(e);for(const s of e.suites)this._mergeSuiteInto(s,t)}_onBegin(){var e,t;(t=(e=this._reporter).onBegin)==null||t.call(e,this._rootSuite)}_onTestBegin(e,t){var d,a;const s=this._tests.get(e);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const o=s._createTestResult(t.id);o.retry=t.retry,o.workerIndex=t.workerIndex,o.parallelIndex=t.parallelIndex,o.setStartTimeNumber(t.startTime),(a=(d=this._reporter).onTestBegin)==null||a.call(d,s,o)}_onTestEnd(e,t){var d,a,g;const s=this._tests.get(e.testId);s.timeout=e.timeout,s.expectedStatus=e.expectedStatus,s.annotations=e.annotations;const o=s.results.find(l=>l._id===t.id);o.duration=t.duration,o.status=t.status,o.errors=t.errors,o.error=(d=o.errors)==null?void 0:d[0],o.attachments=this._parseAttachments(t.attachments),(g=(a=this._reporter).onTestEnd)==null||g.call(a,s,o),o._stepMap=new Map}_onStepBegin(e,t,s){var m,n;const o=this._tests.get(e),d=o.results.find(f=>f._id===t),a=s.parentStepId?d._stepMap.get(s.parentStepId):void 0,g=this._absoluteLocation(s.location),l=new st(s,a,g);a?a.steps.push(l):d.steps.push(l),d._stepMap.set(s.id,l),(n=(m=this._reporter).onStepBegin)==null||n.call(m,o,d,l)}_onStepEnd(e,t,s){var g,l;const o=this._tests.get(e),d=o.results.find(m=>m._id===t),a=d._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(l=(g=this._reporter).onStepEnd)==null||l.call(g,o,d,a)}_onError(e){var t,s;(s=(t=this._reporter).onError)==null||s.call(t,e)}_onStdIO(e,t,s,o,d){var m,n,f,S;const a=d?globalThis.Buffer?Buffer.from(o,"base64"):atob(o):o,g=t?this._tests.get(t):void 0,l=g&&s?g.results.find(c=>c._id===s):void 0;e==="stdout"?(l==null||l.stdout.push(a),(n=(m=this._reporter).onStdOut)==null||n.call(m,a,g,l)):(l==null||l.stderr.push(a),(S=(f=this._reporter).onStdErr)==null||S.call(f,a,g,l))}async _onEnd(e){var t,s;await((s=(t=this._reporter).onEnd)==null?void 0:s.call(t,{status:e.status,startTime:new Date(e.startTime),duration:e.duration}))}_onExit(){var e,t;return(t=(e=this._reporter).onExit)==null?void 0:t.call(e)}_parseConfig(e){const t={...rt,...e};return this._options.configOverrides&&(t.configFile=this._options.configOverrides.configFile,t.reportSlowTests=this._options.configOverrides.reportSlowTests,t.quiet=this._options.configOverrides.quiet,t.reporter=[...this._options.configOverrides.reporter]),t}_parseProject(e){return{metadata:e.metadata,name:e.name,outputDir:this._absolutePath(e.outputDir),repeatEach:e.repeatEach,retries:e.retries,testDir:this._absolutePath(e.testDir),testIgnore:se(e.testIgnore),testMatch:se(e.testMatch),timeout:e.timeout,grep:se(e.grep),grepInvert:se(e.grepInvert),dependencies:e.dependencies,teardown:e.teardown,snapshotDir:this._absolutePath(e.snapshotDir),use:{}}}_parseAttachments(e){return e.map(t=>({...t,body:t.base64&&globalThis.Buffer?Buffer.from(t.base64,"base64"):void 0}))}_mergeSuiteInto(e,t){let s=t.suites.find(o=>o.title===e.title);s||(s=new Q(e.title,t.type==="project"?"file":"describe"),t._addSuite(s)),s.location=this._absoluteLocation(e.location),e.entries.forEach(o=>{"testId"in o?this._mergeTestInto(o,s):this._mergeSuiteInto(o,s)})}_mergeTestInto(e,t){let s=this._options.mergeTestCases?t.tests.find(o=>o.title===e.title&&o.repeatEachIndex===e.repeatEachIndex):void 0;s||(s=new tt(e.testId,e.title,this._absoluteLocation(e.location),e.repeatEachIndex),t._addTest(s),this._tests.set(s.id,s)),this._updateTest(e,s)}_updateTest(e,t){return t.id=e.testId,t.location=this._absoluteLocation(e.location),t.retries=e.retries,t.tags=e.tags??[],t.annotations=e.annotations??[],t}_absoluteLocation(e){return e&&{...e,file:this._absolutePath(e.file)}}_absolutePath(e){if(e!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,e):this._rootDir+"/"+e}}class Q{constructor(e,t){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=e,this._type=t}get type(){return this._type}get suites(){return this._entries.filter(e=>e.type!=="test")}get tests(){return this._entries.filter(e=>e.type==="test")}entries(){return this._entries}allTests(){const e=[],t=s=>{for(const o of s.entries())o.type==="test"?e.push(o):t(o)};return t(this),e}titlePath(){const e=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&e.push(this.title),e}project(){var e;return this._project??((e=this.parent)==null?void 0:e.project())}_addTest(e){e.parent=this,this._entries.push(e)}_addSuite(e){e.parent=this,this._entries.push(e)}}class tt{constructor(e,t,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=e,this.title=t,this.location=s,this.repeatEachIndex=o}titlePath(){const e=this.parent?this.parent.titlePath():[];return e.push(this.title),e}outcome(){return ot(this)}ok(){const e=this.outcome();return e==="expected"||e==="flaky"||e==="skipped"}_createTestResult(e){const t=new it(this.results.length,e);return this.results.push(t),t}}class st{constructor(e,t,s){this.duration=-1,this.steps=[],this._startTime=0,this.title=e.title,this.category=e.category,this.location=s,this.parent=t,this._startTime=e.startTime}titlePath(){var t;return[...((t=this.parent)==null?void 0:t.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}class it{constructor(e,t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=e,this._id=t}setStartTimeNumber(e){this._startTime=e}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}const rt={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[et.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function se(i){return i.map(e=>e.s!==void 0?e.s:new RegExp(e.r.source,e.r.flags))}function ot(i){let e=0,t=0,s=0;for(const o of i.results)o.status==="interrupted"||(o.status==="skipped"&&i.expectedStatus==="skipped"?++e:o.status==="skipped"||(o.status===i.expectedStatus?++t:++s));return t===0&&s===0?"skipped":s===0?"expected":t===0&&e===0?"unexpected":"flaky"}class ne{constructor(e,t,s,o,d){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=o&&[...o.values()].some(Boolean);this.pathSeparator=d,this.rootItem={kind:"group",subKind:"folder",id:e,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(e,this.rootItem);const g=(l,m,n)=>{for(const f of m.suites){const S=f.title||"<anonymous>";let c=n.children.find(v=>v.kind==="group"&&v.title===S);c||(c={kind:"group",subKind:"describe",id:"suite:"+m.titlePath().join("")+""+S,title:S,location:f.location,duration:0,parent:n,children:[],status:"none",hasLoadErrors:!1},this._addChild(n,c)),g(l,f,c)}for(const f of m.tests){const S=f.title;let c=n.children.find(C=>C.kind!=="group"&&C.title===S);c||(c={kind:"case",id:"test:"+f.titlePath().join(""),title:S,parent:n,children:[],tests:[],location:f.location,duration:0,status:"none",project:void 0,test:void 0,tags:f.tags},this._addChild(n,c));const v=f.results[0];let x="none";(v==null?void 0:v[X])==="scheduled"?x="scheduled":(v==null?void 0:v[X])==="running"?x="running":(v==null?void 0:v.status)==="skipped"?x="skipped":(v==null?void 0:v.status)==="interrupted"?x="none":v&&f.outcome()!=="expected"?x="failed":v&&f.outcome()==="expected"&&(x="passed"),c.tests.push(f);const R={kind:"test",id:f.id,title:l.name,location:f.location,test:f,parent:c,children:[],status:x,duration:f.results.length?Math.max(0,f.results[0].duration):0,project:l};this._addChild(c,R),this._treeItemByTestId.set(f.id,R),c.duration=c.children.reduce((C,j)=>C+j.duration,0)}};for(const l of(t==null?void 0:t.suites)||[])if(!(a&&!o.get(l.title)))for(const m of l.suites){const n=this._fileItem(m.location.file.split(d),!0);g(l.project(),m,n)}for(const l of s){if(!l.location)continue;const m=this._fileItem(l.location.file.split(d),!0);m.hasLoadErrors=!0}}_addChild(e,t){e.children.push(t),t.parent=e,this._treeItemById.set(t.id,t)}filterTree(e,t,s){const o=e.trim().toLowerCase().split(" "),d=[...t.values()].some(Boolean),a=l=>{const m=[...l.tests[0].titlePath(),...l.tests[0].tags].join(" ").toLowerCase();return!o.every(n=>m.includes(n))&&!l.tests.some(n=>s==null?void 0:s.has(n.id))?!1:(l.children=l.children.filter(n=>!d||(s==null?void 0:s.has(n.test.id))||t.get(n.status)),l.tests=l.children.map(n=>n.test),!!l.children.length)},g=l=>{const m=[];for(const n of l.children)n.kind==="case"?a(n)&&m.push(n):(g(n),(n.children.length||n.hasLoadErrors)&&m.push(n));l.children=m};g(this.rootItem)}_fileItem(e,t){if(e.length===0)return this.rootItem;const s=e.join(this.pathSeparator),o=this._treeItemById.get(s);if(o)return o;const d=this._fileItem(e.slice(0,e.length-1),!1),a={kind:"group",subKind:t?"file":"folder",id:s,title:e[e.length-1],location:{file:s,line:0,column:0},duration:0,parent:d,children:[],status:"none",hasLoadErrors:!1};return this._addChild(d,a),a}sortAndPropagateStatus(){ve(this.rootItem)}flattenForSingleProject(){const e=t=>{t.kind==="case"&&t.children.length===1?(t.project=t.children[0].project,t.test=t.children[0].test,t.children=[],this._treeItemByTestId.set(t.test.id,t)):t.children.forEach(e)};e(this.rootItem)}shortenRoot(){let e=this.rootItem;for(;e.children.length===1&&e.children[0].kind==="group"&&e.children[0].subKind==="folder";)e=e.children[0];e.location=this.rootItem.location,this.rootItem=e}testIds(){const e=new Set,t=s=>{s.kind==="case"&&s.tests.forEach(o=>e.add(o.id)),s.children.forEach(t)};return t(this.rootItem),e}fileNames(){const e=new Set,t=s=>{s.kind==="group"&&s.subKind==="file"?e.add(s.id):s.children.forEach(t)};return t(this.rootItem),[...e]}flatTreeItems(){const e=[],t=s=>{e.push(s),s.children.forEach(t)};return t(this.rootItem),e}treeItemById(e){return this._treeItemById.get(e)}collectTestIds(e){return e?nt(e):new Set}}function ve(i){for(const a of i.children)ve(a);i.kind==="group"&&i.children.sort((a,g)=>a.location.file.localeCompare(g.location.file)||a.location.line-g.location.line);let e=i.children.length>0,t=i.children.length>0,s=!1,o=!1,d=!1;for(const a of i.children)t=t&&a.status==="skipped",e=e&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",o=o||a.status==="running",d=d||a.status==="scheduled";o?i.status="running":d?i.status="scheduled":s?i.status="failed":t?i.status="skipped":e&&(i.status="passed")}function nt(i){const e=new Set,t=s=>{var o;s.kind==="case"?s.tests.map(d=>d.id).forEach(d=>e.add(d)):s.kind==="test"?e.add(s.id):(o=s.children)==null||o.forEach(t)};return t(i),e}const X=Symbol("statusEx");class at{constructor(e){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new oe(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:(t,s)=>t+e.pathSeparator+s,clearPreviousResultsWhenTestBegins:!0}),this._options=e}_createReporter(){return{version:()=>"v2",onConfigure:e=>{this.config=e,this._lastRunReceiver=new oe({version:()=>"v2",onBegin:t=>{this._lastRunTestCount=t.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:(t,s)=>t+this._options.pathSeparator+s})},onBegin:e=>{var t;if(this.rootSuite||(this.rootSuite=e),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((t=this._testResultsSnapshot)==null?void 0:t.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(e,t)=>{t[X]="running",this._options.onUpdate()},onTestEnd:(e,t)=>{e.outcome()==="skipped"?++this.progress.skipped:e.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,t[X]=t.status,this._options.onUpdate()},onError:e=>this._handleOnError(e),printsToStdio:()=>!1}}processGlobalReport(e){const t=new oe({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of e)t.dispatch(s)}processListReport(e){var s;const t=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(t.map(o=>[o.id,o.results])),this._receiver.reset();for(const o of e)this._receiver.dispatch(o)}processTestReportEvent(e){var t,s,o;(s=(t=this._lastRunReceiver)==null?void 0:t.dispatch(e))==null||s.catch(()=>{}),(o=this._receiver.dispatch(e))==null||o.catch(()=>{})}_handleOnError(e){var t,s;this.loadErrors.push(e),(s=(t=this._options).onError)==null||s.call(t,e),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new Q("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const lt=({source:i})=>{const[e,t]=Le(),[s,o]=K.useState(Fe()),[d]=K.useState(Oe(()=>import("./assets/xtermModule-BeNbaIVa.js"),__vite__mapDeps([0,1]),import.meta.url).then(g=>g.default)),a=K.useRef(null);return K.useEffect(()=>(We(o),()=>Ue(o)),[]),K.useEffect(()=>{const g=i.write,l=i.clear;return(async()=>{const{Terminal:m,FitAddon:n}=await d,f=t.current;if(!f)return;const S=s==="dark-mode"?dt:ct;if(a.current&&a.current.terminal.options.theme===S)return;a.current&&(f.textContent="");const c=new m({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:S}),v=new n;c.loadAddon(v);for(const x of i.pending)c.write(x);i.write=x=>{i.pending.push(x),c.write(x)},i.clear=()=>{i.pending=[],c.clear()},c.open(f),v.fit(),a.current={terminal:c,fitAddon:v}})(),()=>{i.clear=l,i.write=g}},[d,a,t,i,s]),K.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),i.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[e,i]),r.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:t})},ct={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"},dt={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"},ut=({filterText:i,setFilterText:e,statusFilters:t,setStatusFilters:s,projectFilters:o,setProjectFilters:d,testModel:a,runTests:g})=>{const[l,m]=h.useState(!1),n=h.useRef(null);h.useEffect(()=>{var c;(c=n.current)==null||c.focus()},[]);const f=[...t.entries()].filter(([c,v])=>v).map(([c])=>c).join(" ")||"all",S=[...o.entries()].filter(([c,v])=>v).map(([c])=>c).join(" ")||"all";return r.jsxs("div",{className:"filters",children:[r.jsx(Xe,{expanded:l,setExpanded:m,title:r.jsx("input",{ref:n,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:c=>{e(c.target.value)},onKeyDown:c=>{c.key==="Enter"&&g()}})}),r.jsxs("div",{className:"filter-summary",title:"Status: "+f+`
|
|
2
|
+
import{u as Le,r as K,b as Fe,_ as Oe,d as We,e as Ue,j as r,R as h,s as we,f as ae,m as Ae,g as Y,T as D,M as ze,h as Ve,i as Ke,S as $e,a as He,c as qe}from"./assets/inspectorTab-C_9qyxv5.js";import{T as Ye,W as Qe}from"./assets/testServerConnection-DeE2kSzz.js";import{E as Xe,t as Ge,T as Je,W as Ze}from"./assets/workbench-DsQEOQud.js";var et={};class oe{constructor(e,t={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new Q("","root"),this._options=t,this._reporter=e}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(e){const{method:t,params:s}=e;if(t==="onConfigure"){this._onConfigure(s.config);return}if(t==="onProject"){this._onProject(s.project);return}if(t==="onBegin"){this._onBegin();return}if(t==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(t==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(t==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(t==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(t==="onError"){this._onError(s.error);return}if(t==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(t==="onEnd")return this._onEnd(s.result);if(t==="onExit")return this._onExit()}_onConfigure(e){var t,s;this._rootDir=e.rootDir,this._config=this._parseConfig(e),(s=(t=this._reporter).onConfigure)==null||s.call(t,this._config)}_onProject(e){let t=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===e.name):void 0;t||(t=new Q(e.name,"project"),this._rootSuite._addSuite(t)),t._project=this._parseProject(e);for(const s of e.suites)this._mergeSuiteInto(s,t)}_onBegin(){var e,t;(t=(e=this._reporter).onBegin)==null||t.call(e,this._rootSuite)}_onTestBegin(e,t){var d,a;const s=this._tests.get(e);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const o=s._createTestResult(t.id);o.retry=t.retry,o.workerIndex=t.workerIndex,o.parallelIndex=t.parallelIndex,o.setStartTimeNumber(t.startTime),(a=(d=this._reporter).onTestBegin)==null||a.call(d,s,o)}_onTestEnd(e,t){var d,a,g;const s=this._tests.get(e.testId);s.timeout=e.timeout,s.expectedStatus=e.expectedStatus,s.annotations=e.annotations;const o=s.results.find(l=>l._id===t.id);o.duration=t.duration,o.status=t.status,o.errors=t.errors,o.error=(d=o.errors)==null?void 0:d[0],o.attachments=this._parseAttachments(t.attachments),(g=(a=this._reporter).onTestEnd)==null||g.call(a,s,o),o._stepMap=new Map}_onStepBegin(e,t,s){var m,n;const o=this._tests.get(e),d=o.results.find(f=>f._id===t),a=s.parentStepId?d._stepMap.get(s.parentStepId):void 0,g=this._absoluteLocation(s.location),l=new st(s,a,g);a?a.steps.push(l):d.steps.push(l),d._stepMap.set(s.id,l),(n=(m=this._reporter).onStepBegin)==null||n.call(m,o,d,l)}_onStepEnd(e,t,s){var g,l;const o=this._tests.get(e),d=o.results.find(m=>m._id===t),a=d._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(l=(g=this._reporter).onStepEnd)==null||l.call(g,o,d,a)}_onError(e){var t,s;(s=(t=this._reporter).onError)==null||s.call(t,e)}_onStdIO(e,t,s,o,d){var m,n,f,S;const a=d?globalThis.Buffer?Buffer.from(o,"base64"):atob(o):o,g=t?this._tests.get(t):void 0,l=g&&s?g.results.find(c=>c._id===s):void 0;e==="stdout"?(l==null||l.stdout.push(a),(n=(m=this._reporter).onStdOut)==null||n.call(m,a,g,l)):(l==null||l.stderr.push(a),(S=(f=this._reporter).onStdErr)==null||S.call(f,a,g,l))}async _onEnd(e){var t,s;await((s=(t=this._reporter).onEnd)==null?void 0:s.call(t,{status:e.status,startTime:new Date(e.startTime),duration:e.duration}))}_onExit(){var e,t;return(t=(e=this._reporter).onExit)==null?void 0:t.call(e)}_parseConfig(e){const t={...rt,...e};return this._options.configOverrides&&(t.configFile=this._options.configOverrides.configFile,t.reportSlowTests=this._options.configOverrides.reportSlowTests,t.quiet=this._options.configOverrides.quiet,t.reporter=[...this._options.configOverrides.reporter]),t}_parseProject(e){return{metadata:e.metadata,name:e.name,outputDir:this._absolutePath(e.outputDir),repeatEach:e.repeatEach,retries:e.retries,testDir:this._absolutePath(e.testDir),testIgnore:se(e.testIgnore),testMatch:se(e.testMatch),timeout:e.timeout,grep:se(e.grep),grepInvert:se(e.grepInvert),dependencies:e.dependencies,teardown:e.teardown,snapshotDir:this._absolutePath(e.snapshotDir),use:{}}}_parseAttachments(e){return e.map(t=>({...t,body:t.base64&&globalThis.Buffer?Buffer.from(t.base64,"base64"):void 0}))}_mergeSuiteInto(e,t){let s=t.suites.find(o=>o.title===e.title);s||(s=new Q(e.title,t.type==="project"?"file":"describe"),t._addSuite(s)),s.location=this._absoluteLocation(e.location),e.entries.forEach(o=>{"testId"in o?this._mergeTestInto(o,s):this._mergeSuiteInto(o,s)})}_mergeTestInto(e,t){let s=this._options.mergeTestCases?t.tests.find(o=>o.title===e.title&&o.repeatEachIndex===e.repeatEachIndex):void 0;s||(s=new tt(e.testId,e.title,this._absoluteLocation(e.location),e.repeatEachIndex),t._addTest(s),this._tests.set(s.id,s)),this._updateTest(e,s)}_updateTest(e,t){return t.id=e.testId,t.location=this._absoluteLocation(e.location),t.retries=e.retries,t.tags=e.tags??[],t.annotations=e.annotations??[],t}_absoluteLocation(e){return e&&{...e,file:this._absolutePath(e.file)}}_absolutePath(e){if(e!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,e):this._rootDir+"/"+e}}class Q{constructor(e,t){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=e,this._type=t}get type(){return this._type}get suites(){return this._entries.filter(e=>e.type!=="test")}get tests(){return this._entries.filter(e=>e.type==="test")}entries(){return this._entries}allTests(){const e=[],t=s=>{for(const o of s.entries())o.type==="test"?e.push(o):t(o)};return t(this),e}titlePath(){const e=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&e.push(this.title),e}project(){var e;return this._project??((e=this.parent)==null?void 0:e.project())}_addTest(e){e.parent=this,this._entries.push(e)}_addSuite(e){e.parent=this,this._entries.push(e)}}class tt{constructor(e,t,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=e,this.title=t,this.location=s,this.repeatEachIndex=o}titlePath(){const e=this.parent?this.parent.titlePath():[];return e.push(this.title),e}outcome(){return ot(this)}ok(){const e=this.outcome();return e==="expected"||e==="flaky"||e==="skipped"}_createTestResult(e){const t=new it(this.results.length,e);return this.results.push(t),t}}class st{constructor(e,t,s){this.duration=-1,this.steps=[],this._startTime=0,this.title=e.title,this.category=e.category,this.location=s,this.parent=t,this._startTime=e.startTime}titlePath(){var t;return[...((t=this.parent)==null?void 0:t.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}class it{constructor(e,t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=e,this._id=t}setStartTimeNumber(e){this._startTime=e}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}const rt={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[et.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function se(i){return i.map(e=>e.s!==void 0?e.s:new RegExp(e.r.source,e.r.flags))}function ot(i){let e=0,t=0,s=0;for(const o of i.results)o.status==="interrupted"||(o.status==="skipped"&&i.expectedStatus==="skipped"?++e:o.status==="skipped"||(o.status===i.expectedStatus?++t:++s));return t===0&&s===0?"skipped":s===0?"expected":t===0&&e===0?"unexpected":"flaky"}class ne{constructor(e,t,s,o,d){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=o&&[...o.values()].some(Boolean);this.pathSeparator=d,this.rootItem={kind:"group",subKind:"folder",id:e,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(e,this.rootItem);const g=(l,m,n)=>{for(const f of m.suites){const S=f.title||"<anonymous>";let c=n.children.find(v=>v.kind==="group"&&v.title===S);c||(c={kind:"group",subKind:"describe",id:"suite:"+m.titlePath().join("")+""+S,title:S,location:f.location,duration:0,parent:n,children:[],status:"none",hasLoadErrors:!1},this._addChild(n,c)),g(l,f,c)}for(const f of m.tests){const S=f.title;let c=n.children.find(C=>C.kind!=="group"&&C.title===S);c||(c={kind:"case",id:"test:"+f.titlePath().join(""),title:S,parent:n,children:[],tests:[],location:f.location,duration:0,status:"none",project:void 0,test:void 0,tags:f.tags},this._addChild(n,c));const v=f.results[0];let x="none";(v==null?void 0:v[X])==="scheduled"?x="scheduled":(v==null?void 0:v[X])==="running"?x="running":(v==null?void 0:v.status)==="skipped"?x="skipped":(v==null?void 0:v.status)==="interrupted"?x="none":v&&f.outcome()!=="expected"?x="failed":v&&f.outcome()==="expected"&&(x="passed"),c.tests.push(f);const R={kind:"test",id:f.id,title:l.name,location:f.location,test:f,parent:c,children:[],status:x,duration:f.results.length?Math.max(0,f.results[0].duration):0,project:l};this._addChild(c,R),this._treeItemByTestId.set(f.id,R),c.duration=c.children.reduce((C,j)=>C+j.duration,0)}};for(const l of(t==null?void 0:t.suites)||[])if(!(a&&!o.get(l.title)))for(const m of l.suites){const n=this._fileItem(m.location.file.split(d),!0);g(l.project(),m,n)}for(const l of s){if(!l.location)continue;const m=this._fileItem(l.location.file.split(d),!0);m.hasLoadErrors=!0}}_addChild(e,t){e.children.push(t),t.parent=e,this._treeItemById.set(t.id,t)}filterTree(e,t,s){const o=e.trim().toLowerCase().split(" "),d=[...t.values()].some(Boolean),a=l=>{const m=[...l.tests[0].titlePath(),...l.tests[0].tags].join(" ").toLowerCase();return!o.every(n=>m.includes(n))&&!l.tests.some(n=>s==null?void 0:s.has(n.id))?!1:(l.children=l.children.filter(n=>!d||(s==null?void 0:s.has(n.test.id))||t.get(n.status)),l.tests=l.children.map(n=>n.test),!!l.children.length)},g=l=>{const m=[];for(const n of l.children)n.kind==="case"?a(n)&&m.push(n):(g(n),(n.children.length||n.hasLoadErrors)&&m.push(n));l.children=m};g(this.rootItem)}_fileItem(e,t){if(e.length===0)return this.rootItem;const s=e.join(this.pathSeparator),o=this._treeItemById.get(s);if(o)return o;const d=this._fileItem(e.slice(0,e.length-1),!1),a={kind:"group",subKind:t?"file":"folder",id:s,title:e[e.length-1],location:{file:s,line:0,column:0},duration:0,parent:d,children:[],status:"none",hasLoadErrors:!1};return this._addChild(d,a),a}sortAndPropagateStatus(){ve(this.rootItem)}flattenForSingleProject(){const e=t=>{t.kind==="case"&&t.children.length===1?(t.project=t.children[0].project,t.test=t.children[0].test,t.children=[],this._treeItemByTestId.set(t.test.id,t)):t.children.forEach(e)};e(this.rootItem)}shortenRoot(){let e=this.rootItem;for(;e.children.length===1&&e.children[0].kind==="group"&&e.children[0].subKind==="folder";)e=e.children[0];e.location=this.rootItem.location,this.rootItem=e}testIds(){const e=new Set,t=s=>{s.kind==="case"&&s.tests.forEach(o=>e.add(o.id)),s.children.forEach(t)};return t(this.rootItem),e}fileNames(){const e=new Set,t=s=>{s.kind==="group"&&s.subKind==="file"?e.add(s.id):s.children.forEach(t)};return t(this.rootItem),[...e]}flatTreeItems(){const e=[],t=s=>{e.push(s),s.children.forEach(t)};return t(this.rootItem),e}treeItemById(e){return this._treeItemById.get(e)}collectTestIds(e){return e?nt(e):new Set}}function ve(i){for(const a of i.children)ve(a);i.kind==="group"&&i.children.sort((a,g)=>a.location.file.localeCompare(g.location.file)||a.location.line-g.location.line);let e=i.children.length>0,t=i.children.length>0,s=!1,o=!1,d=!1;for(const a of i.children)t=t&&a.status==="skipped",e=e&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",o=o||a.status==="running",d=d||a.status==="scheduled";o?i.status="running":d?i.status="scheduled":s?i.status="failed":t?i.status="skipped":e&&(i.status="passed")}function nt(i){const e=new Set,t=s=>{var o;s.kind==="case"?s.tests.map(d=>d.id).forEach(d=>e.add(d)):s.kind==="test"?e.add(s.id):(o=s.children)==null||o.forEach(t)};return t(i),e}const X=Symbol("statusEx");class at{constructor(e){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new oe(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:(t,s)=>t+e.pathSeparator+s,clearPreviousResultsWhenTestBegins:!0}),this._options=e}_createReporter(){return{version:()=>"v2",onConfigure:e=>{this.config=e,this._lastRunReceiver=new oe({version:()=>"v2",onBegin:t=>{this._lastRunTestCount=t.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:(t,s)=>t+this._options.pathSeparator+s})},onBegin:e=>{var t;if(this.rootSuite||(this.rootSuite=e),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((t=this._testResultsSnapshot)==null?void 0:t.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(e,t)=>{t[X]="running",this._options.onUpdate()},onTestEnd:(e,t)=>{e.outcome()==="skipped"?++this.progress.skipped:e.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,t[X]=t.status,this._options.onUpdate()},onError:e=>this._handleOnError(e),printsToStdio:()=>!1}}processGlobalReport(e){const t=new oe({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of e)t.dispatch(s)}processListReport(e){var s;const t=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(t.map(o=>[o.id,o.results])),this._receiver.reset();for(const o of e)this._receiver.dispatch(o)}processTestReportEvent(e){var t,s,o;(s=(t=this._lastRunReceiver)==null?void 0:t.dispatch(e))==null||s.catch(()=>{}),(o=this._receiver.dispatch(e))==null||o.catch(()=>{})}_handleOnError(e){var t,s;this.loadErrors.push(e),(s=(t=this._options).onError)==null||s.call(t,e),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new Q("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const lt=({source:i})=>{const[e,t]=Le(),[s,o]=K.useState(Fe()),[d]=K.useState(Oe(()=>import("./assets/xtermModule-BeNbaIVa.js"),__vite__mapDeps([0,1]),import.meta.url).then(g=>g.default)),a=K.useRef(null);return K.useEffect(()=>(We(o),()=>Ue(o)),[]),K.useEffect(()=>{const g=i.write,l=i.clear;return(async()=>{const{Terminal:m,FitAddon:n}=await d,f=t.current;if(!f)return;const S=s==="dark-mode"?dt:ct;if(a.current&&a.current.terminal.options.theme===S)return;a.current&&(f.textContent="");const c=new m({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:S}),v=new n;c.loadAddon(v);for(const x of i.pending)c.write(x);i.write=x=>{i.pending.push(x),c.write(x)},i.clear=()=>{i.pending=[],c.clear()},c.open(f),v.fit(),a.current={terminal:c,fitAddon:v}})(),()=>{i.clear=l,i.write=g}},[d,a,t,i,s]),K.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),i.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[e,i]),r.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:t})},ct={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"},dt={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"},ut=({filterText:i,setFilterText:e,statusFilters:t,setStatusFilters:s,projectFilters:o,setProjectFilters:d,testModel:a,runTests:g})=>{const[l,m]=h.useState(!1),n=h.useRef(null);h.useEffect(()=>{var c;(c=n.current)==null||c.focus()},[]);const f=[...t.entries()].filter(([c,v])=>v).map(([c])=>c).join(" ")||"all",S=[...o.entries()].filter(([c,v])=>v).map(([c])=>c).join(" ")||"all";return r.jsxs("div",{className:"filters",children:[r.jsx(Xe,{expanded:l,setExpanded:m,title:r.jsx("input",{ref:n,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:c=>{e(c.target.value)},onKeyDown:c=>{c.key==="Enter"&&g()}})}),r.jsxs("div",{className:"filter-summary",title:"Status: "+f+`
|
|
3
3
|
Projects: `+S,onClick:()=>m(!l),children:[r.jsx("span",{className:"filter-label",children:"Status:"})," ",f,r.jsx("span",{className:"filter-label",children:"Projects:"})," ",S]}),l&&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:[...t.entries()].map(([c,v])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:v,onClick:()=>{const x=new Map(t);x.set(c,!x.get(c)),s(x)}}),r.jsx("div",{children:c})]})},c))}),r.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...o.entries()].map(([c,v])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:v,onClick:()=>{var C;const x=new Map(o);x.set(c,!x.get(c)),d(x);const R=(C=a==null?void 0:a.config)==null?void 0:C.configFile;R&&we.setObject(R+":projects",[...x.entries()].filter(([j,W])=>W).map(([j])=>j))}}),r.jsx("div",{children:c||"untitled"})]})},c))})]})]})},ht=({tag:i,style:e,onClick:t})=>r.jsx("span",{className:ae("tag",`tag-color-${ft(i)}`),onClick:t,style:{margin:"6px 0 0 6px",...e},title:`Click to filter by tag: ${i}`,children:i});function ft(i){let e=0;for(let t=0;t<i.length;t++)e=i.charCodeAt(t)+((e<<8)-e);return Math.abs(e%6)}const pt=Je,gt=({filterText:i,testModel:e,testServerConnection:t,testTree:s,runTests:o,runningState:d,watchAll:a,watchedTreeIds:g,setWatchedTreeIds:l,isLoading:m,onItemSelected:n,requestedCollapseAllCount:f,requestedExpandAllCount:S,setFilterText:c,onRevealSource:v})=>{const[x,R]=h.useState({expandedItems:new Map}),[C,j]=h.useState(),[W,L]=h.useState(f),[$,N]=h.useState(S);h.useEffect(()=>{if(W!==f){x.expandedItems.clear();for(const b of s.flatTreeItems())x.expandedItems.set(b.id,!1);L(f),j(void 0),R({...x});return}if($!==S){x.expandedItems.clear();for(const b of s.flatTreeItems())x.expandedItems.set(b.id,!0);N(S),j(void 0),R({...x});return}if(!d||d.itemSelectedByUser)return;let u;const E=b=>{var P;b.children.forEach(E),!u&&b.status==="failed"&&(b.kind==="test"&&d.testIds.has(b.test.id)||b.kind==="case"&&d.testIds.has((P=b.tests[0])==null?void 0:P.id))&&(u=b)};E(s.rootItem),u&&j(u.id)},[d,j,s,W,L,f,$,N,S,x,R]);const{selectedTreeItem:z}=h.useMemo(()=>{if(!e)return{selectedTreeItem:void 0};const u=C?s.treeItemById(C):void 0,E=mt(u,e);let b;return(u==null?void 0:u.kind)==="test"?b=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(b=u.tests[0]),n({treeItem:u,testCase:b,testFile:E}),{selectedTreeItem:u}},[n,C,e,s]);h.useEffect(()=>{if(!m)if(a)t==null||t.watchNoReply({fileNames:s.fileNames()});else{const u=new Set;for(const E of g.value){const b=s.treeItemById(E),P=b==null?void 0:b.location.file;P&&u.add(P)}t==null||t.watchNoReply({fileNames:[...u]})}},[m,s,a,g,t]);const G=u=>{j(u.id),o("bounce-if-busy",s.collectTestIds(u))},H=(u,E)=>{if(u.preventDefault(),u.stopPropagation(),u.metaKey||u.ctrlKey){const b=i.split(" ");b.includes(E)?c(b.filter(P=>P!==E).join(" ").trim()):c((i+" "+E).trim())}else c((i.split(" ").filter(b=>!b.startsWith("@")).join(" ")+" "+E).trim())};return r.jsx(pt,{name:"tests",treeState:x,setTreeState:R,rootItem:s.rootItem,dataTestId:"test-tree",render:u=>{const E=u.id.replace(/[^\w\d-_]/g,"-"),b=E+"-label",P=E+"-time";return r.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${b} ${P}`,children:[r.jsxs("div",{id:b,className:"ui-mode-tree-item-title",children:[r.jsx("span",{children:u.title}),u.kind==="case"?u.tags.map(q=>r.jsx(ht,{tag:q.slice(1),onClick:J=>H(J,q)},q)):null]}),!!u.duration&&u.status!=="skipped"&&r.jsx("div",{id:P,className:"ui-mode-tree-item-time",children:Ae(u.duration)}),r.jsxs(Y,{noMinHeight:!0,noShadow:!0,children:[r.jsx(D,{icon:"play",title:"Run",onClick:()=>G(u),disabled:!!d&&!d.completed}),r.jsx(D,{icon:"go-to-file",title:"Show source",onClick:v,style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!a&&r.jsx(D,{icon:"eye",title:"Watch",onClick:()=>{g.value.has(u.id)?g.value.delete(u.id):g.value.add(u.id),l({...g})},toggled:g.value.has(u.id)})]})]})},icon:u=>Ge(u.status),title:u=>u.title,selectedItem:z,onAccepted:G,onSelected:u=>{d&&(d.itemSelectedByUser=!0),j(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:i?5:1,noItemsMessage:m?"Loading…":"No tests"})};function mt(i,e){if(!(!i||!e))return{file:i.location.file,line:i.location.line,column:i.location.column,source:{errors:e.loadErrors.filter(t=>{var s;return((s=t.location)==null?void 0:s.file)===i.location.file}).map(t=>({line:t.location.line,message:t.message})),content:void 0}}}function _t(i){return`.playwright-artifacts-${i}`}const wt=({item:i,rootDir:e,onOpenExternally:t,revealSource:s,pathSeparator:o})=>{var f,S;const[d,a]=h.useState(),[g,l]=h.useState(0),m=h.useRef(null),{outputDir:n}=h.useMemo(()=>({outputDir:i.testCase?vt(i.testCase):void 0}),[i]);return h.useEffect(()=>{var R,C;m.current&&clearTimeout(m.current);const c=(R=i.testCase)==null?void 0:R.results[0];if(!c){a(void 0);return}const v=c&&c.duration>=0&&c.attachments.find(j=>j.name==="trace");if(v&&v.path){ge(v.path).then(j=>a({model:j,isLive:!1}));return}if(!n){a(void 0);return}const x=[n,_t(c.workerIndex),"traces",`${(C=i.testCase)==null?void 0:C.id}.json`].join(o);return m.current=setTimeout(async()=>{try{const j=await ge(x);a({model:j,isLive:!0})}catch{a(void 0)}finally{l(g+1)}},500),()=>{m.current&&clearTimeout(m.current)}},[n,i,a,g,l,o]),r.jsx(Ze,{model:d==null?void 0:d.model,showSourcesFirst:!0,rootDir:e,fallbackLocation:i.testFile,isLive:d==null?void 0:d.isLive,status:(f=i.treeItem)==null?void 0:f.status,annotations:((S=i.testCase)==null?void 0:S.annotations)||[],onOpenExternally:t,revealSource:s},"workbench")},vt=i=>{var e;for(let t=i.parent;t;t=t.parent)if(t.project())return(e=t.project())==null?void 0:e.outputDir};async function ge(i){const e=new URLSearchParams;e.set("trace",i),e.set("limit","1");const s=await(await fetch(`contexts?${e.toString()}`)).json();return new ze(s)}const xt=({settings:i})=>r.jsx("div",{className:"vbox settings-view",children:i.map(({value:e,set:t,title:s})=>r.jsx("div",{className:"setting",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:e,onClick:()=>t(!e)}),s]})},s))});let me={cols:80,rows:24};const A={pending:[],clear:()=>{},write:i=>A.pending.push(i),resize:()=>{}},O=new URLSearchParams(window.location.search),St=O.get("ws"),xe=new URL(`../${St}`,window.location.toString());xe.protocol=window.location.protocol==="https:"?"wss:":"ws:";const I={args:O.getAll("arg"),grep:O.get("grep")||void 0,grepInvert:O.get("grepInvert")||void 0,projects:O.getAll("project"),workers:O.get("workers")||void 0,headed:O.has("headed"),updateSnapshots:O.get("updateSnapshots")||void 0,reporters:O.has("reporter")?O.getAll("reporter"):void 0,pathSeparator:O.get("pathSeparator")||"/"};I.updateSnapshots&&!["all","none","missing"].includes(I.updateSnapshots)&&(I.updateSnapshots=void 0);const _e=navigator.platform==="MacIntel",bt=({})=>{var pe;const[i,e]=h.useState(""),[t,s]=h.useState(!1),[o,d]=h.useState(!1),[a,g]=h.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[l,m]=h.useState(new Map),[n,f]=h.useState(),[S,c]=h.useState(),[v,x]=h.useState({}),[R,C]=h.useState(new Set),[j,W]=h.useState(!1),[L,$]=h.useState(),N=L&&!L.completed,[z,G]=Ve("watch-all",!1),[H,u]=h.useState({value:new Set}),E=h.useRef(Promise.resolve()),b=h.useRef(new Set),[P,q]=h.useState(0),[J,Se]=h.useState(0),[be,Te]=h.useState(!1),[le,ce]=h.useState(!0),[w,ke]=h.useState(),[Z,je]=h.useState(),[ee,ye]=h.useState(!1);h.useState(!1);const[Ee,de]=h.useState(!1),Ie=h.useCallback(()=>de(!0),[de]),Re=!1,[ue,Tt]=h.useState(!1),[he,kt]=h.useState(!1),[fe,jt]=h.useState(!1),[Ce,Be]=Ke(),Ne=h.useRef(null),te=h.useCallback(()=>{ke(new Ye(new Qe(xe)))},[]);h.useEffect(()=>{var _;(_=Ne.current)==null||_.focus(),W(!0),te()},[te]),h.useEffect(()=>{if(!w)return;const _=[w.onStdio(p=>{if(p.buffer){const T=atob(p.buffer);A.write(T)}else A.write(p.text);p.type==="stderr"&&d(!0)}),w.onClose(()=>Te(!0))];return A.resize=(p,T)=>{me={cols:p,rows:T},w.resizeTerminalNoReply({cols:p,rows:T})},()=>{for(const p of _)p.dispose()}},[w]),h.useEffect(()=>{if(!w)return;let _;const p=new at({onUpdate:T=>{clearTimeout(_),_=void 0,T?f(p.asModel()):_||(_=setTimeout(()=>{f(p.asModel())},250))},onError:T=>{A.write((T.stack||T.value||"")+`
|
|
4
4
|
`),d(!0)},pathSeparator:I.pathSeparator});return je(p),f(void 0),W(!0),u({value:new Set}),(async()=>{try{await w.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:T,report:y}=await w.runGlobalSetup({});if(p.processGlobalReport(y),T!=="passed")return;const B=await w.listTests({projects:I.projects,locations:I.args,grep:I.grep,grepInvert:I.grepInvert});p.processListReport(B.report),w.onReport(M=>{p.processTestReportEvent(M)});const{hasBrowsers:F}=await w.checkBrowsers({});ce(F)}finally{W(!1)}})(),()=>{clearTimeout(_)}},[w]),h.useEffect(()=>{if(!n)return;const{config:_,rootSuite:p}=n,T=_.configFile?we.getObject(_.configFile+":projects",void 0):void 0,y=new Map(l);for(const B of y.keys())p.suites.find(F=>F.title===B)||y.delete(B);for(const B of p.suites)y.has(B.title)||y.set(B.title,!!(T!=null&&T.includes(B.title)));!T&&y.size&&![...y.values()].includes(!0)&&y.set(y.entries().next().value[0],!0),(l.size!==y.size||[...l].some(([B,F])=>y.get(B)!==F))&&m(y)},[l,n]),h.useEffect(()=>{N&&(n!=null&&n.progress)?c(n.progress):n||c(void 0)},[n,N]);const{testTree:Pe}=h.useMemo(()=>{if(!n)return{testTree:new ne("",new Q("","root"),[],l,I.pathSeparator)};const _=new ne("",n.rootSuite,n.loadErrors,l,I.pathSeparator);return _.filterTree(i,a,N?L==null?void 0:L.testIds:void 0),_.sortAndPropagateStatus(),_.shortenRoot(),_.flattenForSingleProject(),C(_.testIds()),{testTree:_}},[i,n,a,l,C,L,N]),V=h.useCallback((_,p)=>{!w||!n||_==="bounce-if-busy"&&N||(b.current=new Set([...b.current,...p]),E.current=E.current.then(async()=>{var B,F,M;const T=b.current;if(b.current=new Set,!T.size)return;{for(const k of((B=n.rootSuite)==null?void 0:B.allTests())||[])if(T.has(k.id)){k.results=[];const U=k._createTestResult("pending");U[X]="scheduled"}f({...n})}const y=" ["+new Date().toLocaleTimeString()+"]";A.write("\x1B[2m—".repeat(Math.max(0,me.cols-y.length))+y+"\x1B[22m"),c({total:0,passed:0,failed:0,skipped:0}),$({testIds:T}),await w.runTests({locations:I.args,grep:I.grep,grepInvert:I.grepInvert,testIds:[...T],projects:[...l].filter(([k,U])=>U).map(([k])=>k),...ue?{workers:"1"}:{},...he?{headed:!0}:{},...fe?{updateSnapshots:"all"}:{},reporters:I.reporters,trace:"on"});for(const k of((F=n.rootSuite)==null?void 0:F.allTests())||[])((M=k.results[0])==null?void 0:M.duration)===-1&&(k.results=[]);f({...n}),$(k=>k?{...k,completed:!0}:void 0)}))},[l,N,n,w,ue,he,fe]);h.useEffect(()=>{if(!w||!Z)return;const _=w.onTestFilesChanged(async p=>{if(E.current=E.current.then(async()=>{W(!0);try{const M=await w.listTests({projects:I.projects,locations:I.args,grep:I.grep,grepInvert:I.grepInvert});Z.processListReport(M.report)}catch(M){console.log(M)}finally{W(!1)}}),await E.current,p.testFiles.length===0)return;const T=Z.asModel(),y=new ne("",T.rootSuite,T.loadErrors,l,I.pathSeparator),B=[],F=new Set(p.testFiles);if(z){const M=k=>{const U=k.location.file;U&&F.has(U)&&B.push(...y.collectTestIds(k)),k.kind==="group"&&k.subKind==="folder"&&k.children.forEach(M)};M(y.rootItem)}else for(const M of H.value){const k=y.treeItemById(M),U=k==null?void 0:k.location.file;U&&F.has(U)&&B.push(...y.collectTestIds(k))}V("queue-if-busy",new Set(B))});return()=>_.dispose()},[V,w,z,H,Z,l]),h.useEffect(()=>{if(!w)return;const _=p=>{p.code==="Backquote"&&p.ctrlKey?(p.preventDefault(),s(!t)):p.code==="F5"&&p.shiftKey?(p.preventDefault(),w==null||w.stopTestsNoReply({})):p.code==="F5"&&(p.preventDefault(),V("bounce-if-busy",R))};return addEventListener("keydown",_),()=>{removeEventListener("keydown",_)}},[V,te,w,R,t]);const ie=h.useRef(null),Me=h.useCallback(_=>{var p;_.preventDefault(),_.stopPropagation(),(p=ie.current)==null||p.showModal()},[]),re=h.useCallback(_=>{var p;_.preventDefault(),_.stopPropagation(),(p=ie.current)==null||p.close()},[]),De=h.useCallback(_=>{re(_),s(!0),w==null||w.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:p}=await(w==null?void 0:w.checkBrowsers({}));ce(p)})},[re,w]);return r.jsxs("div",{className:"vbox ui-mode",children:[!le&&r.jsxs("dialog",{ref:ie,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:De,children:"Install"}),r.jsx("button",{className:"button secondary",onClick:re,children:"Dismiss"})]})]}),be&&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($e,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:r.jsxs("div",{className:"vbox",children:[r.jsxs("div",{className:ae("vbox",!t&&"hidden"),children:[r.jsxs(Y,{children:[r.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),r.jsx(D,{icon:"circle-slash",title:"Clear output",onClick:()=>{A.clear(),d(!1)}}),r.jsx("div",{className:"spacer"}),r.jsx(D,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),r.jsx(lt,{source:A})]}),r.jsx("div",{className:ae("vbox",t&&"hidden"),children:r.jsx(wt,{pathSeparator:I.pathSeparator,item:v,rootDir:(pe=n==null?void 0:n.config)==null?void 0:pe.rootDir,revealSource:Ee,onOpenExternally:_=>w==null?void 0:w.openNoReply({location:{file:_.file,line:_.line,column:_.column}})})})]}),sidebar:r.jsxs("div",{className:"vbox ui-mode-sidebar",children:[r.jsxs(Y,{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(D,{icon:"refresh",title:"Reload",onClick:()=>te(),disabled:N||j}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(D,{icon:"terminal",title:"Toggle output — "+(_e?"⌃`":"Ctrl + `"),toggled:t,onClick:()=>{s(!t)}}),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)"}})]}),!le&&r.jsx(D,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Me})]}),r.jsx(ut,{filterText:i,setFilterText:e,statusFilters:a,setStatusFilters:g,projectFilters:l,setProjectFilters:m,testModel:n,runTests:()=>V("bounce-if-busy",R)}),r.jsxs(Y,{noMinHeight:!0,children:[!N&&!S&&r.jsx("div",{className:"section-title",children:"Tests"}),!N&&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,"%)"]})}),N&&S&&r.jsx("div",{"data-testid":"status-line",className:"status-line",children:r.jsxs("div",{children:["Running ",S.passed,"/",L.testIds.size," passed (",S.passed/L.testIds.size*100|0,"%)"]})}),r.jsx(D,{icon:"play",title:"Run all — F5",onClick:()=>V("bounce-if-busy",R),disabled:N||j}),r.jsx(D,{icon:"debug-stop",title:"Stop — "+(_e?"⇧F5":"Shift + F5"),onClick:()=>w==null?void 0:w.stopTests({}),disabled:!N||j}),r.jsx(D,{icon:"eye",title:"Watch all",toggled:z,onClick:()=>{u({value:new Set}),G(!z)}}),r.jsx(D,{icon:"collapse-all",title:"Collapse all",onClick:()=>{q(P+1)}}),r.jsx(D,{icon:"expand-all",title:"Expand all",onClick:()=>{Se(J+1)}})]}),r.jsx(gt,{filterText:i,testModel:n,testTree:Pe,testServerConnection:w,runningState:L,runTests:V,onItemSelected:x,watchAll:z,watchedTreeIds:H,setWatchedTreeIds:u,isLoading:j,requestedCollapseAllCount:P,requestedExpandAllCount:J,setFilterText:e,onRevealSource:Ie}),Re,r.jsxs(Y,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>ye(!ee),children:[r.jsx("span",{className:`codicon codicon-${ee?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:ee?"Hide Settings":"Show Settings"}),r.jsx("div",{className:"section-title",children:"Settings"})]}),ee&&r.jsx(xt,{settings:[{value:Ce,set:Be,title:"Dark mode"}]})]})})]})};(async()=>{if(He(),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
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)}qe(document.querySelector("#root")).render(r.jsx(bt,{}))})();
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
8
|
<title>Playwright Test</title>
|
|
9
|
-
<script type="module" crossorigin src="./uiMode.
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
9
|
+
<script type="module" crossorigin src="./uiMode.CzKr-TMc.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-C_9qyxv5.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="./assets/testServerConnection-DeE2kSzz.js">
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/workbench-
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/workbench-DsQEOQud.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DEOUW62d.css">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="./workbench.C-zR9ysA.css">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="./uiMode.voC1ZiOQ.css">
|