Files
supabase/e2e/studio/utils/dismiss-toast.ts
Ali Waseem fef1f043ad chore: added tests for users and minor refactor (#41279)
* added tests for users and minor refactor

* fix helpers

* addressed PR feedback

* remove before await

* missed the await
2025-12-11 13:31:43 -07:00

20 lines
641 B
TypeScript

import { Page } from '@playwright/test'
export const dismissToast = async (page: Page) => {
await page
.locator('li.toast')
.getByRole('button', { name: 'Opt out' })
.waitFor({ state: 'visible' })
await page.locator('li.toast').getByRole('button', { name: 'Opt out' }).click()
}
export const toKebabCase = (str: string) => str.replace(/([A-Z])/g, '-$1').toLowerCase()
export const dismissToastsIfAny = async (page: Page) => {
const closeButtons = page.getByRole('button', { name: 'Close toast' })
const count = await closeButtons.count()
for (let i = 0; i < count; i++) {
await closeButtons.nth(i).click()
}
}