mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-05-26 15:16:14 +00:00
Try to preload fonts in visual tests
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
import {expect, test} from '@playwright/test';
|
import {expect, test} from '@playwright/test';
|
||||||
import {setupGedcomRoute} from './helpers';
|
import {setupGedcomRoute, waitForFonts} from './helpers';
|
||||||
|
|
||||||
test.describe('Core SVG Canvas Layouts @visual', () => {
|
test.describe('Core SVG Canvas Layouts @visual', () => {
|
||||||
test.beforeEach(async ({context}) => {
|
test.beforeEach(async ({page, context}) => {
|
||||||
await setupGedcomRoute(context);
|
await setupGedcomRoute(context);
|
||||||
|
await page.goto('/');
|
||||||
|
await waitForFonts(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
const layouts = [
|
const layouts = [
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import {expect, test} from '@playwright/test';
|
import {expect, test} from '@playwright/test';
|
||||||
import {setupGedcomRoute} from './helpers';
|
import {setupGedcomRoute, waitForFonts} from './helpers';
|
||||||
|
|
||||||
test.describe('Configurations Integration @visual', () => {
|
test.describe('Configurations Integration @visual', () => {
|
||||||
test.beforeEach(async ({page, context}) => {
|
test.beforeEach(async ({page, context}) => {
|
||||||
await setupGedcomRoute(context);
|
await setupGedcomRoute(context);
|
||||||
|
await page.goto('/');
|
||||||
|
await waitForFonts(page);
|
||||||
|
|
||||||
await page.goto('/#/view?url=https://example.org/family.ged');
|
await page.goto('/#/view?url=https://example.org/family.ged');
|
||||||
|
|
||||||
// Wait for the sidebar and the main content container to be visible.
|
// Wait for the sidebar and the main content container to be visible.
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import {expect, test} from '@playwright/test';
|
import {expect, test} from '@playwright/test';
|
||||||
import dedent from 'dedent';
|
import dedent from 'dedent';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import {blockTracking, mockGedcomResponse} from './helpers';
|
import {blockTracking, mockGedcomResponse, waitForFonts} from './helpers';
|
||||||
|
|
||||||
test.describe('Details panel visual validation @visual', () => {
|
test.describe('Details panel visual validation @visual', () => {
|
||||||
test.beforeEach(async ({context}) => {
|
test.beforeEach(async ({page, context}) => {
|
||||||
await blockTracking(context);
|
await blockTracking(context);
|
||||||
|
await page.goto('/');
|
||||||
|
await waitForFonts(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Complex Names Test', async ({page, context}) => {
|
test('Complex Names Test', async ({page, context}) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {BrowserContext} from '@playwright/test';
|
import {BrowserContext, Page} from '@playwright/test';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,3 +40,10 @@ export async function setupGedcomRoute(context: BrowserContext): Promise<void> {
|
|||||||
await mockGedcomResponse(context, gedcomContent);
|
await mockGedcomResponse(context, gedcomContent);
|
||||||
await blockTracking(context);
|
await blockTracking(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures all custom web fonts are fully loaded and rendered.
|
||||||
|
*/
|
||||||
|
export async function waitForFonts(page: Page): Promise<void> {
|
||||||
|
await page.evaluate(() => document.fonts.ready);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import {expect, test} from '@playwright/test';
|
import {expect, test} from '@playwright/test';
|
||||||
import {blockTracking} from './helpers';
|
import {blockTracking, waitForFonts} from './helpers';
|
||||||
|
|
||||||
test.describe('Intro page visual validation @visual', () => {
|
test.describe('Intro page visual validation @visual', () => {
|
||||||
test.beforeEach(async ({page, context}) => {
|
test.beforeEach(async ({page, context}) => {
|
||||||
await blockTracking(context);
|
await blockTracking(context);
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
|
await waitForFonts(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('intro-page', async ({page}) => {
|
test('intro-page', async ({page}) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user