test(ui): add e2e and integration tests

This commit is contained in:
Tuan-Dat Tran
2026-02-23 13:48:13 +01:00
parent 00af8862d3
commit 4198b91498
9 changed files with 632 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import { test, expect } from '@playwright/test';
test.describe('Visual Regression: CV Page', () => {
test('hero section visual snapshot', async ({ page }) => {
await page.goto('/');
await page.waitForLoadState('networkidle');
const hero = page.locator('section').first();
await expect(hero).toHaveScreenshot('hero-section.png', {
maxDiffPixels: 100,
});
});
test('full page visual snapshot', async ({ page }) => {
await page.goto('/');
await page.waitForLoadState('networkidle');
await expect(page).toHaveScreenshot('full-page.png', {
fullPage: true,
maxDiffPixels: 500,
});
});
});
test.describe('Visual Regression: Admin Page', () => {
test('admin panel visual snapshot', async ({ page }) => {
await page.goto('/admin');
await page.waitForLoadState('networkidle');
await expect(page).toHaveScreenshot('admin-panel.png', {
maxDiffPixels: 200,
});
});
test('personal form visual snapshot', async ({ page }) => {
await page.goto('/admin');
await page.waitForLoadState('networkidle');
const form = page.locator('form').first();
await expect(form).toHaveScreenshot('personal-form.png', {
maxDiffPixels: 100,
});
});
});