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>
38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { ae_app_local_data_defaults } from './_helpers/ae_defaults';
|
|
import { testing_event_id, testing_account_id } from './_helpers/env';
|
|
import { attach_minimal_v3_routes } from './_helpers/minimal_v3_mocks';
|
|
|
|
const event_id = testing_event_id;
|
|
|
|
test.describe('Event Badge — smoke', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
page.on('pageerror', (err) => console.error(`BROWSER ERROR: ${err.message}`));
|
|
page.on('console', (msg) => {
|
|
if (msg.type() === 'error' || msg.type() === 'warning') console.error(`BROWSER [${msg.type().toUpperCase()}]: ${msg.text()}`);
|
|
});
|
|
|
|
await attach_minimal_v3_routes(page, event_id);
|
|
|
|
await page.addInitScript(([defaults, event_id, account_id]) => {
|
|
const test_data = { ...defaults, account_id: account_id, manager_access: true } as any;
|
|
test_data.mod = { ...defaults.mod, events: { ...defaults.mod.events, event_id } };
|
|
window.localStorage.setItem('ae_loc', JSON.stringify(test_data));
|
|
}, [ae_app_local_data_defaults, event_id, testing_account_id] as const);
|
|
});
|
|
|
|
test('loads badges list without console errors', async ({ page }) => {
|
|
const errors: string[] = [];
|
|
page.on('pageerror', (err) => errors.push(err.message));
|
|
|
|
await page.goto(`/events/${event_id}/badges`);
|
|
await page.waitForResponse((r) => r.url().includes('site_domain/search') && r.status() === 200);
|
|
|
|
expect(errors).toHaveLength(0);
|
|
// smoke: ensure the page responded to initial handshake
|
|
const resp = await page.request.get('/v3/health', { failOnStatusCode: false });
|
|
// not asserting 200; just ensure request helper works
|
|
expect(resp.ok() || resp.status() >= 400).toBeTruthy();
|
|
});
|
|
});
|