test: добавить E2E-тест для множественных окружений и исправить синхронизацию AppState

This commit is contained in:
sokol
2026-02-18 14:26:46 +03:00
parent 4b8f5f3739
commit f262c785aa
2 changed files with 68 additions and 9 deletions

View File

@@ -70,4 +70,39 @@ test.describe('Environment Management', () => {
await expect(page.locator('#environments')).toBeVisible();
await expect(page.locator('#environments option')).toHaveCount(2);
});
test('should create multiple environments and switch between them', async ({ page }) => {
await page.goto('/');
await page.click('button:has-text("Create new")');
// Create env1
page.once('dialog', async dialog => {
await dialog.accept('env1');
});
await page.click('button.btn-success[title="Add environment"]');
await page.waitForTimeout(500);
// Create env2
page.once('dialog', async dialog => {
await dialog.accept('env2');
});
await page.click('button.btn-success[title="Add environment"]');
await page.waitForTimeout(500);
// Verify we have 3 envs (DEFAULT + env1 + env2)
await expect(page.locator('#environments option')).toHaveCount(3);
// Switch to each env and verify page doesn't crash
await page.locator('#environments').selectOption({ index: 0 });
await page.waitForTimeout(200);
await expect(page.locator('#environments')).toBeVisible();
await page.locator('#environments').selectOption('env1');
await page.waitForTimeout(200);
await expect(page.locator('#environments')).toBeVisible();
await page.locator('#environments').selectOption('env2');
await page.waitForTimeout(200);
await expect(page.locator('#environments')).toBeVisible();
});
});