Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { defineConfig } from '@playwright/test';

// Minimal Playwright configuration
export default defineConfig({
testDir: './tests/e2e',
timeout: 30000,
retries: 2,
use: {
baseURL: 'http://localhost:3000',
headless: true,
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
// Only test in Chromium for now
projects: [
{
name: 'chromium',
use: { channel: 'chrome' },
},
],
webServer: {
command: 'npm run dev:frontend',
port: 3000,
reuseExistingServer: !process.env.CI,
},
});
4 changes: 4 additions & 0 deletions test-results/.last-run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"status": "passed",
"failedTests": []
}
21 changes: 21 additions & 0 deletions tests/e2e/auth/login.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { test, expect } from '@playwright/test'

test.describe('Login Flow', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/login')
})

test('should display login form', async ({ page }) => {
await expect(page.locator('h2')).toContainText('Login')
await expect(page.locator('input[name="email"]')).toBeVisible()
await expect(page.locator('input[name="password"]')).toBeVisible()
await expect(page.locator('button[type="submit"]')).toBeVisible()
})

test('should navigate to signup page', async ({ page }) => {
await page.locator('text=Signup →').click()
await expect(page).toHaveURL(/\/signup/)
})


})
17 changes: 17 additions & 0 deletions tests/e2e/auth/role-selection.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test, expect } from '@playwright/test'

test.describe('Role Selection', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/signup')
})

test('should display role dropdown', async ({ page }) => {
await expect(page.locator('select[name="userType"]')).toBeVisible()
await expect(page.locator('select[name="userType"]')).toHaveValue('patient')
})

test('should change role selection', async ({ page }) => {
await page.locator('select[name="userType"]').selectOption('staff')
await expect(page.locator('select[name="userType"]')).toHaveValue('staff')
})
})
19 changes: 19 additions & 0 deletions tests/e2e/auth/signup.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { test, expect } from '@playwright/test'

test.describe('Signup Flow', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/signup')
})

test('should display signup form', async ({ page }) => {
await expect(page.locator('h2')).toContainText('Sign Up')
await expect(page.locator('select[name="userType"]')).toBeVisible()
await expect(page.locator('input[name="name"]')).toBeVisible()
await expect(page.locator('input[name="email"]')).toBeVisible()
})

test('should allow role selection', async ({ page }) => {
await page.locator('select[name="userType"]').selectOption('doctor')
await expect(page.locator('select[name="userType"]')).toHaveValue('doctor')
})
})