From 40872deb2ae646a08e58c6b1de2473342ae92570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemek=20Wi=C4=99ch?= Date: Mon, 1 Jun 2026 00:01:11 +0200 Subject: [PATCH] Add test for file upload --- tests/README.md | 1 + tests/upload.spec.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/upload.spec.ts diff --git a/tests/README.md b/tests/README.md index 36018ef..1905476 100644 --- a/tests/README.md +++ b/tests/README.md @@ -20,6 +20,7 @@ Verify functional correctness, route parameters, drawer side-panels, dynamic aut * **[embedded.spec.ts](embedded.spec.ts)**: Tests embedded iframe operations using virtual server postMessage listeners to execute proper parent-child synchronizations. * **[intro.spec.ts](intro.spec.ts)**: Checks base landing layouts, instructions panels, menu existence, and responsive header navigation buttons. * **[search.spec.ts](search.spec.ts)**: Targets autocompletion components using robust search locators to verify input debouncing and focus updates. +* **[upload.spec.ts](upload.spec.ts)**: Validates uploading raw GEDCOM files from the local filesystem, asserting navigation transitions, state parsing, and virtual tree renderings. * **[webmcp.spec.ts](webmcp.spec.ts)**: Evaluates out-of-process browser calls from Model Context Protocol tool registrations and action assertions. ### 2. Visual Regression / Screenshot Specs diff --git a/tests/upload.spec.ts b/tests/upload.spec.ts new file mode 100644 index 0000000..3440da5 --- /dev/null +++ b/tests/upload.spec.ts @@ -0,0 +1,20 @@ +import {expect, test} from '@playwright/test'; +import {setupHermeticEnvironment} from './helpers'; + +test.describe('File upload', () => { + test.beforeEach(async ({page, context}) => { + await setupHermeticEnvironment(context); + await page.goto('/'); + }); + + test('uploads a GEDCOM file and displays the tree', async ({page}) => { + // Set the test GEDCOM file to the hidden file input. + await page.setInputFiles('#fileInput', 'src/datasource/testdata/test.ged'); + + // Assert that we navigated to the view page. + await expect(page).toHaveURL(/.*\/view.*/); + + // Verify that the chart content loads properly (e.g. contains the name 'Bonifacy'). + await expect(page.locator('#content')).toContainText('Bonifacy'); + }); +});