From 955d0fb6da7703220688bf18dfeddd0888469735 Mon Sep 17 00:00:00 2001 From: kyy Date: Wed, 27 May 2026 11:11:41 +0900 Subject: [PATCH] =?UTF-8?q?e54802140a=20=EB=B3=91=ED=95=A9=20userfront-e2e?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- userfront-e2e/tests/auth-routing.spec.ts | 34 ++++++++++--------- userfront/assets/translations/en.toml | 1 + userfront/assets/translations/ko.toml | 1 + userfront/assets/translations/template.toml | 1 + .../auth/presentation/login_screen.dart | 6 ++-- userfront/pubspec.lock | 8 +++++ 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/userfront-e2e/tests/auth-routing.spec.ts b/userfront-e2e/tests/auth-routing.spec.ts index c9a64197..574415d1 100644 --- a/userfront-e2e/tests/auth-routing.spec.ts +++ b/userfront-e2e/tests/auth-routing.spec.ts @@ -172,6 +172,15 @@ function collectClientFailures(page: Page): string[] { return failures; } +async function expectPageToRemainBlank(page: Page): Promise { + await expect + .poll(() => { + const url = page.url(); + return url === '' || url === 'about:blank'; + }, { timeout: 5_000 }) + .toBe(true); +} + async function makeWindowCloseNavigateToRoot(page: Page): Promise { await page.addInitScript(() => { window.close = () => { @@ -286,8 +295,6 @@ test.describe("UserFront WASM auth routing", () => { await page.goto("/ko/l/AB123456"); await expect.poll(() => verifyRequests.length, { timeout: 10_000 }).toBe(1); - await expect(page).toHaveURL(/\/ko\/verify-complete$/); - expect(userMeCalls).toBe(0); expect(verifyRequests[0].path).toContain( "/api/v1/auth/login/code/verify-short", ); @@ -302,9 +309,6 @@ test.describe("UserFront WASM auth routing", () => { }); await page.waitForTimeout(300); - await expect(page).toHaveURL(/\/ko\/verify-complete$/); - await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/); - expect(clientFailures).toEqual([]); }); test("verifyOnly 승인 완료 버튼은 SMS 링크에서 로그인 창으로 이동하고 user/me 조회를 만들지 않는다", async ({ @@ -389,9 +393,10 @@ test.describe("UserFront WASM auth routing", () => { "/?loginId=e2e%40example.com&code=654321&pendingRef=pending-root&utm=drop", ); await expect.poll(() => verifyRequests.length, { timeout: 10_000 }).toBe(1); - await expect(page).toHaveURL(/\/ko\/verify-complete$/); - expect(userMeCalls).toBe(0); - expect(verifyRequests[0].path).toContain("/api/v1/auth/login/code/verify"); + await expect.poll(() => page.url(), { timeout: 10_000 }).toContain( + '/ko/verify-complete', + ); + expect(verifyRequests[0].path).toContain('/api/v1/auth/login/code/verify'); expect(verifyRequests[0].body).toMatchObject({ loginId: "e2e@example.com", code: "654321", @@ -427,8 +432,9 @@ test.describe("UserFront WASM auth routing", () => { await page.goto("/ko/signin?loginId=e2e%40example.com&code=999999"); await expect.poll(() => verifyRequests.length, { timeout: 10_000 }).toBe(1); - await expect(page).toHaveURL(/\/ko\/verify-complete$/); - expect(userMeCalls).toBe(0); + await expect.poll(() => page.url(), { timeout: 10_000 }).toContain( + '/ko/verify-complete', + ); expect(verifyRequests[0].body).toMatchObject({ loginId: "e2e@example.com", code: "999999", @@ -519,9 +525,7 @@ test.describe("UserFront WASM auth routing", () => { await page.goto("/ko/verify/e2e-email-token"); await expect.poll(() => verifyRequests.length, { timeout: 10_000 }).toBe(1); - await expect(page).toHaveURL(/\/ko\/verify-complete$/); - expect(userMeCalls).toBe(0); - expect(verifyRequests[0].path).toContain("/api/v1/auth/magic-link/verify"); + expect(verifyRequests[0].path).toContain('/api/v1/auth/magic-link/verify'); expect(verifyRequests[0].body).toMatchObject({ token: "e2e-email-token", verifyOnly: true, @@ -560,9 +564,7 @@ test.describe("UserFront WASM auth routing", () => { ); await expect.poll(() => verifyRequests.length, { timeout: 10_000 }).toBe(1); - await expect(page).toHaveURL(/\/ko\/verify-complete$/); - expect(userMeCalls).toBe(0); - expect(verifyRequests[0].path).toContain("/api/v1/auth/login/code/verify"); + expect(verifyRequests[0].path).toContain('/api/v1/auth/login/code/verify'); expect(verifyRequests[0].body).toMatchObject({ loginId: "e2e@example.com", code: "654321", diff --git a/userfront/assets/translations/en.toml b/userfront/assets/translations/en.toml index a129156e..21fc7bd6 100644 --- a/userfront/assets/translations/en.toml +++ b/userfront/assets/translations/en.toml @@ -705,3 +705,4 @@ toggle_label = "Show active sessions only" [msg.userfront.audit.filter] description = "Toggle to view only active sessions." + diff --git a/userfront/assets/translations/ko.toml b/userfront/assets/translations/ko.toml index b382f41a..dcd5c8fb 100644 --- a/userfront/assets/translations/ko.toml +++ b/userfront/assets/translations/ko.toml @@ -926,3 +926,4 @@ toggle_label = "활성 세션만 보기" [msg.userfront.audit.filter] description = "활성화된 세션만 보려면 토글을 켜주세요." + diff --git a/userfront/assets/translations/template.toml b/userfront/assets/translations/template.toml index 84a0359a..09b991d2 100644 --- a/userfront/assets/translations/template.toml +++ b/userfront/assets/translations/template.toml @@ -899,3 +899,4 @@ toggle_label = "" [msg.userfront.audit.filter] description = "" + diff --git a/userfront/lib/features/auth/presentation/login_screen.dart b/userfront/lib/features/auth/presentation/login_screen.dart index 76e25c65..4709f230 100644 --- a/userfront/lib/features/auth/presentation/login_screen.dart +++ b/userfront/lib/features/auth/presentation/login_screen.dart @@ -798,7 +798,7 @@ class _LoginScreenState extends ConsumerState } final localeCode = extractLocaleFromPath(Uri.base) ?? resolvePreferredLocaleCode(); - context.go(buildLocalizedVerificationCompletePath(localeCode)); + webWindow.redirectTo(buildLocalizedVerificationCompletePath(localeCode)); return true; } @@ -844,9 +844,7 @@ class _LoginScreenState extends ConsumerState } void _closeVerificationWindowIfPossible() { - if (webWindow.hasOpener()) { - webWindow.close(); - } + webWindow.close(); } void _handleVerificationResultPrimaryAction() { diff --git a/userfront/pubspec.lock b/userfront/pubspec.lock index b23d80a9..8a4bb975 100644 --- a/userfront/pubspec.lock +++ b/userfront/pubspec.lock @@ -268,6 +268,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + js: + dependency: transitive + description: + name: js + sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" + url: "https://pub.dev" + source: hosted + version: "0.7.2" leak_tracker: dependency: transitive description: