Skip to content

Commit

Permalink
refactor select patient (#2655)
Browse files Browse the repository at this point in the history
* componentize patient results redirection

* dedupe patient search results

* move file

* fix parent page redirect

* styling

* lint

* [pre-commit.ci] auto fixes from pre-commit hooks

* simplify state setting further

* lint

* test page too

* remove some unneeded markup

* empty file

* lint

* fix playwright tests

* playwright attempt 2

* add level info?

* punt the test issue

* remove the backlink entirely

* [pre-commit.ci] auto fixes from pre-commit hooks

* add hover colors and clean up styles

* typo

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
fzhao99 and pre-commit-ci[bot] authored Oct 3, 2024
1 parent 554dea6 commit 1dc48be
Show file tree
Hide file tree
Showing 15 changed files with 250 additions and 460 deletions.
19 changes: 11 additions & 8 deletions containers/tefca-viewer/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check

import { RETURN_TO_STEP_ONE_LABEL } from "@/app/query/components/PatientSearchResults";
import { test, expect } from "@playwright/test";

test.describe("querying with the TryTEFCA viewer", () => {
Expand Down Expand Up @@ -109,10 +110,12 @@ test.describe("querying with the TryTEFCA viewer", () => {

// Better luck next time, user!
await expect(
page.getByRole("heading", { name: "No Patients Found" }),
page.getByRole("heading", { name: "No Records Found" }),
).toBeVisible();
await expect(page.getByText("There are no patient records")).toBeVisible();
await page.getByRole("link", { name: "Search for a new patient" }).click();
await expect(
page.getByText("No records were found for your search"),
).toBeVisible();
await page.getByRole("link", { name: RETURN_TO_STEP_ONE_LABEL }).click();
await expect(
page.getByRole("heading", { name: "Search for a Patient", exact: true }),
).toBeVisible();
Expand Down Expand Up @@ -260,7 +263,7 @@ test.describe("Test the user journey of a 'tester'", () => {
await page.getByRole("button", { name: "Search for patient" }).click();
// Make sure all the elements for the multiple patients view appear
await expect(
page.getByRole("heading", { name: "Multiple Records Found" }),
page.getByRole("heading", { name: "Select a patient" }),
).toBeVisible();
// Check that there is a Table element with the correct headers
await expect(page.locator("thead").locator("tr")).toHaveText(
Expand All @@ -270,8 +273,8 @@ test.describe("Test the user journey of a 'tester'", () => {
// Check that there are multiple rows in the table
await expect(page.locator("tbody").locator("tr")).toHaveCount(10);

// Click on the first patient's "View Record" button
await page.locator(':nth-match(:text("View Record"), 1)').click();
// Click on the first patient's "Select patient" button
await page.locator(':nth-match(:text("Select patient"), 1)').click();

// Make sure we have a results page with a single patient & appropriate back buttons
await expect(
Expand All @@ -281,9 +284,9 @@ test.describe("Test the user journey of a 'tester'", () => {
page.getByRole("button", { name: "New patient search" }),
).toBeVisible();

await page.getByRole("link", { name: "Return to search results" }).click();
await page.getByRole("button", { name: "New patient search" }).click();
await expect(
page.getByRole("heading", { name: "Multiple Records Found" }),
page.getByRole("heading", { name: "Search for a Patient", exact: true }),
).toBeVisible();
});
});
4 changes: 1 addition & 3 deletions containers/tefca-viewer/src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,7 @@ export const stateOptions = [
export type Mode =
| "search"
| "results"
| "multiple-patients"
| "no-patients"
| "multiple-patients-results"
| "patient-results"
| "customize-queries";

/*Type to specify the expected components for each item in a value set that will be
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1dc48be

Please sign in to comment.