Files
OSIT-AE-App-Svelte/tests/README.md
Scott Idem fd5c36f836 Test: Add Playwright test for session cold-start bug fix
New test validates that presentations AND presenters render on first
navigation when IndexedDB is empty (cold-start scenario).

Test Configuration:
- Demo Session: DOW3h7v6H42 (703) 'How To Do Things'
- Demo Presentation: 7U2eXSjR6H4 (1670) 'Build a House'
- Demo Presenter: gT-hxnifb-0 (2202) 'Bob The Builder'

Tests:
1. UI visibility: Session name, presentation, and presenter all visible
2. IDB integrity: Verifies all nested data written to IndexedDB

Both tests passing - confirms fix works correctly.
2026-02-26 13:47:07 -05:00

78 lines
3.1 KiB
Markdown

# Playwright tests (Aether)
Quick guide for running and editing the Playwright tests in this repo.
Running tests
- Run the full test suite (uses `playwright.config.ts`):
```bash
npx playwright test -c playwright.config.ts
```
- Run a single test file:
```bash
npx playwright test tests/path/to/file.test.ts -c playwright.config.ts
```
- Run a single test by title (grep):
```bash
npx playwright test -g "Badge - interaction" -c playwright.config.ts
```
Notes
- Tests in `tests/disabled/` are ignored by default (see `playwright.config.ts`). Move flaky or environment-dependent tests there.
- The runner starts a local dev server via `npm run dev` by default (see `playwright.config.ts:webServer`). Ensure the app can start on port `5173` or update the config.
Writing / modifying tests
- Tests are TypeScript files under `tests/` and should export Playwright `test` blocks. Example header:
```ts
import { test, expect } from '@playwright/test';
test('example', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/OSIT/);
});
```
- Use `page.route('**/v3/**', handler)` to mock backend responses for deterministic tests.
- Use `page.addInitScript` to inject `ae_loc` localStorage defaults when tests need authenticated/admin state.
Adding new tests
- Create a new file `tests/my_feature.test.ts`.
- Keep tests focused and deterministic: mock network calls and avoid relying on external services.
- Place environment-sensitive tests in `tests/disabled/` so they are not run in CI by default.
Committing
- Stage and commit test changes as usual. Example:
```bash
git add tests/
git commit -m "test: add <description>"
```
Help
- If a test fails due to external network calls or platform-specific behavior, try mocking the relevant endpoints and move the test to `tests/disabled` if it cannot be made deterministic.
## Development / Testing / Demo environment information
* Use snake_case (or Snake_Case or Snake_case or test_NASA_example or test_API_key)
* Aether test/demo base URL: 'http://demo.localhost:5173'
* Aether development API: 'https://dev-api.oneskyit.com'
* Aether test/demo Account: '_XY7DXtc9MY' (1) "One Sky IT Demo"
* Aether test/demo Event: 'pjrcghqwert' (1) "Demo One Sky IT Conference"
* Aether test/demo Event Session: 'DOW3h7v6H42' (703) "How To Do Things"
* Aether test/demo Event Presentation: '7U2eXSjR6H4' (1670) "Build a House"
* Aether test/demo Event Presenter: 'gT-hxnifb-0' (2202) "Bob The Builder"
* Aether test/demo Event File: 'OOsHXtng5mr' (2985) "1 Quick Test for macOS.mp4"
* Aether test/demo Event Badge: 'UIJT-73-63-61' (37163) "Scott Idem"
* Aether test/demo Event Person: 'ffkKxiHpOEC' (16603) "Scott Idem"
* Aether test/demo Event Badge Template: 'jgfixEpYp1B' (18) "Dev Demo 202x"
* Aether test/demo Event Badge Template: 'rzmUgsk7mkq' (19) "Dev Demo 202x Workshops"
* Aether test/demo Journal: 'BVYE-94-46-29' (42) "Testing Things"
* Aether test/demo Journal Entry: 'xRx-Y4-h3-fU' (233) "Another Journal Entry in the Test Journal"
* Aether test/demo Archive: 'nAA2bHLv8RK' (1) "One Sky Test Archive"
* Aether test/demo Archive Content: 'UjKzrk-GKu5' (1) "Hosted File Test"