Skip to content

Commit 17bc3d3

Browse files
committed
added test to check for console errors, decreased playwright timeout to make it fail faster
1 parent 53dbb66 commit 17bc3d3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default defineConfig({
2121
workers: process.env.CI ? 1 : undefined,
2222
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
2323
reporter: 'html',
24+
timeout: 10_000,
2425
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2526
use: {
2627
baseURL: 'http://127.0.0.1:8080',

tests/chart.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ test.beforeEach(async ({ page }) => {
5858
await page.goto('/');
5959
});
6060

61+
test('no console errors during page load', async ({ page }) => {
62+
const errors = [];
63+
64+
page.on('pageerror', error => {
65+
errors.push(error.message);
66+
});
67+
68+
await page.goto('/');
69+
70+
expect(errors).toEqual([]);
71+
});
72+
6173
test('take screenshot', async ({ page }) => {
6274
await page.evaluate(() => document.querySelectorAll('header').forEach(header => header.remove()));
6375
await page.locator('#chart-container').screenshot({ path: 'tmp/sample.png' }); // take a screenshot for README file

0 commit comments

Comments
 (0)