// ============================================================ // BEDSIDE (React port) — sub-nav shell smoke test. // // First-commit scope: the 15 sub-pills render in the expected order // and selecting a pill reveals a panel with a legacy-viewer link. // Actual clinical dosing panels (neonatal through trauma) port in // dedicated follow-up commits alongside the calculators. // ============================================================ const { test, expect, E2E_BASE } = require('../fixtures'); const EXPECTED_PILLS = [ 'neonatal', 'airway', 'cardiac', 'respiratory', 'ventilation', 'seizure', 'sepsis', 'anaphylaxis', 'sedation', 'agitation', 'antiemetics', 'antimicrobials', 'burns', 'toxicology', 'trauma', ]; async function openReactBedside(page) { await page.goto(E2E_BASE + '/app/bedside'); await page.waitForSelector('[data-testid="bedside-subnav"]', { timeout: 15000 }); } test.describe('React Bedside — sub-nav shell', () => { test('all 15 sub-pills render in the expected order', async ({ authedPage: _, page }) => { await openReactBedside(page); for (const id of EXPECTED_PILLS) { await expect(page.locator('[data-testid="bedside-pill-' + id + '"]')).toBeVisible(); } }); test('clicking a pill switches the active panel', async ({ authedPage: _, page }) => { await openReactBedside(page); await expect(page.locator('[data-testid="bedside-panel-neonatal"]')).toBeVisible(); await page.click('[data-testid="bedside-pill-airway"]'); await expect(page.locator('[data-testid="bedside-panel-airway"]')).toBeVisible(); }); test('panel carries a legacy-viewer link', async ({ authedPage: _, page }) => { await openReactBedside(page); await expect(page.getByText('Open in legacy viewer').first()).toBeVisible(); }); test('age-to-weight estimator runs in React', async ({ authedPage: _, page }) => { await openReactBedside(page); await page.fill('[data-testid="bedside-age-input"]', '3y'); await expect(page.locator('[data-testid="bedside-estimate-result"]')).toContainText('14 kg'); await expect(page.locator('[data-testid="bedside-weight-input"]')).toHaveValue('14'); await page.selectOption('[data-testid="bedside-formula-select"]', 'bestguess'); await expect(page.locator('[data-testid="bedside-estimate-result"]')).toContainText('16 kg'); await expect(page.locator('[data-testid="bedside-weight-input"]')).toHaveValue('16'); }); });