feat: The Other Dude v9.0.1 — full-featured email system
ci: add GitHub Pages deployment workflow for docs site Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
33
frontend/tests/e2e/auth.setup.ts
Normal file
33
frontend/tests/e2e/auth.setup.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { test as setup, expect } from '@playwright/test'
|
||||
|
||||
const authFile = 'tests/e2e/.auth/user.json'
|
||||
|
||||
setup('authenticate', async ({ page }) => {
|
||||
const baseURL = process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:5173'
|
||||
await page.goto(`${baseURL}/login`)
|
||||
|
||||
// Use legacy-auth test user (no SRP/Secret Key required)
|
||||
await page.getByLabel(/email/i).fill(
|
||||
process.env.TEST_ADMIN_EMAIL || 'e2e-test@mikrotik-portal.dev'
|
||||
)
|
||||
await page.getByLabel(/password/i).fill(
|
||||
process.env.TEST_ADMIN_PASSWORD || 'admin123'
|
||||
)
|
||||
await page.getByRole('button', { name: /sign in/i }).click()
|
||||
|
||||
// Legacy auth user may trigger SRP upgrade dialog -- dismiss if present
|
||||
const upgradeDialog = page.getByRole('dialog')
|
||||
if (await upgradeDialog.isVisible({ timeout: 3000 }).catch(() => false)) {
|
||||
// Skip/cancel the SRP upgrade for E2E testing
|
||||
const skipButton = page.getByRole('button', { name: /skip|cancel|later|close/i })
|
||||
if (await skipButton.isVisible({ timeout: 1000 }).catch(() => false)) {
|
||||
await skipButton.click()
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for redirect to dashboard (/ or /tenants/...)
|
||||
await expect(page).toHaveURL(/\/$|\/tenants/, { timeout: 15000 })
|
||||
|
||||
// Save storage state (cookies + localStorage) for reuse across tests
|
||||
await page.context().storageState({ path: authFile })
|
||||
})
|
||||
Reference in New Issue
Block a user