forked from baron/baron-sso
test verify-only approval client errors
This commit is contained in:
@@ -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.describe('UserFront WASM auth routing', () => {
|
||||||
test('비로그인 /ko 진입 시 /ko/signin 으로 리다이렉트된다', async ({ page }) => {
|
test('비로그인 /ko 진입 시 /ko/signin 으로 리다이렉트된다', async ({ page }) => {
|
||||||
await mockUserfrontApis(page, { sessionStatus: 401 });
|
await mockUserfrontApis(page, { sessionStatus: 401 });
|
||||||
@@ -207,6 +224,7 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
let userMeCalls = 0;
|
let userMeCalls = 0;
|
||||||
|
const clientFailures = collectClientFailures(page);
|
||||||
const verifyRequests: Array<{
|
const verifyRequests: Array<{
|
||||||
path: string;
|
path: string;
|
||||||
body: Record<string, unknown>;
|
body: Record<string, unknown>;
|
||||||
@@ -243,6 +261,8 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
||||||
|
await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/);
|
||||||
|
expect(clientFailures).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('verifyOnly 승인 완료 버튼은 SMS 링크에서 user/me 조회나 루트 이동을 만들지 않는다', async ({
|
test('verifyOnly 승인 완료 버튼은 SMS 링크에서 user/me 조회나 루트 이동을 만들지 않는다', async ({
|
||||||
@@ -250,6 +270,7 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
}) => {
|
}) => {
|
||||||
let userMeCalls = 0;
|
let userMeCalls = 0;
|
||||||
let verifyCalls = 0;
|
let verifyCalls = 0;
|
||||||
|
const clientFailures = collectClientFailures(page);
|
||||||
|
|
||||||
await mockUserfrontApis(page, {
|
await mockUserfrontApis(page, {
|
||||||
sessionStatus: 401,
|
sessionStatus: 401,
|
||||||
@@ -280,6 +301,8 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
|
|
||||||
expect(userMeCalls).toBe(0);
|
expect(userMeCalls).toBe(0);
|
||||||
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
||||||
|
await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/);
|
||||||
|
expect(clientFailures).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('verifyOnly 승인 링크를 팝업에서 닫으면 창만 닫히고 부모는 이동하지 않는다', async ({
|
test('verifyOnly 승인 링크를 팝업에서 닫으면 창만 닫히고 부모는 이동하지 않는다', async ({
|
||||||
@@ -287,6 +310,7 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
}, testInfo) => {
|
}, testInfo) => {
|
||||||
let userMeCalls = 0;
|
let userMeCalls = 0;
|
||||||
let verifyCalls = 0;
|
let verifyCalls = 0;
|
||||||
|
const clientFailures = collectClientFailures(page);
|
||||||
|
|
||||||
await mockUserfrontApis(page, {
|
await mockUserfrontApis(page, {
|
||||||
sessionStatus: 401,
|
sessionStatus: 401,
|
||||||
@@ -329,12 +353,14 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
|
|
||||||
expect(userMeCalls).toBe(0);
|
expect(userMeCalls).toBe(0);
|
||||||
await expect(page).toHaveURL('about:blank');
|
await expect(page).toHaveURL('about:blank');
|
||||||
|
expect(clientFailures).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('verifyOnly 승인 완료 버튼은 이메일 magic link에서도 user/me 조회나 루트 이동을 만들지 않는다', async ({
|
test('verifyOnly 승인 완료 버튼은 이메일 magic link에서도 user/me 조회나 루트 이동을 만들지 않는다', async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
let userMeCalls = 0;
|
let userMeCalls = 0;
|
||||||
|
const clientFailures = collectClientFailures(page);
|
||||||
const verifyRequests: Array<{
|
const verifyRequests: Array<{
|
||||||
path: string;
|
path: string;
|
||||||
body: Record<string, unknown>;
|
body: Record<string, unknown>;
|
||||||
@@ -374,12 +400,15 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
|
|
||||||
expect(userMeCalls).toBe(0);
|
expect(userMeCalls).toBe(0);
|
||||||
await expect(page).toHaveURL(/\/ko\/verify\/e2e-email-token$/);
|
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 ({
|
test('verifyOnly 승인 완료 버튼은 이메일 code link에서도 user/me 조회나 루트 이동을 만들지 않는다', async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
let userMeCalls = 0;
|
let userMeCalls = 0;
|
||||||
|
const clientFailures = collectClientFailures(page);
|
||||||
const verifyRequests: Array<{
|
const verifyRequests: Array<{
|
||||||
path: string;
|
path: string;
|
||||||
body: Record<string, unknown>;
|
body: Record<string, unknown>;
|
||||||
@@ -427,5 +456,7 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
await expect(page).toHaveURL(
|
await expect(page).toHaveURL(
|
||||||
/\/ko\/verify\?loginId=e2e(?:%40|@)example\.com&code=654321&pendingRef=pending-email$/,
|
/\/ko\/verify\?loginId=e2e(?:%40|@)example\.com&code=654321&pendingRef=pending-email$/,
|
||||||
);
|
);
|
||||||
|
await expect(page).not.toHaveURL(/\/signin(?:\?.*)?$/);
|
||||||
|
expect(clientFailures).toEqual([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user