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:
48
tests/e2e/fixtures.ts
Normal file
48
tests/e2e/fixtures.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { test as base } from '@playwright/test';
|
||||
|
||||
// Extend basic test with custom fixtures
|
||||
export const test = base.extend({
|
||||
// Auto-login fixture for admin user
|
||||
adminPage: async ({ page }, use) => {
|
||||
await page.goto('/');
|
||||
await page.fill('input[type="email"]', 'admin@localhost');
|
||||
await page.fill('input[type="password"]', 'admin123!');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Wait for app to load
|
||||
await page.waitForSelector('h1:has-text("Medication Reminder")');
|
||||
|
||||
await use(page);
|
||||
},
|
||||
|
||||
// Regular user login fixture
|
||||
userPage: async ({ page }, use) => {
|
||||
await page.goto('/');
|
||||
|
||||
// Register a test user first if needed
|
||||
await page.click('text=Register');
|
||||
await page.fill('input[type="email"]', 'testuser@example.com');
|
||||
await page.fill('input[name="username"]', 'testuser');
|
||||
await page.fill('input[type="password"]', 'TestPassword123!');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// For mock database, user might be auto-verified
|
||||
// Wait for either verification message or app load
|
||||
try {
|
||||
await page.waitForSelector('h1:has-text("Medication Reminder")', {
|
||||
timeout: 5000,
|
||||
});
|
||||
} catch {
|
||||
// If not auto-logged in, login manually
|
||||
await page.goto('/');
|
||||
await page.fill('input[type="email"]', 'testuser@example.com');
|
||||
await page.fill('input[type="password"]', 'TestPassword123!');
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForSelector('h1:has-text("Medication Reminder")');
|
||||
}
|
||||
|
||||
await use(page);
|
||||
},
|
||||
});
|
||||
|
||||
export { expect } from '@playwright/test';
|
||||
Reference in New Issue
Block a user