ghostguild-org/e2e/admin-board-channels.spec.js
Jennie Robinson Faber bb0dbfe53e test(e2e): align specs with current page structure
join-flow:
- Form now requires Community Guidelines agreement; tests check the
  checkbox before expecting submit to enable.
- Contribution input is a numeric field with preset chip buttons, not a
  USelect with $0/mo options — fill the input directly.
- Success state lives in SignupFlowOverlay ("Welcome to Ghost Guild!");
  no .success-box exists. Match by heading instead.
- Inline .error-box renders OUTSIDE <form>, so duplicate-email assertion
  uses .signup-flow-overlay .error-box (which is the user-facing error).

member-profile:
- "How you appear to other members" copy was retired; replace with the
  stable "Show in Member Directory" structural label.
- Add waitForLoadState('networkidle') after goto for ClientOnly auth
  hydration so "Edit Profile" reliably appears within timeout.

board:
- Add waitForLoadState('networkidle') after goto so the action-bar's
  "+ New Post" click handler is bound before the test clicks.
- Submit button is named exactly "Post" — disambiguate from "+ New Post"
  buttons with { exact: true }.
- Delete is a two-step in-card confirm (Delete → Confirm), not a native
  browser dialog; drop the page.once('dialog') listener.

admin-board-channels:
- Channel name placeholder is "e.g., coop-formation" (no leading #).
- Slack Channel ID input only appears in the Edit modal (v-if="editingId"),
  not on Create — Slack channel is auto-created server-side. Drop the
  slack ID fill from the Create step.
- Add waitForLoadState('networkidle') before opening the modal.
2026-04-26 18:28:14 +01:00

65 lines
2.6 KiB
JavaScript

import { test, expect } from './helpers/fixtures.js'
test.describe('Admin board channels page', () => {
test('page loads for admin', async ({ adminPage }) => {
await adminPage.goto('/admin/board-channels')
await expect(adminPage.getByRole('heading', { name: 'Board Channels' })).toBeVisible({
timeout: 15000,
})
await expect(adminPage.getByRole('button', { name: '+ New Channel' })).toBeVisible()
})
test('create, edit, and delete a channel', async ({ adminPage }) => {
await adminPage.goto('/admin/board-channels')
await adminPage.waitForLoadState('networkidle')
await expect(adminPage.getByRole('heading', { name: 'Board Channels' })).toBeVisible({
timeout: 15000,
})
const suffix = Date.now().toString().slice(-6)
const channelName = `e2e-channel-${suffix}`
const editedName = `e2e-channel-${suffix}-edited`
// --- Create ---
// Create flow only takes a name; the Slack channel ID is auto-assigned on
// creation and only becomes editable in the Edit modal.
await adminPage.getByRole('button', { name: '+ New Channel' }).click()
await expect(adminPage.getByRole('heading', { name: 'New Channel' })).toBeVisible()
await adminPage.locator('input[placeholder="e.g., coop-formation"]').fill(channelName)
// Select the first available cooperative tag if any are present
const firstTagCheckbox = adminPage.locator('.tag-select input[type="checkbox"]').first()
if (await firstTagCheckbox.isVisible().catch(() => false)) {
await firstTagCheckbox.check()
}
await adminPage.getByRole('button', { name: 'Create Channel' }).click()
await expect(adminPage.getByRole('cell', { name: channelName })).toBeVisible({
timeout: 10000,
})
// --- Edit ---
const row = adminPage.locator('tr', { hasText: channelName })
await row.getByRole('button', { name: 'Edit' }).click()
await expect(adminPage.getByRole('heading', { name: 'Edit Channel' })).toBeVisible()
const nameInput = adminPage.locator('input[placeholder="e.g., coop-formation"]')
await nameInput.fill(editedName)
await adminPage.getByRole('button', { name: 'Save Changes' }).click()
await expect(adminPage.getByRole('cell', { name: editedName })).toBeVisible({
timeout: 10000,
})
// --- Delete (confirm dialog) ---
adminPage.once('dialog', (dialog) => dialog.accept())
const editedRow = adminPage.locator('tr', { hasText: editedName })
await editedRow.getByRole('button', { name: 'Delete' }).click()
await expect(adminPage.getByRole('cell', { name: editedName })).not.toBeVisible({
timeout: 10000,
})
})
})