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
This commit is contained in:
Scott Idem
2026-02-26 15:43:31 -05:00
parent 2c289e39de
commit a91c648c61
14 changed files with 176 additions and 156 deletions

View File

@@ -1,9 +1,9 @@
import { test, expect } from '@playwright/test';
import { ae_app_local_data_defaults } from './_helpers/ae_defaults';
import { demo_account_id } from './_helpers/env';
import { testing_account_id } from './_helpers/env';
// Use canonical demo journal id for deterministic tests
const demo_journal = 'BVYE-94-46-29';
const journal_id = 'BVYE-94-46-29'; // Per README test data
test.describe('Cold-start: Journal view (IndexedDB empty)', () => {
test.beforeEach(async ({ page }) => {
@@ -30,14 +30,14 @@ test.describe('Cold-start: Journal view (IndexedDB empty)', () => {
// Ensure abstract module prop is present for layout/components
mod_abstracts_json: {},
// Provide a test person id so owner-only pages render in tests
person_id: 'test-person-1',
user: { id: 'test-person-1' }
person_id: 'QWODAPCNLQU', // Per README test data
user: { id: 'QWODAPCNLQU' } // Per README test data
};
window.localStorage.setItem('ae_loc', JSON.stringify(testData));
// Also set a lightweight selection object used by pages
window.localStorage.setItem('ae_slct', JSON.stringify({ journal_id: journal_id }));
},
{ defaults: ae_app_local_data_defaults, account_id: demo_account_id, journal_id: demo_journal }
{ defaults: ae_app_local_data_defaults, account_id: testing_account_id, journal_id: journal_id }
);
// Navigate to the app origin so IndexedDB is available in the page
@@ -68,7 +68,7 @@ test.describe('Cold-start: Journal view (IndexedDB empty)', () => {
});
// Seed IndexedDB with the journal record so local liveQuery finds it
await page.evaluate(({ demo_journal }) => {
await page.evaluate(({ journal_id }) => {
return new Promise<void>((resolve) => {
try {
const req = indexedDB.open('ae_journals_db', 1);
@@ -82,7 +82,8 @@ test.describe('Cold-start: Journal view (IndexedDB empty)', () => {
const db = req.result;
const tx = db.transaction('journal', 'readwrite');
const store = tx.objectStore('journal');
store.put({ id: demo_journal, journal_id: demo_journal, name: 'Demo Journal (Cold Start Test)', description: 'Created for cold-start Playwright test', person_id: 'test-person-1' });
// Why are both the id and journal_id fields being set?
store.put({ id: journal_id, journal_id: journal_id, name: 'Demo Journal (Cold Start Test)', description: 'Created for cold-start Playwright test', person_id: 'QWODAPCNLQU' }); // Per README test data
tx.oncomplete = () => {
db.close();
resolve();
@@ -97,20 +98,20 @@ test.describe('Cold-start: Journal view (IndexedDB empty)', () => {
resolve();
}
});
}, { demo_journal });
}, { journal_id });
// Mock the journal GET endpoint used by the journal page
await page.route('**/v3/**', async (route) => {
const req = route.request();
const url = req.url();
if (url.includes(`/v3/crud/journal/${demo_journal}`) && req.method() === 'GET') {
if (url.includes(`/v3/crud/journal/${journal_id}`) && req.method() === 'GET') {
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ data: {
id: demo_journal,
journal_id: demo_journal,
id: journal_id, // Why are both the id and journal_id fields being set?
journal_id: journal_id, // Why are both the id and journal_id fields being set?
name: 'Demo Journal (Cold Start Test)',
description: 'Created for cold-start Playwright test'
} })
@@ -125,7 +126,7 @@ test.describe('Cold-start: Journal view (IndexedDB empty)', () => {
});
test('renders Journal page without prior IndexedDB cache', async ({ page }) => {
await page.goto(`/journals/${demo_journal}`);
await page.goto(`/journals/${journal_id}`);
// The journal title appears in the journal component header
const journal_name = page.locator('h2.journal__name');