UNPKG

@coinbase/onchaintestkit

Version:

End-to-end testing toolkit for blockchain applications, powered by Playwright

24 lines (23 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.switchAccount = switchAccount; function _escapeRegex(text) { return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } /** * Confirms a transaction in the Phantom Wallet notification popup * @param page - The notification page * @param accountName - The name of the account to switch to */ async function switchAccount(_page, _accountName) { console.log("Implemented but not tested, code is commented"); // await page.waitForLoadState("domcontentloaded") // await page.waitForLoadState("networkidle") // // Open settings / account menu // await page.getByTestId("settings-menu-open-button").click() // const namePattern = new RegExp(`^${escapeRegex(accountName)}$`, "i") // const target = page.getByRole("button", { name: namePattern }) // await target.waitFor({ state: "visible", timeout: 15000 }) // await target.click() // await page.waitForLoadState("networkidle") }