Slide 20
Slide 20 text
Playwright
のテストファイル
// ./src/__test__/vrt.test.ts
import type { Page } from "@playwright/test";
import { test, expect } from "@playwright/test";
type TargetPage = Record<"name" | "path", string>;
//
撮影したいページのリスト
const targetPages: TargetPage[] = [
{
name: "home",
path: "/",
},
];
for (const targetPage of targetPages) {
test(targetPage.name, async ({ page }) => {
await page.goto(targetPage.path);
//
スクリーンショットを撮る。TypeScript
で書けるので、必要に応じて前処理を追加できる
await expect(page).toHaveScreenshot();
});
} 20