From c4f8d939d2bf7fc999fae8acc33b6f47b1be628e Mon Sep 17 00:00:00 2001 From: Lectom Date: Thu, 21 May 2026 14:58:26 +0900 Subject: [PATCH] test verify-only approval client errors --- userfront-e2e/tests/auth-routing.spec.ts | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/userfront-e2e/tests/auth-routing.spec.ts b/userfront-e2e/tests/auth-routing.spec.ts index ca6b30ab..aadd4e68 100644 --- a/userfront-e2e/tests/auth-routing.spec.ts +++ b/userfront-e2e/tests/auth-routing.spec.ts @@ -143,6 +143,23 @@ async function mockUserfrontApis( }); } +function collectClientFailures(page: Page): string[] { + const failures: string[] = []; + page.on('pageerror', (error) => { + failures.push(error.message); + }); + page.on('console', (message) => { + const text = message.text(); + if ( + message.type() === 'error' || + /exception|verify_failed|verification failed|인증 실패/i.test(text) + ) { + failures.push(text); + } + }); + return failures; +} + test.describe('UserFront WASM auth routing', () => { test('비로그인 /ko 진입 시 /ko/signin 으로 리다이렉트된다', async ({ page }) => { await mockUserfrontApis(page, { sessionStatus: 401 }); @@ -207,6 +224,7 @@ test.describe('UserFront WASM auth routing', () => { page, }) => { let userMeCalls = 0; + const clientFailures = collectClientFailures(page); const verifyRequests: Array<{ path: string; body: Record; @@ -243,6 +261,8 @@ test.describe('UserFront WASM auth routing', () => { await page.waitForTimeout(300); await expect(page).toHaveURL(/\/ko\/l\/AB123456$/); + await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/); + expect(clientFailures).toEqual([]); }); test('verifyOnly 승인 완료 버튼은 SMS 링크에서 user/me 조회나 루트 이동을 만들지 않는다', async ({ @@ -250,6 +270,7 @@ test.describe('UserFront WASM auth routing', () => { }) => { let userMeCalls = 0; let verifyCalls = 0; + const clientFailures = collectClientFailures(page); await mockUserfrontApis(page, { sessionStatus: 401, @@ -280,6 +301,8 @@ test.describe('UserFront WASM auth routing', () => { expect(userMeCalls).toBe(0); await expect(page).toHaveURL(/\/ko\/l\/AB123456$/); + await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/); + expect(clientFailures).toEqual([]); }); test('verifyOnly 승인 링크를 팝업에서 닫으면 창만 닫히고 부모는 이동하지 않는다', async ({ @@ -287,6 +310,7 @@ test.describe('UserFront WASM auth routing', () => { }, testInfo) => { let userMeCalls = 0; let verifyCalls = 0; + const clientFailures = collectClientFailures(page); await mockUserfrontApis(page, { sessionStatus: 401, @@ -329,12 +353,14 @@ test.describe('UserFront WASM auth routing', () => { expect(userMeCalls).toBe(0); await expect(page).toHaveURL('about:blank'); + expect(clientFailures).toEqual([]); }); test('verifyOnly 승인 완료 버튼은 이메일 magic link에서도 user/me 조회나 루트 이동을 만들지 않는다', async ({ page, }) => { let userMeCalls = 0; + const clientFailures = collectClientFailures(page); const verifyRequests: Array<{ path: string; body: Record; @@ -374,12 +400,15 @@ test.describe('UserFront WASM auth routing', () => { expect(userMeCalls).toBe(0); await expect(page).toHaveURL(/\/ko\/verify\/e2e-email-token$/); + await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/); + expect(clientFailures).toEqual([]); }); test('verifyOnly 승인 완료 버튼은 이메일 code link에서도 user/me 조회나 루트 이동을 만들지 않는다', async ({ page, }) => { let userMeCalls = 0; + const clientFailures = collectClientFailures(page); const verifyRequests: Array<{ path: string; body: Record; @@ -427,5 +456,7 @@ test.describe('UserFront WASM auth routing', () => { await expect(page).toHaveURL( /\/ko\/verify\?loginId=e2e(?:%40|@)example\.com&code=654321&pendingRef=pending-email$/, ); + await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/); + expect(clientFailures).toEqual([]); }); });