mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-05-26 15:16:14 +00:00
Add screenshot tests
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user