New specs (4):
- accept-invite: pre-registrant flow happy path + cadence/preset UX
- admin-pre-registrants: list, filter, action gating, redirect
- admin-series: list, create, edit (delete skipped — button no-ops)
- admin-site-content: list whitelist, edit + roundtrip on /
Extended specs (6):
- join-flow: cadence ×12 math, guidance label, paid-tier success
- events: series-pass-required, member-savings gating
- admin-events: full CRUD via /admin/events/create?edit=<id>
- admin-members: add-member submit, status select, detail nav
- a11y: add /accept-invite, /member/account, /board, /admin/pre-registrants
- wave-slack-onboarding: 9 of 16 scaffold tests now passing
Cross-file isolation hardening:
- admin-events CRUD: refresh auth cookie (auth.spec.js logout test
bumps tokenVersion on the shared admin), wait for hydration
before form fill, search by unique title to dodge pagination.
- board: switch memberPage from shared admin to dedicated seeded
member to avoid the same tokenVersion race.
- wave-slack §6.4: create dedicated test member, filter by email
before clicking, removing the "first row" anchor.
Also fixed board heading drift ("Board" → "Bulletin Board").
85 lines
2.9 KiB
JavaScript
85 lines
2.9 KiB
JavaScript
import { test, expect } from './helpers/fixtures.js'
|
|
|
|
const WHITELISTED_KEYS = ['homepage.wiki_feature']
|
|
|
|
test.describe('Admin site content page', () => {
|
|
test('page loads for admin', async ({ adminPage }) => {
|
|
await adminPage.goto('/admin/site-content')
|
|
await expect(adminPage.getByRole('heading', { name: 'Site Content' })).toBeVisible({
|
|
timeout: 15000,
|
|
})
|
|
})
|
|
|
|
test('renders one block per whitelisted key', async ({ adminPage }) => {
|
|
await adminPage.goto('/admin/site-content')
|
|
await adminPage.waitForLoadState('networkidle')
|
|
await expect(adminPage.getByRole('heading', { name: 'Site Content' })).toBeVisible({
|
|
timeout: 15000,
|
|
})
|
|
|
|
const blocks = adminPage.locator('.content-block')
|
|
await expect(blocks).toHaveCount(WHITELISTED_KEYS.length)
|
|
|
|
for (const key of WHITELISTED_KEYS) {
|
|
await expect(adminPage.locator('.block-key', { hasText: key })).toBeVisible()
|
|
}
|
|
})
|
|
|
|
test('edit, save, persist, and reflect on public page', async ({ adminPage }) => {
|
|
const key = 'homepage.wiki_feature'
|
|
|
|
await adminPage.goto('/admin/site-content')
|
|
await adminPage.waitForLoadState('networkidle')
|
|
await expect(adminPage.getByRole('heading', { name: 'Site Content' })).toBeVisible({
|
|
timeout: 15000,
|
|
})
|
|
|
|
const original = await adminPage.evaluate(
|
|
async (k) => await (await fetch(`/api/site-content/${k}`)).json(),
|
|
key,
|
|
)
|
|
const originalTitle = original.title || ''
|
|
const originalBody = original.body || ''
|
|
|
|
const stamp = Date.now()
|
|
const newTitle = `e2e title ${stamp}`
|
|
const newBody = `e2e body paragraph ${stamp}`
|
|
|
|
const block = adminPage.locator('.content-block', {
|
|
has: adminPage.locator('.block-key', { hasText: key }),
|
|
})
|
|
await expect(block).toBeVisible()
|
|
|
|
const titleInput = block.locator('input[type="text"]')
|
|
const bodyTextarea = block.locator('textarea')
|
|
|
|
await titleInput.fill(newTitle)
|
|
await bodyTextarea.fill(newBody)
|
|
await block.getByRole('button', { name: 'Save' }).click()
|
|
|
|
await expect(block.locator('.block-meta')).toContainText('Updated', { timeout: 10000 })
|
|
|
|
await adminPage.reload()
|
|
await adminPage.waitForLoadState('networkidle')
|
|
const reloadedBlock = adminPage.locator('.content-block', {
|
|
has: adminPage.locator('.block-key', { hasText: key }),
|
|
})
|
|
await expect(reloadedBlock.locator('input[type="text"]')).toHaveValue(newTitle)
|
|
await expect(reloadedBlock.locator('textarea')).toHaveValue(newBody)
|
|
|
|
await adminPage.goto('/')
|
|
await adminPage.waitForLoadState('networkidle')
|
|
await expect(adminPage.getByText(newBody)).toBeVisible({ timeout: 15000 })
|
|
|
|
await adminPage.evaluate(
|
|
async ({ k, t, b }) => {
|
|
await fetch(`/api/admin/site-content/${k}`, {
|
|
method: 'PUT',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ title: t, body: b }),
|
|
})
|
|
},
|
|
{ k: key, t: originalTitle, b: originalBody },
|
|
)
|
|
})
|
|
})
|