1
0
forked from baron/baron-sso

ci: add code check badges and coverage reports

This commit is contained in:
2026-05-29 12:05:43 +09:00
parent c489c7c38f
commit a830242947
164 changed files with 9059 additions and 2012 deletions

View File

@@ -1,26 +1,26 @@
import { expect, test, type Page, type Route } from '@playwright/test';
import { expect, type Page, type Route, test } from "@playwright/test";
async function mockUserfrontApisForRepro(
page: Page,
options: { sessionStatus: number } = { sessionStatus: 401 },
): Promise<void> {
await page.route('**/api/v1/**', async (route: Route) => {
await page.route("**/api/v1/**", async (route: Route) => {
const requestUrl = new URL(route.request().url());
const path = requestUrl.pathname;
if (path.endsWith('/api/v1/user/me')) {
if (path.endsWith("/api/v1/user/me")) {
await route.fulfill({
status: options.sessionStatus,
contentType: 'application/json',
body: JSON.stringify({ error: 'unauthorized' }),
contentType: "application/json",
body: JSON.stringify({ error: "unauthorized" }),
});
return;
}
if (path.endsWith('/api/v1/client-log')) {
if (path.endsWith("/api/v1/client-log")) {
await route.fulfill({
status: 200,
contentType: 'application/json',
contentType: "application/json",
body: JSON.stringify({ ok: true }),
});
return;
@@ -29,23 +29,25 @@ async function mockUserfrontApisForRepro(
// Default mock for other APIs
await route.fulfill({
status: 200,
contentType: 'application/json',
contentType: "application/json",
body: JSON.stringify({}),
});
});
}
test.describe('Issue #345 Reproduction (Log-based Validation)', () => {
test('비로그인 상태에서 login_challenge와 함께 signin 진입 시 루프 없이 로그가 정상 출력되어야 한다', async ({ page }) => {
test.describe("Issue #345 Reproduction (Log-based Validation)", () => {
test("비로그인 상태에서 login_challenge와 함께 signin 진입 시 루프 없이 로그가 정상 출력되어야 한다", async ({
page,
}) => {
const logs: string[] = [];
page.on('console', msg => {
page.on("console", (msg) => {
const text = msg.text();
logs.push(text);
console.log(`[Browser] ${text}`);
});
const requests: string[] = [];
page.on('request', request => {
page.on("request", (request) => {
if (request.isNavigationRequest()) {
requests.push(request.url());
}
@@ -53,29 +55,31 @@ test.describe('Issue #345 Reproduction (Log-based Validation)', () => {
await mockUserfrontApisForRepro(page, { sessionStatus: 401 });
const targetUrl = '/ko/signin?login_challenge=repro_challenge_12345';
const targetUrl = "/ko/signin?login_challenge=repro_challenge_12345";
await page.goto(targetUrl);
// WASM 앱 로딩 및 로직 실행 대기
await page.waitForTimeout(7000);
const currentUrl = page.url();
const signinNavigations = requests.filter(url => url.includes('/signin'));
const signinNavigations = requests.filter((url) => url.includes("/signin"));
// [검증 1] URL 유지 확인
expect(currentUrl).toContain('login_challenge=repro_challenge_12345');
expect(currentUrl).toContain("login_challenge=repro_challenge_12345");
// [검증 2] 리다이렉트 루프 발생 여부 확인 (최초 진입 1회만 있어야 함)
expect(signinNavigations.length).toBeLessThanOrEqual(1);
// [검증 3] 핵심 로직 로그 확인 (성공의 결정적 증거)
// 이전에는 여기서 Exception이 발생했으나, 이제는 아래 로그가 찍혀야 함
const hasSuccessLog = logs.some(log =>
log.includes('[Auth] OIDC auto-accept: No active session (status: 401)')
const hasSuccessLog = logs.some((log) =>
log.includes("[Auth] OIDC auto-accept: No active session (status: 401)"),
);
expect(hasSuccessLog).toBe(true);
console.log('✅ 루프가 해결되었으며, 로그 검증을 통해 정상 동작을 확인했습니다.');
console.log(
"✅ 루프가 해결되었으며, 로그 검증을 통해 정상 동작을 확인했습니다.",
);
});
});