Files
OSIT-AE-App-Svelte/tests/event_badge.test.ts
Scott Idem a91c648c61 test: standardize naming conventions to snake_case
- Rename demo_event_id → testing_event_id (more explicit)
- Rename demo_account_id → testing_account_id (matches convention)
- Rename demo_badge_id → event_badge_id (descriptive)
- Rename demo_template_id → event_badge_template_id (explicit)
- Update all test files for consistency (15 files)
- Enhance README with organized test data sections
- Update person IDs to match README test data
- No regression: 15 tests passing, 7 pre-existing failures unchanged
2026-02-26 15:43:31 -05:00

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 Page - 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() === 'warn') 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 };
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);
});
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();
});
});