test(e2e): fix J5 relationship selector — scope to Beziehungen section, drop baseURL
Some checks failed
CI / OCR Service Tests (pull_request) Successful in 38s
CI / Unit & Component Tests (push) Failing after 3m13s
CI / OCR Service Tests (push) Successful in 34s
CI / Backend Unit Tests (push) Failing after 3m14s
CI / Unit & Component Tests (pull_request) Failing after 3m25s
CI / Backend Unit Tests (pull_request) Failing after 3m22s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-05 19:10:20 +02:00
parent 649c3f8f8a
commit 2632434263

View File

@@ -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' });
});
});