d7fb7b7a7b
Build & Deploy / Build & Push Docker Image (push) Failing after 47s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m4s
Test / Marketplace Unit Tests (push) Failing after 4m55s
Test / Admin Unit Tests (push) Successful in 9m37s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m54s
64 lines
2.2 KiB
TypeScript
64 lines
2.2 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
const scenarios = [
|
|
{
|
|
name: 'desktop-en-light',
|
|
locale: 'en',
|
|
theme: 'light',
|
|
viewport: { width: 1440, height: 1000 },
|
|
},
|
|
{ name: 'desktop-en-dark', locale: 'en', theme: 'dark', viewport: { width: 1440, height: 1000 } },
|
|
{ name: 'tablet-fr-light', locale: 'fr', theme: 'light', viewport: { width: 1024, height: 900 } },
|
|
{ name: 'tablet-fr-dark', locale: 'fr', theme: 'dark', viewport: { width: 1024, height: 900 } },
|
|
{ name: 'mobile-ar-light', locale: 'ar', theme: 'light', viewport: { width: 390, height: 844 } },
|
|
{ name: 'mobile-ar-dark', locale: 'ar', theme: 'dark', viewport: { width: 390, height: 844 } },
|
|
] as const;
|
|
|
|
for (const scenario of scenarios) {
|
|
test(`${scenario.name} visual baseline`, async ({ page, context }) => {
|
|
test.skip(
|
|
test.info().project.name !== 'chromium',
|
|
'Canonical visual baselines use Chromium; other projects run functional coverage.',
|
|
);
|
|
await page.setViewportSize(scenario.viewport);
|
|
await context.addCookies([
|
|
{
|
|
name: 'hpc-theme',
|
|
value: scenario.theme,
|
|
domain: '127.0.0.1',
|
|
path: '/',
|
|
secure: false,
|
|
sameSite: 'Lax',
|
|
},
|
|
]);
|
|
await page.goto(`/${scenario.locale}`);
|
|
await expect(page).toHaveScreenshot(`${scenario.name}.png`, { fullPage: true });
|
|
});
|
|
}
|
|
|
|
test('mobile navigation open baseline', async ({ page }) => {
|
|
test.skip(test.info().project.name !== 'chromium');
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await page.context().addCookies([
|
|
{
|
|
name: 'hpc-theme',
|
|
value: 'dark',
|
|
domain: '127.0.0.1',
|
|
path: '/',
|
|
secure: false,
|
|
sameSite: 'Lax',
|
|
},
|
|
]);
|
|
await page.goto('/ar');
|
|
await page.getByRole('button', { name: 'فتح قائمة التنقل' }).click();
|
|
await expect(page).toHaveScreenshot('mobile-ar-dark-navigation-open.png', { fullPage: true });
|
|
});
|
|
|
|
test('keyboard focus baseline', async ({ page }) => {
|
|
test.skip(test.info().project.name !== 'chromium');
|
|
await page.setViewportSize({ width: 1440, height: 900 });
|
|
await page.goto('/en');
|
|
await page.keyboard.press('Tab');
|
|
await expect(page).toHaveScreenshot('desktop-en-light-focus.png', { fullPage: true });
|
|
});
|