UNPKG

@coinbase/onchaintestkit

Version:

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

24 lines (23 loc) 914 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.spendingCapRemoval = void 0; // Poll until the page is closed (or timeout). This prevents the next // waitForPage call from finding this stale page in context.pages(). async function waitForPageClose(page, timeout = 5000) { const deadline = Date.now() + timeout; while (Date.now() < deadline && !page.isClosed()) { await new Promise(r => setTimeout(r, 200)); } } const confirmRemoval = async (notificationPage) => { await notificationPage.getByRole("button", { name: "Confirm" }).click(); await waitForPageClose(notificationPage); }; const rejectRemoval = async (notificationPage) => { await notificationPage.getByRole("button", { name: "Cancel" }).click(); await waitForPageClose(notificationPage); }; exports.spendingCapRemoval = { confirm: confirmRemoval, reject: rejectRemoval, };