Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/applications-launcher-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function launcherAppsForSession(canAccessFavourites: boolean): LauncherApp[] {

const toolsLauncherCopy = {
heading: "Tools",
description: "Assessment, prescribing, documents, and clinical workflows.",
description: "Assessment, prescribing, and clinical workflows.",
allSectionLabel: "All tools",
countNoun: "tools",
emptyTitle: "No tools match",
Expand Down
2 changes: 1 addition & 1 deletion src/components/clinical-dashboard/favourites-hub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function FavouritesHub({
<ModeHomeHero
testId="favourites-home"
title="Favourites"
subtitle="Notes, sources, medication pages, and clinical sets, ready to reuse."
subtitle="Notes, sources, and clinical sets, ready to reuse."
icon={Heart}
headingLevel={headingLevel}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function MedicationHome({
return (
<ModeHomeTemplate
testId="medication-home"
title="Medication prescribing"
title="Medication"
subtitle="Search a medication or prescribing question."
icon={Pill}
headingLevel={2}
Expand Down
2 changes: 1 addition & 1 deletion src/components/dsm/dsm-home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function DsmHomePage() {
<ModeHomeTemplate
testId="dsm-home"
title="DSM-5 Diagnosis"
subtitle="Find diagnostic criteria, review specifiers, compare diagnoses, and clarify differential considerations."
subtitle="Diagnostic criteria, specifiers, and comparisons."
icon={BookOpenCheck}
actionsLabel="DSM-5 Diagnosis actions"
desktopComposerSlotId={modeHomeDesktopComposerSlotId}
Expand Down
4 changes: 2 additions & 2 deletions src/components/factsheets/factsheets-home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export function FactsheetsHomePage() {
<div className="mode-home-template mx-auto flex w-full max-w-none flex-col items-center gap-5 px-0 text-center sm:max-w-[62rem] sm:gap-6">
<ModeHomeHero
testId="factsheets-home"
title="Clear information for the next conversation."
subtitle="Find a short, plain-language factsheet to support a patient conversation — sourced, dated, and easy to take away."
title="Factsheets"
subtitle="Plain-language patient handouts to print and share."
icon={BookOpenText}
/>

Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/forms-home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function FormsHomePage() {
<ModeHomeTemplate
testId="forms-home-template"
title="Forms"
subtitle="The complete WA MHA 2014 forms register. Search by form code, task, authority, clock, or pathway."
subtitle="The complete WA MHA 2014 forms register."
icon={FileText}
desktopComposerSlotId={modeHomeDesktopComposerSlotId}
actionsLabel="Forms tasks"
Expand Down
4 changes: 2 additions & 2 deletions src/components/formulation/formulation-home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ function FormulationHome() {
<ModeHomeMain testId="formulation-home" contentAlign="startOnPhone">
<ModeHomeTemplate
testId="formulation"
title="How can I help with the formulation?"
subtitle="Search mechanisms, compare alternatives, or build a structured clinical formulation from the evidence in front of you."
title="Formulation"
subtitle="Build a structured clinical formulation from the evidence."
icon={Network}
actionsLabel="Formulation workflows"
desktopComposerSlotId={modeHomeDesktopComposerSlotId}
Expand Down
4 changes: 2 additions & 2 deletions src/components/services/services-home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export function ServicesHomePage({ defaultServiceSlug = null }: { defaultService
>
<ModeHomeTemplate
testId="services-home-template"
title="Find a service"
subtitle="Search by need, catchment, referral route, or provider."
title="Services"
subtitle="Search by need, catchment, or referral route."
icon={Users}
desktopComposerSlotId={modeHomeDesktopComposerSlotId}
actionsLabel="Service tasks"
Expand Down
4 changes: 2 additions & 2 deletions src/components/specifiers/specifiers-home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ function SpecifiersHome() {
<ModeHomeMain testId="specifiers-home" contentAlign="startOnPhone">
<ModeHomeTemplate
testId="specifiers"
title="Refine the diagnosis with the right specifier"
subtitle="Describe the presentation in ordinary clinical language, then check fit, exclusions, and diagnostic wording."
title="Specifiers"
subtitle="Refine diagnostic wording, exclusions, and episode patterns."
icon={Tags}
actionsLabel="Specifier workflows"
desktopComposerSlotId={modeHomeDesktopComposerSlotId}
Expand Down
6 changes: 3 additions & 3 deletions src/components/therapy-compass/screens/home-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export function HomeScreen() {

const therapyCountCopy =
b.therapies.length === 0
? "Search source-grounded therapy records by problem, symptom, skill or population — or jump into a clinical pathway."
: `Search ${b.therapies.length} source-grounded therapy ${b.therapies.length === 1 ? "record" : "records"} by problem, symptom, skill or population — or jump into a clinical pathway.`;
? "Source-grounded therapy records and clinical pathways."
: `${b.therapies.length} source-grounded therapy ${b.therapies.length === 1 ? "record" : "records"} and clinical pathways.`;

return (
<ModeHomeMain testId="therapy-compass-home" contentAlign="startOnPhone">
<ModeHomeTemplate
testId="therapy-compass"
title="What therapy are you looking for?"
title="Therapy"
subtitle={therapyCountCopy}
icon={Search}
actionsLabel="Therapy workflows"
Expand Down
20 changes: 11 additions & 9 deletions tests/therapy-compass-data-recovery.dom.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ describe("Therapy Compass required data recovery", () => {

expect(await screen.findByRole("status")).toHaveTextContent("Loading therapy library…");
expect(screen.getAllByRole("main")).toHaveLength(1);
expect(screen.queryByText(/Search 0 source-grounded therapy/)).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "What therapy are you looking for?" })).not.toBeInTheDocument();
expect(screen.queryByText(/Source-grounded therapy records and clinical pathways/)).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Therapy" })).not.toBeInTheDocument();

release(undefined);

await waitFor(() => expect(screen.getByText(/Search 1 source-grounded therapy record by/)).toBeInTheDocument());
expect(screen.getByRole("heading", { name: "What therapy are you looking for?" })).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByText(/1 source-grounded therapy record and clinical pathways/)).toBeInTheDocument(),
);
expect(screen.getByRole("heading", { name: "Therapy" })).toBeInTheDocument();
expect(screen.getAllByRole("main")).toHaveLength(1);
expect(screen.queryByText(/Search 0 source-grounded therapy/)).not.toBeInTheDocument();
expect(screen.queryByText(/Source-grounded therapy records and clinical pathways/)).not.toBeInTheDocument();
});

it("shows an honest load error, retries all required files, and recovers", async () => {
Expand All @@ -89,17 +91,17 @@ describe("Therapy Compass required data recovery", () => {
);

expect(screen.getByRole("status")).toHaveTextContent("Loading therapy library");
expect(screen.queryByText(/Search 0 source-grounded therapy records/)).not.toBeInTheDocument();
expect(screen.queryByText(/Source-grounded therapy records and clinical pathways/)).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Frequently used therapies" })).not.toBeInTheDocument();

expect(await screen.findByRole("alert")).toHaveTextContent("Therapy Compass could not load");
expect(screen.queryByRole("heading", { name: "What therapy are you looking for?" })).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: "Therapy" })).not.toBeInTheDocument();

failTherapies = false;
fireEvent.click(screen.getByRole("button", { name: "Retry" }));

expect(await screen.findByRole("heading", { name: "What therapy are you looking for?" })).toBeInTheDocument();
expect(screen.getByText(/Search 1 source-grounded therapy record by/)).toBeInTheDocument();
expect(await screen.findByRole("heading", { name: "Therapy" })).toBeInTheDocument();
expect(screen.getByText(/1 source-grounded therapy record and clinical pathways/)).toBeInTheDocument();
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
await waitFor(() => expect(fetchMock).toHaveBeenCalledTimes(2));
});
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ test.describe("Clinical KB accessibility coverage", () => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/therapy-compass", { waitUntil: "domcontentloaded" });

await expect(page.getByRole("heading", { name: "What therapy are you looking for?" })).toBeVisible({
await expect(page.getByRole("heading", { name: "Therapy", exact: true })).toBeVisible({
timeout: 60_000,
});

Expand Down
2 changes: 1 addition & 1 deletion tests/ui-formulation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test("searches patient language, opens a mechanism guide, and carries it into th
}, testInfo) => {
await gotoApp(page, "/formulation");

await expect(page.getByRole("heading", { name: "How can I help with the formulation?" })).toBeVisible();
await expect(page.getByRole("heading", { name: "Formulation", exact: true })).toBeVisible();
await expect(page.getByTestId("formulation-home")).toBeVisible();

const search = page.getByTestId("global-search-input").filter({ visible: true }).first();
Expand Down
6 changes: 3 additions & 3 deletions tests/ui-route-coverage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ test.describe("previously uncovered production routes", () => {
"/therapy-compass",
async (currentPage) => {
await expect(currentPage.getByRole("main")).toBeVisible();
await expect(
currentPage.getByRole("heading", { name: "What therapy are you looking for?", level: 1 }),
).toBeVisible({ timeout: 30_000 });
await expect(currentPage.getByRole("heading", { name: "Therapy", level: 1, exact: true })).toBeVisible({
timeout: 30_000,
});
},
async (currentPage) => {
const search = currentPage
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-specifiers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test("searches clinical language without provenance fields and carries a result
}, testInfo) => {
await gotoApp(page, "/specifiers");

await expect(page.getByRole("heading", { name: "Refine the diagnosis with the right specifier" })).toBeVisible();
await expect(page.getByRole("heading", { name: "Specifiers", exact: true })).toBeVisible();
await expect(page.getByTestId("specifiers-home")).toBeVisible();

const search = page.getByTestId("global-search-input").filter({ visible: true }).first();
Expand Down
16 changes: 10 additions & 6 deletions tests/ui-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,14 @@ test.describe("Clinical KB tools launcher", () => {
await expect(page).toHaveURL(/\/services$/);
await expect(page.getByRole("button", { name: "Mode Services" })).toBeVisible();
await expect(page.getByTestId("services-home")).toBeVisible();
await expect(page.getByRole("heading", { level: 1, name: "Find a service" })).toBeVisible();
await expect(page.getByRole("heading", { level: 1, name: "Services" })).toBeVisible();
await expect(page.getByRole("button", { name: "Expand sidebar" })).toBeVisible();
await expect(page.getByTestId("collapsed-account-settings")).toBeVisible();
await expect(visibleGlobalSearchInput(page)).toHaveCount(1);
const servicesHomeSearch = page.getByTestId("services-home").getByTestId("global-search-input");
await expect(servicesHomeSearch).toBeVisible();
const servicesSearchBox = await servicesHomeSearch.boundingBox();
const servicesHeadingBox = await page.getByRole("heading", { level: 1, name: "Find a service" }).boundingBox();
const servicesHeadingBox = await page.getByRole("heading", { level: 1, name: "Services" }).boundingBox();
expect(servicesSearchBox).not.toBeNull();
expect(servicesHeadingBox).not.toBeNull();
expect((servicesHeadingBox?.y ?? 0) + (servicesHeadingBox?.height ?? 0)).toBeLessThan(servicesSearchBox?.y ?? 0);
Expand Down Expand Up @@ -559,7 +559,7 @@ test.describe("Clinical KB tools launcher", () => {

for (const home of [
{ path: "/?mode=answer", testId: "answer-empty-state", heading: "How can I help?", headingLevel: 2 },
{ path: "/services", testId: "services-home", heading: "Find a service", headingLevel: 1 },
{ path: "/services", testId: "services-home", heading: "Services", headingLevel: 1 },
{ path: "/forms", testId: "forms-home", heading: "Forms", headingLevel: 1 },
{ path: "/differentials", testId: "differentials-home", heading: "Differentials", headingLevel: 1 },
{ path: "/favourites", testId: "favourites-hub", heading: "Favourites command library", headingLevel: 1 },
Expand Down Expand Up @@ -763,10 +763,10 @@ test.describe("Clinical KB tools launcher", () => {
{
path: "/?mode=prescribing",
testId: "medication-home",
heading: "Medication prescribing",
heading: "Medication",
headingLevel: 2,
},
{ path: "/services", testId: "services-home", heading: "Find a service", headingLevel: 1 },
{ path: "/services", testId: "services-home", heading: "Services", headingLevel: 1 },
{ path: "/forms", testId: "forms-home", heading: "Forms", headingLevel: 1 },
{ path: "/differentials", testId: "differentials-home", heading: "Differentials", headingLevel: 1 },
{ path: "/tools", testId: "tools-home", heading: "Tools", headingLevel: 1 },
Expand All @@ -784,8 +784,12 @@ test.describe("Clinical KB tools launcher", () => {
await expect(heroSearch).toBeVisible();

const searchBox = await heroSearch.boundingBox();
// Scope to the mode-home container and match exactly: the standalone
// "Medication" hero title is otherwise a substring of the answer
// section's sr-only "Medication matches" heading (strict-mode clash).
const headingBox = await page
.getByRole("heading", { level: home.headingLevel, name: home.heading })
.getByTestId(home.testId)
.getByRole("heading", { level: home.headingLevel, name: home.heading, exact: true })
.boundingBox();
expect(searchBox).not.toBeNull();
expect(headingBox).not.toBeNull();
Expand Down