import { test, expect } from '@playwright/test'; import { RoleAuthHelper } from '../../helpers/helpers'; import { ApiHelper } from '../../helpers/api-helper'; test.describe('SLA & Notification Smoke Tests', () => { test('Celery worker and Redis are reachable', async ({ page }) => { const resp = await page.request.get('http://localhost:8000/health/'); expect(resp.status()).toBe(200); const body = await resp.json(); expect(body.status).toBe('ok'); }); test('complaint list page loads for SLA-eligible user', async ({ page }) => { const auth = new RoleAuthHelper(page); await auth.login('hospital_admin'); await page.goto('/complaints/'); await page.waitForLoadState('domcontentloaded'); const bodyText = await page.textContent('body'); expect(bodyText).toBeTruthy(); expect(bodyText).not.toContain('Server Error'); }); test('notification settings page loads', async ({ page }) => { const auth = new RoleAuthHelper(page); await auth.login('hospital_admin'); const resp = await page.goto('/notifications/settings/'); await page.waitForLoadState('domcontentloaded'); const bodyText = await page.textContent('body'); expect(bodyText).toBeTruthy(); expect(bodyText).not.toContain('Server Error'); const hasNotificationForm = bodyText.includes('notification') || bodyText.includes('Notification'); expect(hasNotificationForm || await page.url().includes('/notifications/')).toBeTruthy(); }); test('API can create complaint that triggers notifications', async ({ page }) => { const api = new ApiHelper(page); await api.authenticate('hospital_admin'); const resp = await api.get('/complaints/'); expect([200, 403]).toContain(resp.status()); }); });