fix(client): prevent dispatches during render (#54422)

This commit is contained in:
Oliver Eyton-Williams
2024-04-18 10:27:05 +02:00
committed by GitHub
parent 3c1353fbe0
commit 88327aadc3
2 changed files with 40 additions and 11 deletions
+28 -1
View File
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test';
import { test, expect, Page } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
test.use({ storageState: 'playwright/.auth/certified-user.json' });
@@ -137,6 +137,33 @@ test.describe('Certification page - Non Microsoft', () => {
});
});
test.describe('Invalid certification page', () => {
const testInvalidCertification = async ({ page }: { page: Page }) => {
{
await page.goto('/certification/certifieduser/invalid-certification');
await expect(page).toHaveURL('/');
await expect(page.getByRole('alert')).toHaveText(
/The certification you tried to view does not exist/
);
}
};
test.describe('for authenticated user', () => {
test.use({ storageState: 'playwright/.auth/certified-user.json' });
test(
'it should redirect to / and display an error message',
testInvalidCertification
);
});
test.describe('for unauthenticated user', () => {
test.use({ storageState: { cookies: [], origins: [] } });
test(
'it should redirect to / and display an error message',
testInvalidCertification
);
});
});
test.describe('Certification page - Microsoft', () => {
test.beforeEach(async ({ page }) => {
await page.goto(