@checksum-ai/runtime 1.2.1 → 1.2.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.
@@ -1785,7 +1785,7 @@ ${m}
1785
1785
  `).map(x=>x.trim());for(let x of m){let C=x.match(/\((.*):(\d+):(\d+)\)$/)||x.match(/at (.*):(\d+):(\d+)/);if(!C)continue;let[,S,k]=C,I=parseInt(k,10),M=xRr.default.dirname(n.testInfo.config.configFile);if(S.includes(M)&&(0,R0t.existsSync)(S))try{let B=(0,R0t.readFileSync)(S,"utf8"),$=TJe.default.createSourceFile(S,B,TJe.default.ScriptTarget.Latest,!0),W=!1,re=e((oe,pe)=>{let{line:_e}=$.getLineAndCharacterOfPosition(oe.getStart()),{line:Ee}=$.getLineAndCharacterOfPosition(oe.getEnd());_e+1<=I&&Ee+1>=I&&pe&&(W=!0),TJe.default.isTryStatement(oe)&&TJe.default.forEachChild(oe.tryBlock,Pe=>re(Pe,oe)),TJe.default.forEachChild(oe,Pe=>re(Pe,pe))},"checkNode");if(re($,null),W)return!0}catch{continue}}return!1},"isErrorFromTryBlock")(a)}catch{return!0}}async createARSummary(){let{apiKey:n}=this;try{let a=await DJe(async()=>await fetch(`${this.getAPIBaseURL()}/summarize`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:this.apiKey},body:JSON.stringify({appName:n,sessionId:this.sessionId})}));if(a.status!==201)throw new Error("Failed to create AR summary after 3 retries");return await a.text()}catch(a){return this.log("[AIFallback] Error calling summarize",a)," "}}async resolve(n){let a=Date.now();if(Q_e.alreadyTriggered&&this.benchmark)throw new Error("Cannot trigger AI fallback more than once in benchmark mode");Q_e.alreadyTriggered=!0,this.fallbackData=n,this.withChecksumAI=n.withChecksumAI;let o=this.getFailedThought();if(o==="_fail_")return{steps:[],fbResult:"failed"};let c,f;try{await this.initSession();let{result:m,assertionToActionData:x,summary:C,thought:S}=await this.iterate();if(c=m,f=C,m==="switch_to_fallback_action"){await this.checksumPage.createChecksumStep({title:`Attempting to recover using additional actions: ${S}`}),this.fallbackAnalytics.arFallbackIterationResponse({duration:0,command:"switch_to_fallback_action",thought:"Switch to action fallback"}),this.fallbackAnalytics.setFallbackType("recovery");let{result:$,summary:W}=await this.switchToActionFallback(x);c=$,f=W}if(c==="failed"||c==="hard_assertion")return this.fallbackAnalytics.arFallbackEnd({result:c,avgDuration:0,failMessage:this.errorMessage}),this.log("[AIFallback] AIFallback Failed"),{steps:[],fbResult:c,thought:S};let I=Date.now()-a,M=this.iterationSteps.length>0?I/this.iterationSteps.length:0;this.fallbackAnalytics.arFallbackEnd({result:c,avgDuration:M,failMessage:this.errorMessage});let B=0;if(!f){let $=Date.now();f=await this.createARSummary(),B=Date.now()-$}return this.fallbackAnalytics.arFallbackSummary({result:c,duration:B,fallbackType:this.fallbackType,summary:f}),this.addAutoHealErrorToReport(n,o,f),this.fallbackData.type==="action"&&this.markActionStepAsFailed(this.fallbackData),{steps:this.executedSteps.map($=>{switch($.type){case"action":return this.translateExecutedActionToFallbackAction($);case"assertion":return $}}),summary:f,fbResult:c,thought:S}}catch(m){if(this.errorMessage=m.message,this.withChecksumAI&&m.message==="fetch failed")throw m;return this.log("[AIFallback] Error",m),{steps:[],fbResult:"failed"}}}async markActionStepAsFailed(n){try{let a=n.step._testInfo._steps.find(o=>o.stepId===n.step._stepId);a&&(a.error={message:n.error.message,stack:n.error.stack,cause:void 0})}catch(a){this.log("[AIFallback] Error marking action step as failed",a)}}addAutoHealErrorToReport(n,a,o){this.withChecksumAI||(this.checksumPage.addPwAnnotation({type:`"${a}" auto-recovered`,description:o.replace(/^"(.*)"$/,"$1")}),this.checksumPage.addErrorMessage(n.error,`"${a}" auto-recovered:
1786
1786
  ${this.executedSteps.map(c=>{switch(c.type){case"action":return c.thought;case"assertion":return c.feedback}}).join(`,
1787
1787
  `)}`))}async getReductionComponents(n){var a,o;return n.interruptionEvent==="didRequestMoreItemsEvent"?{reducedHTML:(o=(a=n.payload)==null?void 0:a.promptData)==null?void 0:o.reducedHTML,reducedDomHTMLElement:this.lastReducedDOM,flashingHTML:[],elementsForNodeInterpretation:[],currentChecksumId:Q_e.currentChecksumId}:this.pageInteractor.getCurrentReducedHTML({stopFlashingElementsDetection:!0,assignChecksumIdsToAllElements:!0,initialChecksumId:Q_e.currentChecksumId})}getErrorFileContent(n){try{let a=xRr.default.dirname(this.fallbackData.testInfo.config.configFile);return oNn(n,a)}catch{throw new Error("Error while getting error file content for AI fallback")}}async getPageScreenshot(){try{return this.checksumPage.wrapInternalSteps(async()=>{var c,f;let n=await this.page.screenshot({fullPage:!0,type:((f=(c=this.arConfig)==null?void 0:c.modelPreset)==null?void 0:f.type)==="anthropic-vertexai"?"jpeg":"png"}),a=4e3;return(await(0,zNn.default)(n).resize(a,a,{fit:"inside",withoutEnlargement:!0}).toBuffer()).toString("base64")})}catch{return}}getMatcherResultFileData(){let n=this.fallbackData.error.matcherResult;if((n==null?void 0:n.name)!=="toHaveScreenshot")return;let a=e((m,x=!0)=>{if(!m)return"";try{return(0,R0t.readFileSync)(m,x?"base64":"utf-8")}catch{return""}},"readFileSafe"),o=a(n==null?void 0:n.actual),c=a(n==null?void 0:n.diff),f=a(n==null?void 0:n.expected);if(!f)throw this.log("[AIFallback] No expected file found for 'toHaveScreenshot'"),new Error("No expected file found for 'toHaveScreenshot'");return{...n,actual:o,diff:c,expected:f}}async prepareDataForCurrentIteration(){let n=await this.getPreviousActionOverview(),a=this.getMatcherResultFileData(),{reducedHTML:o,flashingHTML:c,elementsForNodeInterpretation:f,currentChecksumId:m}=await this.getReductionComponents(n),x=await this.getPageScreenshot();this.lastReducedDOM=new JNn.JSDOM(o),Q_e.currentChecksumId=m;let C=(()=>{let S=this.executedSteps[this.executedSteps.length-1];if(S&&S.type==="action")return S.locator})();return{reducedHTML:o,flashingHTML:c,elementsForNodeInterpretation:f,previousActionOverview:n,screenshot:x,matcherResult:a,fallbackActionErrorMessage:this.fallbackData.error.message,locatorUsed:C}}async iterate(){this.hasPreviousActionFailed=!1;let n=this.CLIENT_MAX_ITERATIONS;for(;n-- >0;){if(this.didCancel)return this.fallbackAnalytics.arFallbackEnd({result:"failed",avgDuration:0,failMessage:"User canceled"}),{result:"failed",thought:"Fallback Canceled"};let a=await this.prepareDataForCurrentIteration(),o=Date.now(),c=await this.getIterationResponse(a),f=Date.now()-o,{thought:m,command:x,changedVariables:C}=c;if(this.traceAIFallbackIterationNew({thought:m,command:x,duration:f}),this.handleChangedVariables(C),this.fallbackData.type==="assertion"){let M=c.payload;if(x==="scroll"){await this.scrollToElement(M.checksumId);continue}return this.handleAssertionResponse(M)}let S=c.payload;if(this.didCancel)return this.fallbackAnalytics.arFallbackEnd({result:"failed",avgDuration:0,failMessage:"User canceled"}),{result:"failed",thought:"Fallback Canceled"};let k=this.getStopIterationResult(x);if(k)return{result:k.result,summary:S.summary??void 0,thought:m};let I=Date.now();try{let M=await this.pageInteractor.translateActionResponseToAgentPotentialAction(S);await this.executeFallbackAction(S,M),this.trackActionExecution(S,M,Date.now()-I)}catch(M){this.log("[AIFallback] Error while executing selector",M.message),this.hasPreviousActionFailed=!0,this.trackActionExecutionFailure(S,Date.now()-I,M.message);continue}}return this.errorMessage="maximum repetition reached",this.log(`[AIFallback] ${this.errorMessage}`),{result:"failed",thought:"Fallback failed to recover action"}}trackActionExecution(n,a,o){this.fallbackAnalytics.arFallbackActionExecution({thought:n.thought,duration:o,command:n.action.type,checksumId:n.action.checksumid,type:n.action.type,selector:a.selector,locator:a.locator,fillValue:a.fillValue,getMoreItemsId:a.getMoreItemsId})}trackActionExecutionFailure(n,a,o){this.fallbackAnalytics.arFallbackActionExecutionFailure({thought:n.thought,duration:a,command:n.action.type,checksumId:n.action.checksumid,error:o})}getStopIterationResult(n){if(n==="fail")return this.log("[AIFallback] Received fail signal, will quit"),this.errorMessage="Received fail signal",{result:"failed"};if(n==="finish")return this.log("[AIFallback] Received finish step"),{result:"finish"}}handleAssertionResponse(n){if(this.log(`[AIFallback] for assertion returned with value: ${n.command}, feedback: ${n.analysis}`),this.didCancel)return{result:"failed",thought:"Fallback Canceled"};let a=n.command,o=["irrelevant","pass","soft_reject","soft_pass","soft_assertion"].includes(n.command);this.fallbackAnalytics.arFallbackAssertion({duration:0,command:n.command,thought:n.thought}),this.executedSteps.push({type:"assertion",feedback:n.analysis,response:n.command});let c={response:n.command,feedback:n.analysis};if(this.stepsPayload.push(c),n.command==="recovery"){let m={description:n.analysis,reason:n.thought};return{result:"switch_to_fallback_action",assertionToActionData:m,summary:n.summary,thought:n.thought}}return n.command==="hard_assertion"?{result:"hard_assertion",thought:n.thought}:{result:o?"soft_assertion":"failed",summary:n.summary,thought:n.thought}}async scrollToElement(n){if(!n){this.log("[AIFallback] No checksumId provided for scroll");return}await this.pageInteractor.scrollElementIntoViewByChecksumId(n),await WE(1e3)}async executeFallbackAction(n,a){let o=Date.now();try{await this.checksumPage.step(`AI: ${a.thought}`,async()=>{await this.pageInteractor.performAction(a)},void 0,{noLocation:!0})}catch(c){let f=Date.now()-o;throw this.fallbackAnalytics.arFallbackActionExecutionFailure({thought:a.thought,command:n.action.type,duration:f,checksumId:n.action.checksumid,error:c.message}),this.fallbackData.error=c,new Error("Action failed")}this.hasPreviousActionFailed=!1,this.executedSteps.push({type:"action",...a}),this.fallbackAnalytics.arFallbackActionExecution({thought:n.thought,duration:Date.now()-o,command:n.action.type,checksumId:n.action.checksumid,type:n.action.type,selector:a.selector,locator:a.locator,fillValue:a.fillValue,getMoreItemsId:a.getMoreItemsId}),this.addActionStepPayload(n,a),await WE(1e3)}addActionStepPayload(n,a){let{thought:o,action:{checksumid:c,type:f}}=n,{selector:m,locator:x,fillValue:C,getMoreItemsId:S}=a,k={thought:o,checksumid:c,type:f,selector:m,locator:x,fillValue:C,getMoreItemsId:S};return this.stepsPayload.push(k),k}handleMockServer(){return this.finish?{thought:"finish",command:"finish",payload:{thought:"finish"},changedVariables:[]}:(--this.actionsCounter===0&&(this.finish=!0),{thought:"mock-thought",changedVariables:[],command:"click",payload:{thought:"mock-thought",action:{type:"click",checksumid:"10"}}})}handleChangedVariables(n){n.forEach(({name:a,value:o})=>{this.checksumPage.variableStore.setVariable(a,o)})}async getIterationResponse({reducedHTML:n,flashingHTML:a,elementsForNodeInterpretation:o,previousActionOverview:c,screenshot:f,codeTrace:m,fallbackActionErrorMessage:x,locatorUsed:C}){let{apiKey:S}=this;if(this.mockServer)return this.handleMockServer();let k={reduction:{reducedHTML:n,flashingHTML:a,elementsForNodeInterpretation:o},currentURL:this.page.url(),previousActionOverview:c,resolvesSmartAssertion:this.withChecksumAI,variables:this.variables,screenshot:f,fallbackActionErrorMessage:x,locatorUsed:C};try{let I=await DJe(async()=>await fetch(`${this.getAPIBaseURL()}/iterate`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:this.apiKey},body:JSON.stringify({appName:S,sessionId:this.sessionId,iterationData:k})}));if(I.status!==201)throw new Error("Failed to get next iteration");let M=await I.json();return this.log("[AIFallback] Received next action",M),this.sanitizeIterationResponse(M)}catch(I){throw this.log("[AIFallback] Error calling iterate",I),I}}sanitizeIterationResponse(n){var a;return this.fallbackType==="assertion"?{thought:n.thought,command:n.command,payload:n,changedVariables:n.changedVariables??[]}:{thought:n.thought,command:(a=n.action)==null?void 0:a.type,payload:n,changedVariables:n.changedVariables??[]}}async getPreviousActionOverview(){let n=await this.pageInteractor.handleFileChooserEvent();return{success:!this.hasPreviousActionFailed,...this.hasPreviousActionFailed?{failureEvent:"generalExecutionFailureError"}:{},...this.getPreviousWaitActionOverview(),...n,...await this.getPreviousGetMoreItemsActionOverview()}}getExecutedActions(){return this.executedSteps.filter(n=>n.type==="action")}async getPreviousGetMoreItemsActionOverview(){let n=this.getExecutedActions(),a=n[n.length-1];if((a==null?void 0:a.eventCode)!=="get_more_items"||!this.lastReducedDOM)return{};try{return await this.pageInteractor.addMoreItemsToDom(this.lastReducedDOM.window.document.body,a.getMoreItemsId),{interruptionEvent:"didRequestMoreItemsEvent",payload:{promptData:{reducedHTML:this.lastReducedDOM.serialize()},getMoreItemsId:a.getMoreItemsId}}}catch{return{}}}getPreviousWaitActionOverview(){var o;let n=this.getExecutedActions();if(((o=n[n.length-1])==null?void 0:o.eventCode)!=="wait")return{};let a=0;return n.slice().reverse().every(c=>c.eventCode==="wait"?(a++,!0):!1,0),{payload:{waitCount:a}}}async initSession(){let{apiKey:n,goal:a,thoughts:o}=this;if(this.log("[AIFallback] Calling init session...",{appName:n,goal:a,thoughts:o}),!n){let x="Missing Checksum API key, will not run AI fallback";throw Vkr(x),new Error(x)}if(this.mockServer){this.sessionId="mock-session-id";return}let c=this.getErrorFileContent(this.fallbackData.error),f={name:this.fallbackData.error.name??"Error",message:this.fallbackData.error.message,stack:this.fallbackData.error.stack},m={type:this.fallbackData.type,resolveSmartAssertion:this.withChecksumAI,storyTitle:a,testSuiteId:this.testSuiteId,testId:this.testId,thoughtsAndActions:{previous:o.slice(0,Math.max(o.length-1,0)).map(x=>({thought:x})),failing:{thought:o[o.length-1]},next:[]},testFileName:this.testFile.split("/").pop()??"",error:f,errorFileContent:c,matcherResult:this.getMatcherResultFileData(),assertionToActionData:this.fallbackData.type==="recovery"||this.fallbackData.type==="action"?this.fallbackData.assertionToActionData:void 0,arMode:this.arMode,overrideOptions:this.arOverrideOptions};this.fallbackAnalytics.arFallbackStart({error:this.fallbackData.error.message,failedThought:this.getFailedThought()});try{let x=await DJe(async()=>await fetch(`${this.getAPIBaseURL()}/init`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:this.apiKey},body:JSON.stringify({appName:n,data:m,format:"json"})}));if(x.status!==201)throw new Error("Failed to init session after 3 retries");let{sessionId:C,arConfig:S}=await x.json();this.sessionId=C,this.arConfig=S,this.fallbackAnalytics.updateToSessionId(C),this.fallbackAnalytics.arFallbackConfig({config:S}),this.log("[AIFallback] Session ID",this.sessionId)}catch(x){throw this.withChecksumAI&&x.message==="fetch failed"&&(this.checksumPage.step(B0t,async()=>{throw new Error(B0t)}),Vkr(B0t)),this.fallbackAnalytics.arFallbackEnd({result:"failed",avgDuration:this.iterationSteps.length>0?this.iterationSteps.reduce((C,S)=>C+S.duration,0)/this.iterationSteps.length:0,failMessage:x==null?void 0:x.message}),this.log("[AIFallback] Error calling init session",x),x}}getReleaseIterationResultIfExists(n){if(this.fallbackType==="assertion"){if(n==="soft_assertion")return{result:"soft_assertion"}}else{if(n==="finish")return{result:"finish"};if(n==="fail")return{result:"failed"}}}translateExecutedActionToFallbackAction(n){return{type:"action",esraMetadata:n.esraMetadata,generatedLocator:n.locator,selector:n.selector,parentFramesSelectors:n.parentFramesSelectors,method:this.getMethodForPotentialAction(n),thought:n.thought}}getMethodForPotentialAction(n){return{name:this.actionEventCodeToMethodName[n.eventCode],args:e(()=>{switch(n.eventCode){case"click":case"double_click":return[{position:n.clickOffset}];case"drag_and_drop":return[this.pageInteractor.makeLocator(n.dropTarget.selector,n.dropTarget.parentFramesSelectors)];case"input":case"click_and_type":case"clear_and_type":case"selectoption":case"keystroke":case"navigation":return[this.pageInteractor.getActionFillValue(n,!1)];case"upload_files":return n.files;default:return}},"makeArgs")()}}getAPIBaseURL(){return this.API_BASE_DOMAIN+this.API_BASE_ROUTE}getAnalyticsPayload(){return{fallbackType:"ai",error:this.errorMessage,thought:this.getFailedThought(),sessionId:this.sessionId,steps:this.stepsPayload.map(n=>JSON.stringify(n))}}getFailedThought(){return this.thoughts[this.thoughts.length-1]}traceAIFallbackIterationNew(n){this.fallbackAnalytics.arFallbackIterationResponse({duration:n.duration,command:n.command,thought:n.thought}),this.iterationSteps.push({thought:n.thought,command:n.command,duration:n.duration})}toString(){return`Checksum AI ("${this.getFailedThought()}")`}get fallbackType(){return this.fallbackData.type}get fallbackAnalyticsPayload(){return{previousThoughts:this.thoughts,iterationSteps:this.iterationSteps}}};e(Q_e,"AIFallback"),Q_e.alreadyTriggered=!1,Q_e.currentChecksumId="0";var ARr=Q_e;var ERr=class ERr extends LIe{constructor(){super(...arguments);this.API_BASE_ROUTE="/client-api/runtime/esra-fallback"}init(n){let{apiKey:a,testId:o,apiURL:c,checksumId:f,fileName:m,timeout:x}=n;return this.data={...this.data,testId:o,checksumId:f,fileName:m},this.apiKey=a,c&&(this.API_BASE_DOMAIN=c.replace(/\/$/,"")),x&&(this.timeout=x),this.checksumRootFolder=process.env.CHECKSUM_ROOT_FOLDER??k7n(I7n(this.data.fileName),this.data.fileName),this}getRecoveryAttemptTitle(n){return`Checksum auto-heal: trying to locate the element using checksumSelector("${this.data.checksumId}")...`}async sendLog(n){let a=this.getLogPayload(n);try{fetch(`${this.getAPIBaseURL()}/log`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:this.apiKey},body:JSON.stringify(a)}).catch(o=>this.log("[ESRAFallback] Error sending log"))}catch(o){this.log("[ESRAFallback] Error sending log",o)}}getLogPayload(n){let a=process.env.CHECKSUM_TEST_SUITE_ID??"",{selector:o}=n,{checksumId:c,testId:f}=this.data;return this.logPayload={testSuiteId:a,testId:f,selector:o,checksumId:c,thought:this.thought},this.logPayload}async getMetadataForTestId(){return D7n(this.checksumRootFolder,this.data.testId)}getAPIBaseURL(){return this.API_BASE_DOMAIN+this.API_BASE_ROUTE}};e(ERr,"MetadataBaseFallback");var IJe=ERr;var _AlternateSelectorFallback=class _AlternateSelectorFallback extends IJe{constructor(){super(...arguments);this.timeout=5*1e3}init(t){return super.init(t),this}async resolve(params){var t;try{let{method,args}=params,{checksumId}=this.data,alternateLocators=[];try{let n=await this.getMetadataForTestId();if(!(checksumId in n)||!n[checksumId].alternateLocators)throw new Error(`No alternate selection metadata found for id ${checksumId}`);alternateLocators=n[checksumId].alternateLocators.locators}catch(n){throw super.log(`Could not read alternate selector metadata file, ${n.message}`),n}try{this.log("Resolving alternate selectors locators");let elementsMap=new Map;await Promise.all(alternateLocators.map(async locatorExpression=>{let locator=eval(cj(locatorExpression,"this.page"));try{await T8(locator.first().waitFor({bypassChecksum:!0}),5e3),(await T8(locator.elementHandles({bypassChecksum:!0}),1e3)).forEach(a=>{elementsMap.has(a)?elementsMap.set(a,elementsMap.get(a)+1):elementsMap.set(a,1)})}catch(n){return}}));let majorityElementHandle=(t=Array.from(elementsMap.entries()))==null?void 0:t.reduce((n,a)=>n[1]>a[1]?n:a)[0];if(!majorityElementHandle)throw this.errorMessage="No alternate element found",new Error(this.errorMessage);let totalElements=Array.from(elementsMap.values()).reduce((n,a)=>n+a,0),elementSelector=await this.evaluateWithChecksum(async({element:n})=>window.playwright.selector(n),{element:majorityElementHandle});this.log(`Resolved alternate selector: ${elementSelector}' With majority vote of ${elementsMap.get(majorityElementHandle)} out of ${totalElements} elements`),await this.checksumPage.wrapNoLocationSteps(async()=>this.execute(this.page.locator(elementSelector),method,args));let fallbackResult={selector:elementSelector,generatedLocator:`locator("${elementSelector}")`,esraMetadata:void 0};return this.sendLog(fallbackResult),this.logPayload=this.logPayload.concat({mejorityVote:`${elementsMap.get(majorityElementHandle)}/${totalElements}`}),this.checksumPage.addErrorMessage(params.error,`${this.thought?`"${this.thought}" auto-recovered`:"Auto-recovered"} using alternative selector "${elementSelector}"`),{steps:[{type:"action",...fallbackResult}]}}catch(n){throw new Error(`Failed to execute compound selection fallback action: ${n.message}`)}}catch(n){this.errorMessage=n.message,this.log(this.errorMessage);return}}getAnalyticsPayload(){return{fallbackType:"alternative-selector",...this.logPayload??{checksumId:this.data.checksumId,error:this.errorMessage}}}toString(){return`Checksum alternative selector (${this.data.checksumId})`}};e(_AlternateSelectorFallback,"AlternateSelectorFallback");var CRr=_AlternateSelectorFallback;var cca=require("@playwright/test");var lca=Ad(WRt());var GNn=Ad(require("path"));var WNn=!1,SRr=class SRr{constructor(t,n,a){this.frame=t;this.base=n;this.getAnalytics=a;this.LOCATORS_TIMEOUT=WNn?9999999:5e3;this.HANDLES_TIMEOUT=WNn?9999999:5e3;this.HANDLES_INTERVAL=300;this.locatorsChain=[];this.base||(this.base=this.frame)}setBase(t){this.base=t}setAnalytics(t){this.getAnalytics=t}init(...t){return this.sanitizeArgs(...t),new Proxy(this,{get:e((n,a)=>a==="setBase"?function(...o){this.setBase(o[0])}.bind(this):a==="setAnalytics"?function(...o){this.setAnalytics(o[0])}.bind(this):this.handleLocatorChain(n,a),"get")})}getLocatorSelector(t){if(t)return t._selector}sanitizeArgs(...t){if(t.length===1&&typeof t[0]=="object"){if(!t[0].anchors||typeof t[0].anchors!="function")throw new Error("Invalid compound selector format. Object must contain anchors property with a method value");this.anchorLocatorMethod=t[0].anchors,this.targetLocatorMethod=t[0].target;return}if(typeof t[0]!="function")throw new Error("Invalid compound selector format. First argument must be an object or a function");if(this.anchorLocatorMethod=t[0],t.length===2){if(typeof t[1]!="function")throw new Error("Invalid compound selector format. Second argument must be a function");this.targetLocatorMethod=t[1]}}async resolveLocator(){if(this.resolvedLocator)return this.resolvedLocator;d7("Waiting for locators..");let t=this.getLocatorsFromMethods();if(t.find(m=>!("_selector"in m)))throw new Error("Can't resolve at least one locator, make sure anchors and target are valid locators or strings");try{await Promise.all(t.map(async m=>T8(m.first().waitFor({bypassChecksum:!0}),this.LOCATORS_TIMEOUT,"Waiting for compound selector locators timeout")))}catch(m){throw new Error(`Error while waiting for locators - ${m.message}`)}let n=await T8(this.getElementHandles(t),this.HANDLES_TIMEOUT);d7(`Resolved to ${wRr(n)} elements from ${t.length} locators`);let a=this.getLocatorSelector(this.getLocatorsFromMethods(!1,!0,this.frame)[0]),o=await this.frame.evaluate(async({handles:m,targetSelector:x})=>window.checksum.testGenerator.getCompoundSelector().select(m,x),{handles:n,targetSelector:a});if(!o||o.length===0)throw new Error("Could not generate selectors from handles");d7(`Resolved compound selector to ${o.length} selectors`);let c=this.getBase(),f=c.locator(o[0]);return o.slice(1,50).forEach(m=>{f=f.or(c.locator(m))}),this.locatorsChain.length&&this.locatorsChain.forEach(({name:m,args:x})=>{f=f[m](...x)}),d7(`Compound locator selector: ${this.getLocatorSelector(f)}`),this.resolvedLocator=f,f}handleLocatorChain(t,n){if(typeof n=="symbol")return;if(n==="constructor")return e(function(...f){return this[n](...f)},"Locator");if(n==="toString")return()=>this.toString();let a=e(()=>new Proxy(t,{get:e((c,f)=>c.handleLocatorChain(c,f),"get")}),"createLocatorProxy");return n==="valueOf"?e(function(){return a()},"Locator"):n==="then"?(c,f)=>{this.resolveLocator().then(m=>c(m)).catch(f)}:Object.values([...Object.values(F_e),...Object.values(HVe)]).includes(n)?e(function(...f){return t.locatorsChain.push({name:n,args:f}),a()},"Locator"):e(async function(...f){return this.handleAction(n,f)},"Locator").bind(this)}async handleAction(t,n){var a,o;try{if(typeof t=="symbol")return;if(!this.anchorLocatorMethod)throw new Error("Compound selection is missing anchor locators");let c=await this.resolveLocator();return this.frame.executeLocatorAction?await this.frame.executeLocatorAction(c,t,n):await c[t](...n)}catch(c){throw d7(`Failed to execute compound selection action: ${c}`),(o=(a=this.getAnalytics)==null?void 0:a.call(this))==null||o.compoundSelectionFailure({error:c.toString(),selector:this.toString()}),c}}async getElementHandles(t){d7("Resolving compound selector elements");let n,a,o,c,f,m=e(()=>{f=2},"resetSameHandlesCount");do n=a,a=[],await Promise.all(t.map(async x=>{let C=await x.elementHandles({bypassChecksum:!0});if(C.length===0)throw new Error(`No elements found for locator: ${this.getLocatorSelector(x)}`);a.push(C)})),o=wRr(a),c=n?wRr(n):0,d7(`Handles itteration, previous: ${n?c:"-"}, current: ${o}`),c!==o&&m(),await WE(this.HANDLES_INTERVAL);while(!n||c!==o||--f>0);return a}getLocatorsFromMethods(t=!0,n=!0,a=this.getBase()){return(t?this.anchorLocatorMethod(a):[]).concat(n&&this.targetLocatorMethod?[this.targetLocatorMethod(a)]:[]).map(o=>typeof o=="string"?a.getByText(o):o)}getBase(){return this.base}toString(){var t;return`CompoundSelection(${this.resolvedLocator?this.getLocatorSelector(this.resolvedLocator):`${this.anchorLocatorMethod.toString()}, ${(t=this.targetLocatorMethod)==null?void 0:t.toString()})`})`}};e(SRr,"CompoundSelectorLocator");var PJe=SRr,wRr=e(i=>i.reduce((t,n)=>t+n.length,0),"countHandleElements");var DRr=require("path");var HNn=require("fs");var pca=!0,TRr=class TRr{constructor(t){this.options=t;this.navigatingFrames={};this.trackedFramesGuid=[];this.frameNavigationPromises={};this.onFrameNavigated=e(async t=>{let n=F9(t);if(this.trackedFramesGuid.includes(n))return this.frameNavigationPromises[n]=new Promise(async a=>{await this.loadScript(t),a()}),this.frameNavigationPromises[n]},"onFrameNavigated");this.loadScript=e(async(t,{retriesLeft:n=3,retryWaitMS:a=2e3,useWrapper:o=!0}={})=>{var x,C;if(o&&this.scriptLoadWrapper)return this.scriptLoadWrapper(()=>this.loadScript(t,{retriesLeft:n,retryWaitMS:a,useWrapper:!1}),t);if(!this.addScriptTagOptions){this.log.warn("[InjectedScriptManager] addScriptTagOptions not set, skipping loadScript");return}if(this.isFrameClosed(t))return;let c=!1;try{c=this.scriptLoadCheck?await((x=this.scriptLoadCheck)==null?void 0:x.call(this,t)):!1}catch{}if(c||this.isFrameClosed(t))return;this.options.scriptAddWait&&(this.log.log(`Waiting ${this.options.scriptAddWait}[ms] before adding script...`),await WE(this.options.scriptAddWait),this.log.log("Done waiting before adding script"));try{await t.addScriptTag(await this.makeInjectedScriptOptionsForAddScriptTag())}catch(S){if(n>0)return this.log.warn(`[InjectedScriptManager] Failed to add script to frame ${F9(t)}, trying again in ${a/1e3} seconds, ${n-1} retries left.`,S.message),await WE(a),this.loadScript(t,{retriesLeft:n-1,retryWaitMS:a,useWrapper:o});throw S}let f=F9(t),m=Date.now().toString(36)+Math.random().toString(36).substr(2);if(this.navigatingFrames[f]=m,this.options.scriptInitWait&&(this.log.log(`Waiting ${this.options.scriptInitWait}[ms] before onScriptLoad...`),await WE(this.options.scriptInitWait),this.log.log("Done waiting before onScriptLoad")),!this.isFrameClosed(t)){if(this.navigatingFrames[f]&&this.navigatingFrames[f]!==m)return this.log.log("Page navigated again, waiting on new promise..."),this.frameNavigationPromises[f];try{await((C=this.scriptLoadCallback)==null?void 0:C.call(this,t))}catch(S){this.log.error("[WebDriver] onScriptLoad error",S)}}},"loadScript");this.log=new Proxy(console,{get:e((t,n)=>(...a)=>{if(!this.options.silenceLogs)return t[n].apply(t,a)},"get")});this.addScriptTagOptions=this.makeFrameInjectedScriptOptions()}setScriptLoadCallback(t){return this.scriptLoadCallback=t,this}setScriptLoadCheck(t){return this.scriptLoadCheck=t,this}setScriptLoadWrapper(t){return this.scriptLoadWrapper=t,this}async addTrackedFrame(t,n=!0){let a="mainFrame"in t?t.mainFrame():t,o=F9(a);if(this.trackedFramesGuid.includes(o)||this.trackedFramesGuid.push(o),n)return this.onFrameNavigated(a)}getNavigationPromise(t){if(!t){this.log.warn("[InjectedScriptManager] getNavigationPromise called with undefined argument");return}let n=typeof t=="string"?t:"mainFrame"in t?F9(t.mainFrame()):F9(t);return this.frameNavigationPromises[n]}makeFrameInjectedScriptOptions(){switch(this.options.scriptSource){case"file":return this.options.scriptFile?{path:this.options.isScriptFileAbsolute?this.options.scriptFile:(0,DRr.join)(process.cwd(),this.options.scriptFile)}:void 0;case"url":return this.options.scriptURL?{url:this.options.scriptURL}:void 0;default:return}}async makeInjectedScriptOptionsForAddScriptTag(){if(this.options.scriptSource==="url"&&this.addScriptTagOptions.url&&pca){let n=await(await fetch(this.addScriptTagOptions.url)).text(),a=(0,DRr.join)(process.cwd(),"checksumlib.js");return(0,HNn.writeFileSync)(a,n),{path:a}}return this.addScriptTagOptions}isFrameClosed(t){return t.isDetached()||t.page().isClosed()}};e(TRr,"InjectedScriptManager");var FJe=TRr;var FRr=class FRr{constructor(t){this.options=t}async handleError(t,n,a){let o=`Error in ${n} action during ${t} execution: ${a.message}`;throw new Error(o)}async guardedExecute(){try{return await(this.options.timeout!=null?T8(this.execute(),this.options.timeout,"Execution timeout"):this.execute())}catch(t){return this.handleError(this.options.method,this.constructor.name,t)}}};e(FRr,"Action");var YUt=FRr,NRr=class NRr extends YUt{async execute(){return this.options.method in this.options.locator?this.options.locator[this.options.method](...this.options.args):this.options.locator}};e(NRr,"PlaywrightAction");var kRr=NRr,ORr=class ORr extends YUt{constructor(n,a){super(n);this.pageInteractor=a}};e(ORr,"APIAction");var IRr=ORr,BRr=class BRr extends IRr{constructor(t,n){super(t,n.pageInteractor)}async execute(){try{let{locator:t,args:n}=this.options,[a,o]=n,c=await t.screenshot({timeout:3e4}),m=(await this.pageInteractor.getTextDetection(c)).getRectangleByTextAndSizeRanking(a,o);if(!m)throw new Error("No matching text found");await t.click({position:m.center})}catch(t){throw new Error(`Error in canvas click action: ${t.message}`)}}};e(BRr,"CanvasClickAction");var PRr=BRr,ZUt=class ZUt{static createAction(t,n){return t.method in this.customActionMap?new this.customActionMap[t.method]({...t,timeout:15e3},n):new kRr(t)}};e(ZUt,"ActionFactory"),ZUt.customActionMap={canvasClick:PRr};var XUt=ZUt;var tqt=class tqt{constructor(t,n,a,o,c,f,m){this.frame=t;this.checksumPage=n;this.isReplMode=a;this.config=o;this.injectedScriptManager=c;this.getPageInteractor=f;this.onExecutionError=m;this.locatorStack=[];this.setFrameProxy(),this.checksumClient=new xJe({apiURL:this.config.apiURL,apiKey:this.config.apiKey})}static init(t,n,a,o,c,f,m=!1){return new tqt(t,n,m,f,a,o,c).proxy}setFrameProxy(){this.proxy=new Proxy(this,{get:e(function(n,a){return n.handleFrameMethod(a)},"get")})}handleFrameMethod(t){if(typeof t!="symbol")return typeof this[t]=="function"?t==="constructor"?this[t]:this[t].bind(this):[...Object.values(F_e),...Object.values(HVe)].includes(t)?(this.pushToLocatorStack([{type:t,base:this.frame}]),e(function(a,o){try{return this.executeLocator(a,o)}catch(c){throw this.popLocatorChain(),c}},"Locator").bind(this)):this.frame[t]}page(){return this.checksumPage}compoundSelection(...t){var n;try{let a=this.locatorStack.length?(n=this.getCurrentLocatorInChain())==null?void 0:n.base:this.proxy;return new PJe(this.proxy,a).init(...t)}catch{throw new Error("Failed generating compound selector")}}async wrapInternalSteps(t,n=this.frame){try{return n._checksumInternal=!0,await t()}finally{n._checksumInternal=!1}}get navigationPromise(){return this.injectedScriptManager.getNavigationPromise(this.frame)}pushToLocatorStack(t){this.locatorStack.push(t)}getCurrentLocatorChain(){return this.locatorStack.length||this.locatorStack.push([]),this.locatorStack[this.locatorStack.length-1]}popLocatorChain(){return this.locatorStack.pop()}getCurrentLocatorInChain(){let t=this.getCurrentLocatorChain();return t==null?void 0:t[t.length-1]}getLocator(t,n){let a=this.getCurrentLocatorInChain();return a.base[a.type](t,n)}executeLocator(t,n){try{d7(`
1788
- Executing locator ${this.getCurrentLocatorInChain().type} with ${typeof t=="string"?`selector ${t}`:"locator"}`);try{t&&typeof t=="object"&&"has"in t&&this.popLocatorChain()}catch{}let a=this.getLocator(t,n);return new Proxy(a,{get:e((o,c)=>this.getLocatorMethod(a,o,c),"get")})}catch(a){d7("Failed to locate",a)}}getLocatorMethod(t,n,a){return a==="then"?this.handleThen(t,n,a):a==="catch"?this.handleCatch(t,n):a==="finally"?this.handleFinally(t,n):a==="constructor"?e(function(...c){return this.popLocatorChain(),n.constructor(...c)},"Locator"):a in n&&typeof n[a]!="function"||a===Symbol.toPrimitive||a in Object?(this.popLocatorChain(),n[a]):a==="compoundSelection"?function(...o){let c=this.compoundSelection(...o);return c.setBase(t),c}.bind(this):[...Object.values(F_e),...Object.values(HVe)].includes(a)?["or","and"].includes(a)?(d7("'Or' and 'And' locator are not supported, will execute normally"),this.popLocatorChain(),n[a]):(this.getCurrentLocatorChain().push({type:a,base:t}),e(function(...c){return this.executeLocator(c[0],c[1])},"Locator").bind(this)):a==="page"?()=>(this.popLocatorChain(),this.proxy.page()):e(async function(...c){let f=await this.executeLocatorAction(t,a,c);return this.popLocatorChain(),f},"Locator").bind(this)}async executeLocatorAction(t,n,a){if(a&&Array.from(a).some(m=>(m==null?void 0:m.bypassChecksum)===!0))return t[n](...a);let o=t._selector;d7("Executing",n,o);let c=n==="_expect"?"assertion":"action";c==="action"&&this.lastLocatorActionType==="action"&&(d7("Adding minimal wait between consecutive actions..."),await new Promise(m=>setTimeout(m,100))),this.lastLocatorActionType=c,d7("Running initial locator...");let f;try{return this.navigationPromise&&await this.navigationPromise,await this.wrapInternalSteps(async()=>{try{d7("[executeLocatorAction] waitForFunction"),await this.frame.waitForFunction(()=>!!window.checksum,{timeout:5e3})}catch{d7("[executeLocatorAction] checksum libs not loaded")}}),await XUt.createAction({locator:t,method:n,args:a,timeout:this.getLocatorActionTimeout(c,n,a)},{api:this.checksumClient,pageInteractor:this.getPageInteractor()}).guardedExecute();f=new Error("Locator action error")}catch(m){d7("Failed initial execution. Exception:",m.message),f=m}if(c==="action"&&this.onExecutionError)return this.onExecutionError({error:f,locator:t,method:n,args:a},this.frame);throw f}setExpectConfiguration(t=void 0){this.expectConfiguration=t}getLocatorActionTimeout(t,n,a=[]){var o;if(this.isReplMode)return null;try{if(t==="assertion"){let m=this.getAssertionTimeout(a);return d7(`Assertion timeout set to ${m}`),m}let c=["fill","dragTo"].includes(n)?1:0,f=(o=a[c])==null?void 0:o.timeout;return isNaN(f)?3e4:f}catch{return 3e4}}getAssertionTimeout(t=[]){var o,c,f,m,x;let n=(o=t[1])==null?void 0:o.timeout;if(n!==void 0)return n;if(((c=this.expectConfiguration)==null?void 0:c.timeout)!==void 0)return(f=this.expectConfiguration)==null?void 0:f.timeout;let a=(x=(m=this.testInfo._projectInternal)==null?void 0:m.expect)==null?void 0:x.timeout;return a!==void 0?a:3e4}handleThen(t,n,a){return(o,c)=>Promise.resolve(t).then(f=>{let m=o?o(f):f;return m instanceof Promise?m:this.getLocatorMethod(m,n,a)},f=>{if(c)return c(f);throw f})}handleCatch(t,n){return a=>Promise.resolve(t).catch(o=>{if(a)return a(o);throw o})}handleFinally(t,n){return a=>Promise.resolve(t).finally(a)}};e(tqt,"ChecksumFrame");var eqt=tqt;var rqt=class rqt{constructor(t,n,a,o,c){this.page=t;this.config=n;this.getPageInteractor=a;this.injectedScriptManager=o;this._frames={};this.isVTG=!!process.env.CHECKSUM_VTG_TEST_FILE_RUN_CONFIG;var f,m;this.setPageProxy(),this.injectedScriptManager||(this.injectedScriptManager=new FJe({scriptFile:jh.checksumScript.path,scriptSource:jh.checksumScript.source,scriptURL:jh.checksumScript.url,isScriptFileAbsolute:!0,silenceLogs:!jh.isDevMode,scriptInitWait:(f=n==null?void 0:n.options)==null?void 0:f.browserScriptInitWait,scriptAddWait:(m=n==null?void 0:n.options)==null?void 0:m.browserScriptAddWait})),this.registerPageEvents(),this.page.frames().forEach(x=>this.registerFrame(x)),c&&(this.variableStore=c.variableStore)}static makePage(t,n,a){let o=KNn();return new rqt(t,o,()=>n,a).proxy}async registerFrame(t){var o;let n=this.getFrameGuid(t);if(t===this.page.mainFrame()&&(this.mainFrameGuid=n),this._frames[n])return;let a=eqt.init(t,this.proxy,this.injectedScriptManager,this.getPageInteractor,(o=this.onExecutionError)==null?void 0:o.bind(this),this.config);this._frames[n]=a}async onExecutionError(t){throw t.error}getFrameGuid(t){return t._guid}registerPageEvents(){this.page.on("frameattached",async t=>{this.registerFrame(t)})}setPageProxy(){this.proxy=new Proxy(this,{get:e(function(n,a){return n.getPageMethod(a)},"get")})}getPageMethod(t){if(typeof this[t]=="function")return t==="constructor"?this[t]:this[t].bind(this);switch(t){case"pageInteractor":return this.getPageInteractor();case"variableStore":return this.variableStore}return Object.values(F_e).includes(t)?e(function(a,o){try{return this.mainFrame()[t](a,o)}catch(c){throw c}},"Page").bind(this):this.page[t]}mainFrame(){var t;return(t=this._frames)==null?void 0:t[this.mainFrameGuid]}frames(){return Object.values(this._frames)}getFrame(t){if(!this.page.frames().find(a=>this.getFrameGuid(a)===t))throw new Error(`Frame with guid ${t} not found`);return this._frames[t]}async waitForDialog(t){try{return this.getPageInteractor().waitForDialog(!0,t)}catch(n){throw new Error(`Failed to handle native dialog: ${n}`)}}async reauthenticate(t){try{await this.getPageInteractor().reauthenticate(t,this.proxy)}catch(n){throw new Error(`Failed to reauthenticate: ${n}`)}}resolveAssetsFolder(t){return t.map(n=>GNn.join(Qkr(I7e()),n))}compoundSelection(...t){try{return new PJe(this.mainFrame()).init(...t)}catch{throw new Error("Failed generating compound selector")}}get navigationPromise(){return this.injectedScriptManager.getNavigationPromise(this.page)}setExpectConfiguration(t=void 0){this.expectConfiguration=t,Object.values(this._frames).forEach(n=>n.setExpectConfiguration(t))}};e(rqt,"ChecksumPage");var L0t=rqt;var Nfs=1e3*30;var aqt=require("fs");var m4e={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},Lfs={defaultMerge:m4e.defaultMerge};function _ca(i,t){return t}e(_ca,"defaultMetaDataUpdater");function mca(i,t){return i.filter(n=>n!==void 0)}e(mca,"defaultFilterValues");var YNn;(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"})(YNn||(YNn={}));function XNn(i){return typeof i!="object"||i===null?0:Array.isArray(i)?2:yca(i)?1:i instanceof Set?3:i instanceof Map?4:5}e(XNn,"getObjectType");function hca(i){let t=new Set;for(let n of i)for(let a of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(a);return t}e(hca,"getKeys");function gca(i,t){return typeof i=="object"&&Object.prototype.propertyIsEnumerable.call(i,t)}e(gca,"objectHasProperty");function eOn(i){var a;let t=0,n=(a=i[0])==null?void 0:a[Symbol.iterator]();return{[Symbol.iterator](){return{next(){var o;do{if(n===void 0)return{done:!0,value:void 0};let c=n.next();if(c.done===!0){t+=1,n=(o=i[t])==null?void 0:o[Symbol.iterator]();continue}return{done:!1,value:c.value}}while(!0)}}}}}e(eOn,"getIterableOfIterables");var ZNn=["[object Object]","[object Module]"];function yca(i){if(!ZNn.includes(Object.prototype.toString.call(i)))return!1;let{constructor:t}=i;if(t===void 0)return!0;let n=t.prototype;return!(n===null||typeof n!="object"||!ZNn.includes(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}e(yca,"isRecord");function vca(i,t,n){let a={};for(let o of hca(i)){let c=[];for(let x of i)gca(x,o)&&c.push(x[o]);if(c.length===0)continue;let f=t.metaDataUpdater(n,{key:o,parents:i}),m=tOn(c,t,f);m!==m4e.skip&&(o==="__proto__"?Object.defineProperty(a,o,{value:m,configurable:!0,enumerable:!0,writable:!0}):a[o]=m)}return a}e(vca,"mergeRecords$1");function bca(i){return i.flat()}e(bca,"mergeArrays$1");function xca(i){return new Set(eOn(i))}e(xca,"mergeSets$1");function Aca(i){return new Map(eOn(i))}e(Aca,"mergeMaps$1");function Eca(i){return i.at(-1)}e(Eca,"mergeOthers$1");var nqt={mergeRecords:vca,mergeArrays:bca,mergeSets:xca,mergeMaps:Aca,mergeOthers:Eca};function iqt(...i){return Cca({})(...i)}e(iqt,"deepmerge");function Cca(i,t){let n=wca(i,a);function a(...o){return tOn(o,n,t)}return e(a,"customizedDeepmerge"),a}e(Cca,"deepmergeCustom");function wca(i,t){return{defaultMergeFunctions:nqt,mergeFunctions:{...nqt,...Object.fromEntries(Object.entries(i).filter(([n,a])=>Object.hasOwn(nqt,n)).map(([n,a])=>a===!1?[n,nqt.mergeOthers]:[n,a]))},metaDataUpdater:i.metaDataUpdater??_ca,deepmerge:t,useImplicitDefaultMerging:i.enableImplicitDefaultMerging??!1,filterValues:i.filterValues===!1?void 0:i.filterValues??mca,actions:m4e}}e(wca,"getUtils");function tOn(i,t,n){var c;let a=((c=t.filterValues)==null?void 0:c.call(t,i,n))??i;if(a.length===0)return;if(a.length===1)return MRr(a,t,n);let o=XNn(a[0]);if(o!==0&&o!==5){for(let f=1;f<a.length;f++)if(XNn(a[f])!==o)return MRr(a,t,n)}switch(o){case 1:return Sca(a,t,n);case 2:return Dca(a,t,n);case 3:return Tca(a,t,n);case 4:return kca(a,t,n);default:return MRr(a,t,n)}}e(tOn,"mergeUnknowns");function Sca(i,t,n){let a=t.mergeFunctions.mergeRecords(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(i,t,n):a}e(Sca,"mergeRecords");function Dca(i,t,n){let a=t.mergeFunctions.mergeArrays(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(i):a}e(Dca,"mergeArrays");function Tca(i,t,n){let a=t.mergeFunctions.mergeSets(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(i):a}e(Tca,"mergeSets");function kca(i,t,n){let a=t.mergeFunctions.mergeMaps(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(i):a}e(kca,"mergeMaps");function MRr(i,t,n){let a=t.mergeFunctions.mergeOthers(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(i):a}e(MRr,"mergeOthers");var Ica=!1;function d7(...i){Ica&&console.log(...i)}e(d7,"log");async function $Nn(i,t,n,a=6e4){if(!(t in i))return i;let o=e(()=>i[t](...n),"executor");return a===null?o():T8(o(),a,"Execution timeout")}e($Nn,"executePlaywrightMethodWithTimeout");function jRr(i,{role:t,environment:n}={},a=!1){var m,x;let o;if(n&&(o=(m=i.environments)==null?void 0:m.find(({name:C})=>n===C)),o||(o=(x=i.environments)==null?void 0:x.find(({default:C})=>C)),!o)throw new Error("Environment not found. Please make sure your environments are properly defined in the checksum.config.ts file.");let c=o.users,f;if(c&&(t!==void 0&&(f=c.find(C=>C.role===t)),f||(f=c.find(C=>C.default))),!f)throw new Error(`User not found. Please make sure the users array for the "${o.name}" environment is properly defined in the checksum.config.ts file.`);if(n&&o.name!==n){if(a)throw new Error(`Could not find environment with name "${n}" in config file`);console.warn(`Could not find environment with name "${n}" in config file, trying to use default environment`)}if(t&&f.role!==t){if(a)throw new Error(`Could not find user with role "${t}" for environment "${n}" in config file`);console.warn(`Could not find user with role "${t}" for environment "${n}" in config file, trying to login with environment's default user`)}return{environment:o,user:f}}e(jRr,"resolveEnvironment");function Pca(i){let t=`${i??I7e()}/login.ts`;if(!(0,aqt.existsSync)(t))throw console.warn(`Could not locate the login.ts file. Please make sure your login file exists at ${t}`),new Error("Could not find login.ts file");try{return require(t).default}catch(n){throw console.warn("Error loading login.ts file",n),n}}e(Pca,"requireLogin");async function Fca(i,t,{environment:n,user:a,config:o}){try{let c=e(()=>t(i,{environment:n,user:a,config:o}),"performLogin");"checksumAI"in i?await i.checksumAI(`Log in${a!=null&&a.role?` using ${a.role} role`:""}${n!=null&&n.name?` in ${n.name} environment`:""}`,c):await c()}catch(c){throw console.warn(`The login method threw an exception, please check the login.ts file for the following error:
1788
+ Executing locator ${this.getCurrentLocatorInChain().type} with ${typeof t=="string"?`selector ${t}`:"locator"}`);try{t&&typeof t=="object"&&"has"in t&&this.popLocatorChain()}catch{}let a=this.getLocator(t,n);return new Proxy(a,{get:e((o,c)=>this.getLocatorMethod(a,o,c),"get")})}catch(a){d7("Failed to locate",a)}}getLocatorMethod(t,n,a){return a==="then"?this.handleThen(t,n,a):a==="catch"?this.handleCatch(t,n):a==="finally"?this.handleFinally(t,n):a==="constructor"?e(function(...c){return this.popLocatorChain(),n.constructor(...c)},"Locator"):a in n&&typeof n[a]!="function"||a===Symbol.toPrimitive||a in Object||a==="evaluate"?(this.popLocatorChain(),n[a]):a==="compoundSelection"?function(...o){let c=this.compoundSelection(...o);return c.setBase(t),c}.bind(this):[...Object.values(F_e),...Object.values(HVe)].includes(a)?["or","and"].includes(a)?(d7("'Or' and 'And' locator are not supported, will execute normally"),this.popLocatorChain(),n[a]):(this.getCurrentLocatorChain().push({type:a,base:t}),e(function(...c){return this.executeLocator(c[0],c[1])},"Locator").bind(this)):a==="page"?()=>(this.popLocatorChain(),this.proxy.page()):e(async function(...c){let f=await this.executeLocatorAction(t,a,c);return this.popLocatorChain(),f},"Locator").bind(this)}async executeLocatorAction(t,n,a){if(a&&Array.from(a).some(m=>(m==null?void 0:m.bypassChecksum)===!0))return t[n](...a);let o=t._selector;d7("Executing",n,o);let c=n==="_expect"?"assertion":"action";c==="action"&&this.lastLocatorActionType==="action"&&(d7("Adding minimal wait between consecutive actions..."),await new Promise(m=>setTimeout(m,100))),this.lastLocatorActionType=c,d7("Running initial locator...");let f;try{return this.navigationPromise&&await this.navigationPromise,await this.wrapInternalSteps(async()=>{try{d7("[executeLocatorAction] waitForFunction"),await this.frame.waitForFunction(()=>!!window.checksum,{timeout:5e3})}catch{d7("[executeLocatorAction] checksum libs not loaded")}}),await XUt.createAction({locator:t,method:n,args:a,timeout:this.getLocatorActionTimeout(c,n,a)},{api:this.checksumClient,pageInteractor:this.getPageInteractor()}).guardedExecute();f=new Error("Locator action error")}catch(m){d7("Failed initial execution. Exception:",m.message),f=m}if(c==="action"&&this.onExecutionError)return this.onExecutionError({error:f,locator:t,method:n,args:a},this.frame);throw f}setExpectConfiguration(t=void 0){this.expectConfiguration=t}getLocatorActionTimeout(t,n,a=[]){var o;if(this.isReplMode)return null;try{if(t==="assertion"){let m=this.getAssertionTimeout(a);return d7(`Assertion timeout set to ${m}`),m}let c=["fill","dragTo"].includes(n)?1:0,f=(o=a[c])==null?void 0:o.timeout;return isNaN(f)?3e4:f}catch{return 3e4}}getAssertionTimeout(t=[]){var o,c,f,m,x;let n=(o=t[1])==null?void 0:o.timeout;if(n!==void 0)return n;if(((c=this.expectConfiguration)==null?void 0:c.timeout)!==void 0)return(f=this.expectConfiguration)==null?void 0:f.timeout;let a=(x=(m=this.testInfo._projectInternal)==null?void 0:m.expect)==null?void 0:x.timeout;return a!==void 0?a:3e4}handleThen(t,n,a){return(o,c)=>Promise.resolve(t).then(f=>{let m=o?o(f):f;return m instanceof Promise?m:this.getLocatorMethod(m,n,a)},f=>{if(c)return c(f);throw f})}handleCatch(t,n){return a=>Promise.resolve(t).catch(o=>{if(a)return a(o);throw o})}handleFinally(t,n){return a=>Promise.resolve(t).finally(a)}};e(tqt,"ChecksumFrame");var eqt=tqt;var rqt=class rqt{constructor(t,n,a,o,c){this.page=t;this.config=n;this.getPageInteractor=a;this.injectedScriptManager=o;this._frames={};this.isVTG=!!process.env.CHECKSUM_VTG_TEST_FILE_RUN_CONFIG;var f,m;this.setPageProxy(),this.injectedScriptManager||(this.injectedScriptManager=new FJe({scriptFile:jh.checksumScript.path,scriptSource:jh.checksumScript.source,scriptURL:jh.checksumScript.url,isScriptFileAbsolute:!0,silenceLogs:!jh.isDevMode,scriptInitWait:(f=n==null?void 0:n.options)==null?void 0:f.browserScriptInitWait,scriptAddWait:(m=n==null?void 0:n.options)==null?void 0:m.browserScriptAddWait})),this.registerPageEvents(),this.page.frames().forEach(x=>this.registerFrame(x)),c&&(this.variableStore=c.variableStore)}static makePage(t,n,a){let o=KNn();return new rqt(t,o,()=>n,a).proxy}async registerFrame(t){var o;let n=this.getFrameGuid(t);if(t===this.page.mainFrame()&&(this.mainFrameGuid=n),this._frames[n])return;let a=eqt.init(t,this.proxy,this.injectedScriptManager,this.getPageInteractor,(o=this.onExecutionError)==null?void 0:o.bind(this),this.config);this._frames[n]=a}async onExecutionError(t){throw t.error}getFrameGuid(t){return t._guid}registerPageEvents(){this.page.on("frameattached",async t=>{this.registerFrame(t)})}setPageProxy(){this.proxy=new Proxy(this,{get:e(function(n,a){return n.getPageMethod(a)},"get")})}getPageMethod(t){if(typeof this[t]=="function")return t==="constructor"?this[t]:this[t].bind(this);switch(t){case"pageInteractor":return this.getPageInteractor();case"variableStore":return this.variableStore}return Object.values(F_e).includes(t)?e(function(a,o){try{return this.mainFrame()[t](a,o)}catch(c){throw c}},"Page").bind(this):this.page[t]}mainFrame(){var t;return(t=this._frames)==null?void 0:t[this.mainFrameGuid]}frames(){return Object.values(this._frames)}getFrame(t){if(!this.page.frames().find(a=>this.getFrameGuid(a)===t))throw new Error(`Frame with guid ${t} not found`);return this._frames[t]}async waitForDialog(t){try{return this.getPageInteractor().waitForDialog(!0,t)}catch(n){throw new Error(`Failed to handle native dialog: ${n}`)}}async reauthenticate(t){try{await this.getPageInteractor().reauthenticate(t,this.proxy)}catch(n){throw new Error(`Failed to reauthenticate: ${n}`)}}resolveAssetsFolder(t){return t.map(n=>GNn.join(Qkr(I7e()),n))}compoundSelection(...t){try{return new PJe(this.mainFrame()).init(...t)}catch{throw new Error("Failed generating compound selector")}}get navigationPromise(){return this.injectedScriptManager.getNavigationPromise(this.page)}setExpectConfiguration(t=void 0){this.expectConfiguration=t,Object.values(this._frames).forEach(n=>n.setExpectConfiguration(t))}};e(rqt,"ChecksumPage");var L0t=rqt;var Nfs=1e3*30;var aqt=require("fs");var m4e={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},Lfs={defaultMerge:m4e.defaultMerge};function _ca(i,t){return t}e(_ca,"defaultMetaDataUpdater");function mca(i,t){return i.filter(n=>n!==void 0)}e(mca,"defaultFilterValues");var YNn;(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"})(YNn||(YNn={}));function XNn(i){return typeof i!="object"||i===null?0:Array.isArray(i)?2:yca(i)?1:i instanceof Set?3:i instanceof Map?4:5}e(XNn,"getObjectType");function hca(i){let t=new Set;for(let n of i)for(let a of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(a);return t}e(hca,"getKeys");function gca(i,t){return typeof i=="object"&&Object.prototype.propertyIsEnumerable.call(i,t)}e(gca,"objectHasProperty");function eOn(i){var a;let t=0,n=(a=i[0])==null?void 0:a[Symbol.iterator]();return{[Symbol.iterator](){return{next(){var o;do{if(n===void 0)return{done:!0,value:void 0};let c=n.next();if(c.done===!0){t+=1,n=(o=i[t])==null?void 0:o[Symbol.iterator]();continue}return{done:!1,value:c.value}}while(!0)}}}}}e(eOn,"getIterableOfIterables");var ZNn=["[object Object]","[object Module]"];function yca(i){if(!ZNn.includes(Object.prototype.toString.call(i)))return!1;let{constructor:t}=i;if(t===void 0)return!0;let n=t.prototype;return!(n===null||typeof n!="object"||!ZNn.includes(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}e(yca,"isRecord");function vca(i,t,n){let a={};for(let o of hca(i)){let c=[];for(let x of i)gca(x,o)&&c.push(x[o]);if(c.length===0)continue;let f=t.metaDataUpdater(n,{key:o,parents:i}),m=tOn(c,t,f);m!==m4e.skip&&(o==="__proto__"?Object.defineProperty(a,o,{value:m,configurable:!0,enumerable:!0,writable:!0}):a[o]=m)}return a}e(vca,"mergeRecords$1");function bca(i){return i.flat()}e(bca,"mergeArrays$1");function xca(i){return new Set(eOn(i))}e(xca,"mergeSets$1");function Aca(i){return new Map(eOn(i))}e(Aca,"mergeMaps$1");function Eca(i){return i.at(-1)}e(Eca,"mergeOthers$1");var nqt={mergeRecords:vca,mergeArrays:bca,mergeSets:xca,mergeMaps:Aca,mergeOthers:Eca};function iqt(...i){return Cca({})(...i)}e(iqt,"deepmerge");function Cca(i,t){let n=wca(i,a);function a(...o){return tOn(o,n,t)}return e(a,"customizedDeepmerge"),a}e(Cca,"deepmergeCustom");function wca(i,t){return{defaultMergeFunctions:nqt,mergeFunctions:{...nqt,...Object.fromEntries(Object.entries(i).filter(([n,a])=>Object.hasOwn(nqt,n)).map(([n,a])=>a===!1?[n,nqt.mergeOthers]:[n,a]))},metaDataUpdater:i.metaDataUpdater??_ca,deepmerge:t,useImplicitDefaultMerging:i.enableImplicitDefaultMerging??!1,filterValues:i.filterValues===!1?void 0:i.filterValues??mca,actions:m4e}}e(wca,"getUtils");function tOn(i,t,n){var c;let a=((c=t.filterValues)==null?void 0:c.call(t,i,n))??i;if(a.length===0)return;if(a.length===1)return MRr(a,t,n);let o=XNn(a[0]);if(o!==0&&o!==5){for(let f=1;f<a.length;f++)if(XNn(a[f])!==o)return MRr(a,t,n)}switch(o){case 1:return Sca(a,t,n);case 2:return Dca(a,t,n);case 3:return Tca(a,t,n);case 4:return kca(a,t,n);default:return MRr(a,t,n)}}e(tOn,"mergeUnknowns");function Sca(i,t,n){let a=t.mergeFunctions.mergeRecords(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(i,t,n):a}e(Sca,"mergeRecords");function Dca(i,t,n){let a=t.mergeFunctions.mergeArrays(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(i):a}e(Dca,"mergeArrays");function Tca(i,t,n){let a=t.mergeFunctions.mergeSets(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(i):a}e(Tca,"mergeSets");function kca(i,t,n){let a=t.mergeFunctions.mergeMaps(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(i):a}e(kca,"mergeMaps");function MRr(i,t,n){let a=t.mergeFunctions.mergeOthers(i,t,n);return a===m4e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(i):a}e(MRr,"mergeOthers");var Ica=!1;function d7(...i){Ica&&console.log(...i)}e(d7,"log");async function $Nn(i,t,n,a=6e4){if(!(t in i))return i;let o=e(()=>i[t](...n),"executor");return a===null?o():T8(o(),a,"Execution timeout")}e($Nn,"executePlaywrightMethodWithTimeout");function jRr(i,{role:t,environment:n}={},a=!1){var m,x;let o;if(n&&(o=(m=i.environments)==null?void 0:m.find(({name:C})=>n===C)),o||(o=(x=i.environments)==null?void 0:x.find(({default:C})=>C)),!o)throw new Error("Environment not found. Please make sure your environments are properly defined in the checksum.config.ts file.");let c=o.users,f;if(c&&(t!==void 0&&(f=c.find(C=>C.role===t)),f||(f=c.find(C=>C.default))),!f)throw new Error(`User not found. Please make sure the users array for the "${o.name}" environment is properly defined in the checksum.config.ts file.`);if(n&&o.name!==n){if(a)throw new Error(`Could not find environment with name "${n}" in config file`);console.warn(`Could not find environment with name "${n}" in config file, trying to use default environment`)}if(t&&f.role!==t){if(a)throw new Error(`Could not find user with role "${t}" for environment "${n}" in config file`);console.warn(`Could not find user with role "${t}" for environment "${n}" in config file, trying to login with environment's default user`)}return{environment:o,user:f}}e(jRr,"resolveEnvironment");function Pca(i){let t=`${i??I7e()}/login.ts`;if(!(0,aqt.existsSync)(t))throw console.warn(`Could not locate the login.ts file. Please make sure your login file exists at ${t}`),new Error("Could not find login.ts file");try{return require(t).default}catch(n){throw console.warn("Error loading login.ts file",n),n}}e(Pca,"requireLogin");async function Fca(i,t,{environment:n,user:a,config:o}){try{let c=e(()=>t(i,{environment:n,user:a,config:o}),"performLogin");"checksumAI"in i?await i.checksumAI(`Log in${a!=null&&a.role?` using ${a.role} role`:""}${n!=null&&n.name?` in ${n.name} environment`:""}`,c):await c()}catch(c){throw console.warn(`The login method threw an exception, please check the login.ts file for the following error:
1789
1789
  `,c),c}}e(Fca,"proceedWithLogin");function RRr(i){let{config:t,folder:n,throwIfAuthFailed:a}=i,o=Pca(n);return async(c,{role:f,environment:m}={})=>{let{environment:x,user:C}=jRr(t,{role:f,environment:m},i.throwIfEnvInfoInvalid);if(a&&!C)throw new Error("Could not find user credentials matching the provided role and/or environment");await Fca(c,o,{environment:x,user:C,config:t})}}e(RRr,"makeUnboundLogin");var NJe;function KNn(){if(NJe)return NJe;try{let i=(0,aqt.existsSync)(`${I7e()}/checksum.config.ts`)?"checksum.config.ts":(0,aqt.existsSync)(`${I7e()}/checksum.config.tmp.ts`)?"checksum.config.tmp.ts":void 0;if(i)return rOn(require(`${I7e()}/${i}`).default)}catch{console.warn("Could not find checksum config file, will run with defaults")}return rOn()}e(KNn,"loadChecksumConfig");function rOn(i={}){var n,a,o,c;let t={apiKey:void 0,runMode:"normal",apiURL:"https://api.checksum.ai",options:{useChecksumSelectors:!0,useChecksumAI:{actions:!0,assertions:!1},newAssertionsEnabled:!0,useMockData:!1,printLogs:!1,hideReports:process.env.AUTHORIZE_REPORTS==="true"}};return((a=(n=i.options)==null?void 0:n.useChecksumAI)==null?void 0:a.visualComparison)===void 0&&((c=(o=i.options)==null?void 0:o.useChecksumAI)!=null&&c.assertions)&&(i.options.useChecksumAI.visualComparison=!0),NJe=iqt(t,i),jh.testRun.disableAutoRecovery&&(NJe.options.useChecksumAI={actions:!1,assertions:!1,visualComparison:!1}),jh.testRun.disableHostReports&&(NJe.options.hostReports=!1),NJe}e(rOn,"getChecksumConfig");function LRr(i){let t=e(n=>{n.on("dialog",a=>{})},"makeDialogHandler");i.context().pages().forEach(t),i.context().on("page",n=>{t(n)})}e(LRr,"preventDialogAutoDismissal");var B0t="Checksum failed connecting to the server";var nOn=".chk";var URr=class URr{constructor(t,n=!1,a){this.args=t;this.debugMode=n;this.checksumAppUrl="https://app.checksum.ai";this.childProcesses=[];this.printError=e(t=>{console.log("\x1B[31m%s\x1B[0m",t,"\x1B[0m")},"printError");this.processConfigArg(),["exit","SIGINT","SIGTERM","uncaughtException"].forEach(o=>{process.on(o,()=>{this.cleanup(),process.exit()})}),this.checksumRuntimeVersion=this.getChecksumRuntimeVersion(),a!=null&&a.skipChecksumDataLoad||this.loadChecksumData(a)}getChecksumRuntimeVersion(){if(this.checksumRuntimeVersion)return this.checksumRuntimeVersion;try{let t=jh.isRepoMode?(0,OR.join)(jh.runtimeRoot,"package","package.json"):"./package.json";return require(t).version}catch{return"unknown"}}getInternalFilesDirPath(){return(0,OR.join)(this.checksumRoot,nOn)}createInternalFilesDir(){let t=this.getInternalFilesDirPath();if((0,ZP.existsSync)(t)){d7("Internal files directory already exists at",t);return}(0,ZP.mkdirSync)(t,{recursive:!0}),d7("Internal files directory created at",t)}loadTracer(){this.runtimeAnalytics=Wjt.getInstance({version:this.checksumRuntimeVersion},this.debugMode)}async execCmd(t,n={}){let a={...process.env,...n},o=await oqt.spawn(t,{env:a,shell:!0,stdio:"inherit"});return this.childProcesses.push(o),new Promise((f,m)=>{o.on("exit",x=>{x===0?f(!0):m(new Error(`Checksum failed execution with code: ${x} `)),this.childProcesses=this.childProcesses.filter(C=>C!==o)})})}async getCmdOutput(t){return new Promise(function(n,a){oqt.exec(t,(o,c,f)=>{if(o){a(`Error executing command: ${o.message}`);return}n(c.trim())})})}validateAuthExists(){this.checksumRoot||this.findChecksumRoot();let t=(0,OR.join)(this.checksumRoot,".auth");(0,ZP.existsSync)(t)||(0,ZP.writeFileSync)(t,"{}")}loadChecksumData(t={}){this.locateChecksumLibs(),this.loadChecksumConfig(t)}async patchPlaywright(t=!1){d7("Patching playwright",t);let n=(0,OR.join)(__dirname,"./scripts/patch.js");(0,ZP.existsSync)(n)||(n=(0,OR.join)(__dirname,"../../../scripts/src/patch_playwright.js"));let a=`node "${n}"${t?" off":""}`;try{await this.execCmd(a,{PROJECT_ROOT:this.projectRootDirectory,RUNTIME:"true"})}catch(o){console.log("Error patching playwright",o.message)}}async promptKillActivePlaywrightProcesses(){try{let t;try{t=await this.getCmdOutput('ps aux | grep "playwright test" | grep -v grep')}catch{return}if(!t)return;let n=t.split(`
1790
1790
  `).map(o=>{let[c,f]=o.split(/\s+/);return f}).filter(o=>o&&!isNaN(Number(o)));if(n.length===0)return;let a=await v9r({message:"Existing playwright processes detected. Do you want to kill them?",choices:[{name:"Yes (kill them all\u{1F918})",value:"all"},{name:"No",value:"no"},...n.map(o=>({name:o,value:o}))]});if(a==="no")return;a==="all"?n.forEach(o=>{this.execCmd(`kill -9 ${o}`)}):this.execCmd(`kill -9 ${a}`)}catch(t){console.log("Error detecting playwright processes",t)}}getPlaywrightConfigFilePath(){return(0,OR.join)(this.checksumRoot,"playwright.config.ts")}buildVolatileChecksumConfig(){if(!this.volatileChecksumConfig)return;let t=this.getVolatileConfigPath(),n=`
1791
1791
  import { RunMode, getChecksumConfig } from "@checksum-ai/runtime";