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

Commit 093e060

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

6 files changed

+19
-5
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({ maxDiffPixels: 100 });
1529
});
153 KB
Loading
583 KB
Loading
841 KB
Loading
554 KB
Loading

playwright.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ export default defineConfig({
3939
{
4040
name: "webkit",
4141
use: { ...devices["Desktop Safari"] }
42-
},
42+
}
4343

4444
/* Test against mobile viewports. */
45-
{
46-
name: "Mobile Chrome",
47-
use: { ...devices["Pixel 5"] }
48-
}
45+
//{
46+
// name: "Mobile Chrome",
47+
// use: { ...devices["Pixel 5"] }
48+
//}
4949
// {
5050
// name: 'Mobile Safari',
5151
// use: { ...devices['iPhone 12'] },

0 commit comments

Comments
 (0)