mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
New users land in a guided six-step wizard instead of an empty dashboard:
welcome → name your space (profile rename/create + base currency) → first
account(s) → bring your data (the real import flow embedded, with in-place
account creation) → auto-detected subscriptions → orbit complete. Fully
skippable (with are-you-sure confirms where data could be lost), relaunchable
from Settings → About and the tour menu, and impossible to get trapped in:
any pristine-check failure keeps it closed.
Trigger: zero accounts AND zero transactions AND zero bills AND no recorded
decision. Finishing/skipping stamps localStorage AND mirrors into the
per-profile settings KV, so in server mode a decision made on one device is
respected everywhere. A relaunched wizard recognizes existing accounts
('Your accounts — N already in orbit') instead of pitching a first account.
Import page refactored into reusable modules (headless createImportFlow +
ImportDataEntry/ImportMappingStep/ImportPreviewStep/BankRulesEditor) shared
verbatim by the page and the wizard; the bank tab's per-file account picker
(AccountSelect) offers 'New account…' in-place creation. Re-imports are
honest end to end: the preview dry-run announces rows the dedup pass will
skip ('Everything here was already imported'), the result message names
already-imported counts in both storage modes, and the import log records
total duplicates avoided. Bank-file drops no longer fail silently (snapshot +
allSettled + loading overlay + per-file errors).
Subscription auto-detection (features/subscriptionDetection.ts, pure +
30 table-driven tests): token matching with a bounded typo budget, cadence
from median charge gaps, catalogue-plan matching (18.00 → Claude Pro),
ambiguous retailer tokens require stable recurrence, dominant-amount-cluster
keeps Prime detectable amid Amazon shopping. Review UI (SubscriptionScan)
serves the wizard step, Bills → Subscriptions → Scan transactions, and the
Import page's post-import prompt.
Orbital loading system: OrbitSpinner (binary planets around a luminous core)
fronts the Import overlays and subscription scan; OrbitBootScreen replaces
the bare 'Loading...' boot gate and Suspense fallback; index.html stamps the
saved theme pre-paint so nothing flashes. ConfirmDialog moves to z-index
5000 and gains test-ids. The Node test backend stubs GET /api/billing/status
(worker-only feature) so the client's boot probe stops 404-spamming consoles.
Testing: 46 new unit tests (detection engine, onboarding store incl. KV
mirroring via onboardingMirrorSettled), 13 e2e specs across
onboarding.spec.ts / import.spec.ts with a gotoServerlessZeroState helper
(suppressed demo seed = true zero state) and an E2E_PORT env for the whole
harness (default 3800; CI unchanged). EARS spec: docs/specs/frontend/onboarding.md.
55 lines
2.3 KiB
TypeScript
55 lines
2.3 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { E2E_BASE } from './test-helpers'
|
|
|
|
/**
|
|
* Mobile-viewport checks (iPhone 15 Pro) for the shortcut guide and for the
|
|
* "no horizontal page scroll" rule across the core pages — a squished/overflowing
|
|
* layout would push the page wider than the viewport, which these assertions catch.
|
|
* Runs in serverless mode, where the app auto-seeds demo data.
|
|
*/
|
|
test.use({ viewport: { width: 393, height: 852 } })
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.addInitScript(() => {
|
|
localStorage.setItem('finance_storage_mode', 'serverless')
|
|
})
|
|
})
|
|
|
|
test('keyboard shortcuts modal opens with "?" and lists the command bar', async ({ page }) => {
|
|
await page.goto(`${E2E_BASE}/#dashboard`, {
|
|
waitUntil: 'domcontentloaded',
|
|
timeout: 30000,
|
|
})
|
|
// The shortcuts modal is gated behind the app-ready state, and serverless demo seeding can take
|
|
// >10s under parallel load. Wait for the dashboard shell to mount before typing "?" — otherwise
|
|
// the keypress is swallowed by the "Loading…" gate and the modal never appears.
|
|
await expect(page.getByTestId('dashboard-container')).toBeVisible({ timeout: 30000 })
|
|
|
|
await page.keyboard.type('?')
|
|
|
|
const modal = page.getByTestId('shortcuts-modal')
|
|
await expect(modal).toBeVisible({ timeout: 5000 })
|
|
// The modal's purpose is to list shortcuts, so assert its command-bar entry renders (scoped to
|
|
// the modal so this checks the guide's content, not some other command-bar copy on the page).
|
|
await expect(modal.getByText(/command bar/i).first()).toBeVisible()
|
|
|
|
// Esc closes it.
|
|
await page.keyboard.press('Escape')
|
|
await expect(modal).toBeHidden({ timeout: 5000 })
|
|
})
|
|
|
|
// The core pages must never push the document wider than the mobile viewport.
|
|
for (const page_ of ['dashboard', 'transactions', 'accounts', 'analytics', 'import', 'settings']) {
|
|
test(`#${page_} has no horizontal page overflow on mobile`, async ({ page }) => {
|
|
await page.goto(`${E2E_BASE}/#${page_}`, {
|
|
waitUntil: 'domcontentloaded',
|
|
timeout: 30000,
|
|
})
|
|
await page.waitForTimeout(1500)
|
|
const overflows = await page.evaluate(
|
|
() => document.documentElement.scrollWidth > window.innerWidth + 1
|
|
)
|
|
expect(overflows, `#${page_} should not scroll horizontally`).toBe(false)
|
|
})
|
|
}
|