/** * The other authoring gesture nothing end-to-end covers yet: registering a * brand-new account and walking the 3-step onboarding wizard (child -> * solo/couple -> balances). Runs with an empty `storageState` — deliberately * NOT the shared demo session `auth.setup.ts` produces for the rest of the * suite — since registering a fresh account is exactly what's under test. * * Every date used here is derived from "today", never a hardcoded year (see * `support/dates.ts`'s module doc for why). */ import { test, expect } from '@playwright/test' import { uniqueEmail, registerAndReachOnboarding, fillChildStep, continueSoloAndSkipBalances, } from '../support/onboarding' test.use({ storageState: { cookies: [], origins: [] } }) test.describe('onboarding wizard', () => { test('skipping the balances step still reaches the dashboard with the estimated badge', async ({ page }) => { await registerAndReachOnboarding(page, uniqueEmail('onboarding-skip'), 'Alex Testsson') await fillChildStep(page, 'Nova') // Solo is the wizard's default planning mode — nothing to change here. await continueSoloAndSkipBalances(page) await expect(page.getByTestId('dashboard-estimate-badge')).toHaveText('Uppskattat') }) test('a partner added mid-wizard shows their name on Översikt with no navigation in between', async ({ page }) => { await registerAndReachOnboarding(page, uniqueEmail('onboarding-couple'), 'Sam Testsson') await fillChildStep(page, 'Nova') await page.getByTestId('planning-mode-couple').check() await expect(page.getByTestId('onboarding-partner-section')).toBeVisible() await page.getByLabel('Partnerns namn').fill('Kim') await page.getByRole('button', { name: 'Lägg till partner' }).click() await expect(page.getByTestId('onboarding-partner-added')).toHaveText('Partner tillagd: Kim') await page.getByRole('button', { name: 'Fortsätt' }).click() await expect(page.getByTestId('onboarding-step-balances')).toBeVisible() await page.getByRole('button', { name: 'Hoppa över för nu' }).click() // The regression this guards: finishing the wizard flips // WorkspaceContext's `children` from empty to non-empty, which // re-renders this SAME Dashboard mount straight past the onboarding // branch — there is no `navigate()` call in between. A previously // fetched, now-stale members list used to leave the partner showing as // the generic "Förälder N" fallback until a manual navigation away and // back refetched it (see Dashboard.tsx's `wasAwaitingFirstChildRef` // effect, and `nameResolver`/`parentDisplayName`). Asserting // immediately — no reload, no extra navigation — is what would have // caught that. await expect(page.getByTestId('dashboard')).toBeVisible({ timeout: 15_000 }) const age4Bars = page.getByTestId('age4-bars') await expect(age4Bars).toBeVisible() await expect(age4Bars).toContainText('Kim') await expect(age4Bars).not.toContainText('Förälder') }) })