비주얼 회귀 테스트
test("홈페이지 스크린샷", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveScreenshot("homepage.png", {
maxDiffPixels: 100,
});
});API 테스트
test("API 응답 확인", async ({ request }) => {
const response = await request.post("/api/users", {
data: { name: "Kim", email: "kim@test.com" },
});
expect(response.ok()).toBeTruthy();
expect(await response.json()).toMatchObject({ name: "Kim" });
});네트워크 가로채기
route()로 특정 요청을 모킹하여 안정적인 테스트를 작성할 수 있습니다.
댓글 0