Skip to content

Commit eca03fb

Browse files
align customize query flow to design (#25)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 5aac217 commit eca03fb

26 files changed

+782
-864
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { test, expect } from "@playwright/test";
2+
import { TEST_URL } from "../playwright-setup";
3+
import { STEP_TWO_PAGE_TITLE } from "@/app/query/components/patientSearchResults/PatientSearchResultsTable";
4+
import { STEP_THREE_PAGE_TITLE } from "@/app/query/components/selectQuery/SelectSavedQuery";
5+
import { TEST_PATIENT, TEST_PATIENT_NAME } from "./constants";
6+
7+
test.describe("alternate queries with the Query Connector", () => {
8+
test.beforeEach(async ({ page }) => {
9+
// Start every test on our main landing page
10+
await page.goto(TEST_URL);
11+
});
12+
13+
test("query using form-fillable demo patient by phone number", async ({
14+
page,
15+
}) => {
16+
await page.getByRole("button", { name: "Go to the demo" }).click();
17+
await page.getByRole("button", { name: "Fill fields" }).click();
18+
19+
// Delete last name and MRN to force phone number as one of the 3 fields
20+
await page.getByLabel("Last Name").clear();
21+
await page.getByLabel("Medical Record Number").clear();
22+
23+
// Among verification, make sure phone number is right
24+
await page.getByRole("button", { name: "Search for patient" }).click();
25+
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
26+
await expect(
27+
page.getByRole("heading", { name: STEP_TWO_PAGE_TITLE }),
28+
).toBeVisible();
29+
await page.getByRole("link", { name: "Select patient" }).click();
30+
await expect(
31+
page.getByRole("heading", { name: STEP_THREE_PAGE_TITLE }),
32+
).toBeVisible();
33+
await page.getByRole("button", { name: "Submit" }).click();
34+
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
35+
36+
await expect(page.getByText("Patient Name")).toBeVisible();
37+
await expect(page.getByText(TEST_PATIENT_NAME)).toBeVisible();
38+
await expect(page.getByText("Contact")).toBeVisible();
39+
await expect(page.getByText(TEST_PATIENT.Phone)).toBeVisible();
40+
await expect(page.getByText("Patient Identifiers")).toBeVisible();
41+
await expect(page.getByText(TEST_PATIENT.MRN)).toBeVisible();
42+
});
43+
44+
test("social determinants query with generalized function", async ({
45+
page,
46+
}) => {
47+
await page.getByRole("button", { name: "Go to the demo" }).click();
48+
await page.getByRole("button", { name: "Fill fields" }).click();
49+
await page.getByRole("button", { name: "Search for patient" }).click();
50+
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
51+
52+
await page.getByRole("link", { name: "Select patient" }).click();
53+
await expect(
54+
page.getByRole("heading", { name: "Select a query" }),
55+
).toBeVisible();
56+
await page.getByTestId("Select").selectOption("social-determinants");
57+
await page.getByRole("button", { name: "Submit" }).click();
58+
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
59+
60+
await expect(
61+
page.getByRole("heading", { name: "Patient Record" }),
62+
).toBeVisible();
63+
});
64+
65+
test("form-fillable STI query using generalized function", async ({
66+
page,
67+
}) => {
68+
await page.getByRole("button", { name: "Go to the demo" }).click();
69+
await page.getByRole("button", { name: "Fill fields" }).click();
70+
await page.getByRole("button", { name: "Search for patient" }).click();
71+
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
72+
await page.getByRole("link", { name: "Select patient" }).click();
73+
await page.getByTestId("Select").selectOption("chlamydia");
74+
await page.getByRole("button", { name: "Submit" }).click();
75+
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
76+
77+
await expect(
78+
page.getByRole("heading", { name: "Patient Record" }),
79+
).toBeVisible();
80+
});
81+
});

query-connector/e2e/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { hyperUnluckyPatient } from "@/app/constants";
2+
3+
export const TEST_PATIENT = hyperUnluckyPatient;
4+
export const TEST_PATIENT_NAME =
5+
hyperUnluckyPatient.FirstName + " A. " + hyperUnluckyPatient.LastName;

query-connector/e2e/example.spec.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

query-connector/e2e/load.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { test, expect } from "@playwright/test";
2+
import { TEST_URL } from "../playwright-setup";
3+
import { metadata } from "@/app/constants";
4+
5+
test("landing page loads", async ({ page }) => {
6+
await page.goto(TEST_URL);
7+
8+
// Check that each expected text section is present
9+
await expect(
10+
page.getByRole("heading", { name: "Data collection made easier" }),
11+
).toBeVisible();
12+
await expect(
13+
page.getByRole("heading", { name: "What is it?" }),
14+
).toBeVisible();
15+
await expect(
16+
page.getByRole("heading", { name: "How does it work?" }),
17+
).toBeVisible();
18+
19+
// Check that interactable elements are present (header and Get Started)
20+
await expect(page.getByRole("link", { name: metadata.title })).toBeVisible();
21+
await expect(
22+
page.getByRole("button", { name: "Go to the demo" }),
23+
).toBeVisible();
24+
});

0 commit comments

Comments
 (0)