tests: add Playwright event badge CRUD + interaction tests; add minimal V3 mocks and env helper; update presenter/badge smoke tests to use helpers; convert test locals to snake_case

This commit is contained in:
Scott Idem
2026-02-24 17:49:43 -05:00
parent 39614c9cc2
commit 197adff33b
10 changed files with 439 additions and 120 deletions

View File

@@ -1,5 +1,9 @@
import { test, expect } from '@playwright/test';
import { ae_app_local_data_defaults } from './_helpers/ae_defaults';
import { demo_event_id, demo_account_id } from './_helpers/env';
import { attach_minimal_v3_routes } from './_helpers/minimal_v3_mocks';
const demo_event = demo_event_id;
test.describe('Event Presenter Page - smoke', () => {
test.beforeEach(async ({ page }) => {
@@ -8,28 +12,21 @@ test.describe('Event Presenter Page - smoke', () => {
if (msg.type() === 'error' || msg.type() === 'warn') console.error(`BROWSER [${msg.type().toUpperCase()}]: ${msg.text()}`);
});
await page.route('**/*oneskyit.com/**', async (route) => {
const url = route.request().url();
if (url.includes('site_domain/search')) {
return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ data: [{ id: 'td', site_id: 'ts' }] }) });
}
if (url.includes('/v3/crud/event/')) {
return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ data: { id: 'test-event', name: 'Test' } }) });
}
return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ data: [] }) });
});
await attach_minimal_v3_routes(page, demo_event);
await page.addInitScript((defaults) => {
const testData = { ...defaults, account_id: 'smoke-account', manager_access: true };
window.localStorage.setItem('ae_loc', JSON.stringify(testData));
}, ae_app_local_data_defaults);
await page.addInitScript((defaults, event_id, account_id) => {
const test_data = { ...defaults, account_id: account_id, manager_access: true };
// ensure the events module has the event id available
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, demo_event, demo_account_id);
});
test('opens presenter editor without throwing', async ({ page }) => {
const errors: string[] = [];
page.on('pageerror', (e) => errors.push(e.message));
await page.goto('/events/test-event/presenters');
await page.goto(`/events/${demo_event}/presenters`);
await page.waitForResponse((r) => r.url().includes('site_domain/search') && r.status() === 200);
expect(errors).toHaveLength(0);