mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
refactor(test): create helper to look for alerts (#55483)
This commit is contained in:
committed by
GitHub
parent
a1b40fecb9
commit
af1ce853dd
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user