Add screenshot tests

This commit is contained in:
Przemek Więch
2026-05-08 20:24:28 +02:00
parent ac26e6c3cb
commit 29ae67427a
23 changed files with 456 additions and 17 deletions

View File

@@ -10,6 +10,23 @@ export async function blockTracking(context: BrowserContext): Promise<void> {
await context.route('**/*googletagmanager.com/**', (route) => route.abort());
}
/**
* Mocks the endpoint for GEDCOM file requests using the provided GEDCOM content string.
*/
export async function mockGedcomResponse(
context: BrowserContext,
gedcomContent: string,
): Promise<void> {
await context.route('**/family.ged', async (route) => {
await route.fulfill({
status: 200,
contentType: 'text/plain',
headers: {'Access-Control-Allow-Origin': '*'},
body: gedcomContent,
});
});
}
/**
* Sets up interception for raw GEDCOM requests, fulfills them with cached test data
* and sets up CORS proxy checks and analytics blocking.
@@ -20,14 +37,6 @@ export async function setupGedcomRoute(context: BrowserContext): Promise<void> {
'utf-8',
);
await context.route('**/family.ged', async (route) => {
await route.fulfill({
status: 200,
contentType: 'text/plain',
headers: {'Access-Control-Allow-Origin': '*'},
body: gedcomContent,
});
});
await mockGedcomResponse(context, gedcomContent);
await blockTracking(context);
}