@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
44 lines (43 loc) • 1.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.connectWallet = connectWallet;
exports.connectCoinbaseWallet = connectCoinbaseWallet;
const BaseWallet_1 = require("../../../src/wallets/BaseWallet");
/**
* Connects MetaMask wallet to the app and accepts Terms of Service
* This represents the standard onboarding flow for first-time users
*
* @param page - The Playwright page object
* @param metamask - The MetaMask wallet instance
*/
async function connectWallet(page, metamask) {
// Open wallet connect modal
await page.getByTestId("ockConnectButton").first().click();
// Select MetaMask from wallet options
await page
.getByTestId("ockModalOverlay")
.first()
.getByRole("button", { name: "MetaMask" })
.click();
// Handle MetaMask connection request
await metamask.handleAction(BaseWallet_1.BaseActionType.CONNECT_TO_DAPP);
}
/**
* Connects Coinbase wallet to the app
* This represents the standard onboarding flow for first-time users
*
* @param page - The Playwright page object
* @param coinbase - The Coinbase wallet instance
*/
async function connectCoinbaseWallet(page, coinbase) {
// Open wallet connect modal
await page.getByTestId("ockConnectButton").first().click();
// Select Coinbase Wallet from wallet options
await page
.getByTestId("ockModalOverlay")
.first()
.getByRole("button", { name: "Coinbase Wallet" })
.click();
// Handle Coinbase wallet connection request
await coinbase.handleAction(BaseWallet_1.BaseActionType.CONNECT_TO_DAPP);
}