Skip to content

Commit 3d49649

Browse files
committed
Merge branch 'feat/test-all-tools-loading' into chore/all-my-stuffs
# Conflicts: # components.d.ts
2 parents 8907ff0 + 9f38cdf commit 3d49649

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

src/components/ToolCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const theme = useThemeVars();
99
</script>
1010

1111
<template>
12-
<router-link :to="tool.path" class="decoration-none">
12+
<router-link :to="tool.path" class="it-tool-link decoration-none">
1313
<c-card class="h-full transition transition-duration-0.5s !border-2px !hover:border-primary">
1414
<div flex items-center justify-between>
1515
<n-icon class="text-neutral-400 dark:text-neutral-600" size="40" :component="tool.icon" />

src/tools/all-tools.e2e.spec.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
const ignoredHrefs = new Set(['/camera-recorder']);
4+
5+
test.describe('IT Tool', () => {
6+
test('Loads all tools correctly', async ({ page }) => {
7+
test.slow();
8+
9+
const allTools: string[] = [];
10+
11+
await page.goto('/');
12+
await page.waitForSelector('.it-tool-link');
13+
const allLinks = await page.locator('.it-tool-link').all();
14+
for (const a of allLinks) {
15+
allTools.push((await a.getAttribute('href')) || '/');
16+
}
17+
18+
expect(allTools.length).toBeGreaterThan(0);
19+
20+
const errors: Array<Error> = [];
21+
22+
page.on('pageerror', (error) => {
23+
// ignore errors related to physical devices (ie camera recorder)
24+
if (error.message.match(/Requested device not found/)) {
25+
return;
26+
}
27+
errors.push(error);
28+
});
29+
30+
for (const toolHref of allTools) {
31+
if (ignoredHrefs.has(toolHref)) {
32+
continue;
33+
}
34+
await test.step(toolHref, async () => {
35+
errors.splice(0, errors.length);
36+
37+
await page.goto(toolHref);
38+
await page.waitForSelector('.tool-header');
39+
40+
await expect(page).toHaveTitle(/.+ - IT Tools/);
41+
42+
expect(errors, `${toolHref} to have no JS error`).toHaveLength(0);
43+
});
44+
}
45+
});
46+
});

0 commit comments

Comments
 (0)