From f57a2e13f12ca2e627b8a4572996ac5f6727f94d Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Tue, 10 Feb 2026 09:53:39 -0800 Subject: [PATCH] Require password in singleUserScene --- libs/playwright-helpers/src/example.play.spec.ts | 4 ++-- libs/playwright-helpers/src/fixtures/auth.fixture.ts | 6 ++++-- .../src/scene-templates/single-user.scene.ts | 1 + libs/playwright-helpers/src/test.ts | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/playwright-helpers/src/example.play.spec.ts b/libs/playwright-helpers/src/example.play.spec.ts index 8608cceb0a8..d44c7bf14ee 100644 --- a/libs/playwright-helpers/src/example.play.spec.ts +++ b/libs/playwright-helpers/src/example.play.spec.ts @@ -11,10 +11,10 @@ test.skip("login and save session", async ({ auth }) => { await expectUnlockedAs(scene.mangle("test@example.com"), page); }); -test.skip("As long as the previous test ran in this worker, this time it will reuse authentication", async ({ +test.only("As long as the previous test ran in this worker, this time it will reuse authentication", async ({ auth, }) => { - const { page, scene } = await auth.authenticate("test@example.com", "asdfasdfasdf"); + const { page, scene } = await auth.authenticate("test@example.com", "passwordpassword"); await expectUnlockedAs(scene.mangle("test@example.com"), page); }); diff --git a/libs/playwright-helpers/src/fixtures/auth.fixture.ts b/libs/playwright-helpers/src/fixtures/auth.fixture.ts index c6420e5be50..790c223ce5e 100644 --- a/libs/playwright-helpers/src/fixtures/auth.fixture.ts +++ b/libs/playwright-helpers/src/fixtures/auth.fixture.ts @@ -46,7 +46,9 @@ type AuthenticatedContext = { scene: SingleUserScene; }; -type SessionOptions = Simplify, "email">> & { +type SessionOptions = Simplify< + Except, "email" | "password"> +> & { /** The page to use for authenticating */ page?: Page; }; @@ -158,7 +160,7 @@ export class AuthFixture { password: string, options: SessionOptions = {}, ): Promise { - const scene = await Play.scene(new SingleUserSceneTemplate({ ...options, email })); + const scene = await Play.scene(new SingleUserSceneTemplate({ ...options, email, password })); return await this.authenticateForScene(scene, password); } diff --git a/libs/playwright-helpers/src/scene-templates/single-user.scene.ts b/libs/playwright-helpers/src/scene-templates/single-user.scene.ts index e50882103e2..1bb7755bc65 100644 --- a/libs/playwright-helpers/src/scene-templates/single-user.scene.ts +++ b/libs/playwright-helpers/src/scene-templates/single-user.scene.ts @@ -16,6 +16,7 @@ type SceneResult = { }; type UpParams = { email: string; + password: string; emailVerified?: boolean; premium?: boolean; }; diff --git a/libs/playwright-helpers/src/test.ts b/libs/playwright-helpers/src/test.ts index 1bf689fccc3..0874b548246 100644 --- a/libs/playwright-helpers/src/test.ts +++ b/libs/playwright-helpers/src/test.ts @@ -67,7 +67,7 @@ export async function cleanStage(): Promise { // eslint-disable-next-line no-console console.warn( "PLAYWRIGHT_SKIP_CLEAN_STAGE is set, run\n", - `curl -X DELETE ${new URL(playId, webServerBaseUrl).toString()}\n`, + `curl -X DELETE ${new URL(`/seed/${playId}`, webServerBaseUrl).toString()}\n`, ); return; }