Skip to content

Commit ee02522

Browse files
authored
Merge pull request #307 from os2display/feature/5317-template-tests
5317 template tests
2 parents 3d38698 + 593a21f commit ee02522

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

assets/tests/template/template-main.spec.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,82 @@ test("Test template index", async ({ page }) => {
66
await expect(page).toHaveTitle(/OS2Display Templates/);
77
await expect(page.getByText("Examples")).toBeVisible();
88
});
9+
10+
test.describe("Template Links", () => {
11+
test.beforeEach(async ({ page }) => {
12+
await page.goto("/template");
13+
});
14+
15+
test("Should display all templates with links", async ({ page }) => {
16+
const templateIds = [
17+
"book-review-0",
18+
"calendar-0-multiple-days",
19+
"calendar-1-multiple",
20+
"calendar-2-single",
21+
"calendar-3-multiple-days",
22+
"calendar-4-single-booking",
23+
"contacts-underlined",
24+
"contacts-not-underlined",
25+
"iframe-0",
26+
"image-text-0",
27+
"image-text-1",
28+
"image-text-1-multiple-images",
29+
"image-text-2-logo",
30+
"image-text-3-font-sizes",
31+
"image-text-reversed",
32+
"image-text-4-test-theme",
33+
"instagram-0",
34+
"instagram-1-no-max-entries",
35+
"news-feed-0",
36+
"poster-0-single",
37+
"poster-0-single-override",
38+
"poster-1-subscription",
39+
"poster-2-single-no-feed",
40+
"rss-0-no-feed-progress",
41+
"rss-1-with-progress",
42+
"slideshow-0",
43+
"slideshow-1-no-stuff",
44+
"slideshow-2",
45+
"table-0",
46+
"table-1",
47+
"travel-multiple-stations",
48+
"travel-spacious-info-box",
49+
"travel-one-station",
50+
"video-0",
51+
"vimeo-player-0",
52+
];
53+
54+
for (const id of templateIds) {
55+
const link = page.locator(`#${id} a`);
56+
await expect(link).toBeVisible();
57+
await expect(link).toHaveAttribute("href", `/template/${id}`);
58+
}
59+
});
60+
61+
test("Should display all screen templates with links", async ({ page }) => {
62+
const screenTemplateIds = [
63+
"two-split",
64+
"two-split-vertical",
65+
"two-split-vertical-reversed",
66+
"touch-template",
67+
"three-split",
68+
"three-split-horizontal",
69+
"six-areas",
70+
"full-screen",
71+
"four-areas",
72+
];
73+
74+
for (const id of screenTemplateIds) {
75+
const link = page.locator(`#${id} a`);
76+
await expect(link).toBeVisible();
77+
await expect(link).toHaveAttribute("href", `/template/${id}`);
78+
}
79+
});
80+
81+
test("Should have working navigation for one of the links", async ({
82+
page,
83+
}) => {
84+
await page.click("#book-review-0 a");
85+
await expect(page).toHaveURL(/\/template\/book-review-0$/);
86+
});
87+
});

0 commit comments

Comments
 (0)