2024-09-12 16:48:14 +00:00
|
|
|
import { BrowserContext, Page } from '@playwright/test'
|
|
|
|
|
|
|
|
export const signTx = async ({
|
|
|
|
context,
|
|
|
|
page,
|
2024-10-10 12:41:16 +00:00
|
|
|
notificationMsg = /successfully/i,
|
2024-09-12 16:48:14 +00:00
|
|
|
}: {
|
|
|
|
context: BrowserContext
|
|
|
|
page: Page
|
2024-10-10 12:41:16 +00:00
|
|
|
notificationMsg?: string | RegExp
|
2024-09-12 16:48:14 +00:00
|
|
|
}) => {
|
|
|
|
// Sign tx
|
|
|
|
const signPage = await context.waitForEvent('page')
|
|
|
|
|
|
|
|
await signPage.getByRole('button', { name: /approve/i }).click()
|
|
|
|
await signPage.waitForEvent('close')
|
2024-10-10 12:41:16 +00:00
|
|
|
await page.getByText(notificationMsg).waitFor({ state: 'visible' })
|
2024-09-12 16:48:14 +00:00
|
|
|
}
|