session persistence, per-tab model selector Brings detailed coverage to sections that were previously only smoke- tested: - sickvisit-workflow.spec.js: generate → mocked note, refine bar round-trip, load popover, New button clears demographics + transcript. - hospitalcourse-workflow.spec.js: fill H&P → generate → mocked narrative renders via /api/generate-hospital-course, refine updates text, load popover open/close. - auth-screen.spec.js: unauthenticated landing visible, login form structure, forgot-password swap + return, register link is intentionally display:none on this instance (pinned), register form DOM still wired correctly if the link is manually unhidden, reg- password has minlength=8 + type=password. - session-persistence.spec.js: clear cookie simulates logout (UI login is gated by Turnstile which can't be completed in the e2e container); re-login via loginAs restores the last tab + sub-pill via localStorage. - model-selector.spec.js: tab-model-select dropdowns render with >0 options across 7 tabs. Fixture corrections: - /api/sick-visit/note and /api/well-visit/note were not being mocked at all — the wrong /api/generate-sick-visit pattern was intercepting nothing, so tests fell through to the real AI backend. Both now have correct patterns and response shapes (sick-visit returns `note`, well-visit note returns `note`). - /api/generate-hospital-course response key updated from `narrative` to `hospitalCourse` to match what the frontend actually reads. wellvisit-workflow: the Visit Note test now asserts a concrete waitForResponse on /api/well-visit/note + text render, instead of the previous "hit either endpoint" fallback. Suite: 294 passed / 0 failed in 5m30s.
43 lines
2 KiB
JavaScript
43 lines
2 KiB
JavaScript
// ============================================================
|
|
// MODEL SELECTOR — each tab has its own <select.tab-model-select>
|
|
// populated by window._buildModelOptions. Verify the dropdowns
|
|
// render across tabs that should have one.
|
|
// ============================================================
|
|
|
|
const { test, expect, E2E_BASE } = require('../fixtures');
|
|
|
|
async function openTab(page, name) {
|
|
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="${name}"]`);
|
|
await page.waitForFunction((t) => {
|
|
const el = document.getElementById(t + '-tab');
|
|
return el && el.classList.contains('active') && el.innerHTML.trim().length > 100;
|
|
}, name, { timeout: 15000 });
|
|
}
|
|
|
|
test.describe('Per-tab model selector', () => {
|
|
const tabsWithModelPicker = ['encounter', 'dictation', 'chart', 'soap', 'hospital', 'sickvisit', 'wellvisit'];
|
|
|
|
for (const tab of tabsWithModelPicker) {
|
|
test(`${tab}: model picker renders and has at least one option`, async ({ authedPage: _, page }) => {
|
|
await openTab(page, tab);
|
|
// Well Visit has four sub-panels each with their own picker; three of
|
|
// them are hidden until you switch to that sub-tab, so visibility is
|
|
// unreliable. Instead: require that the active tab contains at least
|
|
// one picker AND that at least one picker inside the tab has >0
|
|
// options populated by window._buildModelOptions.
|
|
const pickers = page.locator(`#${tab}-tab select.tab-model-select`);
|
|
await expect.poll(async () => pickers.count(), { timeout: 10000 })
|
|
.toBeGreaterThan(0);
|
|
await expect.poll(async () => {
|
|
return await pickers.evaluateAll(list => list.reduce((max, el) =>
|
|
Math.max(max, el.options ? el.options.length : 0), 0));
|
|
}, { timeout: 10000 }).toBeGreaterThan(0);
|
|
});
|
|
}
|
|
});
|