Files

40 lines
1.5 KiB
TypeScript

import { readFileSync } from "node:fs";
import { expect, test } from "@playwright/test";
// 소스의 사본만 확인하면 public 파일이 배포에서 빠진 경우를 놓친다.
// 실제 production preview가 원문 크레딧과 notice 전문을 제공하는지 확인한다.
test("릴리스는 사용자 크레딧과 런타임 MIT notice 전문을 제공한다", async ({
page,
request,
}) => {
await page.goto("/");
await expect
.soft(
page.getByText("Designed by OZ at Heat-T Medical Inc.", { exact: true }),
)
.toBeVisible({ timeout: 1000 });
const response = await request.get("/THIRD_PARTY_NOTICES.md");
expect(response.ok()).toBe(true);
expect(await response.text()).toBe(
readFileSync("THIRD_PARTY_NOTICES.md", "utf8"),
);
});
// Accept: text/html을 보내도 누락 오디오는 SPA 문서로 대체하지 않아야 한다.
test("누락 음성·환경음은 query와 HTML accept에도 404이고 출처 고지는 번들된다", async ({
request,
}) => {
for (const directory of ["audio", "ambience"]) {
const response = await request.get(`/${directory}/not-found.wav?v=0.2.5`, {
headers: { Accept: "text/html" },
});
expect(response.status()).toBe(404);
expect(await response.text()).not.toContain('<div id="root">');
}
const notice = await request.get("/ambience/AMBIENCE_NOTICES.md");
expect(notice.ok()).toBe(true);
expect(await notice.text()).toBe(
readFileSync("public/ambience/AMBIENCE_NOTICES.md", "utf8"),
);
});