Skip to content

Commit e3b145a

Browse files
committed
Updated tests
1 parent 900daf7 commit e3b145a

9 files changed

Lines changed: 37 additions & 32 deletions

tests/dashboard.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { loggedInTest as test, expect } from "./helpers/test-fixtures";
44
test.describe("Dashboard Management", () => {
55
test.beforeEach(async ({ page }) => {
66
await page.goto("/dashboard");
7-
// Wait for the main page header to confirm dashboard rendered (welcome greeting).
8-
await expect(page.locator("h1, h2, h3").getByText(/Welcome to/).first()).toBeVisible({ timeout: 15000 });
7+
// Wait for the dashboard to render (welcome greeting — now a paragraph, not a heading).
8+
await expect(page.getByText(/Welcome to/).first()).toBeVisible({ timeout: 15000 });
99
// Wait for the People search card to render — it's the first thing in the main column.
1010
await expect(page.locator("#searchText")).toBeVisible({ timeout: 15000 });
1111
});

tests/event-reminders.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ test.describe.serial("Event reminders editor", () => {
8888
await page.locator('[data-testid="save-calendar-button"]').click();
8989
const row = page.locator("table tbody tr").filter({ hasText: CALENDAR }).first();
9090
await expect(row).toBeVisible({ timeout: 15000 });
91-
await row.click();
91+
await row.locator("a").first().click();
9292
await page.waitForURL(/\/calendars\/[\w-]+/, { timeout: 10000 });
9393

9494
await page.locator('[data-testid="new-event-button"]').click();

tests/forms.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ test.describe("Person form submissions (profile rail)", () => {
190190
test("a seeded submission renders its stored answers", async ({ page }) => {
191191
await navigateToPeople(page);
192192
await openPersonRow(page, "Brian Harris");
193+
await page.getByRole("tab", { name: "Forms" }).click();
193194
const railItem = page.getByText("Visitor Information Card", { exact: true }).first();
194195
await expect(railItem).toBeVisible({ timeout: 10000 });
195196
await railItem.click();
@@ -201,6 +202,7 @@ test.describe("Person form submissions (profile rail)", () => {
201202
test("submitting a person form stores and re-renders the answers", async ({ page }) => {
202203
await navigateToPeople(page);
203204
await openPersonRow(page, SEED_PEOPLE.DONALD);
205+
await page.getByRole("tab", { name: "Forms" }).click();
204206
const railItem = page.getByText("Visitor Information Card", { exact: true }).first();
205207
await expect(railItem).toBeVisible({ timeout: 10000 });
206208
await railItem.click();

tests/registration-commerce.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test.describe.serial("Registrations Commerce — settings panels, paid roster, w
7272
await page.locator('[data-testid="save-calendar-button"]').click();
7373
const row = page.locator("table tbody tr").filter({ hasText: CALENDAR }).first();
7474
await expect(row).toBeVisible({ timeout: 15000 });
75-
await row.click();
75+
await row.locator("a").first().click();
7676
await page.waitForURL(/\/calendars\/[\w-]+/, { timeout: 10000 });
7777

7878
await page.locator('[data-testid="new-event-button"]').click();

tests/rooms-resources.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ test.describe.serial("Rooms, resources & approvals", () => {
151151
await page.locator('[data-testid="save-calendar-button"]').click();
152152
const row = page.locator("table tbody tr").filter({ hasText: CALENDAR }).first();
153153
await expect(row).toBeVisible({ timeout: 15000 });
154-
await row.click();
154+
await row.locator("a").first().click();
155155
await page.waitForURL(/\/calendars\/[\w-]+/, { timeout: 10000 });
156156

157157
await page.locator('[data-testid="new-event-button"]').click();
@@ -231,7 +231,7 @@ test.describe.serial("Rooms, resources & approvals", () => {
231231
test("imports events from a pasted .ics calendar", async () => {
232232
await navigateToCalendars(page);
233233
const row = page.locator("table tbody tr").filter({ hasText: CALENDAR }).first();
234-
await row.click();
234+
await row.locator("a").first().click();
235235
await page.waitForURL(/\/calendars\/[\w-]+/, { timeout: 10000 });
236236
await page.locator('[data-testid="import-ics-button"]').click();
237237
await selectOption(page, "import-ics-group-select", APPROVAL_GROUP);

tests/serving-lessons.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { navigateToServing } from "./helpers/navigation";
66
import { STORAGE_STATE_PATH } from "./global-setup";
77

88
// "Apollos" names are private to this spec; retries would create duplicate tabs.
9+
test.describe.serial("Serving Management - Lessons", () => {
910
test.describe.configure({ retries: 0 });
1011
let page: Page;
1112

tests/serving-reminders.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ test.describe.serial("Serving Reminders", () => {
8787
test("admin enables a reminder on a plan type, picks a timing chip, and saves", async () => {
8888
await page.goto("/serving/plans");
8989
await page.waitForURL(/\/serving\/plans/, { timeout: 15000 });
90-
await expect(page.getByRole("heading", { name: "Worship", exact: true })).toBeVisible({ timeout: 15000 });
90+
await expect(page.getByRole("tab", { name: "Worship" })).toBeVisible({ timeout: 15000 });
9191

9292
await openPlanTypeEditor(page);
9393
await expandReminders(page);

tests/serving-songs-tasks.spec.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Page } from "@playwright/test";
22
import { servingTest as test, expect } from "./helpers/test-fixtures";
3-
import { editIconButton } from "./helpers/fixtures";
43
import { login } from "./helpers/auth";
54
import { navigateToServing } from "./helpers/navigation";
65
import { STORAGE_STATE_PATH } from "./global-setup";
@@ -54,7 +53,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
5453
const saveBtn = page.locator('[role="dialog"] button').getByText("Save", { exact: true });
5554
await saveBtn.click();
5655
await page.waitForURL(/\/serving\/songs\/[^/]+/, { timeout: 20000 });
57-
const validatedSong = page.getByRole("heading", { name: "Frolic" });
56+
const validatedSong = page.locator("#page-header-title");
5857
await expect(validatedSong).toBeVisible({ timeout: 10000 });
5958
});
6059

@@ -65,7 +64,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
6564
await page.locator('[data-testid="add-song-button"]').waitFor({ state: "visible", timeout: 10000 });
6665
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
6766
await song.click();
68-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
67+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
6968

7069
await page.locator("button").getByText("Add Arrangement").first().click();
7170
await expect(page.getByText("New Arrangement").first()).toBeVisible({ timeout: 10000 });
@@ -76,7 +75,9 @@ test.describe("Serving Management - Songs & Tasks", () => {
7675
const arrCard = page.locator(".MuiCard-root").filter({ hasText: "Arrangement - New Arrangement" });
7776
await arrCard.getByRole("button", { name: "Edit" }).first().click();
7877
await page.locator("button").getByText("Delete").last().click();
79-
await expect(page).toHaveURL(/\/serving\/songs(?:\/?$|\?)/, { timeout: 10000 });
78+
// Frolic still has its default arrangement, so we stay on the song detail (SongPage
79+
// only returns to the list when the last arrangement is deleted). Confirm cleanup.
80+
await expect(arrCard).toHaveCount(0, { timeout: 10000 });
8081
});
8182

8283
test("should add song key", async () => {
@@ -87,7 +88,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
8788

8889
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
8990
await song.click();
90-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
91+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
9192
const allTabs = page.locator('[role="tab"]');
9293
await expect(allTabs).toHaveCount(2, { timeout: 10000 });
9394
const addKeyTab = page.getByRole("tab", { name: /Add/ });
@@ -105,7 +106,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
105106

106107
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
107108
await song.click();
108-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
109+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
109110
const addBtn = page.locator('[id="addBtnGroup"]');
110111
await addBtn.click();
111112
const addLinkBtn = page.locator("li").getByText("Add External Link");
@@ -128,7 +129,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
128129

129130
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
130131
await song.click();
131-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
132+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
132133
const linkRow = page.locator("li").filter({ hasText: "Frolic on YouTube" });
133134
const editBtn = linkRow.locator('button:has(svg[data-testid="EditIcon"])').first();
134135
await editBtn.click();
@@ -149,7 +150,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
149150

150151
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
151152
await song.click();
152-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
153+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
153154
// Link list re-renders mid-load; wait for link to render then dispatch click.
154155
await page.locator('a[href*="youtu.be"]').waitFor({ state: "visible", timeout: 10000 });
155156
const linkRow = page.locator("li").filter({ has: page.locator('a[href*="youtu.be"]') });
@@ -175,7 +176,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
175176

176177
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
177178
await song.click();
178-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
179+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
179180
// Link list re-renders mid-load; wait for link then dispatch click.
180181
await page.locator('a[href*="youtu.be"]').waitFor({ state: "visible", timeout: 10000 });
181182
const linkRow = page.locator("li").filter({ has: page.locator('a[href*="youtu.be"]') });
@@ -194,7 +195,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
194195

195196
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
196197
await song.click();
197-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
198+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
198199
// Scope to Keys card header to disambiguate from other Edit icons.
199200
const editBtn = page.locator(".MuiCard-root").filter({ has: page.getByRole("heading", { name: "Keys", exact: true }) }).locator('button[aria-label="Edit"]').first();
200201
await editBtn.click();
@@ -215,7 +216,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
215216

216217
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
217218
await song.click();
218-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
219+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
219220
const editBtn = page.locator(".MuiCard-root").filter({ has: page.getByRole("heading", { name: "Keys", exact: true }) }).locator('button[aria-label="Edit"]').first();
220221
await editBtn.click();
221222
const keySignature = page.locator('[name="keySignature"]');
@@ -239,7 +240,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
239240

240241
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
241242
await song.click();
242-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
243+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
243244
await page.locator('[role="tab"]').filter({ hasText: "Zacchaeus Key" }).click();
244245
const editBtn = page.locator(".MuiCard-root").filter({ has: page.getByRole("heading", { name: "Keys", exact: true }) }).locator('button[aria-label="Edit"]').first();
245246
await editBtn.click();
@@ -257,7 +258,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
257258

258259
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
259260
await song.click();
260-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
261+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
261262
const extHeading = page.getByRole("heading", { name: "External Links" });
262263
const extContainer = extHeading.locator("xpath=ancestor::div[1]/..");
263264
await extContainer.locator('button:has(svg[data-testid="EditIcon"])').first().click();
@@ -282,7 +283,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
282283

283284
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
284285
await song.click();
285-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
286+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
286287
const extHeading = page.getByRole("heading", { name: "External Links" });
287288
const extContainer = extHeading.locator("xpath=ancestor::div[1]/..");
288289
await extContainer.locator('button:has(svg[data-testid="EditIcon"])').first().click();
@@ -302,8 +303,8 @@ test.describe("Serving Management - Songs & Tasks", () => {
302303

303304
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
304305
await song.click();
305-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
306-
const editBtn = editIconButton(page).nth(2);
306+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
307+
const editBtn = page.locator(".MuiCard-root").filter({ has: page.getByRole("heading", { name: /Arrangement -/ }) }).getByRole("button", { name: "Edit" }).first();
307308
await editBtn.click();
308309
const lyricBox = page.locator('[name="lyrics"]');
309310
await lyricBox.fill("No Lyrics");
@@ -322,8 +323,8 @@ test.describe("Serving Management - Songs & Tasks", () => {
322323

323324
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
324325
await song.click();
325-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
326-
const editBtn = editIconButton(page).nth(2);
326+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
327+
const editBtn = page.locator(".MuiCard-root").filter({ has: page.getByRole("heading", { name: /Arrangement -/ }) }).getByRole("button", { name: "Edit" }).first();
327328
await editBtn.click();
328329
const lyricBox = page.locator('[name="lyrics"]');
329330
await expect(lyricBox).toHaveCount(1);
@@ -346,8 +347,8 @@ test.describe("Serving Management - Songs & Tasks", () => {
346347

347348
const song = page.locator("a").getByText("Frolic", { exact: true }).first();
348349
await song.click();
349-
await expect(page.getByRole("heading", { name: "Frolic" })).toBeVisible({ timeout: 10000 });
350-
const editBtn = editIconButton(page).nth(2);
350+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
351+
const editBtn = page.locator(".MuiCard-root").filter({ has: page.getByRole("heading", { name: /Arrangement -/ }) }).getByRole("button", { name: "Edit" }).first();
351352
await editBtn.click();
352353
const deleteBtn = page.locator("button").getByText("Delete").last();
353354
await deleteBtn.click();
@@ -525,7 +526,7 @@ test.describe("Serving Management - Songs & Tasks", () => {
525526

526527
const song = page.locator("a").getByText("Amazing Grace", { exact: true }).first();
527528
await song.click();
528-
await expect(page.getByRole("heading", { name: "Amazing Grace" })).toBeVisible({ timeout: 10000 });
529+
await expect(page.locator("#page-header-title")).toBeVisible({ timeout: 10000 });
529530

530531
const arrangementCard = page.locator(".MuiCard-root").filter({ hasText: /^Arrangement - / });
531532
await expect(arrangementCard).toBeVisible({ timeout: 10000 });

tests/website.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ test.describe("Website Management", () => {
7979
await name.fill("Zebedee Test Page");
8080
const saveBtn = page.locator("button").getByText("Save");
8181
await saveBtn.click();
82+
// Redesign: the "Previewing: …" banner is now a paragraph, so only the page-card h6 carries the title.
8283
const validatedPage = page.locator("h6").getByText("Zebedee Test Page");
83-
await expect(validatedPage).toHaveCount(2);
84+
await expect(validatedPage).toHaveCount(1);
8485
});
8586

8687
test("should cancel editing page title", async () => {
@@ -777,7 +778,7 @@ test.describe("Website Management", () => {
777778
// Demo data seeds a solid-nav linkColor override (see globalStyles in demo.sql), so
778779
// the field starts enabled rather than disabled — just ensure the toggle is on
779780
// (check() is a no-op if already checked) instead of assuming a disabled start state.
780-
await linkToggle.check();
781+
if (!(await linkToggle.isChecked())) await linkToggle.check({ force: true });
781782
await expect(linkInput).toBeEnabled();
782783
// `fill` does not work on type=color; use React's native setter.
783784
await linkInput.evaluate((el: HTMLInputElement) => {
@@ -887,7 +888,7 @@ test.describe("Website Management", () => {
887888
await name.fill("Zacchaeus Test Calendar");
888889
const saveBtn = page.locator('[data-testid="save-calendar-button"]');
889890
await saveBtn.click();
890-
const validatedCalendar = page.locator("h6").getByText("Zacchaeus Test Calendar");
891+
const validatedCalendar = page.getByRole("link", { name: "Zacchaeus Test Calendar" });
891892
await expect(validatedCalendar).toHaveCount(1);
892893
});
893894

@@ -945,7 +946,7 @@ test.describe("Website Management", () => {
945946
await name.fill("Zebedee Test Calendar");
946947
const saveBtn = page.locator('[data-testid="save-calendar-button"]');
947948
await saveBtn.click();
948-
const validatedChange = page.locator("h6").getByText("Zebedee Test Calendar");
949+
const validatedChange = page.getByRole("link", { name: "Zebedee Test Calendar" });
949950
await expect(validatedChange).toHaveCount(1);
950951
});
951952

0 commit comments

Comments
 (0)