(function(e,s){typeof exports=="object"&&typeof module!="undefined"?s(exports,require("@c3/utils"),require("lodash"),require("@playwright/test"),require("node:path"),require("playwright")):typeof define=="function"&&define.amd?define(["exports","@c3/utils","lodash","@playwright/test","node:path","playwright"],s):(e=typeof globalThis!="undefined"?globalThis:e||self,s(e.test={},e.utils,e._,e.test,e.path,e.playwright))})(this,function(e,s,f,g,p,k){"use strict";function r(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var c=r(f),b=r(p);class d{constructor(o){this.name=o}}class h extends d{say(){console.log("say")}}class y extends h{say(){console.log("meow")}}const u=`This handy tool helps you create dummy text for all your layout needs.We are gradually adding new functionality and we welcome your suggestions and feedback.Please feel free to send us any additional dummy texts.
`.split(" "),x=()=>c.default.shuffle(u).join(" "),T=()=>c.default.sample(u)||"hello-world",M="https://jsonplaceholder.typicode.com/users",_=async()=>(await fetch(M)).json();let v=0;const R={getRandomPic:(t=160*6,o=90*6)=>`https://picsum.photos/id/${s.rand(10,100)}/${t}/${o}.jpg`,getRandomText:x,getRandomWord:T,getId:()=>`uniq-id-${v++}`,getRandomUser:_,getRandomColor:()=>`#${Math.floor(Math.random()*16777215).toString(16)}`},w=async t=>{await t.goto("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#initialize/welcome"),await t.locator("text=Get Started").click(),await t.waitForURL("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#initialize/select-action"),await t.locator("text=Import wallet").click(),await t.waitForURL("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#initialize/metametrics-opt-in"),await t.locator('[data-testid="page-container-footer-next"]').click(),await t.waitForURL("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#initialize/create-password/import-with-seed-phrase"),await t.locator("select").selectOption("24");const a="hockey   dilemma   magic   rigid   blade   crawl   soldier   screen   mind   siege   disorder   hint   ramp   solid   flat   caution   swamp   anger   attend   trim   tell   obscure   rice   math".split(/\s+/);for(const[n,l]of Object.entries(a)){const i=t.locator(`[data-testid="import-srp__srp-word-${n}"]`);await i.click(),await i.fill(l)}await t.locator("text=I have read and agree to the Terms of Use").click(),await t.locator("#password").click(),await t.locator("#password").fill("Over123456"),await t.locator("#confirm-password").click(),await t.locator("#confirm-password").fill("Over123456"),await t.locator('button:has-text("Import")').click(),await t.waitForURL("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#initialize/end-of-flow"),await t.locator("text=All Done").click(),await t.locator(".popover-header__title button").click()},j=g.test.extend({context:async({},t)=>{const o=b.default.join(__dirname,"./extension"),a=await k.chromium.launchPersistentContext("",{devtools:!1,headless:!1,timeout:0,args:[`--disable-extensions-except=${o}`,`--load-extension=${o}`]});await t(a),await a.close()},metaMaskPage:async({context:t,extensionId:o},a)=>{const n=`chrome-extension://${o}/popup.html`,l=t.pages(),i=l.length>0?l[0]:await t.newPage();await w(i),await i.goto(n);for(const m of t.pages())m.url().includes("home.html#initialize/welcome")&&await m.close();await a(i)},extensionId:async({context:t},o)=>{let[a]=t.backgroundPages();a||(a=await t.waitForEvent("backgroundpage"));const n=a.url().split("/")[2];await o(n)}}),U={approve(){console.log()},reject(){console.log("x")}},S=async(t,o,a)=>{let n=!1;for(;!n;)await t.waitForTimeout(1e3),await t.reload(),n=await t.locator(o,a).isVisible();return t.locator(o,a)},$={confirmBtn:["button",{hasText:"Confirm"}],approveBtn:["button",{hasText:"Approve"}],switchNetworkBtn:["button",{hasText:"Switch network"}],rejectBtn:["button",{hasText:"Reject"}],nextBtn:["button",{hasText:"Next"}],connectBtn:["button",{hasText:"Connect"}]},C=t=>{console.log(`
---pages begin----`),t.pages().forEach(o=>console.log("pageurl",o.url())),t.backgroundPages().forEach(o=>console.log("background page url",o.url())),console.log(`---pages end----
`)};e.Animal=d,e.Cat=y,e.Mammal=h,e.SELECTORS=$,e.metamask=U,e.mock=R,e.printPageUrls=C,e.signinWallet=w,e.testWithMetaMask=j,e.waitForMetaMask=S,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
