Initial commit: Complete NodeJS-native setup
- Migrated from Python pre-commit to NodeJS-native solution - Reorganized documentation structure - Set up Husky + lint-staged for efficient pre-commit hooks - Fixed Dockerfile healthcheck issue - Added comprehensive documentation index
This commit is contained in:
87
tests/e2e/reminders.spec.ts
Normal file
87
tests/e2e/reminders.spec.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Reminder System', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Login as admin
|
||||
await page.goto('/');
|
||||
await page.fill('input[type="email"]', 'admin@localhost');
|
||||
await page.fill('input[type="password"]', 'admin123!');
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator('h1')).toContainText('Medication Reminder');
|
||||
});
|
||||
|
||||
test('should create custom reminder', async ({ page }) => {
|
||||
// Click manage reminders
|
||||
await page.click('button:has-text("Reminders")');
|
||||
|
||||
// Add new reminder
|
||||
await page.click('button:has-text("Add Reminder")');
|
||||
|
||||
// Fill reminder form
|
||||
await page.fill('input[name="title"]', 'Drink Water');
|
||||
await page.selectOption('select[name="icon"]', 'bell');
|
||||
await page.fill('input[name="frequency"]', '60'); // Every hour
|
||||
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Should see reminder in list
|
||||
await expect(page.locator('text=Drink Water')).toBeVisible();
|
||||
});
|
||||
|
||||
test('should edit custom reminder', async ({ page }) => {
|
||||
// First create a reminder
|
||||
await page.click('button:has-text("Reminders")');
|
||||
await page.click('button:has-text("Add Reminder")');
|
||||
await page.fill('input[name="title"]', 'Exercise');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Edit the reminder
|
||||
await page.click('[data-testid="edit-reminder"]');
|
||||
await page.fill('input[name="title"]', 'Morning Exercise');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
await expect(page.locator('text=Morning Exercise')).toBeVisible();
|
||||
});
|
||||
|
||||
test('should delete custom reminder', async ({ page }) => {
|
||||
// Create and then delete reminder
|
||||
await page.click('button:has-text("Reminders")');
|
||||
await page.click('button:has-text("Add Reminder")');
|
||||
await page.fill('input[name="title"]', 'Temporary Reminder');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Delete it
|
||||
await page.click('[data-testid="delete-reminder"]');
|
||||
await page.click('button:has-text("Delete")'); // Confirm
|
||||
|
||||
await expect(page.locator('text=Temporary Reminder')).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('should show scheduled medication doses', async ({ page }) => {
|
||||
// Add a medication first
|
||||
await page.click('button:has-text("Add Medication")');
|
||||
await page.fill('input[name="name"]', 'Scheduled Med');
|
||||
await page.fill('input[name="dosage"]', '5mg');
|
||||
await page.selectOption('select[name="frequency"]', 'daily');
|
||||
await page.fill('input[name="times"]', '3'); // 3 times daily
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Should see scheduled doses for today
|
||||
await expect(page.locator('text=Scheduled Med')).toBeVisible();
|
||||
await expect(page.locator('button:has-text("Take")')).toHaveCount(3);
|
||||
});
|
||||
|
||||
test('should handle missed doses', async ({ page }) => {
|
||||
// This would test the logic for marking doses as missed
|
||||
// when they pass their scheduled time
|
||||
|
||||
// Add medication with past schedule
|
||||
await page.click('button:has-text("Add Medication")');
|
||||
await page.fill('input[name="name"]', 'Past Due Med');
|
||||
await page.fill('input[name="dosage"]', '10mg');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Simulate time passing or manually mark as missed
|
||||
// This would depend on your app's specific implementation
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user