Update visual regression tests

This commit is contained in:
adilallo
2025-09-12 16:01:12 -06:00
parent 500d2d0965
commit 842bbe44f1
5 changed files with 56 additions and 11 deletions
+32 -10
View File
@@ -376,18 +376,40 @@ test.describe("Visual Regression Tests", () => {
});
});
test("error states", async ({ page }) => {
// Test error states by simulating a more controlled error condition
// Instead of blocking resources, we'll simulate a network error state
test("blog listing page", async ({ page }) => {
// Navigate to blog listing page
await page.goto("/blog");
await page.waitForLoadState("networkidle");
await settle(page);
// Navigate to a non-existent route to trigger a 404-like state
// Take full page screenshot of blog listing
await expect(page).toHaveScreenshot("blog-listing.png", {
fullPage: true,
animations: "disabled",
});
});
test("blog post page", async ({ page }) => {
// Navigate to a specific blog post
await page.goto("/blog/resolving-active-conflicts");
await page.waitForLoadState("networkidle");
await settle(page);
// Take full page screenshot of blog post
await expect(page).toHaveScreenshot("blog-post.png", {
fullPage: true,
animations: "disabled",
});
});
test("404 error page", async ({ page }) => {
// Navigate to a non-existent route to trigger 404
await page.goto("/non-existent-page");
await page.waitForLoadState("networkidle");
await settle(page);
// Wait for page to stabilize
await page.waitForTimeout(2000);
// Take screenshot of error state
await expect(page).toHaveScreenshot("homepage-error.png", {
// Take screenshot of 404 page
await expect(page).toHaveScreenshot("404-error.png", {
animations: "disabled",
});
});
@@ -413,7 +435,7 @@ test.describe("Visual Regression Tests", () => {
await page.evaluate(() => {
document.documentElement.style.setProperty(
"--prefers-reduced-motion",
"reduce",
"reduce"
);
});