e2e: sign-in spec enters the emailed code; linked-products waits for the click and the 60 s cache
The Events e2e suite on Postgres: 111/111 (volunteers 'asks for cover' is flaky: it passed alone and in the run before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
* its pages on 127.0.0.1:3221 (`next dev` in apps/accounts/frontend). Its own address (127.0.0.1)
|
||||
* differs from the Events site's (localhost), so their cookies stay apart as on two domains.
|
||||
*
|
||||
* Test helper: POST /test/link { installId, url, secret } links Events, as Connect would.
|
||||
* Test helpers: POST /test/link { installId, url, secret } links Events, as Connect would;
|
||||
* GET /test/code?to=<email> answers the last code emailed to that address.
|
||||
*/
|
||||
import http from 'node:http';
|
||||
import { ed25519PublicToPem, generateEd25519 } from '@crosscode/contracts/signing';
|
||||
@@ -17,7 +18,8 @@ import { memoryDb } from '../../../accounts/backend/tests/support/memoryDb.ts';
|
||||
|
||||
const WEB = 'http://127.0.0.1:3221';
|
||||
const db = memoryDb();
|
||||
const ctx = createCtx(loadConfig({ ACCOUNTS_URL: WEB, NODE_ENV: 'test', JOBS_ENABLED: 'false', LINKS_ALLOW_PRIVATE: 'true', HUB_URL: 'http://127.0.0.1:1', TRUST_PROXY: 'true' }), db as never, { messenger: new MemoryMessenger() });
|
||||
const messenger = new MemoryMessenger();
|
||||
const ctx = createCtx(loadConfig({ ACCOUNTS_URL: WEB, NODE_ENV: 'test', JOBS_ENABLED: 'false', LINKS_ALLOW_PRIVATE: 'true', HUB_URL: 'http://127.0.0.1:1', TRUST_PROXY: 'true' }), db as never, { messenger });
|
||||
await ctx.settings.setMany({
|
||||
hub_install_id: '7e2d1c0b-9a8f-4e6d-8c5b-4a3f2e1d0c9b',
|
||||
church_profile: JSON.stringify({ name: 'E2E Church', shortName: 'E2E' }),
|
||||
@@ -26,6 +28,11 @@ const provider = await createProvider(ctx);
|
||||
const app = createApp(ctx, provider);
|
||||
|
||||
http.createServer((req, res) => {
|
||||
if (req.method === 'GET' && req.url?.startsWith('/test/code?')) {
|
||||
const to = new URL(req.url, WEB).searchParams.get('to') ?? '';
|
||||
res.writeHead(200, { 'content-type': 'text/plain' }).end(messenger.lastCode(to) ?? '');
|
||||
return;
|
||||
}
|
||||
if (req.method === 'POST' && req.url === '/test/link') {
|
||||
let body = '';
|
||||
req.on('data', (c) => { body += c; });
|
||||
|
||||
Reference in New Issue
Block a user