test(e2e): search palette + lesson detail + stats + legacy redirect
Add e2e/ux.spec.ts covering the ⌘K search palette, lesson detail page, stats sections, and the legacy /admin → /lessons redirect. Also fixes two issues uncovered by running the full suite: - Skip auth rate limiter in e2e by running the backend with NODE_ENV=test (registration limit of 5 was tripping later tests). - Render the card table for lesson owners even when the lesson has zero cards, so the first card can be added from the detail page.
This commit is contained in:
@@ -6,7 +6,7 @@ export default defineConfig({
|
||||
webServer: [
|
||||
{
|
||||
command:
|
||||
'rm -f packages/backend/data/e2e.db data/e2e.db && DB_PATH=./data/e2e.db SMTP_HOST=localhost SMTP_PORT=1025 APP_URL=http://localhost:5173 npm -w @flashcard/backend run db:migrate && DB_PATH=./data/e2e.db SMTP_HOST=localhost SMTP_PORT=1025 APP_URL=http://localhost:5173 npm -w @flashcard/backend run dev',
|
||||
'rm -f packages/backend/data/e2e.db data/e2e.db && DB_PATH=./data/e2e.db SMTP_HOST=localhost SMTP_PORT=1025 APP_URL=http://localhost:5173 npm -w @flashcard/backend run db:migrate && NODE_ENV=test DB_PATH=./data/e2e.db SMTP_HOST=localhost SMTP_PORT=1025 APP_URL=http://localhost:5173 npm -w @flashcard/backend run dev',
|
||||
cwd: '../..',
|
||||
port: 3000,
|
||||
reuseExistingServer: false,
|
||||
|
||||
@@ -153,9 +153,9 @@ export function LessonDetailPage() {
|
||||
|
||||
<section>
|
||||
<h2 className="mb-3 font-display text-xl font-bold">Kaarten</h2>
|
||||
{cards.length === 0 ? (
|
||||
{cards.length === 0 && !isOwner ? (
|
||||
<div className="surface p-6 text-center text-sm text-slate-500">
|
||||
{isOwner ? 'Nog geen kaarten — voeg er hieronder een toe.' : 'Deze les heeft nog geen kaarten.'}
|
||||
Deze les heeft nog geen kaarten.
|
||||
</div>
|
||||
) : (
|
||||
<div className="surface overflow-hidden p-1">
|
||||
|
||||
Reference in New Issue
Block a user