forked from baron/baron-sso
역할 전환 E2E 및 권한 안내 검증 테스트 추가
This commit is contained in:
24
devfront/tests/helpers/evidence.ts
Normal file
24
devfront/tests/helpers/evidence.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { Page, TestInfo } from "@playwright/test";
|
||||
|
||||
function safeName(name: string): string {
|
||||
return name
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9-_]+/g, "-")
|
||||
.replace(/-+/g, "-")
|
||||
.replace(/^-|-$/g, "");
|
||||
}
|
||||
|
||||
export async function captureEvidence(
|
||||
page: Page,
|
||||
testInfo: TestInfo,
|
||||
name: string,
|
||||
) {
|
||||
const filename = `${safeName(name)}.png`;
|
||||
const fullPath = testInfo.outputPath(filename);
|
||||
await page.screenshot({ path: fullPath, fullPage: true });
|
||||
await testInfo.attach(name, {
|
||||
path: fullPath,
|
||||
contentType: "image/png",
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user