All Tests Fixed with Initialize feature
This commit is contained in:
@@ -17,30 +17,23 @@ test.describe('I. Core & Authentication', () => {
|
||||
const changePass = page.getByRole('heading', { name: /Change Password|Смена пароля/i });
|
||||
const initAcc = page.getByRole('heading', { name: /Setup Your Account|Настройка аккаунта/i });
|
||||
|
||||
for (let i = 0; i < 30; i++) {
|
||||
if (await dashboard.isVisible()) {
|
||||
console.log('Dashboard visible.');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await expect(dashboard.or(changePass).or(initAcc)).toBeVisible({ timeout: 10000 });
|
||||
|
||||
if (await changePass.isVisible()) {
|
||||
console.log('Change Password screen detected. Handling...');
|
||||
await page.getByLabel(/New Password|Новый пароль/i).fill('StrongNewPass123!');
|
||||
await page.getByRole('button', { name: /Save|Change|Сохранить/i }).click();
|
||||
// Wait a bit for transition
|
||||
await page.waitForTimeout(1000);
|
||||
continue;
|
||||
await expect(dashboard.or(initAcc)).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
|
||||
if (await initAcc.isVisible()) {
|
||||
console.log('Initialization screen detected. Handling...');
|
||||
await page.getByRole('button', { name: /Get Started|Начать работу/i }).click();
|
||||
// Wait a bit for transition
|
||||
await page.waitForTimeout(1000);
|
||||
continue;
|
||||
await expect(dashboard).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
} catch (e) {
|
||||
console.log('handleFirstLogin timeout or already reached dashboard');
|
||||
}
|
||||
|
||||
// Final check with assertion to fail the test if not reached
|
||||
|
||||
Reference in New Issue
Block a user