diff --git a/tests/e2e/test_checkpoint_ui.spec.ts b/tests/e2e/test_checkpoint_ui.spec.ts index a208f0b8..522f47d2 100644 --- a/tests/e2e/test_checkpoint_ui.spec.ts +++ b/tests/e2e/test_checkpoint_ui.spec.ts @@ -280,6 +280,9 @@ test.describe('Checkpoint UI Workflow', () => { const checkpointItems = page.locator('[data-testid^="checkpoint-item-"]'); const emptyState = page.locator('[data-testid="checkpoint-empty-state"]'); + // Wait for either checkpoint items OR empty state to be visible (prevents race condition) + await expect(checkpointItems.first().or(emptyState)).toBeVisible({ timeout: TIMEOUTS.DOM_UPDATE }); + const count = await checkpointItems.count(); if (count > 0) { @@ -310,6 +313,9 @@ test.describe('Checkpoint UI Workflow', () => { const checkpointItems = page.locator('[data-testid^="checkpoint-item-"]'); const emptyState = page.locator('[data-testid="checkpoint-empty-state"]'); + // Wait for either checkpoint items OR empty state to be visible (prevents race condition) + await expect(checkpointItems.first().or(emptyState)).toBeVisible({ timeout: TIMEOUTS.DOM_UPDATE }); + const count = await checkpointItems.count(); if (count > 0) { @@ -352,6 +358,9 @@ test.describe('Checkpoint UI Workflow', () => { const checkpointItems = page.locator('[data-testid^="checkpoint-item-"]'); const emptyState = page.locator('[data-testid="checkpoint-empty-state"]'); + // Wait for either checkpoint items OR empty state to be visible (prevents race condition) + await expect(checkpointItems.first().or(emptyState)).toBeVisible({ timeout: TIMEOUTS.DOM_UPDATE }); + const count = await checkpointItems.count(); if (count > 0) { @@ -379,6 +388,9 @@ test.describe('Checkpoint UI Workflow', () => { const checkpointItems = page.locator('[data-testid^="checkpoint-item-"]'); const emptyState = page.locator('[data-testid="checkpoint-empty-state"]'); + // Wait for either checkpoint items OR empty state to be visible (prevents race condition) + await expect(checkpointItems.first().or(emptyState)).toBeVisible({ timeout: TIMEOUTS.DOM_UPDATE }); + const count = await checkpointItems.count(); if (count > 0) {