Accessibility fixes.
Some checks are pending
Test / vitest (push) Waiting to run
Test / playwright (push) Blocked by required conditions
Test / visual (push) Blocked by required conditions

This commit is contained in:
Jennie Robinson Faber 2026-04-05 16:03:10 +01:00
parent 4aacb26c4b
commit 88c94aaaf4
12 changed files with 276 additions and 260 deletions

View file

@ -1,48 +1,53 @@
import { test, expect } from './helpers/fixtures.js'
import { test, expect } from "./helpers/fixtures.js";
test.describe('Admin members page', () => {
test('members list loads for admin', async ({ adminPage }) => {
await adminPage.goto('/admin/members')
test.describe("Admin members page", () => {
test("members list loads for admin", async ({ adminPage }) => {
await adminPage.goto("/admin/members");
await expect(adminPage.locator('h1')).toHaveText('Members')
await expect(adminPage.getByText('Manage members, contributions, and access')).toBeVisible()
})
await expect(adminPage.locator("h1")).toHaveText("Members");
await expect(
adminPage.getByText("Manage members, contributions, and access"),
).toBeVisible();
});
test('search bar works', async ({ adminPage }) => {
await adminPage.goto('/admin/members')
test("search bar works", async ({ adminPage }) => {
await adminPage.goto("/admin/members");
const searchInput = adminPage.getByPlaceholder('Search members...')
await expect(searchInput).toBeVisible()
const searchInput = adminPage.getByPlaceholder("Search members...");
await expect(searchInput).toBeVisible();
await searchInput.fill('nonexistent-query-xyz')
await searchInput.fill("nonexistent-query-xyz");
// Page should not crash -- either shows filtered results or the empty state
await expect(
adminPage.locator('table').or(adminPage.getByText('No members found matching your criteria'))
).toBeVisible()
})
adminPage
.locator("table")
.or(adminPage.getByText("No members found matching your criteria")),
).toBeVisible();
});
test('non-admin redirect', async ({ browser }) => {
const context = await browser.newContext()
const page = await context.newPage()
test("non-admin redirect", async ({ browser }) => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('/admin/members')
await page.goto("/admin/members");
// Admin middleware redirects non-admin users to / or /members
await page.waitForURL((url) => !url.pathname.startsWith('/admin'))
expect(page.url()).not.toContain('/admin/members')
await page.waitForURL((url) => !url.pathname.startsWith("/admin"));
expect(page.url()).not.toContain("/admin/members");
await context.close()
})
await context.close();
});
test('add member button opens modal', async ({ adminPage }) => {
await adminPage.goto('/admin/members')
test("add member button opens modal", async ({ adminPage }) => {
await adminPage.goto("/admin/members");
await adminPage.waitForLoadState("networkidle"); // ensure Vue hydration is complete
await adminPage.getByRole('button', { name: 'Add Member' }).click()
await adminPage.getByRole("button", { name: "Add Member" }).click();
// Modal should appear with the form heading and fields
await expect(adminPage.getByText('Add New Member')).toBeVisible()
await expect(adminPage.getByPlaceholder('Full name')).toBeVisible()
await expect(adminPage.getByPlaceholder('email@example.com')).toBeVisible()
})
})
await expect(adminPage.getByText("Add New Member")).toBeVisible();
await expect(adminPage.getByPlaceholder("Full name")).toBeVisible();
await expect(adminPage.getByPlaceholder("email@example.com")).toBeVisible();
});
});