test: improve e2e

This commit is contained in:
Johannes Millan 2026-01-17 15:46:49 +01:00
parent 978d71f40d
commit 7f493fcfe6
2 changed files with 18 additions and 3 deletions

View file

@ -54,9 +54,14 @@ export class TaskPage extends BasePage {
async markTaskAsDone(task: Locator): Promise<void> {
await task.waitFor({ state: 'visible' });
await task.hover();
// Give hover effects time to settle
await this.page.waitForTimeout(100);
const doneBtn = task.locator(TASK_DONE_BTN);
await doneBtn.waitFor({ state: 'visible', timeout: 5000 });
await doneBtn.click();
await waitForAngularStability(this.page);
}

View file

@ -15,6 +15,7 @@
import { test, expect } from '../../fixtures/test.fixture';
import { Page, Locator } from '@playwright/test';
import { WorkViewPage } from '../../pages/work-view.page';
import { waitForAngularStability } from '../../utils/waits';
// Helper to open focus mode and select a task
const openFocusModeWithTask = async (
@ -336,12 +337,21 @@ test.describe('Bug #5954: Pomodoro timer sync issues', () => {
await playButton.click();
await expect(task).toHaveClass(/isCurrent/, { timeout: 5000 });
// Step 2: Mark task as done (this stops tracking)
// Wait for Angular to finish re-rendering the task hover controls
// When isCurrent changes, the hover controls switch from play to pause button
await waitForAngularStability(page);
// Step 2: Stop tracking first to avoid continuous re-renders from progress bar
// Use the task page's toggle method which handles play/pause button
await taskPage.toggleTaskTimeTracking(task);
await expect(task).not.toHaveClass(/isCurrent/, { timeout: 5000 });
await waitForAngularStability(page);
// Step 3: Mark task as done (now that tracking is stopped)
await taskPage.markTaskAsDone(task);
await expect(task).toHaveClass(/isDone/, { timeout: 5000 });
await expect(task).not.toHaveClass(/isCurrent/, { timeout: 5000 });
// Step 3: Open focus mode and try to start session
// Step 4: Open focus mode and try to start session
await mainFocusButton.click();
await expect(focusModeOverlay).toBeVisible({ timeout: 5000 });