From 2632434263f26159967754c58e9e2343356c0599 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 5 May 2026 19:10:20 +0200 Subject: [PATCH] =?UTF-8?q?test(e2e):=20fix=20J5=20relationship=20selector?= =?UTF-8?q?=20=E2=80=94=20scope=20to=20Beziehungen=20section,=20drop=20bas?= =?UTF-8?q?eURL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- frontend/e2e/persons.spec.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/e2e/persons.spec.ts b/frontend/e2e/persons.spec.ts index 460df029..4f9ce80d 100644 --- a/frontend/e2e/persons.spec.ts +++ b/frontend/e2e/persons.spec.ts @@ -188,8 +188,7 @@ test.describe('Person detail — sent and received documents', () => { // uses the AddRelationshipForm to link them. Asserts the chip appears. test.describe('Person relationship — add via edit page (J5)', () => { - const baseURL = process.env.E2E_BASE_URL ?? 'http://localhost:3000'; - let personAHref: string; + let personAId: string; let personBName: string; test.beforeAll(async ({ request }) => { @@ -200,7 +199,7 @@ test.describe('Person relationship — add via edit page (J5)', () => { }); if (!aRes.ok()) throw new Error(`Create person A failed: ${aRes.status()}`); const a = await aRes.json(); - personAHref = `${baseURL}/persons/${a.id}`; + personAId = a.id; const bRes = await request.post('/api/persons', { data: { firstName: 'E2E-Rel-B', lastName: stamp } @@ -213,7 +212,7 @@ test.describe('Person relationship — add via edit page (J5)', () => { test('user adds a SPOUSE_OF relationship and sees the chip on the edit page', async ({ page }) => { - await page.goto(`${personAHref}/edit`); + await page.goto(`/persons/${personAId}/edit`); await page.waitForSelector('[data-hydrated]'); // Open the AddRelationshipForm by clicking the "+ Beziehung hinzufügen" button. @@ -234,8 +233,14 @@ test.describe('Person relationship — add via edit page (J5)', () => { // Submit the relationship form. await page.getByRole('button', { name: 'Hinzufügen' }).click(); - // The relationship chip should appear in the Stammbaum section. - await expect(page.getByText(personBName)).toBeVisible({ timeout: 8_000 }); + // The relationship chip should appear inside the Beziehungen section. + const relCard = page + .locator('div') + .filter({ has: page.locator('h2', { hasText: 'Beziehungen' }) }) + .first(); + await expect(relCard.locator('a[href^="/persons/"]', { hasText: personBName })).toBeVisible({ + timeout: 8_000 + }); await page.screenshot({ path: 'test-results/e2e/person-relationship-added.png' }); }); });