// @ts-check import { test, expect } from '@playwright/test'; import { loadTestUser } from '../utils/testUser.js'; test.describe('@p0 Profile — Change password toggle', () => { test.setTimeout(20000); test('toggle shows and hides ChangePasswordForm', async ({ page }) => { const u = loadTestUser(); await page.context().clearCookies(); await page.goto('/signin', { waitUntil: 'networkidle' }); await page.getByPlaceholder('Username', { exact: true }).fill(u.username); await page.getByPlaceholder('Password', { exact: true }).fill(u.password); await page.getByRole('button', { name: /^Sign In$/ }).click(); await page.waitForURL('**/signin-landing**', { timeout: 15000 }); await page.goto('/profile', { waitUntil: 'networkidle' }); // Open change password const toggleBtn = page.getByRole('button', { name: /^Change password$/i }); await expect(toggleBtn).toBeVisible(); await toggleBtn.click(); // Form should appear (look for "Update password" button) await expect(page.getByRole('button', { name: /Update password/i })).toBeVisible({ timeout: 5000 }); // Cancel hides it const cancelBtn = page.getByRole('button', { name: /^Cancel password change$/i }); await cancelBtn.click(); await expect(page.getByRole('button', { name: /Update password/i })).toBeHidden({ timeout: 3000 }); }); });