super-productivity/e2e/tests/task-list-basic/task-list-start-stop.spec.ts
Johannes Millan 11d85208e5 refactor(e2e): replace waitForTimeout with condition-based waits
- Replace ~100 waitForTimeout calls with proper condition-based waits
- Extract shared utilities for time input and task scheduling
- Add timeout constants for consistent wait times
- Add new selectors for reminder dialogs and detail panels

Files refactored across 25+ test files including:
- Plugin tests (lifecycle, upload, loading, enable, structure)
- Reminder tests (view-task, schedule-page, default-options)
- Work view, planner, focus mode, and app feature tests
- Task dragdrop, autocomplete, and daily summary tests

New utilities created:
- e2e/utils/time-input-helper.ts - Robust time input filling
- e2e/utils/schedule-task-helper.ts - Task scheduling helpers
- e2e/constants/timeouts.ts - Standardized timeout values
2026-01-03 15:29:38 +01:00

34 lines
1.1 KiB
TypeScript

import { expect, test } from '../../fixtures/test.fixture';
test.describe('Task List - Start/Stop', () => {
test('should start and stop single task', async ({ page, workViewPage }) => {
// Wait for work view to be ready
await workViewPage.waitForTaskList();
// Add a task
await workViewPage.addTask('0 C task');
// Get the first task
const firstTask = page.locator('task').first();
// Hover over the task to show the play button
await firstTask.hover();
// Wait for play button to be visible and click it
const playBtn = page.locator('.play-btn.tour-playBtn').first();
await playBtn.waitFor({ state: 'visible' });
await playBtn.click();
// Verify the task has the 'isCurrent' class (auto-waits)
await expect(firstTask).toHaveClass(/isCurrent/, { timeout: 5000 });
// Hover again to ensure button is visible
await firstTask.hover();
// Click the play button again to stop the task
await playBtn.click();
// Verify the task no longer has the 'isCurrent' class (auto-waits)
await expect(firstTask).not.toHaveClass(/isCurrent/, { timeout: 5000 });
});
});