8 new spec files covering sections previously only smoke-tested:
- ai-endpoints-contract.spec.js — hits 8 real AI endpoints via request
context and fails if the response leaks TypeError / ReferenceError /
'Cannot read properties of undefined' / 'is not defined' / 'is not a
function'. This is the class of bug that shipped the PE-narrative
regression to prod because every page-level mock prevented the real
handler from running.
- encounter-workflow.spec.js — generate HPI, refine, clear transcript.
- encounter-save-load.spec.js — save draft, load popover, repopulate.
- wellvisit-workflow.spec.js — byvisit, milestones, SSHADESS (12+
reveal), visit note.
- vaxschedule-content.spec.js — schedule + catch-up panels populate
beyond "Loading".
- chart-review-workflow.spec.js — generate + load popover.
- learning-tab.spec.js — search filter, category pills, feed.
- settings-faq-dictation.spec.js — voice/password/2FA/Nextcloud
sections, FAQ expand/collapse, dictation generate flow.
Baseline fixes:
- Added CORS_ORIGINS + API_RATE_LIMIT_MAX env overrides so the e2e
container accepts the browser's Origin header and can absorb the
full suite's API traffic without tripping the 200/min guard.
- Server's /api/ rate limit is now configurable via
API_RATE_LIMIT_MAX (default stays 200).
- extensions-crud: replaced native page.on('dialog') listeners with
#confirm-modal-ok clicks (we moved off native confirm()).
- pe-guide-smoke + extensions-crud: mobile viewport opens the hamburger
before clicking sidebar tabs.
- fixtures.js: /api/refine mock uses 'refined' (real API shape), not
'content'. /api/chart-review replaced with /api/generate-chart-review.
Suite: 230 passed / 0 failed in 4m36s.
57 lines
2.5 KiB
JavaScript
57 lines
2.5 KiB
JavaScript
// ============================================================
|
|
// LEARNING HUB — search, category pills, feed rendering.
|
|
// Quiz flow is gated by having quiz content; just verify the UI
|
|
// scaffolding works without requiring a specific topic to exist.
|
|
// ============================================================
|
|
|
|
const { test, expect, E2E_BASE } = require('../fixtures');
|
|
|
|
async function openTab(page) {
|
|
await page.goto(E2E_BASE + '/');
|
|
await page.waitForSelector('button.tab-btn', { timeout: 15000 });
|
|
const vp = page.viewportSize();
|
|
if (vp && vp.width <= 768) {
|
|
await page.click('#btn-menu-toggle').catch(() => {});
|
|
}
|
|
await page.click('button.tab-btn[data-tab="learning"]');
|
|
await page.waitForFunction(() => {
|
|
const el = document.getElementById('learning-tab');
|
|
return el && el.classList.contains('active') && el.innerHTML.trim().length > 100;
|
|
}, { timeout: 15000 });
|
|
}
|
|
|
|
test.describe('Learning Hub — navigation + search', () => {
|
|
|
|
test('search input + categories + feed all render', async ({ authedPage: _, page }) => {
|
|
await openTab(page);
|
|
await expect(page.locator('#lh-search')).toBeVisible();
|
|
await expect(page.locator('#lh-categories')).toBeVisible();
|
|
await expect(page.locator('#lh-feed')).toBeVisible();
|
|
});
|
|
|
|
test('typing in search filters the feed (even if zero matches)', async ({ authedPage: _, page }) => {
|
|
await openTab(page);
|
|
// Wait for feed to render some content or be flagged as empty
|
|
await expect.poll(async () =>
|
|
(await page.locator('#lh-feed').innerText()).trim().length,
|
|
{ timeout: 10000 }).toBeGreaterThan(0);
|
|
const initialHtml = await page.locator('#lh-feed').innerHTML();
|
|
|
|
// Type a very specific string that likely won't match any topic
|
|
await page.fill('#lh-search', 'xyzzy-unlikely-topic-name');
|
|
// Feed should update — either to empty state or different filtered list
|
|
await expect.poll(async () =>
|
|
(await page.locator('#lh-feed').innerHTML()) !== initialHtml,
|
|
{ timeout: 3000 }).toBe(true);
|
|
});
|
|
|
|
test('clicking a category pill (if present) does not crash the UI', async ({ authedPage: _, page }) => {
|
|
await openTab(page);
|
|
const pills = page.locator('#lh-categories button, #lh-categories .category-pill');
|
|
const count = await pills.count();
|
|
test.skip(count === 0, 'No category pills rendered — nothing to test');
|
|
await pills.first().click();
|
|
// Feed must still be visible and have some content after filtering
|
|
await expect(page.locator('#lh-feed')).toBeVisible();
|
|
});
|
|
});
|