Files
msh-system/tests/e2e/reports/trace/uiMode.CQJ9SCIQ.js

6 lines
36 KiB
JavaScript
Raw Permalink Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-CsJ4vdCR.js","./xtermModule.DYP7pi_n.css"])))=>i.map(i=>d[i]);
import{u as zt,r as H,g as Kt,_ as Vt,h as $t,i as Ht,j as r,R as u,E as qt,s as yt,k as mt,l as Yt,t as Qt,m as Xt,n as q,o as F,T as Et,c as Jt,p as at,a as Zt,W as Gt,S as te,q as ee,b as se,e as ie,f as oe}from"./assets/defaultSettingsView-CJSZINFr.js";var re={};class pt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new Z("","root"),this._options=e,this._reporter=t}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestPaused"){this._onTestPaused(s.testId,s.resultId,s.errors);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onAttach"){this._onAttach(s.testId,s.resultId,s.attachments);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===t.name):void 0;e||(e=new Z(t.name,"project"),this._rootSuite._addSuite(e)),e._project=this._parseProject(t);for(const s of t.suites)this._mergeSuiteInto(s,e)}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var a,n;const s=this._tests.get(t);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const i=s._createTestResult(e.id);i.retry=e.retry,i.workerIndex=e.workerIndex,i.parallelIndex=e.parallelIndex,i.setStartTimeNumber(e.startTime),(n=(a=this._reporter).onTestBegin)==null||n.call(a,s,i)}_onTestPaused(t,e,s){var n,m;const i=this._tests.get(t),a=i.results.find(d=>d._id===e);a.errors.push(...s),a.error=a.errors[0],(m=(n=this._reporter).onTestPaused)==null||m.call(n,i,a)}_onTestEnd(t,e){var a,n;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const i=s.results.find(m=>m._id===e.id);i.duration=e.duration,i.status=e.status,i.errors.push(...e.errors??[]),i.error=i.errors[0],e.attachments&&(i.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),i.annotations=e.annotations,s.annotations=e.annotations),(n=(a=this._reporter).onTestEnd)==null||n.call(a,s,i),i._stepMap=new Map}_onStepBegin(t,e,s){var f,l;const i=this._tests.get(t),a=i.results.find(w=>w._id===e),n=s.parentStepId?a._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),d=new ae(s,n,m,a);n?n.steps.push(d):a.steps.push(d),a._stepMap.set(s.id,d),(l=(f=this._reporter).onStepBegin)==null||l.call(f,i,a,d)}_onStepEnd(t,e,s){var m,d;const i=this._tests.get(t),a=i.results.find(f=>f._id===e),n=a._stepMap.get(s.id);n._endPayload=s,n.duration=s.duration,n.error=s.error,(d=(m=this._reporter).onStepEnd)==null||d.call(m,i,a,n)}_onAttach(t,e,s){this._tests.get(t).results.find(n=>n._id===e).attachments.push(...s.map(n=>({name:n.name,contentType:n.contentType,path:n.path,body:n.base64&&globalThis.Buffer?Buffer.from(n.base64,"base64"):void 0})))}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,a){var f,l,w,x;const n=a?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,m=e?this._tests.get(e):void 0,d=m&&s?m.results.find(c=>c._id===s):void 0;t==="stdout"?(d==null||d.stdout.push(n),(l=(f=this._reporter).onStdOut)==null||l.call(f,n,m,d)):(d==null||d.stderr.push(n),(x=(w=this._reporter).onStdErr)==null||x.call(w,n,m,d))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,{status:t.status,startTime:new Date(t.startTime),duration:t.
Projects: `+x,onClick:()=>f(!d),children:[r.jsx("span",{className:"filter-label",children:"Status:"})," ",w,r.jsx("span",{className:"filter-label",children:"Projects:"})," ",x]}),d&&r.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[r.jsx("div",{className:"filter-list",role:"list","data-testid":"status-filters",children:[...e.entries()].map(([c,T])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:T,onChange:()=>{const _=new Map(e);_.set(c,!_.get(c)),s(_)}}),r.jsx("div",{children:c})]})},c))}),r.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...i.entries()].map(([c,T])=>r.jsx("div",{className:"filter-entry",role:"listitem",children:r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",checked:T,onChange:()=>{var I;const _=new Map(i);_.set(c,!_.get(c)),a(_);const b=(I=n==null?void 0:n.config)==null?void 0:I.configFile;b&&yt.setObject(b+":projects",[..._.entries()].filter(([j,E])=>E).map(([j])=>j))}}),r.jsx("div",{children:c||"untitled"})]})},c))})]})]})},_e=({tag:o,style:t,onClick:e})=>r.jsx("span",{className:mt("tag",`tag-color-${ve(o)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${o}`,children:o});function ve(o){let t=0;for(let e=0;e<o.length;e++)t=o.charCodeAt(e)+((t<<8)-t);return Math.abs(t%6)}const we=Yt,be=({filterText:o,testModel:t,testServerConnection:e,testTree:s,runTests:i,runningState:a,watchAll:n,watchedTreeIds:m,setWatchedTreeIds:d,isLoading:f,onItemSelected:l,requestedCollapseAllCount:w,requestedExpandAllCount:x,setFilterText:c,onRevealSource:T})=>{const[_,b]=u.useState({expandedItems:new Map}),[I,j]=u.useState(),[E,R]=u.useState(w),[W,tt]=u.useState(x);u.useEffect(()=>{if(E!==w){_.expandedItems.clear();for(const k of s.flatTreeItems())_.expandedItems.set(k.id,!1);R(w),j(void 0),b({..._});return}if(W!==x){_.expandedItems.clear();for(const k of s.flatTreeItems())_.expandedItems.set(k.id,!0);tt(x),j(void 0),b({..._});return}if(!a||a.itemSelectedByUser)return;let h;const B=k=>{var M;k.children.forEach(B),!h&&k.status==="failed"&&(k.kind==="test"&&a.testIds.has(k.test.id)||k.kind==="case"&&a.testIds.has((M=k.tests[0])==null?void 0:M.id))&&(h=k)};B(s.rootItem),h&&j(h.id)},[a,j,s,E,R,w,W,tt,x,_,b]);const N=u.useMemo(()=>{if(I)return s.treeItemById(I)},[I,s]);u.useEffect(()=>{if(!t)return;const h=xe(N,t);let B;(N==null?void 0:N.kind)==="test"?B=N.test:(N==null?void 0:N.kind)==="case"&&N.tests.length===1&&(B=N.tests[0]),l({treeItem:N,testCase:B,testFile:h})},[t,N,l]),u.useEffect(()=>{if(!f)if(n)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const h=new Set;for(const B of m.value){const k=s.treeItemById(B),M=k==null?void 0:k.location.file;M&&h.add(M)}e==null||e.watchNoReply({fileNames:[...h]})}},[f,s,n,m,e]);const $=h=>{j(h.id),i("bounce-if-busy",s.collectTestIds(h))},K=(h,B)=>{if(h.preventDefault(),h.stopPropagation(),h.metaKey||h.ctrlKey){const k=o.split(" ");k.includes(B)?c(k.filter(M=>M!==B).join(" ").trim()):c((o+" "+B).trim())}else c((o.split(" ").filter(k=>!k.startsWith("@")).join(" ")+" "+B).trim())};return r.jsx(we,{name:"tests",treeState:_,setTreeState:b,rootItem:s.rootItem,dataTestId:"test-tree",render:h=>{const B=h.id.replace(/[^\w\d-_]/g,"-"),k=B+"-label",M=B+"-time";return r.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${k} ${M}`,children:[r.jsxs("div",{id:k,className:"ui-mode-tree-item-title",children:[r.jsx("span",{children:h.title}),h.kind==="case"?h.tags.map(Y=>r.jsx(_e,{tag:Y.slice(1),onClick:ct=>K(ct,Y)},Y)):null]}),!!h.duration&&h.status!=="skipped"&&r.jsx("div",{id:M,className:"ui-mode-tree-item-time",children:Xt(h.duration)}),r.jsxs(q,{noMinHeight:!0,noShadow:!0,children:[r.jsx(F,{icon:"play",title:"Run",onClick:()=>$(h),disabled:!!a&&!a.completed}),r.jsx(F,{icon:"go-to-file",title:"Show source",onClick:T,style:h.kind==="group"&&h.subKind==="folder"?{visibility:"hidden"}:{}}),!n&&r.jsx(F,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(h.id)?m.value.delete(h.id):m.v
`),a(!0)},pathSeparator:P.pathSeparator});return Pt(g),w(void 0),I(!0),$({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:S,report:C}=await v.runGlobalSetup({});if(g.processGlobalReport(C),S!=="passed")return;const L=await v.listTests({projects:P.projects,locations:P.args,grep:P.grep,grepInvert:P.grepInvert});g.processListReport(L.report),v.onReport(V=>{g.processTestReportEvent(V)});const{hasBrowsers:O}=await v.checkBrowsers({});wt(O)}finally{I(!1)}})(),()=>{clearTimeout(p)}},[v]),u.useEffect(()=>{if(!l)return;const{config:p,rootSuite:g}=l,S=p.configFile?yt.getObject(p.configFile+":projects",void 0):void 0,C=new Map(d);for(const L of C.keys())g.suites.find(O=>O.title===L)||C.delete(L);for(const L of g.suites)C.has(L.title)||C.set(L.title,!!(S!=null&&S.includes(L.title)));!S&&C.size&&![...C.values()].includes(!0)&&C.set(C.entries().next().value[0],!0),(d.size!==C.size||[...d].some(([L,O])=>C.get(L)!==O))&&f(C)},[d,l]),u.useEffect(()=>{R&&(l!=null&&l.progress)?c(l.progress):l||c(void 0)},[l,R]);const{testTree:rt}=u.useMemo(()=>{if(!l)return{testTree:new gt("",new Z("","root"),[],d,P.pathSeparator,Q)};const p=new gt("",l.rootSuite,l.loadErrors,d,P.pathSeparator,Q);return p.filterTree(o,n,R?j==null?void 0:j.testIds:void 0),p.sortAndPropagateStatus(),p.shortenRoot(),p.flattenForSingleProject(),{testTree:p}},[o,l,n,d,j,R,Q]),X=u.useCallback((p,g)=>{if(!(!v||!l)&&!(p==="bounce-if-busy"&&R)){for(const S of g.testIds)h.current.testIds.add(S);for(const S of g.locations)h.current.locations.add(S);K.current=K.current.then(async()=>{var O,V,U;const{testIds:S,locations:C}=h.current;if(h.current={testIds:new Set,locations:new Set},!S.size)return;{for(const y of((O=l.rootSuite)==null?void 0:O.allTests())||[])if(S.has(y.id)){y.results=[];const D=y._createTestResult("pending");D[G]="scheduled"}w({...l})}const L=" ["+new Date().toLocaleTimeString()+"]";z.write("\x1B[2m—".repeat(Math.max(0,jt.cols-L.length))+L+"\x1B[22m"),c({total:0,passed:0,failed:0,skipped:0}),E({testIds:S}),await v.runTests({locations:[...C].map(Ie),grep:P.grep,grepInvert:P.grepInvert,testIds:[...S],projects:[...d].filter(([y,D])=>D).map(([y])=>y),updateSnapshots:ut,reporters:P.reporters,workers:dt?1:void 0,trace:"on"});for(const y of((V=l.rootSuite)==null?void 0:V.allTests())||[])((U=y.results[0])==null?void 0:U.duration)===-1&&(y.results=[]);w({...l}),E(y=>y?{...y,completed:!0}:void 0)})}},[d,R,l,v,ut,dt]),nt=u.useCallback(()=>X("bounce-if-busy",rt.collectTestIds(rt.rootItem)),[X,rt]);u.useEffect(()=>{if(!v||!et)return;const p=v.onTestFilesChanged(async g=>{if(K.current=K.current.then(async()=>{I(!0);try{const U=await v.listTests({projects:P.projects,locations:P.args,grep:P.grep,grepInvert:P.grepInvert});et.processListReport(U.report)}catch(U){console.log(U)}finally{I(!1)}}),await K.current,g.testFiles.length===0)return;const S=et.asModel(),C=new gt("",S.rootSuite,S.loadErrors,d,P.pathSeparator,Q),L=[],O=[],V=new Set(g.testFiles);if(W){const U=y=>{const D=y.location.file;if(D&&V.has(D)){const J=C.collectTestIds(y);L.push(...J.locations),O.push(...J.testIds)}y.kind==="group"&&y.subKind==="folder"&&y.children.forEach(U)};U(C.rootItem)}else for(const U of N.value){const y=C.treeItemById(U);if(!y)continue;let D=y;for(;!(D.kind==="group"&&(D.subKind==="file"||D.subKind==="folder"))&&D.parent;)D=D.parent;const J=D==null?void 0:D.location.file;if(J&&V.has(J)){const St=C.collectTestIds(y);L.push(...St.locations),O.push(...St.testIds)}}X("queue-if-busy",{locations:L,testIds:O})});return()=>p.dispose()},[X,v,W,N,et,d,Q]),u.useEffect(()=>{if(!v)return;const p=g=>{g.code==="Backquote"&&g.ctrlKey?(g.preventDefault(),s(!e)):g.code==="F5"&&g.shiftKey?(g.preventDefault(),v==null||v.stopTestsNoReply({})):g.code==="F5"&&(g.preventDefault(),nt())};return addEventListener("keydown",p),()=>{removeEventListener("keydown",p)}},[nt,ot,v,e]);const ht=u.useRef(null),Ut=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g=ht.current)==null||g.showModal()},[]),ft=u.useCallback(p=>{var g;p.preventDefault(),p.stopPropagation(),(g
Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(o=>{navigator.serviceWorker.oncontrollerchange=()=>o()}),setInterval(function(){fetch("ping")},1e4)}oe.createRoot(document.querySelector("#root")).render(r.jsx(ye,{}))})();