Skip to content

Commit b8ce427

Browse files
committed
#3414 webpage: add tests for the image carousel and translation pages
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent f097d1f commit b8ce427

File tree

2 files changed

+192
-0
lines changed

2 files changed

+192
-0
lines changed

webpage/tests/basic.spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,24 @@ test("concept", async ({ page, config }) => {
2121
page.locator(".mermaid-diagram").getByText("Command-line snippet manager"),
2222
).toBeVisible();
2323
});
24+
25+
test("overview page has image carousel", async ({ page, config }) => {
26+
await page.goto(config.baseURL + "/getting-started/overview.html");
27+
await expect(page).toHaveTitle(/Overview.*QOwnNotes/);
28+
29+
// Check carousel navigation buttons exist
30+
await expect(
31+
page.getByRole("button", { name: "Previous visual" }),
32+
).toBeVisible();
33+
await expect(page.getByRole("button", { name: "Next visual" })).toBeVisible();
34+
35+
// Check carousel slide indicators exist
36+
await expect(
37+
page.getByRole("button", { name: /Carousel slide \d+ of 22/ }),
38+
).toHaveCount(22);
39+
40+
// Check the main image is visible
41+
await expect(
42+
page.getByRole("img", { name: "QOwnNotes screenshot" }),
43+
).toBeVisible();
44+
});

webpage/tests/translations.spec.js

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
// @ts-check
2+
import { test, expect } from "./fixtures.js";
3+
4+
test("German translation - homepage exists", async ({ page, config }) => {
5+
const response = await page.goto(config.baseURL + "/de/");
6+
expect(response.status()).toBe(200);
7+
await expect(page).toHaveTitle("QOwnNotes");
8+
});
9+
10+
test("German translation - content is in German", async ({ page, config }) => {
11+
await page.goto(config.baseURL + "/de/");
12+
13+
// Check German navigation links
14+
await expect(page.getByRole("link", { name: "Loslegen" })).toBeVisible();
15+
await expect(page.getByRole("link", { name: "Installation" })).toBeVisible();
16+
await expect(page.getByRole("link", { name: "Spenden" })).toBeVisible();
17+
18+
// Check German heading and description
19+
await expect(
20+
page.getByRole("heading", { level: 1, name: "QOwnNotes" }),
21+
).toBeVisible();
22+
await expect(
23+
page.getByText("Kostenlose Open-Source-Markdown-Notizen"),
24+
).toBeVisible();
25+
await expect(
26+
page.getByRole("link", { name: "Schnellstart →" }),
27+
).toBeVisible();
28+
});
29+
30+
test("German translation - feature sections", async ({ page, config }) => {
31+
await page.goto(config.baseURL + "/de/");
32+
33+
// Check German feature headings
34+
await expect(
35+
page.getByRole("heading", { level: 2, name: "Besitze deine Notizen" }),
36+
).toBeVisible();
37+
await expect(
38+
page.getByRole("heading", { level: 2, name: "Kleiner Fußabdruck" }),
39+
).toBeVisible();
40+
await expect(
41+
page.getByRole("heading", { level: 2, name: "Anpassung" }),
42+
).toBeVisible();
43+
});
44+
45+
test("German translation - RSS links", async ({ page, config }) => {
46+
await page.goto(config.baseURL + "/de/");
47+
48+
await expect(page.getByRole("link", { name: "Blog RSS" })).toBeVisible();
49+
await expect(
50+
page.getByRole("link", { name: "Veröffentlichungen RSS" }),
51+
).toBeVisible();
52+
});
53+
54+
test("German translation - footer", async ({ page, config }) => {
55+
await page.goto(config.baseURL + "/de/");
56+
57+
await expect(
58+
page.getByText("Erstellt von Patrizio Bekerle mit ❤️"),
59+
).toBeVisible();
60+
});
61+
62+
test("Persian (Farsi) translation - homepage exists", async ({
63+
page,
64+
config,
65+
}) => {
66+
const response = await page.goto(config.baseURL + "/fa/");
67+
expect(response.status()).toBe(200);
68+
await expect(page).toHaveTitle("QOwnNotes");
69+
});
70+
71+
test("Persian (Farsi) translation - content is in Persian", async ({
72+
page,
73+
config,
74+
}) => {
75+
await page.goto(config.baseURL + "/fa/");
76+
77+
// Check Persian navigation links with exact match to avoid strict mode violation
78+
await expect(
79+
page.getByRole("link", { name: "شروع", exact: true }),
80+
).toBeVisible();
81+
await expect(page.getByRole("link", { name: "نصب" })).toBeVisible();
82+
await expect(page.getByRole("link", { name: "کمک مالی" })).toBeVisible();
83+
84+
// Check Persian heading and description
85+
await expect(
86+
page.getByRole("heading", { level: 1, name: "QOwnNotes" }),
87+
).toBeVisible();
88+
await expect(
89+
page.getByText("یادداشت برداری مارک داون پرونده با متن ساده"),
90+
).toBeVisible();
91+
await expect(page.getByRole("link", { name: "شروع سریع⬅" })).toBeVisible();
92+
});
93+
94+
test("Persian (Farsi) translation - feature sections", async ({
95+
page,
96+
config,
97+
}) => {
98+
await page.goto(config.baseURL + "/fa/");
99+
100+
// Check Persian feature headings
101+
await expect(
102+
page.getByRole("heading", {
103+
level: 2,
104+
name: "یادداشت های خود را داشته باشید",
105+
}),
106+
).toBeVisible();
107+
await expect(
108+
page.getByRole("heading", { level: 2, name: "ردپای کوچک" }),
109+
).toBeVisible();
110+
await expect(
111+
page.getByRole("heading", { level: 2, name: "سفارشی سازی" }),
112+
).toBeVisible();
113+
});
114+
115+
test("Persian (Farsi) translation - RSS links", async ({ page, config }) => {
116+
await page.goto(config.baseURL + "/fa/");
117+
118+
await expect(page.getByRole("link", { name: "وبلاگ RSS" })).toBeVisible();
119+
await expect(page.getByRole("link", { name: "RSS انتشارها" })).toBeVisible();
120+
});
121+
122+
test("Persian (Farsi) translation - footer", async ({ page, config }) => {
123+
await page.goto(config.baseURL + "/fa/");
124+
125+
await expect(
126+
page.getByText("ارائه شده توسط پاتریزیو بکرله همراه با ❤️"),
127+
).toBeVisible();
128+
});
129+
130+
test("German translation - getting started page", async ({ page, config }) => {
131+
await page.goto(config.baseURL + "/de/getting-started/overview.html");
132+
await expect(page).toHaveTitle(/bersicht.*QOwnNotes/);
133+
});
134+
135+
test("Persian translation - getting started page", async ({ page, config }) => {
136+
await page.goto(config.baseURL + "/fa/getting-started/overview.html");
137+
await expect(page).toHaveTitle(/مرور کلی.*QOwnNotes/);
138+
});
139+
140+
test("Language selector button exists", async ({ page, config }) => {
141+
await page.goto(config.baseURL + "/");
142+
143+
// Check for language selector button with globe icon
144+
const languageButton = page.getByRole("button", { name: "Languages" });
145+
await expect(languageButton).toBeVisible();
146+
});
147+
148+
test("Translation URLs follow correct pattern", async ({ page, config }) => {
149+
// German URL pattern
150+
await page.goto(config.baseURL + "/de/");
151+
expect(page.url()).toContain("/de/");
152+
153+
// Persian URL pattern
154+
await page.goto(config.baseURL + "/fa/");
155+
expect(page.url()).toContain("/fa/");
156+
});
157+
158+
test("German and Persian pages have correct lang attribute", async ({
159+
page,
160+
config,
161+
}) => {
162+
// Check German page
163+
await page.goto(config.baseURL + "/de/");
164+
const deLangAttr = await page.evaluate(() => document.documentElement.lang);
165+
expect(deLangAttr).toBe("de-DE");
166+
167+
// Check Persian page
168+
await page.goto(config.baseURL + "/fa/");
169+
const faLangAttr = await page.evaluate(() => document.documentElement.lang);
170+
expect(faLangAttr).toBe("fa-IR");
171+
});

0 commit comments

Comments
 (0)