mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(client): prevent dispatches during render (#54422)
This commit is contained in:
committed by
GitHub
parent
3c1353fbe0
commit
88327aadc3
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user