My-Weekly-ToDo-List/tests/tasks/task-management.spec.ts
mARTin 798bcfe44a feat: Add Google Tasks, Apple Reminders, task import/sync, holidays, and UI enhancements
- Add Google Tasks integration and Apple Reminders support
- Add task import/export with list management APIs
- Add goal API for weekly goals
- Add German holidays library
- Add ImportListModal component
- Enhance WeeklyView with major UI improvements
- Enhance CalendarSettings with new connection options
- Add external task fields to database schema
- Add Playwright test suites for auth and tasks
- Add iCloud reminders Python scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:56:14 +01:00

47 lines
1.9 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Task Management', () => {
// These tests assume user is authenticated.
// In a real scenario, we'd use a storage state or login in beforeEach.
// For now, we'll assume navigation to / leads to a functional dashboard if already logged in locally.
test.beforeEach(async ({ page }) => {
await page.goto('/');
// Check if we are on the dashboard, otherwise skip or handle login
// await expect(page).toHaveURL(/.*tasks|dashboard/);
});
test('should create a new task', async ({ page }) => {
const taskInput = page.locator('[data-testid="task-input"]');
if (await taskInput.isVisible()) {
const taskTitle = `New Task ${Date.now()}`;
await taskInput.fill(taskTitle);
await page.keyboard.press('Enter');
await expect(page.getByText(taskTitle)).toBeVisible();
}
});
test('should mark a task as completed', async ({ page }) => {
// Find the first task checkbox
const firstTaskCheckbox = page.locator('input[type="checkbox"]').first();
if (await firstTaskCheckbox.isVisible()) {
const isChecked = await firstTaskCheckbox.isChecked();
await firstTaskCheckbox.click();
await expect(firstTaskCheckbox).toBeChecked({ checked: !isChecked });
}
});
test('should delete a task', async ({ page }) => {
// Find a task and its delete button
// This depends heavily on the UI structure
const taskItem = page.locator('[data-testid^="task-item-"]').first();
if (await taskItem.isVisible()) {
const deleteButton = taskItem.locator('button').filter({ has: page.locator('svg') }); // Simple heuristic for icon button
await deleteButton.click();
// Should no longer be in the document
await expect(taskItem).not.toBeVisible();
}
});
});