Migrate from Cypress to Playwright

This commit is contained in:
Przemek Więch
2026-05-06 11:51:30 +02:00
parent 664ca69fb3
commit d427300ddf
28 changed files with 740 additions and 1403 deletions

33
tests/embedded.spec.ts Normal file
View File

@@ -0,0 +1,33 @@
import {expect, test} from '@playwright/test';
import * as fs from 'fs';
import {setupGedcomRoute} from './helpers';
test.describe('Embedded mode', () => {
test('shows data', async ({page, context}) => {
// Intercept family.ged requests coming from parent frame.
await setupGedcomRoute(context);
// Read the physical HTML wrapper template file.
const wrapperHtml = fs.readFileSync(
'tests/fixtures/embedded_frame.html',
'utf-8',
);
// Route parent page wrapper virtually on the same origin/port dynamically.
await context.route(`**/test-embedded-frame.html`, async (route) => {
await route.fulfill({
status: 200,
contentType: 'text/html',
body: wrapperHtml,
});
});
// Load the virtual wrapper page.
await page.goto(`/test-embedded-frame.html`);
// Assert child iframe successfully loaded Bonifacy Gibbs.
const iframe = page.frameLocator('#topolaFrame');
await expect(iframe.locator('#root')).toContainText('Bonifacy');
});
});