refactor(test): create helper to look for alerts (#55483)

This commit is contained in:
Oliver Eyton-Williams
2024-07-12 09:19:48 +02:00
committed by GitHub
parent a1b40fecb9
commit af1ce853dd
7 changed files with 22 additions and 27 deletions
+5 -3
View File
@@ -1,5 +1,9 @@
import { execSync } from 'child_process';
import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
import { alertToBeVisible } from './utils/alerts';
test.use({ storageState: 'playwright/.auth/development-user.json' });
test.beforeEach(() => {
@@ -36,9 +40,7 @@ test.describe('After creating token', () => {
).toBeVisible();
await page.getByRole('button', { name: 'Delete my user token' }).click();
await expect(page.getByRole('alert')).toContainText(
/Your user token has been deleted./
);
await alertToBeVisible(page, translations.flash['token-deleted']);
await expect(
page.getByText('User Token', { exact: true })
).not.toBeVisible();