import { test, expect } from '@playwright/test'; const API = 'http://localhost:3000'; test.describe('API Endpoints', () => { test('health check', async ({ request }) => { const res = await request.get(`${API}/health`); expect(res.ok()).toBeTruthy(); const data = await res.json(); expect(data.status).toBe('ok'); }); test('list tasks', async ({ request }) => { const res = await request.get(`${API}/api/v1/tasks`); expect(res.ok()).toBeTruthy(); }); test('list groups', async ({ request }) => { const res = await request.get(`${API}/api/v1/groups`); expect(res.ok()).toBeTruthy(); const data = await res.json(); expect(data.data.length).toBeGreaterThan(0); }); test('system health', async ({ request }) => { const res = await request.get(`${API}/api/v1/system/health`); expect(res.ok()).toBeTruthy(); }); test('create and delete task', async ({ request }) => { const create = await request.post(`${API}/api/v1/tasks`, { data: { title: 'E2E Test Task', priority: 'low' } }); expect(create.ok()).toBeTruthy(); const { data } = await create.json(); const del = await request.delete(`${API}/api/v1/tasks/${data.id}`); expect(del.ok()).toBeTruthy(); }); });