From cc164b877e9862e3fcc58ec7b56ca81886da3460 Mon Sep 17 00:00:00 2001 From: Conduction Release Bot Date: Fri, 28 Aug 2026 20:24:25 +0200 Subject: [PATCH] fix(e2e): establish the organisation baseline instead of inheriting it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `development` has been red on this one test since the ADR-111 demo-data step landed (304 passed, 1 failed). The test asserts a FLIP: organisation.done goes false -> true when the details are saved. It read the "false" end off whatever the instance happened to hold: const before = await api(page, 'GET', `${APP}/api/setup/status`) expect(before.json?.steps?.organisation?.done).toBe(false) That is no longer empty. The `demo-data` setup step seeds an organisation, so on any instance where demo data ran, `receipt_company_name` is already set and the step is already done — expected false, received true. Clearing the three keys first costs one request and makes the flip attributable to this test rather than to which specs happened to run before it. The `finally` block already restores them, so the test remains a no-op for its neighbours. The precondition also gains a message. `Expected: false / Received: true` on a bare boolean says nothing about which of the two possible causes it is — the step not resetting, or the save not landing. Supersedes #1503, which fixed the same failure by seeding the value the test then asserted was absent; that inverts the flip rather than establishing it, and the PR went stale and conflicted. --- .../spec-coverage/first-time-setup.spec.ts | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/e2e/spec-coverage/first-time-setup.spec.ts b/tests/e2e/spec-coverage/first-time-setup.spec.ts index 13caeb705..563b968b6 100644 --- a/tests/e2e/spec-coverage/first-time-setup.spec.ts +++ b/tests/e2e/spec-coverage/first-time-setup.spec.ts @@ -205,9 +205,27 @@ test.describe('First-time setup contract', () => { }) => { await openApp(page) - // Precondition: unset, so the flip below is caused by this test. + // ESTABLISH the precondition, do not inherit it. This test asserts a + // FLIP from not-done to done, which only means anything from a known + // starting point — and the starting point is no longer empty: the + // ADR-111 `demo-data` setup step seeds an organisation, so on a CI + // instance where demo data ran, `receipt_company_name` is already set + // and `organisation.done` is already true. + // + // Reading the baseline off whatever the instance happens to hold made + // this test's verdict depend on which other specs ran first. Clearing + // the keys here costs one request and makes the flip attributable to + // this test alone. + await api(page, 'POST', `${APP}/api/setup/config`, { + receipt_company_name: '', + receipt_company_vat: '', + receipt_company_kvk: '', + }) const before = await api(page, 'GET', `${APP}/api/setup/status`) - expect(before.json?.steps?.organisation?.done).toBe(false) + expect( + before.json?.steps?.organisation?.done, + 'clearing receipt_company_name did not reset the organisation step, so the flip asserted below would prove nothing', + ).toBe(false) try { const saved = await api(page, 'POST', `${APP}/api/setup/config`, {