import { test, expect } from './helpers/fixtures.js' test.describe('Member profile page', () => { test('profile page loads', async ({ adminPage }) => { await adminPage.goto('/member/profile') await adminPage.waitForLoadState('networkidle') // Auth is checked client-side in onMounted — wait for profile form to render await expect(adminPage.getByText('Edit Profile')).toBeVisible({ timeout: 15000 }) // Verify a stable structural section label, not transient marketing copy await expect(adminPage.getByText('Show in Member Directory')).toBeVisible() }) test('form fields are present', async ({ adminPage }) => { await adminPage.goto('/member/profile') await expect(adminPage.getByText('Edit Profile')).toBeVisible({ timeout: 15000 }) // Name input await expect(adminPage.locator('input[placeholder="Your name"]')).toBeVisible() // Bio textarea await expect(adminPage.locator('textarea[placeholder*="Share your background"]')).toBeVisible() // Save button await expect(adminPage.getByRole('button', { name: 'Save Profile' })).toBeVisible() }) test('bio field accepts input', async ({ adminPage }) => { await adminPage.goto('/member/profile') await adminPage.waitForLoadState('networkidle') await expect(adminPage.getByText('Edit Profile')).toBeVisible({ timeout: 15000 }) const bio = adminPage.locator('textarea[placeholder*="Share your background"]') const saveBtn = adminPage.getByRole('button', { name: 'Save Profile' }) // Save button should start disabled (no changes yet) await expect(saveBtn).toBeDisabled() // Clear and type new text await bio.clear() await bio.fill('Game designer exploring cooperative structures') // Save button should now be enabled await expect(saveBtn).toBeEnabled() }) test('pronouns field editable', async ({ adminPage }) => { await adminPage.goto('/member/profile') await expect(adminPage.getByText('Edit Profile')).toBeVisible({ timeout: 15000 }) const pronouns = adminPage.locator('input[placeholder="e.g., she/her, they/them"]') await expect(pronouns).toBeVisible() await pronouns.clear() await pronouns.fill('they/them') await expect(pronouns).toHaveValue('they/them') }) })