23 lines
1.0 KiB
TypeScript
23 lines
1.0 KiB
TypeScript
export async function handleFirstLogin(page: any) {
|
|
try {
|
|
const heading = page.getByRole('heading', { name: /Change Password/i });
|
|
const initAcc = page.getByRole('heading', { name: /Setup Your Account/i });
|
|
const dashboard = page.getByText(/Free Workout|Свободная тренировка/i).first();
|
|
|
|
await expect(heading.or(initAcc).or(dashboard)).toBeVisible({ timeout: 10000 });
|
|
|
|
if (await heading.isVisible()) {
|
|
await page.getByLabel(/New Password|Новый пароль/i).fill('StrongNewPass123!');
|
|
await page.getByRole('button', { name: /Save|Change|Сохранить/i }).click();
|
|
await expect(initAcc.or(dashboard)).toBeVisible({ timeout: 10000 });
|
|
}
|
|
|
|
if (await initAcc.isVisible()) {
|
|
await page.getByRole('button', { name: /Get Started|Начать работу/i }).click();
|
|
await expect(dashboard).toBeVisible({ timeout: 10000 });
|
|
}
|
|
} catch (e) {
|
|
// Fallback or already handled
|
|
}
|
|
}
|