Some checks are pending
Copilot Setup Steps / copilot-setup-steps (push) Waiting to run
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { test, expect } from './fixtures';
|
|
|
|
test.describe('Seed', () => {
|
|
test('seed', async ({ page, createUniqueUser }) => {
|
|
// 1. Create User
|
|
const user = await createUniqueUser();
|
|
|
|
// 2. Go to Login
|
|
await page.goto('/');
|
|
|
|
// 3. Login
|
|
await page.getByLabel('Email').fill(user.email);
|
|
await page.getByLabel('Password').fill(user.password);
|
|
await page.getByRole('button', { name: 'Login' }).click();
|
|
|
|
// 4. Handle transitions (Change Password, Account Setup)
|
|
const dashboard = page.getByText(/Free Workout|Свободная тренировка/i).first();
|
|
const changePass = page.getByRole('heading', { name: /Change Password|Смена пароля/i });
|
|
const initAcc = page.getByRole('heading', { name: /Setup Your Account|Настройка аккаунта/i });
|
|
|
|
try {
|
|
await expect(dashboard.or(changePass).or(initAcc)).toBeVisible({ timeout: 10000 });
|
|
|
|
if (await changePass.isVisible()) {
|
|
await page.getByLabel(/New Password|Новый пароль/i).fill('StrongNewPass123!');
|
|
await page.getByRole('button', { name: /Save|Change|Сохранить/i }).click();
|
|
await expect(dashboard.or(initAcc)).toBeVisible({ timeout: 10000 });
|
|
}
|
|
|
|
if (await initAcc.isVisible()) {
|
|
await page.getByRole('button', { name: /Get Started|Начать работу/i }).click();
|
|
}
|
|
} catch (e) {
|
|
console.log('Transition handling timeout or already reached dashboard');
|
|
}
|
|
|
|
// 5. Ensure we are at Dashboard
|
|
await expect(dashboard).toBeVisible();
|
|
});
|
|
});
|