shiplightai 0.1.74 → 0.1.76
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/dist/cjs/debugger-manager.cjs +5 -5
- package/dist/cjs/debugger-pw.cjs +49 -49
- package/dist/cjs/fixture.cjs +97 -97
- package/dist/cjs/index.cjs +4 -4
- package/dist/cjs/reporter.cjs +3 -3
- package/dist/cli.js +75 -75
- package/dist/debugger-manager.d.ts +5 -0
- package/dist/debugger-manager.js +8 -8
- package/dist/debugger-pw.js +48 -48
- package/dist/fixture.d.ts +71 -1
- package/dist/fixture.js +97 -97
- package/dist/index.js +4 -4
- package/dist/reporter.js +3 -3
- package/dist/static-embedded/assets/{index-CoKedfWS.js → index-Dk5ihq1Y.js} +2 -2
- package/dist/static-embedded/assets/{index-BEW7CdFm.js → index-Mg0a6DkO.js} +50 -4
- package/dist/static-embedded/index.html +1 -1
- package/package.json +4 -4
package/dist/reporter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as x from"fs";import*as w from"path";import{v4 as At}from"uuid";import{z as s}from"zod";var ee=s.enum(["JS_CODE","AI_MODE"]),z=s.object({type:ee,expression:s.string()}),te=s.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),F=s.object({uid:s.string(),type:te,comment:s.string().optional()}),re=s.object({action_data:s.object({action_name:s.string(),kwargs:s.record(s.any()).optional(),args:s.array(s.any()).optional()}),action_description:s.string().optional(),url:s.string().optional(),xpath:s.string().nullable().optional(),locator:s.string().nullable().optional(),css_selector:s.string().nullable().optional(),unique_selector:s.string().nullable().optional(),element_index:s.number().nullable().optional(),frame_path:s.array(s.any()).optional(),artifacts:s.record(s.any()).optional(),feedback:s.string().optional(),original_browser_use_action:s.any().optional()}).passthrough(),ie=F.extend({type:s.literal("DRAFT"),description:s.string()}),ne=F.extend({type:s.literal("ACTION"),description:s.string(),action_entity:re.optional(),locator:s.string().optional(),use_pure_vision:s.boolean().optional()}),E=s.lazy(()=>s.union([ie,ne,F.extend({type:s.literal("STEP"),description:s.string().optional().default(""),statements:s.array(E),reference_id:s.number().optional(),template_path:s.string().optional(),template_params:s.record(s.string()).optional()}),F.extend({type:s.literal("IF_ELSE"),description:s.string().optional(),condition:z,then:s.array(E),else:s.array(E).optional()}),F.extend({type:s.literal("WHILE_LOOP"),description:s.string().optional(),condition:z,body:s.array(E),timeout_ms:s.number().optional()})])),oe=s.object({name:s.string(),statements:s.array(E),teardown:s.array(E).optional(),skip:s.union([s.boolean(),s.string()]).optional(),timeout:s.number().optional(),fail:s.union([s.boolean(),s.string()]).optional(),only:s.boolean().optional(),slow:s.boolean().optional()}),H=s.object({tests:s.array(oe).min(1),beforeAll:s.array(E).optional(),afterAll:s.array(E).optional(),beforeEach:s.array(E).optional(),afterEach:s.array(E).optional()}),J=s.object({comment:s.string().optional(),version:s.string().optional(),goal:s.string().optional(),url:s.string().optional(),baseURL:s.string().optional(),final_feedback:s.string().optional(),completed:s.boolean().optional(),success:s.boolean().optional(),statements:s.array(E).optional(),teardown:s.array(E).optional(),last_modified_at:s.string().optional(),testGroup:H.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"});import{stringify as It,parse as Oe,parseAllDocuments as Lt,parseDocument as Ie,Document as Nt,isMap as U,isSeq as W}from"yaml";import{v4 as P}from"uuid";function Y(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Y);let t=e,r=Object.keys(t);if(r.length===1){let n=r[0];if(n.startsWith("{ ")&&n.endsWith(" }")&&t[n]===null)return`{{${n.slice(2,-2)}}}`}let i={};for(let[n,a]of Object.entries(t))i[n]=Y(a);return i}var ae=1024*1024;function L(e){if(e.length>ae)throw new Error(`YAML input too large (${e.length} bytes, max ${ae})`);let t=Y(Oe(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Le(t);let r={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:M(t.statements??[])};t.final_feedback&&(r.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(r.teardown=M(t.teardown));let i=J.safeParse(r);if(!i.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(i.error.errors)}`);let n=i.data;return le(e,n),n}function Le(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let r=t.tests;if(!Array.isArray(r)||r.length===0)throw new Error('Suite must have a non-empty "tests" array');let n={tests:r.map(p=>{if(!p.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(p.statements)||p.statements.length===0)throw new Error(`Suite test "${p.name}" must have a non-empty "statements" array`);let h={name:p.name,statements:M(p.statements)};return Array.isArray(p.teardown)&&p.teardown.length>0&&(h.teardown=M(p.teardown)),p.skip!==void 0&&(h.skip=p.skip),typeof p.timeout=="number"&&(h.timeout=p.timeout),p.fail!==void 0&&(h.fail=p.fail),p.only===!0&&(h.only=!0),p.slow===!0&&(h.slow=!0),h})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(n.beforeAll=M(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(n.afterAll=M(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(n.beforeEach=M(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(n.afterEach=M(t.afterEach));let a=H.safeParse(n);if(!a.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(a.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:a.data}}function M(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Ne)}function Ne(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use an object with a "desc" key instead. Example: { "desc": "${e}" }`);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected object, got ${typeof e}`);let t=e;if("IF"in t)return Ce(t);if("WHILE"in t)return De(t);if("STEP"in t)return Fe(t);if("VERIFY"in t){let r=t.VERIFY,i={statement:typeof r=="string"?r:String(r)};return typeof t.js=="string"&&(i.code=t.js),{uid:P(),type:"ACTION",description:String(r),action_entity:{action_description:String(r),action_data:{action_name:"verify",kwargs:i}}}}if("URL"in t){let r=t.URL,i=t.new_tab===!0?!0:void 0,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,a={url:typeof r=="string"?r:String(r)};return i&&(a.new_tab=!0),n!==void 0&&(a.timeout_seconds=n),{uid:P(),type:"ACTION",description:`Navigate to ${r}`,action_entity:{action_description:`Navigate to ${r}`,action_data:{action_name:"go_to_url",kwargs:a}}}}if("WAIT_UNTIL"in t){let r=t.WAIT_UNTIL,i=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:P(),type:"ACTION",description:`Wait until: ${r}`,action_entity:{action_description:`Wait until: ${r}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof r=="string"?r:String(r),timeout_seconds:i}}}}}if("WAIT"in t){let r=t.WAIT,i=typeof t.seconds=="number"?t.seconds:3;return{uid:P(),type:"ACTION",description:typeof r=="string"?r:`Wait ${i}s`,action_entity:{action_description:typeof r=="string"?r:`Wait ${i}s`,action_data:{action_name:"wait",kwargs:{seconds:i}}}}}if("CODE"in t){let r=t.CODE;if(r==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');let i=typeof t.description=="string"?t.description:"Code block";return{uid:P(),type:"ACTION",description:i,action_entity:{action_description:i,action_data:{action_name:"js_code",kwargs:{code:typeof r=="string"?r:String(r)}}}}}if("js"in t&&!("VERIFY"in t)&&!("action"in t)){if("intent"in t||"desc"in t)throw new Error("A `js:` statement uses `description:`, not `intent:`. Raw JS does not self-heal \u2014 use `description: + js:` for code, or express it as a structured action (`intent:` + `action:`/`locator:`) to keep self-healing.");let r=typeof t.description=="string"&&t.description.trim()!==""?t.description:"Code block",i=t.js;return{uid:P(),type:"ACTION",description:r,action_entity:{action_description:r,action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:r,...i}=t;return se({...i,action:"function",functionName:r})}if("action"in t)return se(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:P(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function ce(e){if(typeof e!="string")throw new Error(`Condition must be a string, got ${typeof e}`);return e.startsWith("js:")?{type:"JS_CODE",expression:e.slice(3)}:{type:"AI_MODE",expression:e}}function Ce(e){let t=ce(e.IF),r=e.THEN;if(!Array.isArray(r))throw new Error("IF_ELSE requires a THEN array");let i={uid:P(),type:"IF_ELSE",condition:t,then:M(r)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(i.else=M(e.ELSE)),i}function De(e){let t=ce(e.WHILE),r=e.DO;if(!Array.isArray(r))throw new Error("WHILE_LOOP requires a DO array");let i={uid:P(),type:"WHILE_LOOP",condition:t,body:M(r)};return typeof e.timeout_ms=="number"&&(i.timeout_ms=e.timeout_ms),i}function Fe(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let r={uid:P(),type:"STEP",description:t,statements:M(e.statements)};if(typeof e.reference_id=="number"&&(r.reference_id=e.reference_id),typeof e.template_path=="string"&&(r.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let i=e.template_params,n={};for(let[a,o]of Object.entries(i))n[a]=String(o);r.template_params=n}return r}var We=new Set(["action","intent","desc","locator","xpath","use_pure_vision"]);function se(e){let t=typeof e.action=="string"?e.action:String(e.action),r=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",i=typeof e.locator=="string"?e.locator:void 0,n=typeof e.xpath=="string"?e.xpath:void 0,a=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,o={};for(let[l,g]of Object.entries(e))We.has(l)||(o[l]=g);t==="verify"&&typeof o.js=="string"&&(o.code=o.js,delete o.js),(t==="ai_action"||t==="ai_step")&&o.statement===void 0&&(o.statement=r);let p={action_description:r,action_data:{action_name:t,kwargs:Object.keys(o).length>0?o:{}}};i&&(p.locator=i),n&&(p.xpath=n);let h={uid:P(),type:"ACTION",description:r,action_entity:p};return a&&(h.use_pure_vision=!0),h}function le(e,t){let r;try{r=Ie(e)}catch{return}let i=r.contents;if(!i||!U(i))return;if(r.commentBefore)t.comment=r.commentBefore;else{let h=i.items?.[0];h?.key&&h.key.commentBefore&&(t.comment=h.key.commentBefore)}let n=i,a=n.get("statements",!0);W(a)&&t.statements&&B(a,t.statements);let o=n.get("teardown",!0);W(o)&&t.teardown&&B(o,t.teardown)}function B(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let r=0;r<Math.min(e.items.length,t.length);r++){let i=e.items[r];i.commentBefore&&!(r===0&&e.commentBefore)&&(t[r].comment=i.commentBefore);let n=t[r];if(n.type==="STEP"&&U(i)){let a=i.get("statements",!0);W(a)&&B(a,n.statements)}else if(n.type==="IF_ELSE"&&U(i)){let a=i.get("THEN",!0);W(a)&&B(a,n.then);let o=i.get("ELSE",!0);W(o)&&n.else&&B(o,n.else)}else if(n.type==="WHILE_LOOP"&&U(i)){let a=i.get("DO",!0);W(a)&&B(a,n.body)}}}import{parse as Bt,stringify as Rt}from"yaml";var N=(e,t,r)=>{e.forEach((i,n)=>{let a=`${t}.${n}`;i.type==="DRAFT"?r[a]={description:i.description||"Draft",action_entity:void 0}:i.type==="ACTION"?r[a]={description:i.description||"Action",action_entity:i.action_entity,locator:i.locator}:i.type==="STEP"&&i.statements?N(i.statements,a,r):i.type==="IF_ELSE"?(r[a]={description:"IF "+(i.condition?.expression||""),action_entity:void 0},i.then&&N(i.then,`${a}.then`,r),i.else&&N(i.else,`${a}.else`,r)):i.type==="WHILE_LOOP"&&(r[a]={description:"WHILE "+(i.condition?.expression||""),action_entity:void 0},i.body&&N(i.body,`${a}.body`,r))})};function K(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return N(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&N(e.teardown,"teardown",t),t}var pe=112;var Ge=1080-pe;var ue={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}};var de={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},G=(e,t=!1)=>{let r=["chromium"];return t&&r.push("webkit"),de[e].map(i=>ue[i]).filter(i=>i.defaultBrowserType&&r.includes(i.defaultBrowserType))};var He={desktop:{label:"Desktop",type:"desktop",devices:G("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:G("mobile")}},Ue={desktop:{label:"Desktop",type:"desktop",devices:G("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:G("mobile",!0)}};var C=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(C||{});import{stringify as un}from"yaml";import{createHash as Xe}from"crypto";import{parse as qe,stringify as be}from"yaml";import{readFileSync as Ze,existsSync as Qe}from"fs";import{resolve as X,dirname as et}from"path";import{parse as fe,stringify as tt}from"yaml";var ge=5e3;function Je(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Ye(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function ye(e){let t=Je(e),r=e.locator;if(typeof r=="string"&&r.trim())return r=r.trim(),r.endsWith("first()")?`${t}.${r}`:`${t}.${r}.first()`;let i=Ye(e);if(i){let n=JSON.stringify(i);return`${t}.locator(${n}).first()`}return null}var $=new Map;function f(e,t){$.set(e,t)}function D(e,t,r=[]){let i=[...r];return t.locator?i.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&i.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(t.frame_path)}`),i.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...i.map(n=>` ${n},`),"});"]}f("click",e=>{let t=ye(e);if(!t)return['await agent.execAction("click", page, {});'];let r=e.action_data?.kwargs?.timeout_ms??ge;return[`await ${t}.click({ timeout: ${r} });`]});f("click_element",$.get("click"));f("click_element_by_index",$.get("click"));f("double_click",e=>D("double_click",e));f("double_click_on_element",$.get("double_click"));f("right_click",e=>D("right_click",e));f("right_click_on_element",$.get("right_click"));f("hover",e=>D("hover",e));f("hover_element_by_index",$.get("hover"));f("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return D("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("fill",$.get("input_text"));f("clear_input",e=>D("clear_input",e));f("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});f("send_keys",$.get("press"));f("send_keys_on_element",e=>{let t=ye(e),r=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(r)} } },`,"});"];let i=e.action_data?.kwargs?.timeout_ms??ge;return[`await ${t}.press(${JSON.stringify(r)}, { timeout: ${i} });`]});f("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return D("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});f("scroll_down",$.get("scroll"));f("scroll_up",$.get("scroll"));f("scroll_element",$.get("scroll"));f("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});f("scroll_on_element",e=>D("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));f("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});f("open_tab",$.get("go_to_url"));f("go_back",()=>['await agent.execAction("go_back", page, {});']);f("reload_page",()=>['await agent.execAction("reload_page", page, {});']);f("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);f("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);f("verify",(e,t)=>{let r=e.action_data?.kwargs,i=typeof r?.code=="string",n=i?r?.statement||e.action_description:e.action_description||r?.statement;if(i&&n){let o=r.code.split(`
|
|
1
|
+
import*as x from"fs";import*as w from"path";var ee=112;var Ie=1080-ee;var te={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}};var re={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},G=(e,t=!1)=>{let r=["chromium"];return t&&r.push("webkit"),re[e].map(i=>te[i]).filter(i=>i.defaultBrowserType&&r.includes(i.defaultBrowserType))};var Le={desktop:{label:"Desktop",type:"desktop",devices:G("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:G("mobile")}},Ne={desktop:{label:"Desktop",type:"desktop",devices:G("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:G("mobile",!0)}};import{v4 as Ot}from"uuid";import{z as s}from"zod";var ie=s.enum(["JS_CODE","AI_MODE"]),z=s.object({type:ie,expression:s.string()}),ne=s.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),F=s.object({uid:s.string(),type:ne,comment:s.string().optional()}),oe=s.object({action_data:s.object({action_name:s.string(),kwargs:s.record(s.any()).optional(),args:s.array(s.any()).optional()}),action_description:s.string().optional(),url:s.string().optional(),xpath:s.string().nullable().optional(),locator:s.string().nullable().optional(),css_selector:s.string().nullable().optional(),unique_selector:s.string().nullable().optional(),element_index:s.number().nullable().optional(),frame_path:s.array(s.any()).optional(),artifacts:s.record(s.any()).optional(),feedback:s.string().optional(),original_browser_use_action:s.any().optional()}).passthrough(),ae=F.extend({type:s.literal("DRAFT"),description:s.string()}),se=F.extend({type:s.literal("ACTION"),description:s.string(),action_entity:oe.optional(),locator:s.string().optional(),use_pure_vision:s.boolean().optional()}),E=s.lazy(()=>s.union([ae,se,F.extend({type:s.literal("STEP"),description:s.string().optional().default(""),statements:s.array(E),reference_id:s.number().optional(),template_path:s.string().optional(),template_params:s.record(s.string()).optional()}),F.extend({type:s.literal("IF_ELSE"),description:s.string().optional(),condition:z,then:s.array(E),else:s.array(E).optional()}),F.extend({type:s.literal("WHILE_LOOP"),description:s.string().optional(),condition:z,body:s.array(E),timeout_ms:s.number().optional()})])),ce=s.object({name:s.string(),statements:s.array(E),teardown:s.array(E).optional(),skip:s.union([s.boolean(),s.string()]).optional(),timeout:s.number().optional(),fail:s.union([s.boolean(),s.string()]).optional(),only:s.boolean().optional(),slow:s.boolean().optional()}),H=s.object({tests:s.array(ce).min(1),beforeAll:s.array(E).optional(),afterAll:s.array(E).optional(),beforeEach:s.array(E).optional(),afterEach:s.array(E).optional()}),J=s.object({comment:s.string().optional(),version:s.string().optional(),goal:s.string().optional(),url:s.string().optional(),baseURL:s.string().optional(),final_feedback:s.string().optional(),completed:s.boolean().optional(),success:s.boolean().optional(),statements:s.array(E).optional(),teardown:s.array(E).optional(),last_modified_at:s.string().optional(),testGroup:H.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"});import{stringify as Ft,parse as Ce,parseAllDocuments as Wt,parseDocument as De,Document as Bt,isMap as U,isSeq as W}from"yaml";import{v4 as P}from"uuid";function Y(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Y);let t=e,r=Object.keys(t);if(r.length===1){let n=r[0];if(n.startsWith("{ ")&&n.endsWith(" }")&&t[n]===null)return`{{${n.slice(2,-2)}}}`}let i={};for(let[n,a]of Object.entries(t))i[n]=Y(a);return i}var le=1024*1024;function L(e){if(e.length>le)throw new Error(`YAML input too large (${e.length} bytes, max ${le})`);let t=Y(Ce(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Fe(t);let r={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:M(t.statements??[])};t.final_feedback&&(r.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(r.teardown=M(t.teardown));let i=J.safeParse(r);if(!i.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(i.error.errors)}`);let n=i.data;return de(e,n),n}function Fe(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let r=t.tests;if(!Array.isArray(r)||r.length===0)throw new Error('Suite must have a non-empty "tests" array');let n={tests:r.map(p=>{if(!p.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(p.statements)||p.statements.length===0)throw new Error(`Suite test "${p.name}" must have a non-empty "statements" array`);let h={name:p.name,statements:M(p.statements)};return Array.isArray(p.teardown)&&p.teardown.length>0&&(h.teardown=M(p.teardown)),p.skip!==void 0&&(h.skip=p.skip),typeof p.timeout=="number"&&(h.timeout=p.timeout),p.fail!==void 0&&(h.fail=p.fail),p.only===!0&&(h.only=!0),p.slow===!0&&(h.slow=!0),h})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(n.beforeAll=M(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(n.afterAll=M(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(n.beforeEach=M(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(n.afterEach=M(t.afterEach));let a=H.safeParse(n);if(!a.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(a.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:a.data}}function M(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(We)}function We(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use an object with a "desc" key instead. Example: { "desc": "${e}" }`);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected object, got ${typeof e}`);let t=e;if("IF"in t)return Be(t);if("WHILE"in t)return Re(t);if("STEP"in t)return Ge(t);if("VERIFY"in t){let r=t.VERIFY,i={statement:typeof r=="string"?r:String(r)};return typeof t.js=="string"&&(i.code=t.js),{uid:P(),type:"ACTION",description:String(r),action_entity:{action_description:String(r),action_data:{action_name:"verify",kwargs:i}}}}if("URL"in t){let r=t.URL,i=t.new_tab===!0?!0:void 0,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,a={url:typeof r=="string"?r:String(r)};return i&&(a.new_tab=!0),n!==void 0&&(a.timeout_seconds=n),{uid:P(),type:"ACTION",description:`Navigate to ${r}`,action_entity:{action_description:`Navigate to ${r}`,action_data:{action_name:"go_to_url",kwargs:a}}}}if("WAIT_UNTIL"in t){let r=t.WAIT_UNTIL,i=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:P(),type:"ACTION",description:`Wait until: ${r}`,action_entity:{action_description:`Wait until: ${r}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof r=="string"?r:String(r),timeout_seconds:i}}}}}if("WAIT"in t){let r=t.WAIT,i=typeof t.seconds=="number"?t.seconds:3;return{uid:P(),type:"ACTION",description:typeof r=="string"?r:`Wait ${i}s`,action_entity:{action_description:typeof r=="string"?r:`Wait ${i}s`,action_data:{action_name:"wait",kwargs:{seconds:i}}}}}if("CODE"in t){let r=t.CODE;if(r==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');let i=typeof t.description=="string"?t.description:"Code block";return{uid:P(),type:"ACTION",description:i,action_entity:{action_description:i,action_data:{action_name:"js_code",kwargs:{code:typeof r=="string"?r:String(r)}}}}}if("js"in t&&!("VERIFY"in t)&&!("action"in t)){if("intent"in t||"desc"in t)throw new Error("A `js:` statement uses `description:`, not `intent:`. Raw JS does not self-heal \u2014 use `description: + js:` for code, or express it as a structured action (`intent:` + `action:`/`locator:`) to keep self-healing.");let r=typeof t.description=="string"&&t.description.trim()!==""?t.description:"Code block",i=t.js;return{uid:P(),type:"ACTION",description:r,action_entity:{action_description:r,action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:r,...i}=t;return pe({...i,action:"function",functionName:r})}if("action"in t)return pe(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:P(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function ue(e){if(typeof e!="string")throw new Error(`Condition must be a string, got ${typeof e}`);return e.startsWith("js:")?{type:"JS_CODE",expression:e.slice(3)}:{type:"AI_MODE",expression:e}}function Be(e){let t=ue(e.IF),r=e.THEN;if(!Array.isArray(r))throw new Error("IF_ELSE requires a THEN array");let i={uid:P(),type:"IF_ELSE",condition:t,then:M(r)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(i.else=M(e.ELSE)),i}function Re(e){let t=ue(e.WHILE),r=e.DO;if(!Array.isArray(r))throw new Error("WHILE_LOOP requires a DO array");let i={uid:P(),type:"WHILE_LOOP",condition:t,body:M(r)};return typeof e.timeout_ms=="number"&&(i.timeout_ms=e.timeout_ms),i}function Ge(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let r={uid:P(),type:"STEP",description:t,statements:M(e.statements)};if(typeof e.reference_id=="number"&&(r.reference_id=e.reference_id),typeof e.template_path=="string"&&(r.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let i=e.template_params,n={};for(let[a,o]of Object.entries(i))n[a]=String(o);r.template_params=n}return r}var He=new Set(["action","intent","desc","locator","xpath","use_pure_vision"]);function pe(e){let t=typeof e.action=="string"?e.action:String(e.action),r=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",i=typeof e.locator=="string"?e.locator:void 0,n=typeof e.xpath=="string"?e.xpath:void 0,a=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,o={};for(let[l,g]of Object.entries(e))He.has(l)||(o[l]=g);t==="verify"&&typeof o.js=="string"&&(o.code=o.js,delete o.js),(t==="ai_action"||t==="ai_step")&&o.statement===void 0&&(o.statement=r);let p={action_description:r,action_data:{action_name:t,kwargs:Object.keys(o).length>0?o:{}}};i&&(p.locator=i),n&&(p.xpath=n);let h={uid:P(),type:"ACTION",description:r,action_entity:p};return a&&(h.use_pure_vision=!0),h}function de(e,t){let r;try{r=De(e)}catch{return}let i=r.contents;if(!i||!U(i))return;if(r.commentBefore)t.comment=r.commentBefore;else{let h=i.items?.[0];h?.key&&h.key.commentBefore&&(t.comment=h.key.commentBefore)}let n=i,a=n.get("statements",!0);W(a)&&t.statements&&B(a,t.statements);let o=n.get("teardown",!0);W(o)&&t.teardown&&B(o,t.teardown)}function B(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let r=0;r<Math.min(e.items.length,t.length);r++){let i=e.items[r];i.commentBefore&&!(r===0&&e.commentBefore)&&(t[r].comment=i.commentBefore);let n=t[r];if(n.type==="STEP"&&U(i)){let a=i.get("statements",!0);W(a)&&B(a,n.statements)}else if(n.type==="IF_ELSE"&&U(i)){let a=i.get("THEN",!0);W(a)&&B(a,n.then);let o=i.get("ELSE",!0);W(o)&&n.else&&B(o,n.else)}else if(n.type==="WHILE_LOOP"&&U(i)){let a=i.get("DO",!0);W(a)&&B(a,n.body)}}}import{parse as Kt,stringify as jt}from"yaml";var N=(e,t,r)=>{e.forEach((i,n)=>{let a=`${t}.${n}`;i.type==="DRAFT"?r[a]={description:i.description||"Draft",action_entity:void 0}:i.type==="ACTION"?r[a]={description:i.description||"Action",action_entity:i.action_entity,locator:i.locator}:i.type==="STEP"&&i.statements?N(i.statements,a,r):i.type==="IF_ELSE"?(r[a]={description:"IF "+(i.condition?.expression||""),action_entity:void 0},i.then&&N(i.then,`${a}.then`,r),i.else&&N(i.else,`${a}.else`,r)):i.type==="WHILE_LOOP"&&(r[a]={description:"WHILE "+(i.condition?.expression||""),action_entity:void 0},i.body&&N(i.body,`${a}.body`,r))})};function K(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return N(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&N(e.teardown,"teardown",t),t}var C=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(C||{});import{stringify as un}from"yaml";import{createHash as Xe}from"crypto";import{parse as qe,stringify as be}from"yaml";import{readFileSync as Ze,existsSync as Qe}from"fs";import{resolve as X,dirname as et}from"path";import{parse as fe,stringify as tt}from"yaml";var ge=5e3;function Je(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Ye(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function ye(e){let t=Je(e),r=e.locator;if(typeof r=="string"&&r.trim())return r=r.trim(),r.endsWith("first()")?`${t}.${r}`:`${t}.${r}.first()`;let i=Ye(e);if(i){let n=JSON.stringify(i);return`${t}.locator(${n}).first()`}return null}var $=new Map;function f(e,t){$.set(e,t)}function D(e,t,r=[]){let i=[...r];return t.locator?i.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&i.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(t.frame_path)}`),i.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...i.map(n=>` ${n},`),"});"]}f("click",e=>{let t=ye(e);if(!t)return['await agent.execAction("click", page, {});'];let r=e.action_data?.kwargs?.timeout_ms??ge;return[`await ${t}.click({ timeout: ${r} });`]});f("click_element",$.get("click"));f("click_element_by_index",$.get("click"));f("double_click",e=>D("double_click",e));f("double_click_on_element",$.get("double_click"));f("right_click",e=>D("right_click",e));f("right_click_on_element",$.get("right_click"));f("hover",e=>D("hover",e));f("hover_element_by_index",$.get("hover"));f("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return D("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("fill",$.get("input_text"));f("clear_input",e=>D("clear_input",e));f("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});f("send_keys",$.get("press"));f("send_keys_on_element",e=>{let t=ye(e),r=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(r)} } },`,"});"];let i=e.action_data?.kwargs?.timeout_ms??ge;return[`await ${t}.press(${JSON.stringify(r)}, { timeout: ${i} });`]});f("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return D("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});f("scroll_down",$.get("scroll"));f("scroll_up",$.get("scroll"));f("scroll_element",$.get("scroll"));f("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});f("scroll_on_element",e=>D("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));f("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});f("open_tab",$.get("go_to_url"));f("go_back",()=>['await agent.execAction("go_back", page, {});']);f("reload_page",()=>['await agent.execAction("reload_page", page, {});']);f("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);f("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);f("verify",(e,t)=>{let r=e.action_data?.kwargs,i=typeof r?.code=="string",n=i?r?.statement||e.action_description:e.action_description||r?.statement;if(i&&n){let o=r.code.split(`
|
|
2
2
|
`),p=JSON.stringify(n);return["{ const _t = Date.now(); try {",...o.map(h=>` ${h}`),` console.log(\`[VERIFY:JS] \u2713 \${((Date.now()-_t)/1000).toFixed(1)}s: ${p}\`);`,"} catch (_e) {",` console.log(\`[VERIFY:JS\u2192AI] JS failed \${((Date.now()-_t)/1000).toFixed(1)}s: (\${_e instanceof Error ? _e.message : String(_e)}), falling back to AI: ${p}\`);`,` await agent.assert(page, ${p}, ${JSON.stringify(t||"")});`,"} }"]}return i?r.code.split(`
|
|
3
3
|
`):n?[`await agent.assert(page, ${JSON.stringify(n)}, ${JSON.stringify(t||"")});`]:["// Skipping verify: missing statement or code"]});f("ai_assert",$.get("verify"));f("assert",$.get("verify"));f("ai_action",(e,t)=>{let r=e.action_data?.kwargs?.statement;if(!r)return["// Skipping ai_action: missing statement"];let i=JSON.stringify(r),n=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${i}, '${t||""}', ${n});`]});f("ai_step",(e,t)=>{let r=e.action_data?.kwargs?.statement;return r?[`await agent.run(page, ${JSON.stringify(r)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]});f("ai_extract",(e,t)=>{let r=e.action_data?.kwargs?.element_description,i=e.action_data?.kwargs?.variable_name;if(!r||!i)return["// Skipping ai_extract: missing element_description or variable_name"];let n=JSON.stringify(r),a=JSON.stringify(i);return[`await agent.extract(page, ${n}, ${a}, '${t||""}');`]});f("ai_wait_until",(e,t)=>{let r=e.action_data?.kwargs?.condition,i=e.action_data?.kwargs?.timeout_seconds||60;return r?[`await agent.waitUntilCondition(page, ${JSON.stringify(r)}, ${i}, '${t||""}');`]:["// Skipping ai_wait_until: missing condition"]});f("save_variable",e=>{let t=e.action_data?.kwargs?.name||"",r=e.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(t)}, value: ${JSON.stringify(r)} } },`,"});"]});f("js_code",e=>{let t=e.action_data?.kwargs?.code;if(!t)return["// Skipping js_code: missing code"];let r=["{"],i=t.split(`
|
|
4
4
|
`);for(let n of i)r.push(` ${n}`);return r.push("}"),r});f("function",(e,t,r)=>{let i=e.action_data?.kwargs||{},n=i.functionName;if(n&&n.includes("#")){let[o,p]=n.split("#");if(o&&p){let h=o.replace(/\.(ts|js|mjs)$/,""),l=`import { ${p} } from '${h}';`;r?.imports?.add(l);let g={...i,functionName:p},b=he(g);return b?[b.endsWith(";")?b:`${b};`]:["// Skipping function: invalid export pattern"]}}let a=he(i);return a?[a.endsWith(";")?a:`${a};`]:["// Skipping function: missing functionName"]});f("generate_2fa_code",e=>{let t=e.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]});f("upload_file",e=>{let t=e.action_data?.kwargs||{},r=[],i={};return t.paths?i.paths=t.paths:t.path&&(i.path=t.path),t.use_file_input&&(i.use_file_input=!0),r.push(`action_data: { kwargs: ${JSON.stringify(i)} }`),e.locator?r.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&r.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...r.map(n=>` ${n},`),"});"]});f("wait_for_download_complete",e=>['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]);f("switch_tab",e=>['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]);f("close_tab",e=>{let t=e.action_data?.kwargs?.page_id;return t=t??e.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]});f("set_date_for_native_date_picker",e=>{let t=e.action_data?.kwargs?.date??"",r=[];return r.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),e.locator?r.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&r.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...r.map(i=>` ${i},`),"});"]});f("done",()=>["// Done - no action needed"]);function q(e,t){let r=t.action_data?.kwargs||{},i=[];return typeof r.relative_x=="number"&&typeof r.relative_y=="number"?(i.push(`action_data: { kwargs: { relative_x: ${r.relative_x}, relative_y: ${r.relative_y} } }`),t.locator?i.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&i.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(t.frame_path)}`)):typeof r.x=="number"&&typeof r.y=="number"&&i.push(`action_data: { kwargs: { x: ${r.x}, y: ${r.y} } }`),[`await agent.execAction("${e}", page, {`,...i.map(n=>` ${n},`),"});"]}f("click_by_coordinates",e=>q("click_by_coordinates",e));f("right_click_by_coordinates",e=>q("right_click_by_coordinates",e));f("double_click_by_coordinates",e=>q("double_click_by_coordinates",e));f("drag_drop",e=>{let t=e.action_data?.kwargs||{},r={};typeof t.relative_x=="number"&&(r.relative_x=t.relative_x),typeof t.relative_y=="number"&&(r.relative_y=t.relative_y),typeof t.delta_x=="number"&&(r.delta_x=t.delta_x),typeof t.delta_y=="number"&&(r.delta_y=t.delta_y),typeof t.coord_source_x=="number"&&(r.coord_source_x=t.coord_source_x),typeof t.coord_source_y=="number"&&(r.coord_source_y=t.coord_source_y),typeof t.coord_target_x=="number"&&(r.coord_target_x=t.coord_target_x),typeof t.coord_target_y=="number"&&(r.coord_target_y=t.coord_target_y);let i=[`action_data: { kwargs: ${JSON.stringify(r)} }`];return e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("drag_drop", page, {',...i.map(n=>` ${n},`),"});"]});f("get_dropdown_options",e=>{let t=[];return e.xpath&&t.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(e.frame_path)}`),t.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...t.map(r=>` ${r},`),"});"]});f("extract_email_content",e=>{let t=e.action_data?.kwargs||{};return['await agent.execAction("extract_email_content", page, {',` action_data: { kwargs: ${JSON.stringify(t)} },`,"});"]});f("js_action",e=>{let t=e.action_data?.kwargs?.code;return t?t.split(`
|
|
@@ -883,9 +883,9 @@ import*as x from"fs";import*as w from"path";import{v4 as At}from"uuid";import{z
|
|
|
883
883
|
});
|
|
884
884
|
</script>
|
|
885
885
|
</body>
|
|
886
|
-
</html>`}var $e="0.1.
|
|
886
|
+
</html>`}var $e="0.1.76",Ee=$e!=="dev"?$e:void 0;var kn=3600*1e3,Tn=10080*60*1e3;var gt={before:0,main:1,teardown:2,after:3};function Me(e){let t=e.split(".")[0];return gt[t]??1}function Pe(e){return e.split(".").map(t=>{let r=Number(t);return Number.isNaN(r)?0:r})}function yt(e){return[...e].sort(([t],[r])=>{let i=Me(t),n=Me(r);if(i!==n)return i-n;let a=Pe(t),o=Pe(r);for(let p=0;p<Math.max(a.length,o.length);p++){let h=a[p]??-1,l=o[p]??-1;if(h!==l)return h-l}return 0})}function bt(e){let t=new Set;for(let r of e)if(t.add(r.category),r.category==="hook")for(let i of r.steps)t.add(i.category);return t}function _t(e,t){let r=e.toLowerCase();return r.includes("before")?"before":r.includes("after")?"after":t}function Z(e,t="main",r,i,n){r===void 0&&(r=!bt(e).has("test.step")),n||(n=new Map);let a=[];for(let o of e){if(o.category==="fixture"||o.category==="test.attach")continue;if(o.category==="hook"){let h=_t(o.title,t);a.push(...Z(o.steps,h,r,i,n));continue}if(o.category==="test.step"||r&&(o.category==="expect"||o.category==="pw:api")){let h=n.get(t)??0;n.set(t,h+1);let l=`${t}.${h}`,g={stepId:l,description:o.title,status:o.error?"failure":o.duration===-1?"skipped":"success",duration:o.duration>=0?o.duration:void 0};o.error&&(g.error=o.error.message??o.error.stack),i&&o.location&&i.set(l,o.location),a.push(g),o.steps.length>0&&a.push(...Z(o.steps,l,r,i,n))}}return a}function wt(e,t){let r=w.isAbsolute(e)?e:w.join(process.cwd(),e),i=w.join(r,"latest");try{if(x.lstatSync(i).isSymbolicLink())x.unlinkSync(i);else{console.warn("[report] 'latest' exists and is not a symlink; skipping update");return}}catch{}try{process.platform==="win32"?x.symlinkSync(w.join(r,t),i,"junction"):x.symlinkSync(t,i,"dir")}catch(n){console.warn(`[report] Could not create 'latest' symlink: ${n instanceof Error?n.message:String(n)}`)}}var Q=class{outputFolder;openMode;latestSymlinkDir;collected=[];config;runStartTime;constructor(t={}){this.outputFolder=t.outputFolder||"shiplight-report",this.openMode=t.open||"on-failure",this.latestSymlinkDir=t.latestSymlinkDir}onBegin(t,r){this.config=t,this.runStartTime=new Date().toISOString()}onTestEnd(t,r){this.collected.push({test:t,result:r})}async onEnd(t){if(this.collected.length===0)return;let r=new Map;for(let l of this.collected){let g=l.test.titlePath().join(" > "),b=r.get(g);b||(b=[],r.set(g,b)),b.push(l)}let i=[];for(let[,l]of r.entries()){let g=l[0].test.location.file,b=[],c,u,m;for(let y=0;y<l.length;y++){let{test:v,result:T}=l[y],A=await this.buildReportTest(v,T,g);c=A,u||(u=A.startTime),m=A.endTime,b.push({attemptNumber:y+1,status:T.status,duration:T.duration,steps:A.steps,error:A.error,videoPath:A.videoPath,tracePath:A.tracePath})}let d=b[b.length-1],{test:S}=l[l.length-1],_={title:S.title,baseTitle:c?.baseTitle,file:w.relative(process.cwd(),g),status:d.status,duration:d.duration,steps:d.steps,error:d.error,videoPath:d.videoPath,tracePath:d.tracePath,actionStepsMap:c?.actionStepsMap,tags:c?.tags,baseUrl:c?.baseUrl,skip:c?.skip,slow:c?.slow,timeout:c?.timeout,parameterSetName:c?.parameterSetName,startTime:u,endTime:m,suiteName:c?.suiteName};b.length>1&&(_.retries=b.length-1,_.attempts=b,b.some(v=>v.status==="failed"||v.status==="timedOut")&&d.status==="passed"&&(_.flaky=!0)),i.push(_)}let n={tests:i,totalDuration:t.duration,timestamp:new Date().toISOString(),shiplightVersion:Ee},a=w.isAbsolute(this.outputFolder)?this.outputFolder:w.join(process.cwd(),this.outputFolder);x.mkdirSync(a,{recursive:!0});let o=w.join(a,"screenshots");for(let l=0;l<n.tests.length;l++){let g=n.tests[l],b=g.attempts&&g.attempts.length>0,c=[{obj:g,prefix:b?`test-${l}-attempt-0`:`test-${l}`,screenshotSubDir:`test-${l}`}];if(g.attempts)for(let u=0;u<g.attempts.length;u++)c.push({obj:g.attempts[u],prefix:`test-${l}-attempt-${u+1}`,screenshotSubDir:`test-${l}/attempt-${u}`});for(let{obj:u,prefix:m,screenshotSubDir:d}of c){let S=w.join(o,d),_=!1;for(let y of u.steps)if(y.screenshot&&w.isAbsolute(y.screenshot))try{_||(x.mkdirSync(S,{recursive:!0}),_=!0);let v=`${y.stepId.replace(/\./g,"-")}.png`;x.copyFileSync(y.screenshot,w.join(S,v)),y.screenshot=`screenshots/${d}/${v}`}catch(v){console.warn(`[reporter] Failed to copy screenshot for ${y.stepId}:`,v)}if(u.videoPath&&w.isAbsolute(u.videoPath)){let y=w.extname(u.videoPath)||".webm",v=`${m}-video${y}`;try{x.copyFileSync(u.videoPath,w.join(a,v)),u.videoPath=v}catch{u.videoPath=void 0}}if(u.tracePath&&w.isAbsolute(u.tracePath)){let y=w.extname(u.tracePath)||".zip",v=`${m}-trace${y}`;try{x.copyFileSync(u.tracePath,w.join(a,v)),u.tracePath=v}catch{u.tracePath=void 0}}}}let p=w.join(a,"report-data.json");x.writeFileSync(p,JSON.stringify(n,null,2),"utf-8");let h=w.join(a,"index.html");if(x.writeFileSync(h,Ae({...n,outputDir:a}),"utf-8"),console.log(`
|
|
887
887
|
Shiplight report written to: ${h}`),this.latestSymlinkDir&&wt(this.latestSymlinkDir,w.basename(a)),this.openMode==="always"||this.openMode==="on-failure"&&t.status!=="passed")try{let l=(await import("open")).default;await l(h)}catch{}}printsToStdio(){return!1}async buildReportTest(t,r,i){let n={title:t.title,file:w.relative(process.cwd(),i),status:r.status,duration:r.duration,steps:[],startTime:new Date(r.startTime).toISOString(),endTime:new Date(r.startTime.getTime()+r.duration).toISOString()};r.errors.length>0&&(n.error=r.errors.map(c=>c.message||c.stack||String(c)).join(`
|
|
888
888
|
|
|
889
|
-
`)),r.stdout.length>0&&(n.stdout=r.stdout.map(c=>typeof c=="string"?c:c.toString()).join("")),r.stderr.length>0&&(n.stderr=r.stderr.map(c=>typeof c=="string"?c:c.toString()).join(""));for(let c of r.attachments)c.name==="video"&&c.path&&(n.videoPath=c.path),c.name==="trace"&&c.path&&(n.tracePath=c.path);let a=r.attachments.find(c=>c.name==="shiplight-results"),o=null;if(a)try{if(a.body)o=JSON.parse(a.body.toString("utf-8"));else if(a.path){let c=x.readFileSync(a.path,"utf-8");o=JSON.parse(c)}}catch{}let p=i.replace(/\.yaml\.spec\.ts$/,".test.yaml"),h={},l=t.title.match(/^(.*)\s+\[([^\]]+)\]$/),g=l?l[1]:t.title,b=l?l[2]:void 0;if(b&&(n.parameterSetName=b),x.existsSync(p))try{let c=x.readFileSync(p,"utf-8"),u=ve(c,p);if(u.suite){let m=u.suite.tests.find(d=>d.name===g);m&&(h=K(m.testFlow),m.tags?.length&&(n.tags=m.tags),m.skip!==void 0&&(n.skip=m.skip),m.slow&&(n.slow=m.slow),m.timeout!==void 0&&(n.timeout=m.timeout),n.baseTitle=m.name||m.testFlow?.goal),n.suiteName=u.name,u.tags?.length&&(n.suiteTags=u.tags),u.use?.baseURL&&(n.baseUrl=u.use.baseURL)}else u.testFlow&&(h=K(u.testFlow),n.baseTitle=u.name||u.testFlow?.goal,u.tags?.length&&(n.tags=u.tags),u.use?.baseURL&&(n.baseUrl=u.use.baseURL))}catch{}if(o||Object.keys(h).length>0){let c=new Set([...Object.keys(h),...Object.keys(o||{})]),u=Array.from(c).map(d=>[d,null]),m=yt(u);for(let[d]of m){let S=h[d],_=o?.[d],y=S?.description;if(!y||y==="Action"||y==="Draft"){let T=S?.action_entity;y=T?.action_description||T?.action_data?.kwargs?.description||_?.description||d}let v={stepId:d,description:y,status:_?.status||"pending",duration:_?.duration};if(_?.message){let T=typeof _.message=="string"?_.message:JSON.stringify(_.message,null,2);_.status==="failure"?v.error=T:v.message=T}if(_?.screenshot){let T=_.screenshot,A=a?.path?w.dirname(a.path):"",O=w.isAbsolute(T)?T:w.join(A,T);x.existsSync(O)&&(v.screenshot=O)}_?.code&&(v.code=_.code),n.steps.push(v)}}if(o===null&&Object.keys(h).length===0&&!i.endsWith(".yaml.spec.ts")){let c=new Map;if(n.steps=Z(r.steps,"main",void 0,c),n.steps.length>0){let u=new Map;n.actionStepsMap=Object.fromEntries(n.steps.map(m=>{let d=c.get(m.stepId),S;if(d?.file){if(!u.has(d.file))try{u.set(d.file,x.readFileSync(d.file,"utf-8").split(`
|
|
889
|
+
`)),r.stdout.length>0&&(n.stdout=r.stdout.map(c=>typeof c=="string"?c:c.toString()).join("")),r.stderr.length>0&&(n.stderr=r.stderr.map(c=>typeof c=="string"?c:c.toString()).join(""));for(let c of r.attachments)c.name==="video"&&c.path&&(n.videoPath=c.path),c.name==="trace"&&c.path&&(n.tracePath=c.path);let a=r.attachments.find(c=>c.name==="shiplight-results"),o=null;if(a)try{if(a.body)o=JSON.parse(a.body.toString("utf-8"));else if(a.path){let c=x.readFileSync(a.path,"utf-8");o=JSON.parse(c)}}catch{}let p=i.replace(/\.yaml\.spec\.ts$/,".test.yaml"),h={},l=t.title.match(/^(.*)\s+\[([^\]]+)\]$/),g=l?l[1]:t.title,b=l?l[2]:void 0;if(b&&(n.parameterSetName=b),x.existsSync(p))try{let c=x.readFileSync(p,"utf-8"),u=ve(c,p,this.config.rootDir);if(u.suite){let m=u.suite.tests.find(d=>d.name===g);m&&(h=K(m.testFlow),m.tags?.length&&(n.tags=m.tags),m.skip!==void 0&&(n.skip=m.skip),m.slow&&(n.slow=m.slow),m.timeout!==void 0&&(n.timeout=m.timeout),n.baseTitle=m.name||m.testFlow?.goal),n.suiteName=u.name,u.tags?.length&&(n.suiteTags=u.tags),u.use?.baseURL&&(n.baseUrl=u.use.baseURL)}else u.testFlow&&(h=K(u.testFlow),n.baseTitle=u.name||u.testFlow?.goal,u.tags?.length&&(n.tags=u.tags),u.use?.baseURL&&(n.baseUrl=u.use.baseURL))}catch{}if(o||Object.keys(h).length>0){let c=new Set([...Object.keys(h),...Object.keys(o||{})]),u=Array.from(c).map(d=>[d,null]),m=yt(u);for(let[d]of m){let S=h[d],_=o?.[d],y=S?.description;if(!y||y==="Action"||y==="Draft"){let T=S?.action_entity;y=T?.action_description||T?.action_data?.kwargs?.description||_?.description||d}let v={stepId:d,description:y,status:_?.status||"pending",duration:_?.duration};if(_?.message){let T=typeof _.message=="string"?_.message:JSON.stringify(_.message,null,2);_.status==="failure"?v.error=T:v.message=T}if(_?.screenshot){let T=_.screenshot,A=a?.path?w.dirname(a.path):"",O=w.isAbsolute(T)?T:w.join(A,T);x.existsSync(O)&&(v.screenshot=O)}_?.code&&(v.code=_.code),n.steps.push(v)}}if(o===null&&Object.keys(h).length===0&&!i.endsWith(".yaml.spec.ts")){let c=new Map;if(n.steps=Z(r.steps,"main",void 0,c),n.steps.length>0){let u=new Map;n.actionStepsMap=Object.fromEntries(n.steps.map(m=>{let d=c.get(m.stepId),S;if(d?.file){if(!u.has(d.file))try{u.set(d.file,x.readFileSync(d.file,"utf-8").split(`
|
|
890
890
|
`))}catch{u.set(d.file,[])}let y=u.get(d.file);S=y[d.line-1]?.trim();let v=d.line-2,T=d.line,A=[],O=d.line;v>=0&&(A.push(y[v]??""),O=d.line-1),A.push(y[d.line-1]??""),T<y.length&&A.push(y[T]??""),m.code=A.join(`
|
|
891
891
|
`),m.codeStartLine=O,m.codeLine=d.line}let _={description:m.description,...S&&{action_entity:{action_description:m.description,action_data:{action_name:"js_code",args:[],kwargs:{code:S}}}}};return[m.stepId,_]}))}}return Object.keys(h).length>0?n.actionStepsMap=h:o&&n.steps.length>0&&(n.actionStepsMap=Object.fromEntries(n.steps.map(c=>{let u=o[c.stepId],m=u?.type,d={description:c.description,...m&&{action_entity:{action_description:c.description,action_data:{action_name:m==="step"?"js_code":m,args:[],kwargs:m==="step"?{code:u?.code??c.description}:{statement:c.description}}}}};return[c.stepId,d]}))),n}},vt=Q;export{vt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as reactExports, W as We } from "./index-
|
|
1
|
+
import { r as reactExports, W as We } from "./index-Mg0a6DkO.js";
|
|
2
2
|
function _defineProperty$1(obj, key, value) {
|
|
3
3
|
if (key in obj) {
|
|
4
4
|
Object.defineProperty(obj, key, {
|
|
@@ -649,4 +649,4 @@ export {
|
|
|
649
649
|
loader,
|
|
650
650
|
Le as useMonaco
|
|
651
651
|
};
|
|
652
|
-
//# sourceMappingURL=index-
|
|
652
|
+
//# sourceMappingURL=index-Dk5ihq1Y.js.map
|
|
@@ -42987,6 +42987,11 @@ const DebuggerProvider = ({
|
|
|
42987
42987
|
setIsDebugging(true);
|
|
42988
42988
|
} catch (error) {
|
|
42989
42989
|
console.error("Failed to start debugging:", error);
|
|
42990
|
+
notifications.show({
|
|
42991
|
+
title: "Failed to start debug session",
|
|
42992
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
42993
|
+
color: "red"
|
|
42994
|
+
});
|
|
42990
42995
|
} finally {
|
|
42991
42996
|
setIsStepping(false);
|
|
42992
42997
|
}
|
|
@@ -43320,6 +43325,11 @@ const DebuggerProvider = ({
|
|
|
43320
43325
|
}
|
|
43321
43326
|
} catch (error) {
|
|
43322
43327
|
console.error("Failed to start debugging and run until target:", error);
|
|
43328
|
+
notifications.show({
|
|
43329
|
+
title: "Failed to start debug session",
|
|
43330
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
43331
|
+
color: "red"
|
|
43332
|
+
});
|
|
43323
43333
|
setIsDebugging(false);
|
|
43324
43334
|
setIsStepping(false);
|
|
43325
43335
|
throw error;
|
|
@@ -187982,7 +187992,7 @@ function dynamic(importFn, _options) {
|
|
|
187982
187992
|
);
|
|
187983
187993
|
return Wrapper;
|
|
187984
187994
|
}
|
|
187985
|
-
const MonacoEditor = dynamic(() => __vitePreload(() => import("./index-
|
|
187995
|
+
const MonacoEditor = dynamic(() => __vitePreload(() => import("./index-Dk5ihq1Y.js"), true ? [] : void 0), {});
|
|
187986
187996
|
const CodeEditor = ({
|
|
187987
187997
|
initialCode = "",
|
|
187988
187998
|
onConfirm,
|
|
@@ -197605,6 +197615,12 @@ const TestFlowEditorController = ({
|
|
|
197605
197615
|
return debugSession;
|
|
197606
197616
|
} catch (error) {
|
|
197607
197617
|
setSessionInitProgress(null);
|
|
197618
|
+
if (onReceivedLiveviewUrl) {
|
|
197619
|
+
onReceivedLiveviewUrl(void 0, void 0);
|
|
197620
|
+
}
|
|
197621
|
+
if (onModeChange) {
|
|
197622
|
+
onModeChange();
|
|
197623
|
+
}
|
|
197608
197624
|
console.error("Session initialization failed:", error);
|
|
197609
197625
|
throw new Error(`Failed to initialize debug session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
197610
197626
|
}
|
|
@@ -200236,6 +200252,36 @@ function useInitialConfig() {
|
|
|
200236
200252
|
}, []);
|
|
200237
200253
|
return config2;
|
|
200238
200254
|
}
|
|
200255
|
+
class EditorErrorBoundary extends We.Component {
|
|
200256
|
+
constructor() {
|
|
200257
|
+
super(...arguments);
|
|
200258
|
+
this.state = { error: null };
|
|
200259
|
+
}
|
|
200260
|
+
static getDerivedStateFromError(error) {
|
|
200261
|
+
return { error };
|
|
200262
|
+
}
|
|
200263
|
+
componentDidCatch(error, info) {
|
|
200264
|
+
console.error("Editor render error:", error, info.componentStack);
|
|
200265
|
+
}
|
|
200266
|
+
render() {
|
|
200267
|
+
if (this.state.error) {
|
|
200268
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Center, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { align: "center", gap: "sm", children: [
|
|
200269
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "lg", c: "red", children: "Something went wrong" }),
|
|
200270
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "sm", c: "dimmed", style: { maxWidth: 400, textAlign: "center" }, children: this.state.error.message }),
|
|
200271
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
200272
|
+
Button,
|
|
200273
|
+
{
|
|
200274
|
+
variant: "light",
|
|
200275
|
+
color: "blue",
|
|
200276
|
+
onClick: () => this.setState({ error: null }),
|
|
200277
|
+
children: "Retry"
|
|
200278
|
+
}
|
|
200279
|
+
)
|
|
200280
|
+
] }) });
|
|
200281
|
+
}
|
|
200282
|
+
return this.props.children;
|
|
200283
|
+
}
|
|
200284
|
+
}
|
|
200239
200285
|
const DEFAULT_SIDEBAR_WIDTH = 300;
|
|
200240
200286
|
const MIN_SIDEBAR_WIDTH = 180;
|
|
200241
200287
|
const MAX_SIDEBAR_WIDTH = 600;
|
|
@@ -200513,7 +200559,7 @@ function LocalDebuggerPage() {
|
|
|
200513
200559
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "sm", c: "dimmed", children: error || "No test flow data" })
|
|
200514
200560
|
] }) });
|
|
200515
200561
|
}
|
|
200516
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
200562
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(EditorErrorBoundary, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
200517
200563
|
TestFlowEditorController,
|
|
200518
200564
|
{
|
|
200519
200565
|
intRunner: localIntRunnerApi,
|
|
@@ -200532,7 +200578,7 @@ function LocalDebuggerPage() {
|
|
|
200532
200578
|
v2: true
|
|
200533
200579
|
},
|
|
200534
200580
|
selectedFile
|
|
200535
|
-
);
|
|
200581
|
+
) });
|
|
200536
200582
|
};
|
|
200537
200583
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column" }, children: [
|
|
200538
200584
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Notifications$1, { position: "top-right" }),
|
|
@@ -200710,4 +200756,4 @@ export {
|
|
|
200710
200756
|
We as W,
|
|
200711
200757
|
reactExports as r
|
|
200712
200758
|
};
|
|
200713
|
-
//# sourceMappingURL=index-
|
|
200759
|
+
//# sourceMappingURL=index-Mg0a6DkO.js.map
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/* Prevent FOUC */
|
|
9
9
|
body { margin: 0; background: #1a1b1e; color: #c1c2c5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
|
|
10
10
|
</style>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-Mg0a6DkO.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-uF1WN2rG.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shiplightai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.76",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shiplight CLI for running and debugging .test.yaml files",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -98,11 +98,11 @@
|
|
|
98
98
|
"tsup": "^8.3.5",
|
|
99
99
|
"typescript": "5.5.4",
|
|
100
100
|
"mcp-tools": "1.0.0",
|
|
101
|
-
"sdk-internal": "0.1.1",
|
|
102
101
|
"sdk-core": "0.1.0",
|
|
103
|
-
"
|
|
102
|
+
"sdk-internal": "0.1.1",
|
|
104
103
|
"shiplight-types": "0.1.0",
|
|
105
|
-
"@loggia/common": "1.0.0"
|
|
104
|
+
"@loggia/common": "1.0.0",
|
|
105
|
+
"shiplight-tools": "1.0.0"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
108
|
"@playwright/test": "^1.60.0"
|