Skip to content

Commit a03190b

Browse files
committed
#3414 webpage: fix survey-popup test
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 518c36b commit a03190b

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

webpage/tests/survey-popup.spec.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,24 @@ import { test, expect } from "./fixtures.js";
44
test("frontpage has popup with survey question", async ({ page, config }) => {
55
await page.goto(config.baseURL);
66

7-
// Check for the poll/popup with the survey question
7+
// Check for the textbox (use .first() since there are multiple polls on frontpage)
88
await expect(
9-
page.getByText("How did you find out about QOwnNotes?"),
9+
page
10+
.getByRole("textbox", {
11+
name: "How did you find out about QOwnNotes?",
12+
})
13+
.first(),
1014
).toBeVisible();
1115

12-
// Check for the textbox
16+
// Check for the Submit button
1317
await expect(
14-
page.getByRole("textbox", {
15-
name: "How did you find out about QOwnNotes?",
16-
}),
18+
page.getByRole("button", { name: "Submit" }).first(),
1719
).toBeVisible();
1820

19-
// Check for the character counter
20-
await expect(page.getByText("0 / 200")).toBeVisible();
21-
22-
// Check for the Submit button
23-
await expect(page.getByRole("button", { name: "Submit" })).toBeVisible();
24-
2521
// Check for the Close poll button
26-
await expect(page.getByRole("button", { name: "Close poll" })).toBeVisible();
22+
await expect(
23+
page.getByRole("button", { name: "Close poll" }).first(),
24+
).toBeVisible();
2725
});
2826

2927
test("overview page has popup with survey question", async ({
@@ -34,7 +32,9 @@ test("overview page has popup with survey question", async ({
3432

3533
// Check the survey popup is also on other pages
3634
await expect(
37-
page.getByText("How did you find out about QOwnNotes?"),
35+
page.getByRole("textbox", {
36+
name: "How did you find out about QOwnNotes?",
37+
}),
3838
).toBeVisible();
3939
await expect(page.getByRole("button", { name: "Submit" })).toBeVisible();
4040
await expect(page.getByRole("button", { name: "Close poll" })).toBeVisible();
@@ -45,7 +45,9 @@ test("blog page has popup with survey question", async ({ page, config }) => {
4545

4646
// Check the survey popup is on blog page
4747
await expect(
48-
page.getByText("How did you find out about QOwnNotes?"),
48+
page.getByRole("textbox", {
49+
name: "How did you find out about QOwnNotes?",
50+
}),
4951
).toBeVisible();
5052
await expect(page.getByRole("button", { name: "Submit" })).toBeVisible();
5153
});

0 commit comments

Comments
 (0)