Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align customize query flow to design #17

Closed
wants to merge 10 commits into from
Closed
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
81 changes: 81 additions & 0 deletions containers/tefca-viewer/e2e/alternate_queries.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { test, expect } from "@playwright/test";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole page is just a copy-paste from the existing file to help parallelize the playwright runners

import { TEST_URL } from "../playwright-setup";
import { STEP_TWO_PAGE_TITLE } from "@/app/query/components/patientSearchResults/PatientSearchResultsTable";
import { STEP_THREE_PAGE_TITLE } from "@/app/query/components/selectQuery/SelectSavedQuery";
import { TEST_PATIENT, TEST_PATIENT_NAME } from "./constants";

test.describe("alternate queries with the Query Connector", () => {
test.beforeEach(async ({ page }) => {
// Start every test on our main landing page
await page.goto(TEST_URL);
});

test("query using form-fillable demo patient by phone number", async ({
page,
}) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Fill fields" }).click();

// Delete last name and MRN to force phone number as one of the 3 fields
await page.getByLabel("Last Name").clear();
await page.getByLabel("Medical Record Number").clear();

// Among verification, make sure phone number is right
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
await expect(
page.getByRole("heading", { name: STEP_TWO_PAGE_TITLE }),
).toBeVisible();
await page.getByRole("link", { name: "Select patient" }).click();
await expect(
page.getByRole("heading", { name: STEP_THREE_PAGE_TITLE }),
).toBeVisible();
await page.getByRole("button", { name: "Submit" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

await expect(page.getByText("Patient Name")).toBeVisible();
await expect(page.getByText(TEST_PATIENT_NAME)).toBeVisible();
await expect(page.getByText("Contact")).toBeVisible();
await expect(page.getByText(TEST_PATIENT.Phone)).toBeVisible();
await expect(page.getByText("Patient Identifiers")).toBeVisible();
await expect(page.getByText(TEST_PATIENT.MRN)).toBeVisible();
});

test("social determinants query with generalized function", async ({
page,
}) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Fill fields" }).click();
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

await page.getByRole("link", { name: "Select patient" }).click();
await expect(
page.getByRole("heading", { name: "Select a query" }),
).toBeVisible();
await page.getByTestId("Select").selectOption("social-determinants");
await page.getByRole("button", { name: "Submit" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

await expect(
page.getByRole("heading", { name: "Patient Record" }),
).toBeVisible();
});

test("form-fillable STI query using generalized function", async ({
page,
}) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Fill fields" }).click();
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
await page.getByRole("link", { name: "Select patient" }).click();
await page.getByTestId("Select").selectOption("chlamydia");
await page.getByRole("button", { name: "Submit" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

await expect(
page.getByRole("heading", { name: "Patient Record" }),
).toBeVisible();
});
});
5 changes: 5 additions & 0 deletions containers/tefca-viewer/e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { hyperUnluckyPatient } from "@/app/constants";

export const TEST_PATIENT = hyperUnluckyPatient;
export const TEST_PATIENT_NAME =
hyperUnluckyPatient.FirstName + " A. " + hyperUnluckyPatient.LastName;
20 changes: 0 additions & 20 deletions containers/tefca-viewer/e2e/example.spec.ts

This file was deleted.

24 changes: 24 additions & 0 deletions containers/tefca-viewer/e2e/load.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { test, expect } from "@playwright/test";
import { TEST_URL } from "../playwright-setup";
import { metadata } from "@/app/constants";

test("landing page loads", async ({ page }) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole page is just a copy-paste from the existing file to help parallelize the playwright runners

await page.goto(TEST_URL);

// Check that each expected text section is present
await expect(
page.getByRole("heading", { name: "Data collection made easier" }),
).toBeVisible();
await expect(
page.getByRole("heading", { name: "What is it?" }),
).toBeVisible();
await expect(
page.getByRole("heading", { name: "How does it work?" }),
).toBeVisible();

// Check that interactable elements are present (header and Get Started)
await expect(page.getByRole("link", { name: metadata.title })).toBeVisible();
await expect(
page.getByRole("button", { name: "Go to the demo" }),
).toBeVisible();
});
Loading