Skip to content

Commit

Permalink
tests(fix): add console message grabber to testing script
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsneighbour committed Dec 24, 2024
1 parent b133b00 commit 73cb65f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions tests/e2e/all-pages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,22 @@ test('Verify each link in links.json is reachable', async ({ page }) => {
}

for (const link of links) {
const errors = [];
await page.goto(link);
expect(page.url()).toBe(link);
//console.log(`Successfully navigated to ${link}`);

page.on('console', (message) => {
if (message.type() === 'error') {
errors.push(`Error message: ${message.text()}`);
}
});

page.on('pageerror', (err) => {
console.log(err.message);
});

expect(errors).toHaveLength(0);
}
});

Expand Down
3 changes: 1 addition & 2 deletions tests/html-validator/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"element-name": [
"warn",
{
"whitelist": ["menu", "date", "lite-youtube", "web-vitals"]
"whitelist": ["menu", "date", "lite-youtube"]
}
],
"element-required-content": "off",
Expand Down Expand Up @@ -59,7 +59,6 @@
":[a-z0-9-]+",
"x-[a-z0-9-]+:[a-z0-9-]+",
"x-[a-z0-9-]+.[a-z0-9-]+.[a-z0-9-]+"

]
}
]
Expand Down

0 comments on commit 73cb65f

Please sign in to comment.