Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: verify that there are no errors on the website (#6365)
closes: #6354
- Loading branch information
Showing
1 changed file
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
import AxeBuilder from '@axe-core/playwright'; | ||
import { test } from '@playwright/test'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('Index', async ({ page }) => { | ||
await page.goto('/'); | ||
await new AxeBuilder({ page }).analyze(); | ||
test.describe('Website', () => { | ||
test('Axe', async ({ page }) => { | ||
await page.goto('/'); | ||
await new AxeBuilder({ page }).analyze(); | ||
}); | ||
|
||
test('should have no errors', async ({ page }) => { | ||
const errorMessages: string[] = []; | ||
page.on('console', msg => { | ||
if (['error', 'warning'].includes(msg.type())) { | ||
errorMessages.push(`[${msg.type()}] ${msg.text()}`); | ||
} | ||
}); | ||
await page.goto('/'); | ||
expect(errorMessages).toStrictEqual([ | ||
"[error] Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot", | ||
]); | ||
}); | ||
}); |