Skip to content

Commit

Permalink
Add "Select an Option" to FHIR Server Dropdown + Fix e2e tests (#2700)
Browse files Browse the repository at this point in the history
* reverse order of hooks

* update tests to account for new content on "no patients" results

* Add default option to force change of FHIR server option
  • Loading branch information
m-goggins authored Oct 8, 2024
1 parent a0a658d commit c66b8d3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
51 changes: 27 additions & 24 deletions containers/tefca-viewer/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,33 @@ test.describe("querying with the TryTEFCA viewer", () => {
).toBeVisible();
});

//TODO: Add this test back in once you no longer have to click to select the query from the dropdown
// test("unsuccessful user query: no patients", async ({ page }) => {
// await page.getByRole("button", { name: "Go to the demo" }).click();
// await page
// .getByLabel("Query", { exact: true })
// .selectOption("social-determinants");
// await page.getByRole("button", { name: "Fill fields" }).click();

// await page.getByLabel("First Name").fill("Ellie");
// await page.getByLabel("Last Name").fill("Williams");
// await page.getByLabel("Phone Number").fill("5555555555");
// await page.getByLabel("Medical Record Number").fill("TLOU1TLOU2");
// await page.getByRole("button", { name: "Search for patient" }).click();

// // Better luck next time, user!
// await expect(
// page.getByRole("heading", { name: "No Patients 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.getByRole("heading", { name: "Search for a Patient", exact: true })
// ).toBeVisible();
// });
test("unsuccessful user query: no patients", async ({ page }) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page
.getByLabel("Query", { exact: true })
.selectOption("social-determinants");
await page.getByRole("button", { name: "Advanced" }).click();
await page
.getByLabel("FHIR Server (QHIN)", { exact: true })
.selectOption("HELIOS Meld: Direct");

await page.getByLabel("First Name").fill("Ellie");
await page.getByLabel("Last Name").fill("Williams");
await page.getByLabel("Phone Number").fill("5555555555");
await page.getByLabel("Medical Record Number").fill("TLOU1TLOU2");
await page.getByRole("button", { name: "Search for patient" }).click();

// Better luck next time, user!
await expect(
page.getByRole("heading", { name: "No Records Found" }),
).toBeVisible();
await expect(
page.getByText("No records were found for your search"),
).toBeVisible();
await page
.getByRole("link", { name: "Revise your patient search" })
.click();
});

test("successful demo user query: the quest for watermelon mcgee", async ({
page,
Expand Down
4 changes: 2 additions & 2 deletions containers/tefca-viewer/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export default defineConfig({
// },
],

/* Hook to ensure Docker is shut down after tests or on error */
globalTeardown: "./playwright-teardown",
/* Hook to ensure DB is started & migrations have run before tests start*/
globalSetup: "./playwright-setup",
/* Hook to ensure Docker is shut down after tests or on error */
globalTeardown: "./playwright-teardown",
});
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,15 @@ const SearchForm: React.FC<SearchFormProps> = ({
id="fhir_server"
name="fhir_server"
value={fhirServer}
defaultValue={""}
onChange={(event) => {
setFhirServer(event.target.value as FHIR_SERVERS);
}}
required
>
<option value="" disabled>
Select FHIR Server
{" "}
-- Select an Option --{" "}
</option>
{Object.keys(fhirServers).map((fhirServer: string) => (
<option key={fhirServer} value={fhirServer}>
Expand Down

0 comments on commit c66b8d3

Please sign in to comment.