@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
27 lines (26 loc) • 940 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.approvePermission = void 0;
const approveTokenPermission = async (notificationPage) => {
// click "Confirm" button
await notificationPage.getByRole("button", { name: "Confirm" }).click();
// wait for the page to be closed
await notificationPage
.waitForSelector("*", { state: "detached" })
.catch(() => {
// Page is already closed, which is what we want
});
};
const rejectTokenPermission = async (notificationPage) => {
await notificationPage.getByRole("button", { name: "Reject" }).click();
// wait for the page to be closed
await notificationPage
.waitForSelector("*", { state: "detached" })
.catch(() => {
// Page is already closed, which is what we want
});
};
exports.approvePermission = {
approve: approveTokenPermission,
reject: rejectTokenPermission,
};