All 4 badge test files had identical ~35-line beforeEach blocks (pageerror listener,
inline V3 route mocks, addInitScript localStorage seed). Replaced with two helpers
in minimal_v3_mocks.ts:
seed_trusted_session(page, event_id, account_id?)
— seeds ae_loc localStorage with trusted/manager auth via addInitScript;
account_id defaults to testing_account_id
setup_badge_test_page(page, event_id)
— one-call beforeEach: pageerror listener + attach_minimal_v3_routes +
seed_trusted_session
Each test file's beforeEach is now 1-3 lines. All 12 tests still pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause fix: tests/_helpers/ae_defaults.ts was missing __version: 1, causing
store_versions.ts to wipe ae_loc from localStorage on every test page load. This
made trusted_access fall back to false, hiding the print button (can_print guard)
and failing all attendee workflow tests.
Changes:
- ae_defaults.ts: add __version: 1 with comment explaining the store_versions guard
- idb_helpers.ts: extract inject_badge_and_template() from print layout test into
shared helper; now used by all three print/render test files
- event_badge_render.test.ts: new — 4 tests covering full_name_override priority,
full_name fallback, duplex=0 hides badge back, duplex=1 shows badge back
- event_badge_attendee_workflow.test.ts: cleaned up (diagnostic code removed);
all 3 tests now pass
- event_badge_print_layout.test.ts: renamed from badge_print_layout.test.ts;
inline inject_idb() replaced with shared idb_helpers import
- event_badge_smoke.test.ts: renamed from event_badge.test.ts
- playwright.config.ts: use system /usr/bin/chromium on Arch Linux (avoids
Playwright's bundled Chromium which requires Ubuntu libs not present on Arch)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Added testing_site_id, testing_site_domain_id, testing_fqdn, testing_person_id
- Created mock_site_domain object matching +layout.ts expectations
- Updated minimal_v3_mocks.ts to use mock_site_domain
- Fixes 'Domain Not Registered' overlay in Playwright tests
- All test IDs now documented with comments from tests/README.md