Extract shared test runner (helpers.js), add file-based SQLite with setup_db.py for fixture seeding, and add tests for auth guard, credentials management, full registration flow, health endpoint, password auth, and magic link registration errors. 66 checks across 7 test files.
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
// tests/e2e/test_registration.js
|
|
// Tests magic link registration error states: invalid token, used token.
|
|
|
|
const { TARGET_URL, run } = require('./helpers');
|
|
|
|
run(async (page, assert) => {
|
|
const fixtures = JSON.parse(process.env.E2E_FIXTURES || '{}');
|
|
|
|
// ---- Invalid token ----
|
|
console.log('\n--- Invalid registration token ---');
|
|
const resp1 = await page.goto(`${TARGET_URL}/register/invalid-token-12345`);
|
|
assert(resp1.status() === 400, `Invalid token returns 400 (got: ${resp1.status()})`);
|
|
const body1 = await page.locator('body').textContent();
|
|
assert(
|
|
body1.includes('Invalid or expired'),
|
|
`Shows invalid/expired message (got: "${body1.trim()}")`
|
|
);
|
|
|
|
// ---- Used token ----
|
|
console.log('\n--- Used registration token ---');
|
|
assert(fixtures.used_token, 'Used token fixture exists');
|
|
const resp2 = await page.goto(`${TARGET_URL}/register/${fixtures.used_token}`);
|
|
assert(resp2.status() === 400, `Used token returns 400 (got: ${resp2.status()})`);
|
|
const body2 = await page.locator('body').textContent();
|
|
assert(
|
|
body2.includes('Invalid or expired'),
|
|
`Shows invalid/expired for used token (got: "${body2.trim()}")`
|
|
);
|
|
});
|