@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
37 lines (36 loc) • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.rejectEvent = exports.confirmEvent = void 0;
/**
* Confirms a transaction in the Phantom Wallet notification popup
* @param page - The notification page
*/
const confirmEvent = async (page) => {
// Wait for the transaction confirmation page to load
await page.waitForLoadState("domcontentloaded");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(2000);
await page.reload();
// Wait for the primary confirm button and click it
const confirmButton = page.getByTestId("primary-button");
await confirmButton.waitFor({ state: "visible", timeout: 10000 });
await confirmButton.click();
};
exports.confirmEvent = confirmEvent;
/**
* Rejects a transaction in the Phantom Wallet notification popup
* @param page - The notification page
*/
const rejectEvent = async (page) => {
// Wait for the transaction confirmation page to load
await page.waitForLoadState("domcontentloaded");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(1000);
await page.reload();
// Wait for the secondary reject button and click it
const rejectButton = page.getByTestId("secondary-button");
await rejectButton.waitFor({ state: "visible", timeout: 10000 });
await page.waitForTimeout(1000);
await rejectButton.click();
};
exports.rejectEvent = rejectEvent;