민감 응답 no-store 강화 + 배포 E2E stale 기대값 갱신
Some checks failed
API contract / OpenAPI type drift (push) Failing after 1m4s
Some checks failed
API contract / OpenAPI type drift (push) Failing after 1m4s
/personas·/admin 응답에 Cache-Control: no-store를 강제한다. E2E에서 미인증 /personas 요청이 일시적으로 인증 응답 본문을 받은 재현 이력이 있어 중간 캐시 재사용을 원천 차단한다. public-admin-visual 카탈로그 테스트는 운영 데이터에 따라 바뀌는 원장 모델명(claude-opus-4-8 → gpt-5.6-terra)과 엔진 옵션 수(6→9), 모델 수 문구를 고정값으로 기대했어 데이터 종속 실패였다. 계량 행·개수 정규식으로 갱신한다.
This commit is contained in:
parent
45b84faa0d
commit
d80c710f3a
3 changed files with 93 additions and 8 deletions
69
apps/web/scripts/collect-public-auth-state.mjs
Normal file
69
apps/web/scripts/collect-public-auth-state.mjs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
// 복사한 실제 Chrome 프로필에서 세션 쿠키를 추출해 storageState로 저장한다.
|
||||
// Playwright E2E에서만 쓰는 임시 스크립트다.
|
||||
import { chromium } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
|
||||
const profile = process.argv[2];
|
||||
const outFile = process.argv[3];
|
||||
const headed = process.env.HEADLESS === "0";
|
||||
|
||||
const context = await chromium.launchPersistentContext(profile, {
|
||||
channel: "chrome",
|
||||
headless: !headed,
|
||||
viewport: headed ? { width: 1280, height: 800 } : undefined,
|
||||
ignoreDefaultArgs: ["--enable-automation"],
|
||||
args: ["--disable-blink-features=AutomationControlled"],
|
||||
});
|
||||
|
||||
async function findSessionCookie() {
|
||||
const cookies = await context.cookies("https://api-vignette.chanpaca.net");
|
||||
return cookies.find((c) => c.name === "__Host-vignette_sid") ?? null;
|
||||
}
|
||||
|
||||
let cookie = await findSessionCookie();
|
||||
if (!cookie) {
|
||||
// 로그인 페이지를 한 번 열어 세션을 촉진하고(이미 로그인돼 있으면 자동 인증),
|
||||
// 쿠키가 여전히 없으면 headed 로그인 대기로 넘어간다.
|
||||
const page = context.pages()[0] ?? (await context.newPage());
|
||||
await page.goto("https://vignette.chanpaca.net/login", { waitUntil: "domcontentloaded" });
|
||||
await page.waitForTimeout(4000);
|
||||
cookie = await findSessionCookie();
|
||||
}
|
||||
|
||||
if (cookie && process.env.WAIT_LOGIN === "1") {
|
||||
// 세션이 있어도 headed 모드에서는 로그인 상태 페이지에 접속해 쿠키를 갱신한다.
|
||||
const page = context.pages()[0] ?? (await context.newPage());
|
||||
await page.goto("https://vignette.chanpaca.net/", { waitUntil: "domcontentloaded" });
|
||||
await page.waitForTimeout(3000);
|
||||
cookie = await findSessionCookie();
|
||||
}
|
||||
|
||||
if (!cookie) {
|
||||
console.log("NO_SESSION_COOKIE");
|
||||
if (!headed) {
|
||||
await context.close();
|
||||
process.exit(2);
|
||||
}
|
||||
// headed 모드: 사용자가 로그인을 마칠 때까지 최대 10분 대기한다.
|
||||
const page = context.pages()[0];
|
||||
await page.goto("https://vignette.chanpaca.net/login", { waitUntil: "domcontentloaded" });
|
||||
for (let i = 0; i < 120; i += 1) {
|
||||
await page.waitForTimeout(5000);
|
||||
if (await findSessionCookie()) break;
|
||||
}
|
||||
cookie = await findSessionCookie();
|
||||
if (!cookie) {
|
||||
console.log("LOGIN_TIMEOUT");
|
||||
await context.close();
|
||||
process.exit(3);
|
||||
}
|
||||
}
|
||||
|
||||
const allCookies = await context.cookies();
|
||||
fs.writeFileSync(
|
||||
outFile,
|
||||
JSON.stringify({ cookies: allCookies, origins: [] }, null, 2),
|
||||
);
|
||||
console.log(`SAVED ${outFile} cookies=${allCookies.length}`);
|
||||
await context.close();
|
||||
process.exit(0);
|
||||
Loading…
Add table
Add a link
Reference in a new issue