Fix 22 UI tests: auto-retry assertions instead of point-in-time checks

Problem: After waitForAngular, content assertions ran before Angular's
XHR data loaded. Tests checked textContent('body') at a point when
the table/heading hadn't rendered yet.

Fix: Replace point-in-time checks with Playwright auto-retry assertions:
- expect(locator).toBeVisible({ timeout: 15_000 }) — retries until visible
- expect(locator).toContainText('X', { timeout: 15_000 }) — retries until text appears
- expect(rows.first()).toBeVisible() — retries until table has data

Also: landing page test now uses waitForFunction to detect Angular redirect.

10 files changed, net -45 lines (simpler, more robust assertions).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-02 22:04:52 +03:00
parent ae64042759
commit 9402f1a558
10 changed files with 74 additions and 119 deletions

View File

@@ -137,15 +137,11 @@ test.describe('Pagination — UI Pager', () => {
});
await waitForAngular(page);
// The pager should show "X total · page Y of Z"
// The pager should show "X total . page Y of Z" — auto-retry
const pagerInfo = page.locator('.pager__info');
const isVisible = await pagerInfo.isVisible({ timeout: 5_000 }).catch(() => false);
if (isVisible) {
const text = await pagerInfo.textContent();
expect(text).toContain('total');
expect(text).toContain('page');
}
await expect(pagerInfo).toBeVisible({ timeout: 15_000 });
await expect(pagerInfo).toContainText('total', { timeout: 15_000 });
await expect(pagerInfo).toContainText('page', { timeout: 15_000 });
await snap(page, 'pagination-ui-pager');
});
@@ -157,17 +153,15 @@ test.describe('Pagination — UI Pager', () => {
});
await waitForAngular(page);
// Check for pagination navigation
// Check for pagination navigation — auto-retry
const pager = page.locator('.pager');
const isVisible = await pager.isVisible({ timeout: 5_000 }).catch(() => false);
await expect(pager).toBeVisible({ timeout: 15_000 });
if (isVisible) {
// Should have navigation buttons
const firstBtn = page.locator('button[title="First page"]');
const lastBtn = page.locator('button[title="Last page"]');
await expect(firstBtn).toBeVisible({ timeout: 3_000 });
await expect(lastBtn).toBeVisible({ timeout: 3_000 });
}
// Should have navigation buttons
const firstBtn = page.locator('button[title="First page"]');
const lastBtn = page.locator('button[title="Last page"]');
await expect(firstBtn).toBeVisible({ timeout: 15_000 });
await expect(lastBtn).toBeVisible({ timeout: 15_000 });
await snap(page, 'pagination-ui-controls');
});