Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit f629846

Browse files
committed
test(e2e): add snapshot test to landing page
1 parent b760707 commit f629846

6 files changed

+16
-1
lines changed

e2e/landing-page.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { test, expect } from "@playwright/test";
33
test.beforeEach(async ({ page }) => {
44
await page.goto("/");
55
});
6+
//do not use system suffix
7+
// eslint-disable-next-line no-empty-pattern
8+
test.beforeEach(async ({}, testInfo) => {
9+
testInfo.snapshotSuffix = "";
10+
});
611

712
test("should render the page correctly", async ({ page }) => {
813
await expect(page).toHaveTitle(/Developer Quiz/);
@@ -12,4 +17,13 @@ test("should render the page correctly", async ({ page }) => {
1217
});
1318
await expect(startButton).toBeVisible();
1419
await expect(startButton).toHaveAttribute("href", "#/quizzes");
20+
// snapshot test for first section
21+
const learnSection = page
22+
.locator("div")
23+
.filter({
24+
hasText:
25+
"Learn to Code RPG QuizPractice with 1200+ QuestionsGet started (it's free)"
26+
})
27+
.nth(1);
28+
await expect(learnSection).toHaveScreenshot();
1529
});
158 KB
Loading
618 KB
Loading
901 KB
Loading
712 KB
Loading

playwright.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ export default defineConfig({
4141
use: { ...devices["Desktop Safari"] }
4242
},
4343

44-
/* Test against mobile viewports. */
4544
{
4645
name: "Mobile Chrome",
4746
use: { ...devices["Pixel 5"] }
4847
}
48+
/*/ Test against mobile viewports. */
49+
4950
// {
5051
// name: 'Mobile Safari',
5152
// use: { ...devices['iPhone 12'] },

0 commit comments

Comments
 (0)