@checksum-ai/runtime 4.3.2-beta.1 → 4.3.2
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/.env
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
CHECKSUM_RUNTIME_BUILD_TIME=2026-06-
|
|
1
|
+
CHECKSUM_RUNTIME_BUILD_TIME=2026-06-03T20:27:18.193Z
|
package/cli.js
CHANGED
|
@@ -747,7 +747,7 @@ ${n}`)}get createChecksumStep(){return n=>this.checksumPage.createChecksumStep(n
|
|
|
747
747
|
`)},"writeStderrLine");var G4n=t(i=>ire(i),"defaultSink"),Y4n=G4n;var Mcr=t(i=>i==="true"||i==="1","truthy"),O_t=t(()=>Mcr(process.env.CHECKSUM_WIDE_EVENTS)||Mcr(process.env.WIDE_EVENT_PRETTY),"wideEventsEnabled"),Z4n=t(i=>{let n=i.kind??"event",s=i.outcome?` ${i.outcome}`:"",c=typeof i.duration_ms=="number"?` ${i.duration_ms}ms`:"";return`${n}${s}${c}`.trim()},"messageFor"),Lcr=t(i=>{if(!O_t())return;let n={severity:bDe(i),message:i.message??Z4n(i),...i};try{Y4n(n)}catch(s){try{EDe(`[wide-event] runtime emit failed: ${String(s)}`)}catch{}}},"dispatch"),wM=t((i,n={})=>{let s=Date.now(),c={timestamp:new Date().toISOString(),kind:i,...n},u=!1,_={set(h){return Object.assign(c,h),_},emit(h){u||(u=!0,h&&Object.assign(c,h),c.duration_ms===void 0&&(c.duration_ms=Date.now()-s),Lcr(c))}};return _},"wideEvent"),M_t=t((i,n={})=>{Lcr({timestamp:new Date().toISOString(),kind:i,...n})},"emitWideEvent"),Pz=t(i=>i instanceof Error?{type:i.name,message:i.message}:{type:"UnknownError",message:String(i)},"toErrorField");var gP=class gP extends qk{constructor(n,s,c,u,_,h,b){super(n,s,c,u,_,h,b),this.runtimePageContext=h}init(n){var s;return this.initializationData=n,(s=this.initializationData.fallbackConfig).arMode??(s.arMode="fast"),this}canResolve(n){return!0}get failingThought(){return this.initializationData.thoughts.failing}getRecoveryAttemptTitle(){switch(this.initializationData.type){case"action":return`Checksum Auto-Recovery: trying to achieve action "${this.failingThought}"...`;case"assertion":return`Checksum Auto-Recovery: trying to verify assertion "${this.failingThought}"...`}}static async registerSession(n){let s=n.config.apiURL,c=n.config.apiKey;return await(await fetch(`${s}${gP.API_BASE_ROUTE}/register-auto-recovery-session`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:c},body:JSON.stringify({appName:n.testIdentification.testFileName,fallbackData:n})})).json()}async prepareSession(n){let s=await gP.registerSession(this.initializationData);this.utils=new vDe({page:this.page,evaluateWithChecksum:this.evaluateWithChecksum,checksumPage:this.checksumPage,pageInteractor:this.pageInteractor,arConfig:s.arConfig,sessionId:s.sessionId,runtimeFallbackData:this.initializationData,fallbackData:n,variableStore:this.variables,runtimePage:this.runtimePageContext,context:this.context});try{this.agent=await gDe.build(this.utils)}catch(c){let u=c instanceof Error?c.message:String(c),_=c instanceof Error?c.stack:void 0;throw new Error(`Failed to prepare ARFallback: ${u}`)}}async resolve(n){var h;let s=null,c=new Promise((b,S)=>{s=setTimeout(()=>{s=null,this.utils.analytics.ARError({error:`Auto-recovery timed out after ${gP.TIMEOUT_MS/1e3} seconds`});let k="Auto-Recovery attempt finished unsuccessfully";this.utils.createChecksumStep({title:k,withError:!0}),this.utils.addAutoRecoveryErrorToReport(k,!1),S(new Error(k))},gP.TIMEOUT_MS)}),u=Date.now();await this.prepareSession(n);let _=wM("auto_recovery_session",{recovery:this.utils.analytics.metadata});this.utils.analytics.ARStart();try{let b=await Promise.race([this.agent.init(),c]);return s!==null&&(clearTimeout(s),s=null),this.utils.analytics.ARFinish({duration:Date.now()-u}),_.emit({outcome:"success",result:b.result,steps_count:((h=b.stepsThoughts)==null?void 0:h.length)??0,final_thought:b.finalThought}),{fbResult:b.result,thought:b.finalThought,stepsThoughts:b.stepsThoughts,steps:[]}}catch(b){throw s!==null&&(clearTimeout(s),s=null),this.utils.analytics.ARFinish({duration:Date.now()-u}),_.emit({outcome:"error",error:Pz(b)}),b}}};t(gP,"ARFallback"),gP.API_BASE_ROUTE="/auto-recovery",gP.TIMEOUT_MS=12e4;var yP=gP;var Qcr=t(i=>{let n=i.info();return n.annotations.some(s=>s.type==="bug")||n.tags.some(s=>s==="@bug")},"isKnownBugTest");var L_t=1e3*30;var IM=class IM extends e8e{constructor(s,c="normal",u,_,h,b,S,k,B,G,j,K,ee){var Ye,st,Be;super(s,u,j,()=>this.pageInteractor,void 0);this.page=s;this.runMode=c;this.testRunAnalytics=_;this.monitorBridge=h;this.testInfo=b;this.checksumTestId=S;this.test=k;this.options=B;this.isReplMode=G;this.config=j;this.pageInteractorAPI=K;this.lastInteractionTime=Date.now();this.hasRuntimeStartedTrace=!1;this.unzippedHarData=[];this.fallbacks=[];this.hasUsedAutoRecovery=!1;this.hasSuccessfulAutoRecovery=!1;this.arSummaries=[];this.arStepIds=[];this.arResults=[];this.failedSteps=[];this.thoughtsCounter=0;this.highLevelThoughts=[];this.framesMsgBroker=new _6e;this.previousSteps=[];this.scriptLoadWrapper=t(async(s,c)=>(!this.isTimeMachineFrame(c)&&this.navigationPromise&&await this.navigationPromise,this.wrapInternalSteps(s,c.page())),"scriptLoadWrapper");this.scriptLoadCheck=t(async s=>s.evaluate(()=>!!window.checksum),"scriptLoadCheck");this.scriptLoadCallback=t(async s=>{await s.evaluate(async({appSpecificRules:c,esraTimeout:u,sessionRecorder:_,showFrontendLogs:h,showTMSeeker:b,filesObserver:S,nativeDialogObserver:k,assertionsObserver:B,actionsObserver:G,recordOptions:j})=>{var K;(K=window.checksum)==null||K.testGenerator.init(c,{esraTimeout:u,showFrontendLogs:h,skipElementHighlighting:!0,recordOptions:j},{assertionGenerator:!1,sessionRecorder:_,filesObserver:S,nativeDialogObserver:k,assertionsObserver:B,actionsObserver:G});try{b&&window.checksum.timeMachine.openSeekbar()}catch{}},{appSpecificRules:this.appSpecificRules,esraTimeout:L_t,sessionRecorder:!this.isTimeMachineFrame(s)&&!!this.timeMachine,showFrontendLogs:Ac.isDevMode,showTMSeeker:this.isTimeMachineFrame(s)&&process.env.CHECKSUM_SHOW_TIME_MACHINE==="true",filesObserver:!1,nativeDialogObserver:!1,assertionsObserver:!1,actionsObserver:!1,recordOptions:void 0}),Nc(`[init] init script loaded for ${s.page().url()}`)},"scriptLoadCallback");CDe(B.printLogs),Qcr(k)&&this.config.options.useChecksumAI.skipTestsWithKnownBugs&&(console.log("Auto recovery will not run for this test as it is marked as a known bug"),this.config.options.useChecksumAI.actions=!1,this.config.options.useChecksumAI.assertions=!1,this.config.options.useChecksumAI.visualComparison=!1),this.injectedScriptManager.setScriptLoadWrapper(this.scriptLoadWrapper).setScriptLoadCallback(this.scriptLoadCallback).setScriptLoadCheck(this.scriptLoadCheck);let fe=Vcr({config:this.config,throwIfAuthFailed:!0}),Ze=this.getPlaywrightProjectConfig();if(this.pageInteractor=new afe(this.evaluateWithChecksum.bind(this),()=>this.page.mainFrame(),()=>this.timeMachine,{log:Nc,logError:Nc},{navigationTimeout:(Ye=Ze.use)==null?void 0:Ye.navigationTimeout,actionTimeout:(st=Ze.use)==null?void 0:st.actionTimeout,testAssetsDir:nfe(PS()),waitActionDelay:1e3},this.pageInteractorAPI,fe),this.checkForActiveTracing(),this.resetFallbacks(),ee&&(this.highLevelThoughts=ee.highLevelThoughts??[],this.timeMachineBrowserContext=ee.timeMachineBrowserContext,this.variableStore=ee.variableStore),Ac.testRun.timeMachine.active){let ht=this.shouldRecordRRwebEvents()?{recordRRwebEventsToFile:!0,recordRRwebEventsToFilePath:iNt(this.checksumTestId,this.testInfo.retry)}:{};this.timeMachine=new qTe(this.framesMsgBroker,this.injectedScriptManager,{...ht,headless:process.env.CHECKSUM_SHOW_TIME_MACHINE==="true"?!1:Ac.testRun.timeMachine.headless,webProxy:(Be=b.project.use)==null?void 0:Be.proxy}),this.timeMachineBrowserContext&&this.timeMachine.setTimeMachineBrowserContext(this.timeMachineBrowserContext)}}previousThoughtsAndTimestamps(){return this.previousSteps}static async init(s,c,u,_,h,b,S,k,B,G=!1){let j=!1;S||(S=Y7t(5),j=!0,console.warn(`Checksum test id was not defined for test "${b.title}" and was auto-generated. Please replace - "${b.title}" with -
|
|
748
748
|
test(defineChecksumTest("${b.title}", "${S}"), async ({ page }) => {...`)),_.addTestInfo(S,b.testId,j),B.options.useChecksumAI!==void 0&&typeof B.options.useChecksumAI=="boolean"&&(B.options.useChecksumAI={actions:B.options.useChecksumAI,assertions:!1,visualComparison:!1});let K=new o4e(B),ee=new IM(s,B.runMode,c,u,_,b,S,k,{useChecksumSelectors:!0,useChecksumAI:{actions:!0,assertions:!1},newAssertionsEnabled:B.runMode!=="normal",useMockData:!1,printLogs:!1,...B.options},G,B,K,{variableStore:h});return c.pages().length===0&&(k._checksum.expect.setPage(ee),k._checksum.checksumAI.page=ee,h.clearAll(),ee.testRunAnalytics.testRunStart()),await ee.asyncInit(),ee.proxy}async asyncInit(s=!1){await this.loadAppSpecificRules(),await this.wrapInternalSteps(async()=>{await this.page.addInitScript(()=>{window.sessionStorage.setItem("checksumai:disable","true")})}),this.timeMachine&&(await this.timeMachine.prepare(this.page.mainFrame()),this.timeMachineBrowserContext=this.timeMachine.getTimeMachineBrowserContext()),this.pageInteractor.init(),s||await this.prepareForTestArtifacts()}async makePage(s){let c=new IM(s,this.runMode,this._context,this.testRunAnalytics,this.monitorBridge,this.testInfo,this.checksumTestId,this.test,this.options,this.isReplMode,this.config,this.pageInteractorAPI,{highLevelThoughts:this.highLevelThoughts,timeMachineBrowserContext:this.timeMachineBrowserContext,variableStore:this.variableStore});return await c.asyncInit(!0),c.proxy}getTimeMachinePage(){var s;return(s=this.timeMachine)==null?void 0:s.getPage()}getFramesMessageBroker(){return this.framesMsgBroker}isTimeMachineFrame(s){var c;return s===((c=this.timeMachine)==null?void 0:c.getFrame())}shouldRecordRRwebEvents(){return Ac.testRun.timeMachine.recordRRwebEventsToFile&&this.config.options.hostReports}recordInteraction(){let s=this.getPageGuid(this.page);IM.recentlyInteracted.set(s,Date.now()),this.lastInteractionTime=Date.now()}static getMostRecentPage(s){let c=s.pages(),u=c[0],_=0;for(let h of c){let b=h._guid,S=IM.recentlyInteracted.get(b)||0;S>_&&(_=S,u=h)}return u}async goto(s,c){return this.recordInteraction(),this.page.goto(s,c)}async reload(s){return this.recordInteraction(),this.page.reload(s)}async goBack(s){return this.recordInteraction(),this.page.goBack(s)}async goForward(s){return this.recordInteraction(),this.page.goForward(s)}async click(s,c){return this.recordInteraction(),this.page.click(s,c)}async dblclick(s,c){return this.recordInteraction(),this.page.dblclick(s,c)}async fill(s,c,u){return this.recordInteraction(),this.page.fill(s,c,u)}async press(s,c,u){return this.recordInteraction(),this.page.press(s,c,u)}async check(s,c){return this.recordInteraction(),this.page.check(s,c)}async uncheck(s,c){return this.recordInteraction(),this.page.uncheck(s,c)}async selectOption(s,c,u){return this.recordInteraction(),this.page.selectOption(s,c,u)}async hover(s,c){return this.recordInteraction(),this.page.hover(s,c)}async type(s,c,u){return this.recordInteraction(),this.page.type(s,c,u)}async setInputFiles(s,c,u){return this.recordInteraction(),this.page.setInputFiles(s,c,u)}async tap(s,c){return this.recordInteraction(),this.page.tap(s,c)}async dragAndDrop(s,c,u){return this.recordInteraction(),this.page.dragAndDrop(s,c,u)}getPlaywrightProjectConfig(){return this.testInfo.project}checkForActiveTracing(){var u;let c=(u=this.getPlaywrightProjectConfig().use)==null?void 0:u.trace;this.traceMode=typeof c=="string"?c:c==null?void 0:c.mode}registerPageEvents(){super.registerPageEvents(),this.injectedScriptManager.addTrackedFrame(this.page),this.page.on("framenavigated",async s=>{this.injectedScriptManager.onFrameNavigated(s)})}checksumSelector(s){return this.checksumStepId=s,this.options.useChecksumSelectors&&this.setSelectorFallback(s),this.proxy}checksumAI(s,c,u){let _=this.addNewThought(s,"action",!!c);this.previousSteps.push({thought:_.thought,timestamp:Date.now()});let h=this.getPageGuid(this.page);return afe.setLastAction(h,s),c&&typeof c=="function"?this.test.step(s,async b=>{var S;try{return u!=null&&u.withDialog&&this.pageInteractor.listenToDialog(),await c()}catch(k){if(_.children=[],!this.options.useChecksumAI.actions||u!=null&&u.withDialog||u!=null&&u.skipAutoRecovery)throw k;this.setAIFallback(s,"action");try{return await this.initiateFallbackSequence({type:"action",error:k,method:void 0,args:[],testInfo:this.testInfo,step:b},{fallbackTypes:[AN,yP]})}catch(B){throw this.testRunAnalytics.testRunError({failedThought:s,error:(B==null?void 0:B.message)||"Unknown error"}),B}}finally{this.pageInteractor.removeListener("dialog"),this.currentThought=(S=this.currentThought)==null?void 0:S.parent}}):(this.options.useChecksumAI.actions&&!(u!=null&&u.skipAutoRecovery)&&this.setAIFallback(s,"action"),this.proxy)}resolveAssetsFolder(s){return s.map(c=>i8.join(nfe(PS()),c))}getRuntimeOptions(){return this.options}addPwAnnotation(s){this.testInfo.annotations.push({type:s.type,description:`
|
|
749
749
|
${s.description}`})}async onTestComplete(s){this.testRunAnalytics.testRunEnd({success:s,autoRecoveryTriggered:this.hasUsedAutoRecovery,summaries:this.arSummaries}),this.monitorBridge.addChecksumTestMetadata({checksumTestId:this.checksumTestId,pwTestId:this.testInfo.testId,retry:this.testInfo.retry,type:"autoRecoveryMetadata",data:{autoRecoveryTriggered:this.hasUsedAutoRecovery,autoRecovered:this.hasSuccessfulAutoRecovery&&s}}),this.monitorBridge.addChecksumTestMetadata({checksumTestId:this.checksumTestId,pwTestId:this.testInfo.testId,retry:this.testInfo.retry,type:"autoRecoverySummaries",data:this.arSummaries}),this.cleanupMockData()}async wrapInternalSteps(s,c=this.page){try{return c.mainFrame()._checksumInternal=!0,c._checksumInternal=!0,await s()}finally{c.mainFrame()._checksumInternal=!1,c._checksumInternal=!1}}async conditionallyWrapInternalSteps(s,c){return s?this.wrapInternalSteps(c):c()}async wrapNoLocationSteps(s){try{return this.testInfo._checksumNoLocation=!0,await s()}finally{this.testInfo._checksumNoLocation=!1}}findAllStepsRecursively(s,c,u=[]){for(let _ of s){(_._stepId===c||_.stepId===c)&&u.push(_);let h=[_.steps,_._testInfoSteps,_._steps].filter(Boolean);for(let b of h)this.findAllStepsRecursively(b,c,u)}return u}makeChecksumStepFunction(s){return c=>{if(!s)return;let u=c._stepId||c.stepId;this.findAllStepsRecursively(c._testInfo._steps,u).forEach(h=>{h.error={message:"ChecksumStepError",stack:"Fallback Failed",cause:void 0}})}}async createChecksumStep(s){let c,u={box:!0,noLocation:!0,obtainStep:t(_=>{c=_},"obtainStep")};return await this.step(s.title,this.makeChecksumStepFunction(s.withError),!1,u),c!=null&&c.stepId&&this.arStepIds.push(c.stepId),c}async step(s,c,u=!0,{obtainStep:_=void 0,box:h=!1,noLocation:b=void 0}={}){let S=this.testInfo._checksumNoLocation;try{this.testInfo._checksumInternal=u===!0,b!==void 0&&(this.testInfo._checksumNoLocation=b),await this.test.step(s,c||(()=>{}),{obtainStep:_,box:h})}finally{this.testInfo._checksumInternal=!1,this.testInfo._checksumNoLocation=S}}addErrorMessage(s,c){this.testInfo.addError(s,c)}async evaluateWithChecksum(s,c,u=!0){return this.navigationPromise&&await this.navigationPromise,this.conditionallyWrapInternalSteps(u,()=>this.page.evaluate(s,c))}getChecksumTestId(){return this.checksumTestId}addNewThought(s,c,u=!1){let _={id:void 0,thought:s,type:c,children:u?[]:void 0,parent:void 0};if(!this.currentThought)this.highLevelThoughts.push(_);else if(this.currentThought.children)this.currentThought.children.push(_),_.parent=this.currentThought;else{let h=this.currentThought.parent;h?(h.children.push(_),_.parent=h):this.highLevelThoughts.push(_)}return _.parent?_.id=`${_.parent.id}.${_.parent.children.length}`:_.id=`${++this.thoughtsCounter}`,this.currentThought=_,_}buildThoughtsChainForFallback(s=this.highLevelThoughts){let c=[];return s.forEach(u=>{c.push(u.thought),u.children&&c.push(...this.buildThoughtsChainForFallback(u.children))}),c}compoundSelection(...s){let c=super.compoundSelection(...s);return c.setAnalytics(()=>this.testRunAnalytics),this.checksumStepId&&this.options.useChecksumSelectors&&this.setCompoundSelectorFallback(this.checksumStepId),c}setSelectorFallback(s){let c={checksumId:s,fileName:this.testInfo.file,testId:this.checksumTestId,apiKey:this.config.apiKey,apiURL:this.config.apiURL,timeout:L_t};this.pushFallback(this.constructFallback(Ipe).init(c)),this.pushFallback(this.constructFallback(Spe).init(c))}setCompoundSelectorFallback(s){this.pushFallback(this.constructFallback(wpe).init({checksumId:s,fileName:this.testInfo.file,testId:this.checksumTestId,apiKey:this.config.apiKey,apiURL:this.config.apiURL,timeout:L_t}))}setAIFallback(s,c){var b;let u=((b=this.options.useChecksumAI)==null?void 0:b.arVersion)===1,_=t(()=>{var K,ee,fe,Ze,Ye,st;let S=this.buildThoughtsChainForFallback(),k={title:this.testInfo.title},B={testFileName:this.testInfo.file,testId:this.testInfo.testId,testSuiteId:process.env.CHECKSUM_TEST_SUITE_ID||""},G={previous:S.slice(0,-1),failing:s,next:S.slice(1)},j={storyInfo:k,testIdentification:B,fallbackConfig:{arMode:(K=this.options.useChecksumAI)==null?void 0:K.arMode,overrideOptions:{...(ee=this.options.useChecksumAI)==null?void 0:ee.overrideOptions,...(fe=this.options.useChecksumAI)!=null&&fe.modelName&&!((Ye=(Ze=this.options.useChecksumAI)==null?void 0:Ze.overrideOptions)!=null&&Ye.modelName)?{modelName:this.options.useChecksumAI.modelName}:{}},markRecovered:(st=this.options.useChecksumAI)==null?void 0:st.markRecovered},thoughts:G,config:{apiURL:this.config.apiURL,apiKey:this.config.apiKey},type:c};return this.constructFallback(yP).init(j)},"createArFallback"),h=t(()=>{var S,k;return this.constructFallback(AN).init({goal:this.testInfo.title,testFile:this.testInfo.file,apiKey:this.config.apiKey,apiURL:this.config.apiURL,testId:this.checksumTestId,thoughts:this.buildThoughtsChainForFallback(),arMode:(S=this.options.useChecksumAI)==null?void 0:S.arMode,overrideOptions:(k=this.options.useChecksumAI)==null?void 0:k.overrideOptions,fallbackType:c})},"createAIFallback");return u?this.pushFallback(h()):this.pushFallback(_()),this.proxy}pushFallback(s){this.fallbacks.push(s),this.sortFallbacks()}handleAIFallback(s,c,u,_){let h=s.fallbackAnalyticsPayload.iterationSteps,b=h.length>0?_/h.length:0;this.testRunAnalytics.testRunFallbackExecution({result:u.fbResult,failedThought:s.getFailedThought(),summary:u.summary,stepsPayload:s.fallbackAnalyticsPayload,type:s.fallbackType??c.type,duration:_,avgDuration:b,success:["finish","soft_assertion"].includes(u.fbResult)}),this.arResults.push({failedThought:s.getFailedThought(),result:u.fbResult,thought:u.thought})}handleAutoRecovery(s,c,u,_){let h=u.stepsThoughts.length>0?_/u.stepsThoughts.length:0;this.testRunAnalytics.testRunAutoRecovery({failingThought:s.failingThought,type:c.type,finalThought:u.thought,result:u.fbResult,duration:_,avgStepDuration:h,stepsThoughts:u.stepsThoughts,version:"v1"})}async runFallback(s,c){let u=Date.now(),_=s.resolve(c),h=await Kd(_,s.timeout),b=Date.now()-u;s instanceof AN&&(this.hasUsedAutoRecovery=!0,this.handleAIFallback(s,c,h,b)),s instanceof yP&&(this.hasUsedAutoRecovery=!0,this.handleAutoRecovery(s,c,h,b));let S=h.thought?`: ${h.thought}`:"";if(!h||h.fbResult==="failed")throw this.hasSuccessfulAutoRecovery=!1,this.createChecksumStep({title:`Recovery Failed${S}`,withError:!0}),new Error("Fallback failed");if(h.fbResult==="hard_assertion")throw this.hasSuccessfulAutoRecovery=!1,this.createChecksumStep({title:`Recovery Failed${S}`,withError:!0}),new Jfe(h.fbResult);if(this.hasUsedAutoRecovery&&(this.hasSuccessfulAutoRecovery=!0),s instanceof AN&&h.summary&&this.arSummaries.push(h.summary),s instanceof yP&&h.thought&&this.arSummaries.push(h.thought),this.createChecksumStep({title:`Recovery Complete${S}`}),h.steps.length===1){let k=h.steps[0];k.thought&&(this.currentThought.thought=k.thought)}else this.currentThought.children=h.steps.map((k,B)=>({id:`${this.currentThought.id}.${B+1}`,thought:k.thought,type:k.type,children:void 0,parent:this.currentThought}))}async runConditionallyWithinStep(s,c,u){return s?await this.step(c,u):await u()}async onExecutionError(s){try{return await this.initiateFallbackSequence({type:"action",...s})}catch(c){if(!this.currentThought){let{locator:u,method:_}=s;this.testRunAnalytics.testRunActionExecutionFailure({locator:u.toString(),selector:u._selector,method:_,checksumStepId:this.checksumStepId,error:c.toString()})}throw c}}async initiateFallbackSequence(s,{fallbackTypes:c=void 0}={}){Nc(`[initiateFallbackSequence] with type: ${s.type}...`);let u=this.fallbacks.find(b=>b instanceof AN);if(u){let b=u.getFailedThought(),S=this.variableStore.getActiveVariables();this.fallbacks.forEach(k=>{k.setThought(b),k.setVariables(S)})}let _=this.fallbacks.find(b=>b instanceof yP);if(_){let b=_.failingThought;this.fallbacks.forEach(S=>{S instanceof yP&&S.setVariables(this.variableStore.getActiveVariables()),S.setThought(b)})}let h=this.fallbacks;c&&(h=h.filter(b=>c.reduce((S,k)=>S||b instanceof k,!1))),h=h.filter(b=>b.canResolve(s));try{for(let b of h){let S=b==null?void 0:b.toString();S&&console.log(`Using ${S}`);let k;try{let B=await this.runConditionallyWithinStep(s.type!=="assertion"||!s.withChecksumAI,b.getRecoveryAttemptTitle(s),async()=>await this.runFallback(b,s));k=!0}catch(B){if(k=!1,s.withChecksumAI&&B.message==="fetch failed")throw new Error(zK);B instanceof Jfe&&B.fallbackResult==="hard_assertion"&&(s.error.fallbackResult="hard_assertion"),S&&console.log(`Failed to use ${S}`),b.cancel();continue}return!0}throw s.error}finally{this.resetFallbacks()}}resetFallbacks(){this.fallbacks=[this.constructFallback(Tpe).init()]}async shutdown(){if(this.shouldRecordRRwebEvents()){try{await this.timeMachine.flushRRwebEventsToFile();let s=this.timeMachine.getRRwebFilePath();this.monitorBridge.addAsset({type:"rrweb-recording",path:s,testId:this.checksumTestId,fileName:i8.basename(s)})}catch(s){Nc("Error shutting down RRweb events recording",s)}if(this.testRunAnalytics)return Nc("Flushing analytics events......"),this.testRunAnalytics.close()}}sortFallbacks(){let s=[Tpe,wpe,Ipe,Spe,AN];this.fallbacks.sort((c,u)=>s.indexOf(c.constructor)-s.indexOf(u.constructor))}constructFallback(s){return new s(this.page,this.evaluateWithChecksum.bind(this),this,this.pageInteractor,{generateSelectionData:this.runMode!=="normal"},this,this._context)}async prepareForTestArtifacts(){if((this.options.useMockData||this.runMode==="refactor")&&await this.prepareAPIMock(),this.traceMode&&this.traceMode!=="off"){let c=await this.getTraceFilePath();c&&this.monitorBridge.addAsset({type:"trace",path:c,testId:this.checksumTestId,project:this.testInfo.project.name})}if(!1){let c=nNt(l6e(this.testInfo.file),this.checksumTestId);this.monitorBridge.addAsset({type:"har",path:c,testId:this.checksumTestId})}}async getTraceFilePath(){try{return this.hasRuntimeStartedTrace?sNt(l6e(this.testInfo.file),this.checksumTestId).replace(".zip",".original.zip"):this.testInfo.outputPath("trace.zip")}catch{return}}async prepareMockData(){let s=nWe(l6e(this.testInfo.file)),c=i8.join(s,`${this.checksumTestId}.har.zip`);if(!(0,oE.existsSync)(c))throw new Error("Could not find har file or zip file");let u=i8.join(s,"tmp");(0,oE.existsSync)(u)||(0,oE.mkdirSync)(u);let _=(0,oE.readFileSync)(c),h=await(0,Jcr.loadAsync)(_);for(let S of Object.keys(h.files)){let k=await h.file(S).async("string"),B=i8.join(u,S);(0,oE.writeFileSync)(B,k),this.unzippedHarData.push(B)}let b=i8.join(u,"test.har");if(!(0,oE.existsSync)(b))throw this.cleanupMockData(),new Error(`Could not find har file ${b} after unzipping ${c}`);return b}cleanupMockData(){this.unzippedHarData.forEach(s=>{(0,oE.rmSync)(s)}),this.unzippedHarData.length>0&&(0,oE.rmSync)(i8.dirname(this.unzippedHarData[0]),{recursive:!0,force:!0})}async prepareAPIMock(){let s={GET:0,POST:0,PUT:0,DELETE:0};try{let c=await this.prepareMockData();await this.page.routeFromHAR(c,{url:"*/**",notFound:"fallback",update:!1});let u=this.page._routes[0].handler;await this.page.route("**/*",_=>{let h=_.request().headers(),b=_.request().method();h["Checksum-Id"]=(++s[b]).toString(),_.request()._applyFallbackOverrides({headers:h}),u(_)})}catch(c){Nc("Error setting up mock data",c.message)}}async loadAppSpecificRules(){this.appSpecificRules={};let s=i8.join(Yj(PS()),"settings.asr");if(!(0,oE.existsSync)(s)){Nc("Could not find ASR file");return}let{ungzip:c}=rWe();try{let u=await c((0,oE.readFileSync)(s));this.appSpecificRules=JSON.parse(u)||{}}catch(u){Nc("Could not read ASR file",u.message)}}addAutoRecoveryStepId(s){this.arStepIds.push(s)}};t(IM,"RuntimePage"),IM.recentlyInteracted=new Map;var Ucr=IM;var SDe=require("fs");var TM={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},gfi={defaultMerge:TM.defaultMerge};function X4n(i,n){return n}t(X4n,"defaultMetaDataUpdater");function eSn(i,n){return i.filter(s=>s!==void 0)}t(eSn,"defaultFilterValues");var zcr;(function(i){i[i.NOT=0]="NOT",i[i.RECORD=1]="RECORD",i[i.ARRAY=2]="ARRAY",i[i.SET=3]="SET",i[i.MAP=4]="MAP",i[i.OTHER=5]="OTHER"})(zcr||(zcr={}));function $cr(i){return typeof i!="object"||i===null?0:Array.isArray(i)?2:nSn(i)?1:i instanceof Set?3:i instanceof Map?4:5}t($cr,"getObjectType");function tSn(i){let n=new Set;for(let s of i)for(let c of[...Object.keys(s),...Object.getOwnPropertySymbols(s)])n.add(c);return n}t(tSn,"getKeys");function rSn(i,n){return typeof i=="object"&&Object.prototype.propertyIsEnumerable.call(i,n)}t(rSn,"objectHasProperty");function qcr(i){var c;let n=0,s=(c=i[0])==null?void 0:c[Symbol.iterator]();return{[Symbol.iterator](){return{next(){var u;do{if(s===void 0)return{done:!0,value:void 0};let _=s.next();if(_.done===!0){n+=1,s=(u=i[n])==null?void 0:u[Symbol.iterator]();continue}return{done:!1,value:_.value}}while(!0)}}}}}t(qcr,"getIterableOfIterables");var Wcr=["[object Object]","[object Module]"];function nSn(i){if(!Wcr.includes(Object.prototype.toString.call(i)))return!1;let{constructor:n}=i;if(n===void 0)return!0;let s=n.prototype;return!(s===null||typeof s!="object"||!Wcr.includes(Object.prototype.toString.call(s))||!s.hasOwnProperty("isPrototypeOf"))}t(nSn,"isRecord");function iSn(i,n,s){let c={};for(let u of tSn(i)){let _=[];for(let S of i)rSn(S,u)&&_.push(S[u]);if(_.length===0)continue;let h=n.metaDataUpdater(s,{key:u,parents:i}),b=Gcr(_,n,h);b!==TM.skip&&(u==="__proto__"?Object.defineProperty(c,u,{value:b,configurable:!0,enumerable:!0,writable:!0}):c[u]=b)}return c}t(iSn,"mergeRecords$1");function sSn(i){return i.flat()}t(sSn,"mergeArrays$1");function aSn(i){return new Set(qcr(i))}t(aSn,"mergeSets$1");function oSn(i){return new Map(qcr(i))}t(oSn,"mergeMaps$1");function cSn(i){return i.at(-1)}t(cSn,"mergeOthers$1");var xDe={mergeRecords:iSn,mergeArrays:sSn,mergeSets:aSn,mergeMaps:oSn,mergeOthers:cSn};function Hcr(...i){return lSn({})(...i)}t(Hcr,"deepmerge");function lSn(i,n){let s=uSn(i,c);function c(...u){return Gcr(u,s,n)}return t(c,"customizedDeepmerge"),c}t(lSn,"deepmergeCustom");function uSn(i,n){return{defaultMergeFunctions:xDe,mergeFunctions:{...xDe,...Object.fromEntries(Object.entries(i).filter(([s,c])=>Object.hasOwn(xDe,s)).map(([s,c])=>c===!1?[s,xDe.mergeOthers]:[s,c]))},metaDataUpdater:i.metaDataUpdater??X4n,deepmerge:n,useImplicitDefaultMerging:i.enableImplicitDefaultMerging??!1,filterValues:i.filterValues===!1?void 0:i.filterValues??eSn,actions:TM}}t(uSn,"getUtils");function Gcr(i,n,s){var _;let c=((_=n.filterValues)==null?void 0:_.call(n,i,s))??i;if(c.length===0)return;if(c.length===1)return Q_t(c,n,s);let u=$cr(c[0]);if(u!==0&&u!==5){for(let h=1;h<c.length;h++)if($cr(c[h])!==u)return Q_t(c,n,s)}switch(u){case 1:return fSn(c,n,s);case 2:return pSn(c,n,s);case 3:return dSn(c,n,s);case 4:return _Sn(c,n,s);default:return Q_t(c,n,s)}}t(Gcr,"mergeUnknowns");function fSn(i,n,s){let c=n.mergeFunctions.mergeRecords(i,n,s);return c===TM.defaultMerge||n.useImplicitDefaultMerging&&c===void 0&&n.mergeFunctions.mergeRecords!==n.defaultMergeFunctions.mergeRecords?n.defaultMergeFunctions.mergeRecords(i,n,s):c}t(fSn,"mergeRecords");function pSn(i,n,s){let c=n.mergeFunctions.mergeArrays(i,n,s);return c===TM.defaultMerge||n.useImplicitDefaultMerging&&c===void 0&&n.mergeFunctions.mergeArrays!==n.defaultMergeFunctions.mergeArrays?n.defaultMergeFunctions.mergeArrays(i):c}t(pSn,"mergeArrays");function dSn(i,n,s){let c=n.mergeFunctions.mergeSets(i,n,s);return c===TM.defaultMerge||n.useImplicitDefaultMerging&&c===void 0&&n.mergeFunctions.mergeSets!==n.defaultMergeFunctions.mergeSets?n.defaultMergeFunctions.mergeSets(i):c}t(dSn,"mergeSets");function _Sn(i,n,s){let c=n.mergeFunctions.mergeMaps(i,n,s);return c===TM.defaultMerge||n.useImplicitDefaultMerging&&c===void 0&&n.mergeFunctions.mergeMaps!==n.defaultMergeFunctions.mergeMaps?n.defaultMergeFunctions.mergeMaps(i):c}t(_Sn,"mergeMaps");function Q_t(i,n,s){let c=n.mergeFunctions.mergeOthers(i,n,s);return c===TM.defaultMerge||n.useImplicitDefaultMerging&&c===void 0&&n.mergeFunctions.mergeOthers!==n.defaultMergeFunctions.mergeOthers?n.defaultMergeFunctions.mergeOthers(i):c}t(Q_t,"mergeOthers");var Ycr=!1;function CDe(i){Ycr=i}t(CDe,"setLogToConsole");function Nc(...i){Ycr&&console.log(...i)}t(Nc,"log");async function Ijt(i,n,s,c=6e4){if(!(n in i))return i;let u=t(()=>i[n](...s),"executor");return c===null?u():Kd(u(),c,"Execution timeout")}t(Ijt,"executePlaywrightMethodWithTimeout");function mSn({envName:i,role:n}={}){return{envName:process.env.CHECKSUM_RUNTIME_ENV_OVERRIDE_NAME??i,role:process.env.CHECKSUM_RUNTIME_ENV_OVERRIDE_ROLE??n}}t(mSn,"applyRuntimeEnvOverrides");function hSn(i,{role:n,environment:s}={},c=!1){var b,S;let u;if(s&&(u=(b=i.environments)==null?void 0:b.find(({name:k})=>s===k)),u||(u=(S=i.environments)==null?void 0:S.find(({default:k})=>k)),!u)throw new Error("Environment not found. Please make sure your environments are properly defined in the checksum.config.ts file.");let _=u.users,h;if(_&&(n!==void 0&&(h=_.find(k=>k.role===n)),h||(h=_.find(k=>k.default))),!h)throw new Error(`User not found. Please make sure the users array for the "${u.name}" environment is properly defined in the checksum.config.ts file.`);if(s&&u.name!==s){if(c)throw new Error(`Could not find environment with name "${s}" in config file`);console.warn(`Could not find environment with name "${s}" in config file, trying to use default environment`)}if(n&&h.role!==n){if(c)throw new Error(`Could not find user with role "${n}" for environment "${s}" in config file`);console.warn(`Could not find user with role "${n}" for environment "${s}" in config file, trying to login with environment's default user`)}return{environment:u,user:h}}t(hSn,"resolveEnvironment");function gSn(i){let n=`${i??PS()}/login.ts`;if(!(0,SDe.existsSync)(n))throw console.warn(`Could not locate the login.ts file. Please make sure your login file exists at ${n}`),new Error("Could not find login.ts file");try{return require(n).default}catch(s){throw console.warn("Error loading login.ts file",s),s}}t(gSn,"requireLogin");async function ySn(i,n,{environment:s,user:c,config:u}){try{let _=t(()=>n(i,{environment:s,user:c,config:u}),"performLogin");"checksumAI"in i?await i.checksumAI(`Log in${c!=null&&c.role?` using ${c.role} role`:""}${s!=null&&s.name?` in ${s.name} environment`:""}`,_,{skipAutoRecovery:!0}):await _()}catch(_){throw console.warn(`The login method threw an exception, please check the login.ts file for the following error:
|
|
750
|
-
`,_),_}}t(ySn,"proceedWithLogin");function Vcr(i){let{config:n,folder:s,throwIfAuthFailed:c}=i,u=gSn(s);return async(_,{role:h,environment:b}={})=>{let{envName:S,role:k}=mSn({envName:b,role:h}),{environment:B,user:G}=hSn(n,{role:k,environment:S},i.throwIfEnvInfoInvalid);if(c&&!G)throw new Error("Could not find user credentials matching the provided role and/or environment");await ySn(_,u,{environment:B,user:G,config:n})}}t(Vcr,"makeUnboundLogin");var sre;function LZt(){if(sre)return sre;try{let i=(0,SDe.existsSync)(`${PS()}/checksum.config.ts`)?"checksum.config.ts":(0,SDe.existsSync)(`${PS()}/checksum.config.tmp.ts`)?"checksum.config.tmp.ts":void 0;if(i)return wDe(require(`${PS()}/${i}`).default)}catch{console.warn("Could not find checksum config file, will run with defaults")}return wDe()}t(LZt,"loadChecksumConfig");function wDe(i={}){var s,c,u,_;let n={apiKey:void 0,runMode:"normal",apiURL:"https://api.checksum.ai",options:{useChecksumSelectors:!0,useChecksumAI:{actions:!0,assertions:!1,skipTestsWithKnownBugs:!0},newAssertionsEnabled:!0,useMockData:!1,printLogs:!1,consecutiveActionDelay:100,hideReports:process.env.AUTHORIZE_REPORTS==="true"}};return((c=(s=i.options)==null?void 0:s.useChecksumAI)==null?void 0:c.visualComparison)===void 0&&((_=(u=i.options)==null?void 0:u.useChecksumAI)!=null&&_.assertions)&&(i.options.useChecksumAI.visualComparison=!0),sre=Hcr(n,i),Ac.testRun.disableAutoRecovery&&(sre.options.useChecksumAI={actions:!1,assertions:!1,visualComparison:!1}),Ac.testRun.disableHostReports&&(sre.options.hostReports=!1),sre}t(wDe,"getChecksumConfig");var zK="Checksum failed connecting to the server";var flr=Pa(require("child_process")),Z_t=require("crypto"),wv=require("fs"),X1=require("path");var IDe=(k=>(k.RuntimeError="Runtime Error",k.TestRunMonitorError="Test Run Monitor Error",k.ChecksumConfigError="Checksum Config Error",k.InitializationError="Initialization Error",k.TraceProcessingError="Trace Processing Error",k.TestSuiteInitError="Test Suite Init Error",k.UploadStart="Upload Start",k.UploadComplete="Upload Complete",k.UploadFailed="Upload Failed",k))(IDe||{});var Fz=class Fz{constructor(n,s){this.isolatedMode=s,this.analytics=GS.createFromConfig(n,s,!1)}static getInstance(n,s){return Fz.instance||(Fz.instance=new Fz(n,s)),Fz.instance}get tableName(){return"test_suites"}get metadata(){return this.analytics.metadata}event(n){this.analytics.trackEventWithTable(n,this.metadata,this.tableName)}testSuiteStart(){let n={event:"Test Suite Start",metadata:this.metadata};this.event(n)}testSuiteEnd(n){this.event({event:"Test Suite End",metadata:this.metadata,...n})}checksumConfig(n){this.event({event:"Checksum Config",metadata:this.metadata,...n})}checksumConfigError(n){this.event({event:"Checksum Config Error",metadata:this.metadata,...n})}testSuiteError(n){this.event({event:"Test Suite Error",metadata:this.metadata,...n})}allUploadsComplete(){this.event({event:"All Uploads Complete",metadata:this.metadata})}testsFailed(){this.event({event:"Tests Failed",metadata:this.metadata})}testRunMonitorError(n){this.event({event:"Test Run Monitor Error",metadata:this.metadata,...n})}uploadStart(n){this.event({event:"Upload Start",metadata:this.metadata,...n})}uploadComplete(n){this.event({event:"Upload Complete",metadata:this.metadata,...n})}uploadFailed(n){this.event({event:"Upload Failed",metadata:this.metadata,...n})}traceProcessingError(n){this.event({event:"Trace Processing Error",metadata:this.metadata,...n})}uploadsCompleteWithErrors(n){this.event({event:"Uploads Complete With Errors",metadata:this.metadata,...n})}reportComplete(n){this.event({event:"Report Complete",metadata:this.metadata,...n})}playwrightConfig(n){this.event({event:"Playwright Config",metadata:this.metadata,...n})}playwrightConfigError(n){this.event({event:"Playwright Config Error",metadata:this.metadata,...n})}completionStatus(n){this.event({event:"Completion Status",metadata:this.metadata,...n})}reportUploadError(n={}){this.event({event:"Report Upload Error",metadata:this.metadata,...n})}runtimeTimeout(n={}){this.event({event:"Runtime Timeout",metadata:this.metadata,...n})}runtimeComplete(){this.event({event:"Runtime Complete",metadata:this.metadata})}genericEvent(n,s={}){this.event({event:n,metadata:this.metadata,...s})}};t(Fz,"TestSuiteAnalytics");var phe=Fz;var kDe=Pa(require("child_process")),Ym=require("fs"),uh=require("path");var Bz=class Bz{constructor(n,s){this.analytics=GS.createFromConfig(n,s)}static getInstance(n={},s=!1){return Bz.instance||(Bz.instance=new Bz(n,s)),Bz.instance}get tableName(){return"runtime"}event(n){this.analytics.trackEventWithTable(n,this.metadata,this.tableName)}checksumConfig(n){this.event({event:"Checksum Config",metadata:this.metadata,config:n})}eventWithMessage(n,s){this.event({event:n,metadata:this.metadata,message:s})}get metadata(){return{...this.analytics.metadata,appName:"unknown",commitHash:"unknown",envName:"unknown",branch:"unknown",testSuiteRunId:"unknown",checksumRuntimeVersion:"unknown",...this.analytics.metadata}}async close(){return this.analytics.close()}};t(Bz,"RuntimeAnalytics");var TDe=Bz;var Zcr=".chk";var U_t=class U_t{constructor(n,s=!1,c){this.args=n;this.debugMode=s;this.checksumAppUrl="https://app.checksum.ai";this.childProcesses=[];this.printError=t(n=>{console.log("\x1B[31m%s\x1B[0m",n,"\x1B[0m")},"printError");this.processConfigArg(),["exit","SIGINT","SIGTERM","uncaughtException"].forEach(u=>{process.on(u,()=>{this.cleanup(),process.exit()})}),this.checksumRuntimeVersion=this.getChecksumRuntimeVersion(),c!=null&&c.skipChecksumDataLoad||this.loadChecksumData(c)}getChecksumRuntimeVersion(){if(this.checksumRuntimeVersion)return this.checksumRuntimeVersion;try{let n=Ac.isRepoMode?(0,uh.join)(Ac.runtimeRoot,"package","package.json"):"./package.json";return require(n).version}catch{return"unknown"}}getInternalFilesDirPath(){return(0,uh.join)(this.checksumRoot,Zcr)}createInternalFilesDir(){let n=this.getInternalFilesDirPath();if((0,Ym.existsSync)(n)){Nc("Internal files directory already exists at",n);return}(0,Ym.mkdirSync)(n,{recursive:!0}),Nc("Internal files directory created at",n)}loadTracer(){this.runtimeAnalytics=TDe.getInstance({version:this.checksumRuntimeVersion},this.debugMode)}async execCmd(n,s={}){let c={...process.env,...s},u=await kDe.spawn(n,{env:c,shell:!0,stdio:"inherit"});return this.childProcesses.push(u),new Promise((h,b)=>{u.on("exit",S=>{S===0?h(!0):b(new Error(`Checksum failed execution with code: ${S} `)),this.childProcesses=this.childProcesses.filter(k=>k!==u)})})}async getCmdOutput(n){return new Promise(function(s,c){kDe.exec(n,(u,_,h)=>{if(u){c(`Error executing command: ${u.message}`);return}s(_.trim())})})}validateAuthExists(){this.checksumRoot||this.findChecksumRoot();let n=(0,uh.join)(this.checksumRoot,".auth");(0,Ym.existsSync)(n)||(0,Ym.writeFileSync)(n,"{}")}loadChecksumData(n={}){this.locateChecksumLibs(),this.loadChecksumConfig(n)}async patchPlaywright(n=!1
|
|
750
|
+
`,_),_}}t(ySn,"proceedWithLogin");function Vcr(i){let{config:n,folder:s,throwIfAuthFailed:c}=i,u=gSn(s);return async(_,{role:h,environment:b}={})=>{let{envName:S,role:k}=mSn({envName:b,role:h}),{environment:B,user:G}=hSn(n,{role:k,environment:S},i.throwIfEnvInfoInvalid);if(c&&!G)throw new Error("Could not find user credentials matching the provided role and/or environment");await ySn(_,u,{environment:B,user:G,config:n})}}t(Vcr,"makeUnboundLogin");var sre;function LZt(){if(sre)return sre;try{let i=(0,SDe.existsSync)(`${PS()}/checksum.config.ts`)?"checksum.config.ts":(0,SDe.existsSync)(`${PS()}/checksum.config.tmp.ts`)?"checksum.config.tmp.ts":void 0;if(i)return wDe(require(`${PS()}/${i}`).default)}catch{console.warn("Could not find checksum config file, will run with defaults")}return wDe()}t(LZt,"loadChecksumConfig");function wDe(i={}){var s,c,u,_;let n={apiKey:void 0,runMode:"normal",apiURL:"https://api.checksum.ai",options:{useChecksumSelectors:!0,useChecksumAI:{actions:!0,assertions:!1,skipTestsWithKnownBugs:!0},newAssertionsEnabled:!0,useMockData:!1,printLogs:!1,consecutiveActionDelay:100,hideReports:process.env.AUTHORIZE_REPORTS==="true"}};return((c=(s=i.options)==null?void 0:s.useChecksumAI)==null?void 0:c.visualComparison)===void 0&&((_=(u=i.options)==null?void 0:u.useChecksumAI)!=null&&_.assertions)&&(i.options.useChecksumAI.visualComparison=!0),sre=Hcr(n,i),Ac.testRun.disableAutoRecovery&&(sre.options.useChecksumAI={actions:!1,assertions:!1,visualComparison:!1}),Ac.testRun.disableHostReports&&(sre.options.hostReports=!1),sre}t(wDe,"getChecksumConfig");var zK="Checksum failed connecting to the server";var flr=Pa(require("child_process")),Z_t=require("crypto"),wv=require("fs"),X1=require("path");var IDe=(k=>(k.RuntimeError="Runtime Error",k.TestRunMonitorError="Test Run Monitor Error",k.ChecksumConfigError="Checksum Config Error",k.InitializationError="Initialization Error",k.TraceProcessingError="Trace Processing Error",k.TestSuiteInitError="Test Suite Init Error",k.UploadStart="Upload Start",k.UploadComplete="Upload Complete",k.UploadFailed="Upload Failed",k))(IDe||{});var Fz=class Fz{constructor(n,s){this.isolatedMode=s,this.analytics=GS.createFromConfig(n,s,!1)}static getInstance(n,s){return Fz.instance||(Fz.instance=new Fz(n,s)),Fz.instance}get tableName(){return"test_suites"}get metadata(){return this.analytics.metadata}event(n){this.analytics.trackEventWithTable(n,this.metadata,this.tableName)}testSuiteStart(){let n={event:"Test Suite Start",metadata:this.metadata};this.event(n)}testSuiteEnd(n){this.event({event:"Test Suite End",metadata:this.metadata,...n})}checksumConfig(n){this.event({event:"Checksum Config",metadata:this.metadata,...n})}checksumConfigError(n){this.event({event:"Checksum Config Error",metadata:this.metadata,...n})}testSuiteError(n){this.event({event:"Test Suite Error",metadata:this.metadata,...n})}allUploadsComplete(){this.event({event:"All Uploads Complete",metadata:this.metadata})}testsFailed(){this.event({event:"Tests Failed",metadata:this.metadata})}testRunMonitorError(n){this.event({event:"Test Run Monitor Error",metadata:this.metadata,...n})}uploadStart(n){this.event({event:"Upload Start",metadata:this.metadata,...n})}uploadComplete(n){this.event({event:"Upload Complete",metadata:this.metadata,...n})}uploadFailed(n){this.event({event:"Upload Failed",metadata:this.metadata,...n})}traceProcessingError(n){this.event({event:"Trace Processing Error",metadata:this.metadata,...n})}uploadsCompleteWithErrors(n){this.event({event:"Uploads Complete With Errors",metadata:this.metadata,...n})}reportComplete(n){this.event({event:"Report Complete",metadata:this.metadata,...n})}playwrightConfig(n){this.event({event:"Playwright Config",metadata:this.metadata,...n})}playwrightConfigError(n){this.event({event:"Playwright Config Error",metadata:this.metadata,...n})}completionStatus(n){this.event({event:"Completion Status",metadata:this.metadata,...n})}reportUploadError(n={}){this.event({event:"Report Upload Error",metadata:this.metadata,...n})}runtimeTimeout(n={}){this.event({event:"Runtime Timeout",metadata:this.metadata,...n})}runtimeComplete(){this.event({event:"Runtime Complete",metadata:this.metadata})}genericEvent(n,s={}){this.event({event:n,metadata:this.metadata,...s})}};t(Fz,"TestSuiteAnalytics");var phe=Fz;var kDe=Pa(require("child_process")),Ym=require("fs"),uh=require("path");var Bz=class Bz{constructor(n,s){this.analytics=GS.createFromConfig(n,s)}static getInstance(n={},s=!1){return Bz.instance||(Bz.instance=new Bz(n,s)),Bz.instance}get tableName(){return"runtime"}event(n){this.analytics.trackEventWithTable(n,this.metadata,this.tableName)}checksumConfig(n){this.event({event:"Checksum Config",metadata:this.metadata,config:n})}eventWithMessage(n,s){this.event({event:n,metadata:this.metadata,message:s})}get metadata(){return{...this.analytics.metadata,appName:"unknown",commitHash:"unknown",envName:"unknown",branch:"unknown",testSuiteRunId:"unknown",checksumRuntimeVersion:"unknown",...this.analytics.metadata}}async close(){return this.analytics.close()}};t(Bz,"RuntimeAnalytics");var TDe=Bz;var Zcr=".chk";var U_t=class U_t{constructor(n,s=!1,c){this.args=n;this.debugMode=s;this.checksumAppUrl="https://app.checksum.ai";this.childProcesses=[];this.printError=t(n=>{console.log("\x1B[31m%s\x1B[0m",n,"\x1B[0m")},"printError");this.processConfigArg(),["exit","SIGINT","SIGTERM","uncaughtException"].forEach(u=>{process.on(u,()=>{this.cleanup(),process.exit()})}),this.checksumRuntimeVersion=this.getChecksumRuntimeVersion(),c!=null&&c.skipChecksumDataLoad||this.loadChecksumData(c)}getChecksumRuntimeVersion(){if(this.checksumRuntimeVersion)return this.checksumRuntimeVersion;try{let n=Ac.isRepoMode?(0,uh.join)(Ac.runtimeRoot,"package","package.json"):"./package.json";return require(n).version}catch{return"unknown"}}getInternalFilesDirPath(){return(0,uh.join)(this.checksumRoot,Zcr)}createInternalFilesDir(){let n=this.getInternalFilesDirPath();if((0,Ym.existsSync)(n)){Nc("Internal files directory already exists at",n);return}(0,Ym.mkdirSync)(n,{recursive:!0}),Nc("Internal files directory created at",n)}loadTracer(){this.runtimeAnalytics=TDe.getInstance({version:this.checksumRuntimeVersion},this.debugMode)}async execCmd(n,s={}){let c={...process.env,...s},u=await kDe.spawn(n,{env:c,shell:!0,stdio:"inherit"});return this.childProcesses.push(u),new Promise((h,b)=>{u.on("exit",S=>{S===0?h(!0):b(new Error(`Checksum failed execution with code: ${S} `)),this.childProcesses=this.childProcesses.filter(k=>k!==u)})})}async getCmdOutput(n){return new Promise(function(s,c){kDe.exec(n,(u,_,h)=>{if(u){c(`Error executing command: ${u.message}`);return}s(_.trim())})})}validateAuthExists(){this.checksumRoot||this.findChecksumRoot();let n=(0,uh.join)(this.checksumRoot,".auth");(0,Ym.existsSync)(n)||(0,Ym.writeFileSync)(n,"{}")}loadChecksumData(n={}){this.locateChecksumLibs(),this.loadChecksumConfig(n)}async patchPlaywright(n=!1){Nc("Patching playwright",n);let s=(0,uh.join)(__dirname,"./scripts/patch.js");(0,Ym.existsSync)(s)||(s=(0,uh.join)(__dirname,"../../../scripts/src/patch_playwright.js"));let c=`node "${s}"${n?" off":""}`;try{await this.execCmd(c,{PROJECT_ROOT:this.projectRootDirectory,RUNTIME:"true"})}catch(u){console.log("Error patching playwright",u.message)}}getPlaywrightConfigFilePath(){return(0,uh.join)(this.checksumRoot,"playwright.config.ts")}getProgressReporterPath(){return Ac.isRepoMode?(0,uh.join)(Ac.runtimeRoot,"src/playwright-progress-reporter/checksum-progress-reporter.ts"):(0,uh.join)(__dirname,"checksum-progress-reporter.js")}getWrappedPlaywrightConfigPath(){return(0,uh.join)(this.checksumRoot??"","playwright.config.checksum.tmp.ts")}buildRunPlaywrightConfig(){let n=this.getPlaywrightConfigFilePath();try{let s=this.getWrappedPlaywrightConfigPath(),c=this.getProgressReporterPath();return(0,Ym.writeFileSync)(s,`// Auto-generated by @checksum-ai/runtime \u2014 wraps the project's Playwright
|
|
751
751
|
// config to add the Checksum progress reporter. Safe to delete.
|
|
752
752
|
import baseConfig from "./playwright.config";
|
|
753
753
|
|
|
@@ -818,7 +818,7 @@ This command runs postinstall processes, currently including:
|
|
|
818
818
|
|
|
819
819
|
Example:
|
|
820
820
|
npx checksumai postinstall
|
|
821
|
-
`)}}};t(K_t,"CLIHelp");var hhe=K_t;var R6=require("fs"),Mz=require("path");var plr=["script","template"],dlr='<script id="playwrightReportBase64" type="application/zip">',_lr="</script>";var Hlr=require("htmlparser2"),Glr=Pa(qlr()),_A=require("fs"),NM=require("path"),Ylr=require("os"),Zlr=require("crypto");var nwn=t(i=>i.files.flatMap(n=>n.tests.map(s=>{var c;return{playwrightTestId:s.testId,ok:!!s.ok,outcome:s.outcome,title:s.title,filePath:(c=s.location)==null?void 0:c.file,projectName:s.projectName||void 0,tags:s.tags??[],annotations:s.annotations??[]}})),"htmlReportToRows"),Oz=class Oz{constructor(n,s,c,u={},_={},h,b,S,k={}){this.reportHTMLFilePath=n;this.testRunUUID=s;this.pwTestIdToChecksumTestId=c;this.playwrightIdToMetadata=u;this.channel=h;this.checksumTestIdToUsingPlaceholder=k;this.supportVideo=!1;this.config={hosted:!0,assetsBaseURL:"https://api.checksum.ai/api/test-runs"};this.config={...this.config,..._},this.checksumRoot=b||(0,NM.dirname)((0,NM.dirname)(n)),this.projectRoot=S||this.checksumRoot}async process(){var _;let n=0;try{n=((_=(0,_A.statSync)(this.reportHTMLFilePath))==null?void 0:_.size)||0,this.channel.debug(`Report HTML file size approximately ${n} bytes`)}catch(h){this.channel.debug(`Failed to retrieve file size for ${this.reportHTMLFilePath}`,h)}let s=(0,NM.join)((0,Ylr.tmpdir)(),`pw-report-${(0,Zlr.randomUUID)()}.zip`),c=t(()=>{try{(0,_A.existsSync)(s)&&(0,_A.unlinkSync)(s)}catch{}},"cleanupFile"),u={sigterm:t(()=>{c(),process.exit(143)},"sigterm"),sigint:t(()=>{c(),process.exit(130)},"sigint"),exit:c};process.once("SIGTERM",u.sigterm),process.once("SIGINT",u.sigint),process.once("exit",u.exit);try{this.channel.debug("Extracting base64 to temp ZIP file...");let h=Date.now();await this.extractBase64ToFile(s);let b=Date.now()-h;this.channel.debug("Modifying ZIP file...");let S=Date.now(),k=this.modifyZipFile(s),B=Date.now()-S;this.channel.debug("Writing output HTML...");let G=Date.now();await this.writeOutputWithStreamedZip(s);let j=Date.now()-G;return{report_html_bytes:n,extract_ms:b,modify_ms:B,write_ms:j,entry_count:k.entryCount,json_entry_count:k.jsonEntryCount,largest_entry_bytes:k.largestEntryBytes,largest_entry_name:k.largestEntryName}}finally{process.removeListener("SIGTERM",u.sigterm),process.removeListener("SIGINT",u.sigint),process.removeListener("exit",u.exit);try{(0,_A.existsSync)(s)&&(0,_A.unlinkSync)(s)}catch{this.channel.debug(`Failed to cleanup temp file: ${s}`)}}}async extractBase64ToFile(n){return new Promise((s,c)=>{let u=!1,_=!1,h=!1,b=[],S=0,k=(0,_A.createWriteStream)(n);k.on("error",ee=>{if(!_){_=!0;try{K.destroyed||K.destroy(),j.end()}catch{}c(ee)}});let B=t(()=>{if(S<4)return;let ee=b.join("");b.length=0,h||(ee=ee.replace("data:application/zip;base64,",""),h=!0);let fe=Math.floor(ee.length/4)*4,Ze=ee.slice(0,fe),Ye=ee.slice(fe);if(Ye.length>0?(b.push(Ye),S=Ye.length):S=0,Ze.length>0){let st=Buffer.from(Ze,"base64");k.write(st)}},"flushBuffer"),G=t(ee=>plr.includes(ee),"isPayloadTag"),j=new Hlr.Parser({onopentag:t((ee,fe)=>{G(ee)&&fe.id==="playwrightReportBase64"&&(u=!0)},"onopentag"),ontext:t(ee=>{u&&(b.push(ee),S+=ee.length,S>1024*1024&&B())},"ontext"),onclosetag:t(ee=>{if(G(ee)&&u&&!_){if(_=!0,S>0){let fe=b.join("");if(h||(fe=fe.replace("data:application/zip;base64,","")),fe.length>0){let Ze=Buffer.from(fe,"base64");k.write(Ze)}}try{K.destroyed||K.destroy()}catch{}k.end(()=>s())}},"onclosetag"),onerror:t(ee=>{if(!_){_=!0;try{j.end(),K.destroyed||K.destroy(),k.destroyed||k.destroy()}catch{}c(ee)}},"onerror")}),K=(0,_A.createReadStream)(this.reportHTMLFilePath,{encoding:"utf8"});K.on("data",ee=>j.write(ee)),K.on("end",()=>{if(j.end(),!_){_=!0;try{k.destroyed||k.destroy()}catch{}c(new Error("Could not find playwrightReportBase64 in HTML"))}}),K.on("error",ee=>{if(!_){_=!0;try{j.end(),k.destroyed||k.destroy()}catch{}c(ee)}})})}modifyZipFile(n){let s=new Glr.default(n),c=s.getEntries(),u=!1,_=0,h=0,b="";for(let S of c){if(S.isDirectory||!S.entryName.endsWith(".json"))continue;let k=S.getData().toString("utf8");if(_+=1,k.length>h&&(h=k.length,b=S.entryName),S.entryName==="report.json"){let B=JSON.parse(k);this.handleReportJSON(B),this.report=B,this.extractStats(B),S.setData(Buffer.from(JSON.stringify(B),"utf8")),u=!0}else S.setData(Buffer.from(this.replaceAttachmentPaths(k),"utf8"))}if(!u)throw new Error("report.json not found in ZIP file");return s.writeZip(n),{entryCount:c.length,jsonEntryCount:_,largestEntryBytes:h,largestEntryName:b}}replaceAttachmentPaths(n){return n.replace(/"path"\s*:\s*"([^"]+)"/g,(s,c)=>{if(c.startsWith("http://")||c.startsWith("https://"))return s;let u=(0,NM.basename)(c);return`"path":"${this.makeAttachmentPath(c)}"`})}async writeOutputWithStreamedZip(n){let s=this.getTemplate(),c=this.getProcessedFilePath(),u=c.replace(".html",".backup.html");(0,_A.copyFileSync)(c,u);let _=(0,_A.createWriteStream)(c);await new Promise((h,b)=>{_.on("error",b),_.write(s),_.write(dlr+"data:application/zip;base64,");let S=(0,_A.createReadStream)(n,{highWaterMark:3*1024*1024});S.on("data",k=>{let B=k.toString("base64");_.write(B)||S.pause()}),_.on("drain",()=>{S.resume()}),S.on("end",()=>{_.write(_lr),_.end(()=>h())}),S.on("error",k=>{try{_.destroyed||_.destroy()}catch{}b(k)}),_.on("error",k=>{try{S.destroyed||S.destroy()}catch{}b(k)})})}testHasTrace(n,s){try{if(!this.report)return!0;let c=Object.keys(this.pwTestIdToChecksumTestId??{}).find(_=>this.pwTestIdToChecksumTestId[_]===n);if(!c)return!0;let u=t(_=>_.some(h=>{var b;return(b=h.attachments)==null?void 0:b.some(S=>S.name==="trace")}),"hasTrace");for(let _ of this.report.files)for(let h of _.tests)if(h.testId===c&&h.projectName===s&&u(h.results))return!0;return!1}catch(c){return this.channel.debug("Failed to check if test has trace, assuming trace exists",c),!0}}getProcessedFilePath(){return this.reportHTMLFilePath}getTemplate(){return Oz.templateCache||(Oz.templateCache=(0,_A.readFileSync)(Ac.playwrightReporter.htmlReportTemplatePath,"utf-8")),Oz.templateCache}getReportsStats(){return this.stats}extractStats(n){n.stats&&(this.stats=FDe(nwn(n),n.stats,{pwTestIdToChecksumTestId:this.pwTestIdToChecksumTestId,playwrightIdToMetadata:this.playwrightIdToMetadata,checksumTestIdToUsingPlaceholder:this.checksumTestIdToUsingPlaceholder,toRelativeFilePath:t(s=>Y_t(s,this.checksumRoot,this.projectRoot),"toRelativeFilePath")}))}makeAttachmentPath(n){return this.config.hosted?`${this.config.assetsBaseURL}/${this.testRunUUID}/report-data-file-url?fileName=${(0,NM.basename)(n)}`:n}handleReportJSON(n){let s={},c=t(u=>{var b;let _=u.testId,h=this.playwrightIdToMetadata[_];h&&(s[_]=h),u.checksumTestId=G_t({playwrightTestId:u.testId,filePath:(b=u.location)==null?void 0:b.file,title:u.title},{pwTestIdToChecksumTestId:this.pwTestIdToChecksumTestId}),u.results.forEach(S=>{this.processAttachments(S.attachments,u.testId)})},"getChecksumMetadataForPWTestId");n.files.forEach(u=>{u.tests.forEach(c)}),n.checksumMetadata=s}handleFileReportJSON(n){var s;(s=n.tests)==null||s.forEach(c=>{var u;(u=c.results)==null||u.forEach(_=>{this.processAttachments(_.attachments,c.testId)})})}processAttachments(n,s){if(n.forEach(c=>this.updateAttachment(c,s)),!this.supportVideo){let c=n.findIndex(u=>u.name==="video");c!==-1&&n.splice(c,1)}}updateAttachment(n,s){n.path&&(n.path=this.makeAttachmentPath(n.path))}};t(Oz,"PlaywrightReportProcessor"),Oz.templateCache=null;var LDe=Oz;var imt=class imt extends dA{constructor(n,s){super(n,s,{skipChecksumDataLoad:!0}),this.findProjectRoot(),this.apiBaseUrl=process.env.CHECKSUM_SHARD_API_URL||process.env.CHECKSUM_URL||"https://app.checksum.ai",this.authToken=process.env.CHECKSUM_API_KEY||""}async run(){var b;let n=this.getArg("--blob-dir"),s=this.getArg("--parent-run-id"),c=this.getArg("--shard-total");(!n||!s)&&(console.error("Usage: npx checksumai merge-reports --blob-dir=<path> --parent-run-id=<uuid> [--shard-total=<n>]"),process.exit(1)),this.authToken||(console.error("[merge-reports] CHECKSUM_API_KEY env var is required"),process.exit(1));let u=(0,Mz.join)(this.projectRootDirectory,"merged-report");(0,R6.mkdirSync)(u,{recursive:!0});let _=(0,Mz.join)(u,"report.json");await this.patchPlaywright(!1,!0);let h=0;try{console.log("[merge-reports] Running npx playwright merge-reports...");let S=`npx playwright merge-reports --reporter=html,json "${n}"`;await this.execCmd(S,{PLAYWRIGHT_HTML_OUTPUT_DIR:u,PLAYWRIGHT_JSON_OUTPUT_NAME:_});let k=await this.processReport(s,u);await this.uploadReport(s,u),await this.uploadReportDataFiles(s,u);let B=this.parseJsonReport(_);await this.finalizeRun(s,B,k),console.log(`[merge-reports] Done: ${B.passed} passed, ${B.failed} failed`+(B.flaky?`, ${B.flaky} flaky`:"")+(B.skipped?`, ${B.skipped} skipped`:"")+((b=k==null?void 0:k.tests)!=null&&b.length?`, ${k.tests.length} per-test rows forwarded`:" (counts only \u2014 no per-test rows)")),h=0}catch(S){console.error(`[merge-reports] Failed: ${S.message}`),h=1}finally{await this.patchPlaywright(!0,!0)}process.exit(h)}async uploadReport(n,s){let c=(0,Mz.join)(s,"index.html");if(!(0,R6.existsSync)(c))throw new Error(`Merged report not found at ${c}`);let{url:u}=await this.getSignedUploadUrl(n,{type:"report"}),_=(0,R6.readFileSync)(c),h=await fetch(u,{method:"PUT",headers:{"Content-Type":"text/html"},body:new Uint8Array(_)});if(!h.ok)throw new Error(`Report upload failed: ${h.status}`);console.log(`[merge-reports] Report uploaded (${(_.length/1024).toFixed(0)} KB)`)}async uploadReportDataFiles(n,s){let c=(0,Mz.join)(s,"data");if(!(0,R6.existsSync)(c)){console.log("[merge-reports] No data/ directory \u2014 skipping data uploads");return}let u=(0,R6.readdirSync)(c,{withFileTypes:!0}).filter(h=>h.isFile()&&!h.name.endsWith(".webm")).map(h=>h.name);if(u.length===0)return;console.log(`[merge-reports] Uploading ${u.length} data files (traces, screenshots)...`);let _=0;for(let h of u)try{let b=(0,Mz.join)(c,h),{url:S}=await this.getSignedUploadUrl(n,{type:"report-data-file",fileName:h}),k=(0,R6.readFileSync)(b),B=await fetch(S,{method:"PUT",body:new Uint8Array(k)});if(!B.ok){let G=await B.text().catch(()=>"");console.warn(`[merge-reports] Failed to upload data/${h}: ${B.status} ${G.slice(0,200)}`);continue}_++}catch(b){console.warn(`[merge-reports] Error uploading data/${h}: ${b.message}`)}if(_<u.length/2)throw new Error(`Too many data file uploads failed: ${_}/${u.length}`);_<u.length&&console.warn(`[merge-reports] ${u.length-_}/${u.length} data files failed to upload \u2014 some traces may be missing`),console.log(`[merge-reports] Uploaded ${_}/${u.length} data files`)}async getSignedUploadUrl(n,s){let c=await fetch(`${this.apiBaseUrl}/client-api/test-runs/${n}/get-upload-url`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(s)});if(!c.ok){let u=await c.text();throw new Error(`Failed to get upload URL (${c.status}): ${u}`)}return c.json()}parseJsonReport(n){let s={passed:0,failed:0,flaky:0,skipped:0};if(!(0,R6.existsSync)(n))return console.warn("[merge-reports] JSON report not found \u2014 stats unavailable"),s;try{let c=JSON.parse((0,R6.readFileSync)(n,"utf-8"));if(c.stats)return{passed:c.stats.expected||0,failed:c.stats.unexpected||0,flaky:c.stats.flaky||0,skipped:c.stats.skipped||0};let u=0,_=0,h=0,b=0,S=t(k=>{for(let B of k){for(let G of B.specs||[])for(let j of G.tests||[])j.status==="expected"?u++:j.status==="unexpected"?_++:j.status==="flaky"?h++:j.status==="skipped"&&b++;B.suites&&S(B.suites)}},"walkSuites");return S(c.suites||[]),{passed:u,failed:_,flaky:h,skipped:b}}catch(c){return console.warn(`[merge-reports] Failed to parse JSON report: ${c.message}`),s}}async finalizeRun(n,s,c){let u=this.checksumRuntimeVersion,_=c?{parentRunId:n,passed:c.passed,failed:c.failed,bug:c.bug,recovered:c.recovered,flaky:s.flaky,skipped:s.skipped,tests:c.tests??[],endedAt:Date.now(),runtimeVersion:u}:{parentRunId:n,...s,endedAt:Date.now(),runtimeVersion:u},h=await fetch(`${this.apiBaseUrl}/client-api/sharded-run/finalize`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(_)});if(!h.ok){let b=await h.text();throw new Error(`Finalize failed (${h.status}): ${b}`)}}async processReport(n,s){let c=(0,Mz.join)(s,"index.html");if(!(0,R6.existsSync)(c))return null;let u={debug:t((...h)=>{},"debug"),log:t(h=>console.log(`[merge-reports] ${h}`),"log")},_=new LDe(c,n,{},{},{hosted:!0},u,this.projectRootDirectory,this.projectRootDirectory);return await _.process(),console.log("[merge-reports] Applied Checksum report template + metadata"),_.getReportsStats()??null}};t(imt,"CLIMergeReports");var QDe=imt;var smt=class smt extends dA{constructor(n,s=!1){super(n,s,{skipChecksumDataLoad:!0})}async run(){let s=`npx playwright show-report ${this.getNonChecksumArgs().join(" ")}`;try{await this.execCmd(s)}catch(c){console.log("Error showing report",c.message)}}};t(smt,"CLIShowReport");var UDe=smt;var Lpr=require("crypto"),fh=require("fs"),cE=require("path");var PM=t(i=>i.name==="up"||i.name==="k"||i.ctrl&&i.name==="p","isUpKey"),dre=t(i=>i.name==="down"||i.name==="j"||i.ctrl&&i.name==="n","isDownKey"),Klr=t(i=>i.name==="space","isSpaceKey"),_re=t(i=>i.name==="backspace","isBackspaceKey"),jDe=t(i=>"123456789".includes(i.name),"isNumberKey"),o1=t(i=>i.name==="enter"||i.name==="return","isEnterKey");var amt=class amt extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(n){super(),this.cause=n==null?void 0:n.cause}};t(amt,"AbortPromptError");var JDe=amt,omt=class omt extends Error{name="CancelPromptError";message="Prompt was canceled"};t(omt,"CancelPromptError");var VDe=omt,cmt=class cmt extends Error{name="ExitPromptError"};t(cmt,"ExitPromptError");var zDe=cmt,lmt=class lmt extends Error{name="HookError"};t(lmt,"HookError");var $De=lmt,umt=class umt extends Error{name="ValidationError"};t(umt,"ValidationError");var FM=umt;var _mt=require("async_hooks");var WDe=require("async_hooks");var Xlr=new WDe.AsyncLocalStorage;function iwn(i){return{rl:i,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}t(iwn,"createStore");function eur(i,n){let s=iwn(i);return Xlr.run(s,()=>{function c(u){s.handleChange=()=>{s.index=0,u()},s.handleChange()}return t(c,"cycle"),n(c)})}t(eur,"withHooks");function Lz(){let i=Xlr.getStore();if(!i)throw new $De("[Inquirer] Hook functions can only be called from within a prompt");return i}t(Lz,"getStore");function fmt(){return Lz().rl}t(fmt,"readline");function pmt(i){let n=t((...s)=>{let c=Lz(),u=!1,_=c.handleChange;c.handleChange=()=>{u=!0};let h=i(...s);return u&&_(),c.handleChange=_,h},"wrapped");return WDe.AsyncResource.bind(n)}t(pmt,"withUpdates");function mre(i){let n=Lz(),{index:s}=n,c={get(){return n.hooks[s]},set(_){n.hooks[s]=_},initialized:s in n.hooks},u=i(c);return n.index++,u}t(mre,"withPointer");function tur(){Lz().handleChange()}t(tur,"handleChange");var Qz={queue(i){let n=Lz(),{index:s}=n;n.hooksEffect.push(()=>{var u,_;(_=(u=n.hooksCleanup)[s])==null||_.call(u);let c=i(fmt());if(c!=null&&typeof c!="function")throw new FM("useEffect return value must be a cleanup function or nothing.");n.hooksCleanup[s]=c})},run(){let i=Lz();pmt(()=>{i.hooksEffect.forEach(n=>{n()}),i.hooksEffect.length=0})()},clearAll(){let i=Lz();i.hooksCleanup.forEach(n=>{n==null||n()}),i.hooksEffect.length=0,i.hooksCleanup.length=0}};function gl(i){return mre(n=>{let s=t(u=>{n.get()!==u&&(n.set(u),tur())},"setFn");if(n.initialized)return[n.get(),s];let c=typeof i=="function"?i():i;return n.set(c),[c,s]})}t(gl,"useState");function s8(i,n){mre(s=>{let c=s.get();(!Array.isArray(c)||n.some((_,h)=>!Object.is(_,c[h])))&&Qz.queue(i),s.set(n)})}t(s8,"useEffect");var Dw=Pa(BM(),1);var a8=Pa(require("process"),1);function awn(){return a8.default.platform!=="win32"?a8.default.env.TERM!=="linux":!!a8.default.env.WT_SESSION||!!a8.default.env.TERMINUS_SUBLIME||a8.default.env.ConEmuTask==="{cmd::Cmder}"||a8.default.env.TERM_PROGRAM==="Terminus-Sublime"||a8.default.env.TERM_PROGRAM==="vscode"||a8.default.env.TERM==="xterm-256color"||a8.default.env.TERM==="alacritty"||a8.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}t(awn,"isUnicodeSupported");var sur={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},aur={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},own={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},cwn={...sur,...aur},lwn={...sur,...own},uwn=awn(),fwn=uwn?cwn:lwn,HDe=fwn,t_i=Object.entries(aur);var our={prefix:{idle:Dw.default.blue("?"),done:Dw.default.green(HDe.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map(i=>Dw.default.yellow(i))},style:{answer:Dw.default.cyan,message:Dw.default.bold,error:t(i=>Dw.default.red(`> ${i}`),"error"),defaultAnswer:t(i=>Dw.default.dim(`(${i})`),"defaultAnswer"),help:Dw.default.dim,highlight:Dw.default.cyan,key:t(i=>Dw.default.cyan(Dw.default.bold(`<${i}>`)),"key")}};function cur(i){if(typeof i!="object"||i===null)return!1;let n=i;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(i)===n}t(cur,"isPlainObject");function lur(...i){let n={};for(let s of i)for(let[c,u]of Object.entries(s)){let _=n[c];n[c]=cur(_)&&cur(u)?lur(_,u):u}return n}t(lur,"deepMerge");function Kh(...i){let n=[our,...i.filter(s=>s!=null)];return lur(...n)}t(Kh,"makeTheme");function k0({status:i="idle",theme:n}){let[s,c]=gl(!1),[u,_]=gl(0),{prefix:h,spinner:b}=Kh(n);return s8(()=>{if(i==="loading"){let k,B=-1,G=setTimeout(_mt.AsyncResource.bind(()=>{c(!0),k=setInterval(_mt.AsyncResource.bind(()=>{B=B+1,_(B%b.frames.length)}),b.interval)}),300);return()=>{clearTimeout(G),clearInterval(k)}}else c(!1)},[i]),s?b.frames[u]:typeof h=="string"?h:h[i==="loading"?"idle":i]??h.idle}t(k0,"usePrefix");function O6(i,n){return mre(s=>{let c=s.get();if(!c||c.dependencies.length!==n.length||c.dependencies.some((u,_)=>u!==n[_])){let u=i();return s.set({value:u,dependencies:n}),u}return c.value})}t(O6,"useMemo");function Nw(i){return gl({current:i})[0]}t(Nw,"useRef");function D0(i){let n=Nw(i);n.current=i,s8(s=>{let c=!1,u=pmt((_,h)=>{c||n.current(h,s)});return s.input.on("keypress",u),()=>{c=!0,s.input.removeListener("keypress",u)}},[])}t(D0,"useKeypress");var Lur=Pa(fur(),1),Qur=Pa(Mur(),1);function vhe(i,n){return i.split(`
|
|
821
|
+
`)}}};t(K_t,"CLIHelp");var hhe=K_t;var R6=require("fs"),Mz=require("path");var plr=["script","template"],dlr='<script id="playwrightReportBase64" type="application/zip">',_lr="</script>";var Hlr=require("htmlparser2"),Glr=Pa(qlr()),_A=require("fs"),NM=require("path"),Ylr=require("os"),Zlr=require("crypto");var nwn=t(i=>i.files.flatMap(n=>n.tests.map(s=>{var c;return{playwrightTestId:s.testId,ok:!!s.ok,outcome:s.outcome,title:s.title,filePath:(c=s.location)==null?void 0:c.file,projectName:s.projectName||void 0,tags:s.tags??[],annotations:s.annotations??[]}})),"htmlReportToRows"),Oz=class Oz{constructor(n,s,c,u={},_={},h,b,S,k={}){this.reportHTMLFilePath=n;this.testRunUUID=s;this.pwTestIdToChecksumTestId=c;this.playwrightIdToMetadata=u;this.channel=h;this.checksumTestIdToUsingPlaceholder=k;this.supportVideo=!1;this.config={hosted:!0,assetsBaseURL:"https://api.checksum.ai/api/test-runs"};this.config={...this.config,..._},this.checksumRoot=b||(0,NM.dirname)((0,NM.dirname)(n)),this.projectRoot=S||this.checksumRoot}async process(){var _;let n=0;try{n=((_=(0,_A.statSync)(this.reportHTMLFilePath))==null?void 0:_.size)||0,this.channel.debug(`Report HTML file size approximately ${n} bytes`)}catch(h){this.channel.debug(`Failed to retrieve file size for ${this.reportHTMLFilePath}`,h)}let s=(0,NM.join)((0,Ylr.tmpdir)(),`pw-report-${(0,Zlr.randomUUID)()}.zip`),c=t(()=>{try{(0,_A.existsSync)(s)&&(0,_A.unlinkSync)(s)}catch{}},"cleanupFile"),u={sigterm:t(()=>{c(),process.exit(143)},"sigterm"),sigint:t(()=>{c(),process.exit(130)},"sigint"),exit:c};process.once("SIGTERM",u.sigterm),process.once("SIGINT",u.sigint),process.once("exit",u.exit);try{this.channel.debug("Extracting base64 to temp ZIP file...");let h=Date.now();await this.extractBase64ToFile(s);let b=Date.now()-h;this.channel.debug("Modifying ZIP file...");let S=Date.now(),k=this.modifyZipFile(s),B=Date.now()-S;this.channel.debug("Writing output HTML...");let G=Date.now();await this.writeOutputWithStreamedZip(s);let j=Date.now()-G;return{report_html_bytes:n,extract_ms:b,modify_ms:B,write_ms:j,entry_count:k.entryCount,json_entry_count:k.jsonEntryCount,largest_entry_bytes:k.largestEntryBytes,largest_entry_name:k.largestEntryName}}finally{process.removeListener("SIGTERM",u.sigterm),process.removeListener("SIGINT",u.sigint),process.removeListener("exit",u.exit);try{(0,_A.existsSync)(s)&&(0,_A.unlinkSync)(s)}catch{this.channel.debug(`Failed to cleanup temp file: ${s}`)}}}async extractBase64ToFile(n){return new Promise((s,c)=>{let u=!1,_=!1,h=!1,b=[],S=0,k=(0,_A.createWriteStream)(n);k.on("error",ee=>{if(!_){_=!0;try{K.destroyed||K.destroy(),j.end()}catch{}c(ee)}});let B=t(()=>{if(S<4)return;let ee=b.join("");b.length=0,h||(ee=ee.replace("data:application/zip;base64,",""),h=!0);let fe=Math.floor(ee.length/4)*4,Ze=ee.slice(0,fe),Ye=ee.slice(fe);if(Ye.length>0?(b.push(Ye),S=Ye.length):S=0,Ze.length>0){let st=Buffer.from(Ze,"base64");k.write(st)}},"flushBuffer"),G=t(ee=>plr.includes(ee),"isPayloadTag"),j=new Hlr.Parser({onopentag:t((ee,fe)=>{G(ee)&&fe.id==="playwrightReportBase64"&&(u=!0)},"onopentag"),ontext:t(ee=>{u&&(b.push(ee),S+=ee.length,S>1024*1024&&B())},"ontext"),onclosetag:t(ee=>{if(G(ee)&&u&&!_){if(_=!0,S>0){let fe=b.join("");if(h||(fe=fe.replace("data:application/zip;base64,","")),fe.length>0){let Ze=Buffer.from(fe,"base64");k.write(Ze)}}try{K.destroyed||K.destroy()}catch{}k.end(()=>s())}},"onclosetag"),onerror:t(ee=>{if(!_){_=!0;try{j.end(),K.destroyed||K.destroy(),k.destroyed||k.destroy()}catch{}c(ee)}},"onerror")}),K=(0,_A.createReadStream)(this.reportHTMLFilePath,{encoding:"utf8"});K.on("data",ee=>j.write(ee)),K.on("end",()=>{if(j.end(),!_){_=!0;try{k.destroyed||k.destroy()}catch{}c(new Error("Could not find playwrightReportBase64 in HTML"))}}),K.on("error",ee=>{if(!_){_=!0;try{j.end(),k.destroyed||k.destroy()}catch{}c(ee)}})})}modifyZipFile(n){let s=new Glr.default(n),c=s.getEntries(),u=!1,_=0,h=0,b="";for(let S of c){if(S.isDirectory||!S.entryName.endsWith(".json"))continue;let k=S.getData().toString("utf8");if(_+=1,k.length>h&&(h=k.length,b=S.entryName),S.entryName==="report.json"){let B=JSON.parse(k);this.handleReportJSON(B),this.report=B,this.extractStats(B),S.setData(Buffer.from(JSON.stringify(B),"utf8")),u=!0}else S.setData(Buffer.from(this.replaceAttachmentPaths(k),"utf8"))}if(!u)throw new Error("report.json not found in ZIP file");return s.writeZip(n),{entryCount:c.length,jsonEntryCount:_,largestEntryBytes:h,largestEntryName:b}}replaceAttachmentPaths(n){return n.replace(/"path"\s*:\s*"([^"]+)"/g,(s,c)=>{if(c.startsWith("http://")||c.startsWith("https://"))return s;let u=(0,NM.basename)(c);return`"path":"${this.makeAttachmentPath(c)}"`})}async writeOutputWithStreamedZip(n){let s=this.getTemplate(),c=this.getProcessedFilePath(),u=c.replace(".html",".backup.html");(0,_A.copyFileSync)(c,u);let _=(0,_A.createWriteStream)(c);await new Promise((h,b)=>{_.on("error",b),_.write(s),_.write(dlr+"data:application/zip;base64,");let S=(0,_A.createReadStream)(n,{highWaterMark:3*1024*1024});S.on("data",k=>{let B=k.toString("base64");_.write(B)||S.pause()}),_.on("drain",()=>{S.resume()}),S.on("end",()=>{_.write(_lr),_.end(()=>h())}),S.on("error",k=>{try{_.destroyed||_.destroy()}catch{}b(k)}),_.on("error",k=>{try{S.destroyed||S.destroy()}catch{}b(k)})})}testHasTrace(n,s){try{if(!this.report)return!0;let c=Object.keys(this.pwTestIdToChecksumTestId??{}).find(_=>this.pwTestIdToChecksumTestId[_]===n);if(!c)return!0;let u=t(_=>_.some(h=>{var b;return(b=h.attachments)==null?void 0:b.some(S=>S.name==="trace")}),"hasTrace");for(let _ of this.report.files)for(let h of _.tests)if(h.testId===c&&h.projectName===s&&u(h.results))return!0;return!1}catch(c){return this.channel.debug("Failed to check if test has trace, assuming trace exists",c),!0}}getProcessedFilePath(){return this.reportHTMLFilePath}getTemplate(){return Oz.templateCache||(Oz.templateCache=(0,_A.readFileSync)(Ac.playwrightReporter.htmlReportTemplatePath,"utf-8")),Oz.templateCache}getReportsStats(){return this.stats}extractStats(n){n.stats&&(this.stats=FDe(nwn(n),n.stats,{pwTestIdToChecksumTestId:this.pwTestIdToChecksumTestId,playwrightIdToMetadata:this.playwrightIdToMetadata,checksumTestIdToUsingPlaceholder:this.checksumTestIdToUsingPlaceholder,toRelativeFilePath:t(s=>Y_t(s,this.checksumRoot,this.projectRoot),"toRelativeFilePath")}))}makeAttachmentPath(n){return this.config.hosted?`${this.config.assetsBaseURL}/${this.testRunUUID}/report-data-file-url?fileName=${(0,NM.basename)(n)}`:n}handleReportJSON(n){let s={},c=t(u=>{var b;let _=u.testId,h=this.playwrightIdToMetadata[_];h&&(s[_]=h),u.checksumTestId=G_t({playwrightTestId:u.testId,filePath:(b=u.location)==null?void 0:b.file,title:u.title},{pwTestIdToChecksumTestId:this.pwTestIdToChecksumTestId}),u.results.forEach(S=>{this.processAttachments(S.attachments,u.testId)})},"getChecksumMetadataForPWTestId");n.files.forEach(u=>{u.tests.forEach(c)}),n.checksumMetadata=s}handleFileReportJSON(n){var s;(s=n.tests)==null||s.forEach(c=>{var u;(u=c.results)==null||u.forEach(_=>{this.processAttachments(_.attachments,c.testId)})})}processAttachments(n,s){if(n.forEach(c=>this.updateAttachment(c,s)),!this.supportVideo){let c=n.findIndex(u=>u.name==="video");c!==-1&&n.splice(c,1)}}updateAttachment(n,s){n.path&&(n.path=this.makeAttachmentPath(n.path))}};t(Oz,"PlaywrightReportProcessor"),Oz.templateCache=null;var LDe=Oz;var imt=class imt extends dA{constructor(n,s){super(n,s,{skipChecksumDataLoad:!0}),this.findProjectRoot(),this.apiBaseUrl=process.env.CHECKSUM_SHARD_API_URL||process.env.CHECKSUM_URL||"https://app.checksum.ai",this.authToken=process.env.CHECKSUM_API_KEY||""}async run(){let n=this.getArg("--blob-dir"),s=this.getArg("--parent-run-id"),c=this.getArg("--shard-total");(!n||!s)&&(console.error("Usage: npx checksumai merge-reports --blob-dir=<path> --parent-run-id=<uuid> [--shard-total=<n>]"),process.exit(1)),this.authToken||(console.error("[merge-reports] CHECKSUM_API_KEY env var is required"),process.exit(1));let u=(0,Mz.join)(this.projectRootDirectory,"merged-report");(0,R6.mkdirSync)(u,{recursive:!0});let _=(0,Mz.join)(u,"report.json");await this.patchPlaywright();let h=0;try{console.log("[merge-reports] Running npx playwright merge-reports...");let b=`npx playwright merge-reports --reporter=html,json "${n}"`;await this.execCmd(b,{PLAYWRIGHT_HTML_OUTPUT_DIR:u,PLAYWRIGHT_JSON_OUTPUT_NAME:_}),await this.processReport(s,u),await this.uploadReport(s,u),await this.uploadReportDataFiles(s,u);let S=this.parseJsonReport(_);await this.finalizeRun(s,S),console.log(`[merge-reports] Done: ${S.passed} passed, ${S.failed} failed`+(S.flaky?`, ${S.flaky} flaky`:"")+(S.skipped?`, ${S.skipped} skipped`:"")),h=0}catch(b){console.error(`[merge-reports] Failed: ${b.message}`),h=1}finally{await this.patchPlaywright(!0)}process.exit(h)}async uploadReport(n,s){let c=(0,Mz.join)(s,"index.html");if(!(0,R6.existsSync)(c))throw new Error(`Merged report not found at ${c}`);let{url:u}=await this.getSignedUploadUrl(n,{type:"report"}),_=(0,R6.readFileSync)(c),h=await fetch(u,{method:"PUT",headers:{"Content-Type":"text/html"},body:new Uint8Array(_)});if(!h.ok)throw new Error(`Report upload failed: ${h.status}`);console.log(`[merge-reports] Report uploaded (${(_.length/1024).toFixed(0)} KB)`)}async uploadReportDataFiles(n,s){let c=(0,Mz.join)(s,"data");if(!(0,R6.existsSync)(c)){console.log("[merge-reports] No data/ directory \u2014 skipping data uploads");return}let u=(0,R6.readdirSync)(c,{withFileTypes:!0}).filter(h=>h.isFile()&&!h.name.endsWith(".webm")).map(h=>h.name);if(u.length===0)return;console.log(`[merge-reports] Uploading ${u.length} data files (traces, screenshots)...`);let _=0;for(let h of u)try{let b=(0,Mz.join)(c,h),{url:S}=await this.getSignedUploadUrl(n,{type:"report-data-file",fileName:h}),k=(0,R6.readFileSync)(b),B=await fetch(S,{method:"PUT",body:new Uint8Array(k)});if(!B.ok){let G=await B.text().catch(()=>"");console.warn(`[merge-reports] Failed to upload data/${h}: ${B.status} ${G.slice(0,200)}`);continue}_++}catch(b){console.warn(`[merge-reports] Error uploading data/${h}: ${b.message}`)}if(_<u.length/2)throw new Error(`Too many data file uploads failed: ${_}/${u.length}`);_<u.length&&console.warn(`[merge-reports] ${u.length-_}/${u.length} data files failed to upload \u2014 some traces may be missing`),console.log(`[merge-reports] Uploaded ${_}/${u.length} data files`)}async getSignedUploadUrl(n,s){let c=await fetch(`${this.apiBaseUrl}/client-api/test-runs/${n}/get-upload-url`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(s)});if(!c.ok){let u=await c.text();throw new Error(`Failed to get upload URL (${c.status}): ${u}`)}return c.json()}parseJsonReport(n){let s={passed:0,failed:0,flaky:0,skipped:0};if(!(0,R6.existsSync)(n))return console.warn("[merge-reports] JSON report not found \u2014 stats unavailable"),s;try{let c=JSON.parse((0,R6.readFileSync)(n,"utf-8"));if(c.stats)return{passed:c.stats.expected||0,failed:c.stats.unexpected||0,flaky:c.stats.flaky||0,skipped:c.stats.skipped||0};let u=0,_=0,h=0,b=0,S=t(k=>{for(let B of k){for(let G of B.specs||[])for(let j of G.tests||[])j.status==="expected"?u++:j.status==="unexpected"?_++:j.status==="flaky"?h++:j.status==="skipped"&&b++;B.suites&&S(B.suites)}},"walkSuites");return S(c.suites||[]),{passed:u,failed:_,flaky:h,skipped:b}}catch(c){return console.warn(`[merge-reports] Failed to parse JSON report: ${c.message}`),s}}async finalizeRun(n,s){let c=await fetch(`${this.apiBaseUrl}/client-api/sharded-run/finalize`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify({parentRunId:n,...s})});if(!c.ok){let u=await c.text();throw new Error(`Finalize failed (${c.status}): ${u}`)}}async processReport(n,s){let c=(0,Mz.join)(s,"index.html");if(!(0,R6.existsSync)(c))return;let u={debug:t((...h)=>{},"debug"),log:t(h=>console.log(`[merge-reports] ${h}`),"log")};await new LDe(c,n,{},{},{hosted:!0},u,this.projectRootDirectory,this.projectRootDirectory).process(),console.log("[merge-reports] Applied Checksum report template + metadata")}};t(imt,"CLIMergeReports");var QDe=imt;var smt=class smt extends dA{constructor(n,s=!1){super(n,s,{skipChecksumDataLoad:!0})}async run(){let s=`npx playwright show-report ${this.getNonChecksumArgs().join(" ")}`;try{await this.execCmd(s)}catch(c){console.log("Error showing report",c.message)}}};t(smt,"CLIShowReport");var UDe=smt;var Lpr=require("crypto"),fh=require("fs"),cE=require("path");var PM=t(i=>i.name==="up"||i.name==="k"||i.ctrl&&i.name==="p","isUpKey"),dre=t(i=>i.name==="down"||i.name==="j"||i.ctrl&&i.name==="n","isDownKey"),Klr=t(i=>i.name==="space","isSpaceKey"),_re=t(i=>i.name==="backspace","isBackspaceKey"),jDe=t(i=>"123456789".includes(i.name),"isNumberKey"),o1=t(i=>i.name==="enter"||i.name==="return","isEnterKey");var amt=class amt extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(n){super(),this.cause=n==null?void 0:n.cause}};t(amt,"AbortPromptError");var JDe=amt,omt=class omt extends Error{name="CancelPromptError";message="Prompt was canceled"};t(omt,"CancelPromptError");var VDe=omt,cmt=class cmt extends Error{name="ExitPromptError"};t(cmt,"ExitPromptError");var zDe=cmt,lmt=class lmt extends Error{name="HookError"};t(lmt,"HookError");var $De=lmt,umt=class umt extends Error{name="ValidationError"};t(umt,"ValidationError");var FM=umt;var _mt=require("async_hooks");var WDe=require("async_hooks");var Xlr=new WDe.AsyncLocalStorage;function iwn(i){return{rl:i,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}t(iwn,"createStore");function eur(i,n){let s=iwn(i);return Xlr.run(s,()=>{function c(u){s.handleChange=()=>{s.index=0,u()},s.handleChange()}return t(c,"cycle"),n(c)})}t(eur,"withHooks");function Lz(){let i=Xlr.getStore();if(!i)throw new $De("[Inquirer] Hook functions can only be called from within a prompt");return i}t(Lz,"getStore");function fmt(){return Lz().rl}t(fmt,"readline");function pmt(i){let n=t((...s)=>{let c=Lz(),u=!1,_=c.handleChange;c.handleChange=()=>{u=!0};let h=i(...s);return u&&_(),c.handleChange=_,h},"wrapped");return WDe.AsyncResource.bind(n)}t(pmt,"withUpdates");function mre(i){let n=Lz(),{index:s}=n,c={get(){return n.hooks[s]},set(_){n.hooks[s]=_},initialized:s in n.hooks},u=i(c);return n.index++,u}t(mre,"withPointer");function tur(){Lz().handleChange()}t(tur,"handleChange");var Qz={queue(i){let n=Lz(),{index:s}=n;n.hooksEffect.push(()=>{var u,_;(_=(u=n.hooksCleanup)[s])==null||_.call(u);let c=i(fmt());if(c!=null&&typeof c!="function")throw new FM("useEffect return value must be a cleanup function or nothing.");n.hooksCleanup[s]=c})},run(){let i=Lz();pmt(()=>{i.hooksEffect.forEach(n=>{n()}),i.hooksEffect.length=0})()},clearAll(){let i=Lz();i.hooksCleanup.forEach(n=>{n==null||n()}),i.hooksEffect.length=0,i.hooksCleanup.length=0}};function gl(i){return mre(n=>{let s=t(u=>{n.get()!==u&&(n.set(u),tur())},"setFn");if(n.initialized)return[n.get(),s];let c=typeof i=="function"?i():i;return n.set(c),[c,s]})}t(gl,"useState");function s8(i,n){mre(s=>{let c=s.get();(!Array.isArray(c)||n.some((_,h)=>!Object.is(_,c[h])))&&Qz.queue(i),s.set(n)})}t(s8,"useEffect");var Dw=Pa(BM(),1);var a8=Pa(require("process"),1);function awn(){return a8.default.platform!=="win32"?a8.default.env.TERM!=="linux":!!a8.default.env.WT_SESSION||!!a8.default.env.TERMINUS_SUBLIME||a8.default.env.ConEmuTask==="{cmd::Cmder}"||a8.default.env.TERM_PROGRAM==="Terminus-Sublime"||a8.default.env.TERM_PROGRAM==="vscode"||a8.default.env.TERM==="xterm-256color"||a8.default.env.TERM==="alacritty"||a8.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}t(awn,"isUnicodeSupported");var sur={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},aur={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},own={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},cwn={...sur,...aur},lwn={...sur,...own},uwn=awn(),fwn=uwn?cwn:lwn,HDe=fwn,t_i=Object.entries(aur);var our={prefix:{idle:Dw.default.blue("?"),done:Dw.default.green(HDe.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map(i=>Dw.default.yellow(i))},style:{answer:Dw.default.cyan,message:Dw.default.bold,error:t(i=>Dw.default.red(`> ${i}`),"error"),defaultAnswer:t(i=>Dw.default.dim(`(${i})`),"defaultAnswer"),help:Dw.default.dim,highlight:Dw.default.cyan,key:t(i=>Dw.default.cyan(Dw.default.bold(`<${i}>`)),"key")}};function cur(i){if(typeof i!="object"||i===null)return!1;let n=i;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(i)===n}t(cur,"isPlainObject");function lur(...i){let n={};for(let s of i)for(let[c,u]of Object.entries(s)){let _=n[c];n[c]=cur(_)&&cur(u)?lur(_,u):u}return n}t(lur,"deepMerge");function Kh(...i){let n=[our,...i.filter(s=>s!=null)];return lur(...n)}t(Kh,"makeTheme");function k0({status:i="idle",theme:n}){let[s,c]=gl(!1),[u,_]=gl(0),{prefix:h,spinner:b}=Kh(n);return s8(()=>{if(i==="loading"){let k,B=-1,G=setTimeout(_mt.AsyncResource.bind(()=>{c(!0),k=setInterval(_mt.AsyncResource.bind(()=>{B=B+1,_(B%b.frames.length)}),b.interval)}),300);return()=>{clearTimeout(G),clearInterval(k)}}else c(!1)},[i]),s?b.frames[u]:typeof h=="string"?h:h[i==="loading"?"idle":i]??h.idle}t(k0,"usePrefix");function O6(i,n){return mre(s=>{let c=s.get();if(!c||c.dependencies.length!==n.length||c.dependencies.some((u,_)=>u!==n[_])){let u=i();return s.set({value:u,dependencies:n}),u}return c.value})}t(O6,"useMemo");function Nw(i){return gl({current:i})[0]}t(Nw,"useRef");function D0(i){let n=Nw(i);n.current=i,s8(s=>{let c=!1,u=pmt((_,h)=>{c||n.current(h,s)});return s.input.on("keypress",u),()=>{c=!0,s.input.removeListener("keypress",u)}},[])}t(D0,"useKeypress");var Lur=Pa(fur(),1),Qur=Pa(Mur(),1);function vhe(i,n){return i.split(`
|
|
822
822
|
`).flatMap(s=>(0,Qur.default)(s,n,{trim:!1,hard:!0}).split(`
|
|
823
823
|
`).map(c=>c.trimEnd())).join(`
|
|
824
824
|
`)}t(vhe,"breakLines");function KDe(){return(0,Lur.default)({defaultWidth:80,output:fmt().output})}t(KDe,"readlineWidth");function Bwn(i,n){return vhe(i,n).split(`
|
package/package.json
CHANGED
|
@@ -382,13 +382,7 @@ function run(projectPath) {
|
|
|
382
382
|
channelOwner(projectPath);
|
|
383
383
|
stackTrace(projectPath);
|
|
384
384
|
indexContent(projectPath);
|
|
385
|
-
|
|
386
|
-
// the HTML reporter sleep ~10s per `trace` attachment waiting for a
|
|
387
|
-
// `checksum-playwright-trace` file that only the live run produces; in
|
|
388
|
-
// the merge path (real Playwright traces) it is pure dead time.
|
|
389
|
-
if (process.env.CHECKSUM_SKIP_TRACE_PATCH !== "true") {
|
|
390
|
-
reportTraceFile(projectPath);
|
|
391
|
-
}
|
|
385
|
+
reportTraceFile(projectPath);
|
|
392
386
|
}
|
|
393
387
|
} else {
|
|
394
388
|
console.warn("Project path not found", projectPath);
|
|
@@ -518,13 +518,7 @@ function run(projectPath) {
|
|
|
518
518
|
channelOwner(projectPath);
|
|
519
519
|
stackTrace(projectPath);
|
|
520
520
|
indexContent(projectPath);
|
|
521
|
-
|
|
522
|
-
// the HTML reporter sleep ~10s per `trace` attachment waiting for a
|
|
523
|
-
// `checksum-playwright-trace` file that only the live run produces; in
|
|
524
|
-
// the merge path (real Playwright traces) it is pure dead time.
|
|
525
|
-
if (process.env.CHECKSUM_SKIP_TRACE_PATCH !== "true") {
|
|
526
|
-
reportTraceFile(projectPath);
|
|
527
|
-
}
|
|
521
|
+
reportTraceFile(projectPath);
|
|
528
522
|
htmlReporter(projectPath);
|
|
529
523
|
}
|
|
530
524
|
} else {
|
|
@@ -518,13 +518,7 @@ function run(projectPath) {
|
|
|
518
518
|
channelOwner(projectPath);
|
|
519
519
|
stackTrace(projectPath);
|
|
520
520
|
indexContent(projectPath);
|
|
521
|
-
|
|
522
|
-
// the HTML reporter sleep ~10s per `trace` attachment waiting for a
|
|
523
|
-
// `checksum-playwright-trace` file that only the live run produces; in
|
|
524
|
-
// the merge path (real Playwright traces) it is pure dead time.
|
|
525
|
-
if (process.env.CHECKSUM_SKIP_TRACE_PATCH !== "true") {
|
|
526
|
-
reportTraceFile(projectPath);
|
|
527
|
-
}
|
|
521
|
+
reportTraceFile(projectPath);
|
|
528
522
|
htmlReporter(projectPath);
|
|
529
523
|
}
|
|
530
524
|
} else {
|
|
@@ -534,13 +534,7 @@ function run(projectPath) {
|
|
|
534
534
|
channelOwner(projectPath);
|
|
535
535
|
stackTrace(projectPath);
|
|
536
536
|
indexContent(projectPath);
|
|
537
|
-
|
|
538
|
-
// the HTML reporter sleep ~10s per `trace` attachment waiting for a
|
|
539
|
-
// `checksum-playwright-trace` file that only the live run produces; in
|
|
540
|
-
// the merge path (real Playwright traces) it is pure dead time.
|
|
541
|
-
if (process.env.CHECKSUM_SKIP_TRACE_PATCH !== "true") {
|
|
542
|
-
reportTraceFile(projectPath);
|
|
543
|
-
}
|
|
537
|
+
reportTraceFile(projectPath);
|
|
544
538
|
htmlReporter(projectPath);
|
|
545
539
|
}
|
|
546
540
|
} else {
|