From 419ef65b0f1c4a68faf12ab25b49d637362d4f3c Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Tue, 8 Oct 2024 15:53:02 -0400 Subject: [PATCH 01/20] Switching fill fields to golden patient --- containers/tefca-viewer/src/app/constants.ts | 67 +++++++------------ .../tefca-viewer/src/app/fhir-servers.ts | 5 +- 2 files changed, 27 insertions(+), 45 deletions(-) diff --git a/containers/tefca-viewer/src/app/constants.ts b/containers/tefca-viewer/src/app/constants.ts index 77d104e87..506fa39a3 100644 --- a/containers/tefca-viewer/src/app/constants.ts +++ b/containers/tefca-viewer/src/app/constants.ts @@ -103,37 +103,33 @@ export type PatientType = | "social-determinants" | "sti-syphilis-positive"; +/* + * Common "Hyper Unlucky" patient data used for all non-newborn screening use cases + */ +const hyperUnluckyPatient: DemoDataFields = { + FirstName: "Hyper", + LastName: "Unlucky", + DOB: "1975-12-06", + MRN: "8692756", + Phone: "517-425-1398", + FhirServer: "Public HAPI: eHealthExchange", + UseCase: "cancer", // UseCase will be updated per case +}; + /* Demo patient data used to populate the form fields with each value being a type of DemoDataFields */ export const demoData: Record = { - cancer: { - FirstName: "Lee", - LastName: "Shaw", - DOB: "1975-12-06", - MRN: "8692756", - Phone: "517-425-1398", - FhirServer: "HELIOS Meld: Direct", - UseCase: "cancer", - }, - "sti-chlamydia-positive": { - FirstName: "Chlamydia", - LastName: "JMC", - DOB: "2001-05-07", - MRN: "b50z-wayszq-ofib", - Phone: "", - FhirServer: "JMC Meld: Direct", - UseCase: "chlamydia", - }, - "sti-gonorrhea-positive": { - FirstName: "GC", - LastName: "JMC", - DOB: "1998-05-31", - MRN: "JMC-1002", - Phone: "", - FhirServer: "JMC Meld: Direct", - UseCase: "gonorrhea", + cancer: { ...hyperUnluckyPatient, UseCase: "cancer" }, + "sti-chlamydia-positive": { ...hyperUnluckyPatient, UseCase: "chlamydia" }, + "sti-gonorrhea-positive": { ...hyperUnluckyPatient, UseCase: "gonorrhea" }, + "social-determinants": { + ...hyperUnluckyPatient, + UseCase: "social-determinants", }, + "sti-syphilis-positive": { ...hyperUnluckyPatient, UseCase: "syphilis" }, + + // Newborn screening data remains unchanged "newborn-screening-technical-fail": { FirstName: "Mango", LastName: "Smith", @@ -161,26 +157,9 @@ export const demoData: Record = { FhirServer: "CernerHelios: eHealthExchange", UseCase: "newborn-screening", }, - "social-determinants": { - FirstName: "Veronica", - LastName: "Blackstone", - DOB: "1998-06-18", - MRN: "34972316", - Phone: "937-379-3497", - FhirServer: "HELIOS Meld: Direct", - UseCase: "social-determinants", - }, - "sti-syphilis-positive": { - FirstName: "Veronica", - LastName: "Blackstone", - DOB: "1998-06-18", - MRN: "34972316", - Phone: "937-379-3497", - FhirServer: "HELIOS Meld: Direct", - UseCase: "syphilis", - }, }; +// Define Option type type Option = { value: string; label: string; diff --git a/containers/tefca-viewer/src/app/fhir-servers.ts b/containers/tefca-viewer/src/app/fhir-servers.ts index 998cca4a1..b92a2c25b 100644 --- a/containers/tefca-viewer/src/app/fhir-servers.ts +++ b/containers/tefca-viewer/src/app/fhir-servers.ts @@ -23,7 +23,10 @@ export const fhirServers: Record = { init: {} as RequestInit, }, "JMC Meld: eHealthExchange": configureEHX("JMCHelios"), - "Public HAPI: eHealthExchange": configureEHX("PublicHAPI"), + "Public HAPI: eHealthExchange": { + hostname: "https://hapi.fhir.org/baseR4/", + init: {} as RequestInit, + }, "OpenEpic: eHealthExchange": configureEHX("OpenEpic"), "CernerHelios: eHealthExchange": configureEHX("CernerHelios"), "OPHDST Meld: Direct": { From d4c1cfaab7b1ec1581dab37dc9841e8abd2b4064 Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Wed, 9 Oct 2024 16:05:15 -0400 Subject: [PATCH 02/20] fixing URLs --- containers/tefca-viewer/src/app/CustomQuery.ts | 2 +- containers/tefca-viewer/src/app/constants.ts | 17 +++++++++++++++-- containers/tefca-viewer/src/app/fhir-servers.ts | 10 +++++----- .../tefca-viewer/src/app/query-service.ts | 2 +- .../query/components/searchForm/SearchForm.tsx | 4 +++- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/containers/tefca-viewer/src/app/CustomQuery.ts b/containers/tefca-viewer/src/app/CustomQuery.ts index beb1396cb..606e1afff 100644 --- a/containers/tefca-viewer/src/app/CustomQuery.ts +++ b/containers/tefca-viewer/src/app/CustomQuery.ts @@ -98,7 +98,7 @@ export class CustomQuery { this.diagnosticReportQuery, this.conditionQuery, this.medicationRequestQuery, - this.socialHistoryQuery, + // this.socialHistoryQuery, this.encounterQuery, this.encounterClassTypeQuery, ]; diff --git a/containers/tefca-viewer/src/app/constants.ts b/containers/tefca-viewer/src/app/constants.ts index 506fa39a3..f4f41e7e3 100644 --- a/containers/tefca-viewer/src/app/constants.ts +++ b/containers/tefca-viewer/src/app/constants.ts @@ -74,7 +74,7 @@ export const FhirServers = [ "HELIOS Meld: eHealthExchange", "JMC Meld: Direct", "JMC Meld: eHealthExchange", - "Public HAPI: eHealthExchange", + "Public HAPI: Direct", "OpenEpic: eHealthExchange", "CernerHelios: eHealthExchange", "OPHDST Meld: Direct", @@ -112,7 +112,7 @@ const hyperUnluckyPatient: DemoDataFields = { DOB: "1975-12-06", MRN: "8692756", Phone: "517-425-1398", - FhirServer: "Public HAPI: eHealthExchange", + FhirServer: "Public HAPI: Direct", UseCase: "cancer", // UseCase will be updated per case }; @@ -130,6 +130,19 @@ export const demoData: Record = { "sti-syphilis-positive": { ...hyperUnluckyPatient, UseCase: "syphilis" }, // Newborn screening data remains unchanged + // We need to figure how to display specific cases for specific referral, fail, pass + // "newborn-screening-technical-fail": { + // ...hyperUnluckyPatient, + // UseCase: "newborn-screening", + // }, + // "newborn-screening-referral": { + // ...hyperUnluckyPatient, + // UseCase: "newborn-screening", + // }, + // "newborn-screening-pass": { + // ...hyperUnluckyPatient, + // UseCase: "newborn-screening", + // }, "newborn-screening-technical-fail": { FirstName: "Mango", LastName: "Smith", diff --git a/containers/tefca-viewer/src/app/fhir-servers.ts b/containers/tefca-viewer/src/app/fhir-servers.ts index b92a2c25b..98603b9b6 100644 --- a/containers/tefca-viewer/src/app/fhir-servers.ts +++ b/containers/tefca-viewer/src/app/fhir-servers.ts @@ -14,23 +14,23 @@ type FHIR_SERVER_CONFIG = { */ export const fhirServers: Record = { "HELIOS Meld: Direct": { - hostname: "https://gw.interop.community/HeliosConnectathonSa/open/", + hostname: "https://gw.interop.community/HeliosConnectathonSa/open", init: {} as RequestInit, }, "HELIOS Meld: eHealthExchange": configureEHX("MeldOpen"), "JMC Meld: Direct": { - hostname: "https://gw.interop.community/JMCHeliosSTISandbox/open/", + hostname: "https://gw.interop.community/JMCHeliosSTISandbox/open", init: {} as RequestInit, }, "JMC Meld: eHealthExchange": configureEHX("JMCHelios"), - "Public HAPI: eHealthExchange": { - hostname: "https://hapi.fhir.org/baseR4/", + "Public HAPI: Direct": { + hostname: "https://hapi.fhir.org/baseR4", init: {} as RequestInit, }, "OpenEpic: eHealthExchange": configureEHX("OpenEpic"), "CernerHelios: eHealthExchange": configureEHX("CernerHelios"), "OPHDST Meld: Direct": { - hostname: "https://gw.interop.community/CDCSepHL7Connectatho/open/", + hostname: "https://gw.interop.community/CDCSepHL7Connectatho/open", init: {} as RequestInit, }, }; diff --git a/containers/tefca-viewer/src/app/query-service.ts b/containers/tefca-viewer/src/app/query-service.ts index 3ae98552b..5e85d795a 100644 --- a/containers/tefca-viewer/src/app/query-service.ts +++ b/containers/tefca-viewer/src/app/query-service.ts @@ -99,7 +99,7 @@ async function patientQuery( queryResponse: QueryResponse, ): Promise { // Query for patient - let query = "Patient?"; + let query = "/Patient?"; if (request.first_name) { query += `given=${request.first_name}&`; } diff --git a/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx b/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx index ef733131a..a6f0d92a7 100644 --- a/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx +++ b/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx @@ -66,7 +66,9 @@ const SearchForm: React.FC = ({ ); const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); - const [fhirServer, setFhirServer] = useState(); + const [fhirServer, setFhirServer] = useState( + "Public HAPI: Direct", + ); const [phone, setPhone] = useState(""); const [dob, setDOB] = useState(""); const [mrn, setMRN] = useState(""); From da42e8423064a2d64ae4b16cffe7a2e306062f09 Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Wed, 9 Oct 2024 16:44:37 -0400 Subject: [PATCH 03/20] updating e2e --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index 1c740d0e0..eb4cd8a8b 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -140,9 +140,9 @@ test.describe("querying with the TryTEFCA viewer", () => { page.getByRole("heading", { name: "Patient Record" }), ).toBeVisible(); await expect(page.getByText("Patient Name")).toBeVisible(); - await expect(page.getByText("Veronica Anne Blackstone")).toBeVisible(); + await expect(page.getByText("Hyper A. Unlucky")).toBeVisible(); await expect(page.getByText("Contact")).toBeVisible(); - await expect(page.getByText("937-379-3497")).toBeVisible(); + await expect(page.getByText("517-425-1398")).toBeVisible(); await expect(page.getByText("Patient Identifiers")).toBeVisible(); await expect(page.getByText("34972316")).toBeVisible(); }); From b1659b57b6919729db8895515b8e19a564b3d961 Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Thu, 10 Oct 2024 09:08:31 -0400 Subject: [PATCH 04/20] trying to fix e2e --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 2 +- containers/tefca-viewer/src/app/CustomQuery.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index eb4cd8a8b..5c5500df4 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -144,7 +144,7 @@ test.describe("querying with the TryTEFCA viewer", () => { await expect(page.getByText("Contact")).toBeVisible(); await expect(page.getByText("517-425-1398")).toBeVisible(); await expect(page.getByText("Patient Identifiers")).toBeVisible(); - await expect(page.getByText("34972316")).toBeVisible(); + await expect(page.getByText("8692756")).toBeVisible(); }); test("social determinants query with generalized function", async ({ diff --git a/containers/tefca-viewer/src/app/CustomQuery.ts b/containers/tefca-viewer/src/app/CustomQuery.ts index 606e1afff..beb1396cb 100644 --- a/containers/tefca-viewer/src/app/CustomQuery.ts +++ b/containers/tefca-viewer/src/app/CustomQuery.ts @@ -98,7 +98,7 @@ export class CustomQuery { this.diagnosticReportQuery, this.conditionQuery, this.medicationRequestQuery, - // this.socialHistoryQuery, + this.socialHistoryQuery, this.encounterQuery, this.encounterClassTypeQuery, ]; From 3ed56dc23541e857d1e497ea4d0c233cfbce0e29 Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Thu, 10 Oct 2024 09:27:21 -0400 Subject: [PATCH 05/20] uno vez mas --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index 5c5500df4..ac4cb5392 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -167,7 +167,6 @@ test.describe("querying with the TryTEFCA viewer", () => { await page.getByRole("button", { name: "Go to the demo" }).click(); await page.getByLabel("Query", { exact: true }).selectOption("chlamydia"); await page.getByRole("button", { name: "Fill fields" }).click(); - await page.getByLabel("Phone Number").fill(""); await page.getByRole("button", { name: "Search for patient" }).click(); await expect( page.getByRole("heading", { name: "Patient Record" }), From 6e0837f20ba2132011f57cef8acfa29f623c5b93 Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Thu, 10 Oct 2024 09:31:55 -0400 Subject: [PATCH 06/20] undo --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index ac4cb5392..5c5500df4 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -167,6 +167,7 @@ test.describe("querying with the TryTEFCA viewer", () => { await page.getByRole("button", { name: "Go to the demo" }).click(); await page.getByLabel("Query", { exact: true }).selectOption("chlamydia"); await page.getByRole("button", { name: "Fill fields" }).click(); + await page.getByLabel("Phone Number").fill(""); await page.getByRole("button", { name: "Search for patient" }).click(); await expect( page.getByRole("heading", { name: "Patient Record" }), From dd21f025b5bf354d2517cbc4ab8129f362f5afcf Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Thu, 10 Oct 2024 09:32:29 -0400 Subject: [PATCH 07/20] fix --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index 5c5500df4..d4282b898 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -167,7 +167,7 @@ test.describe("querying with the TryTEFCA viewer", () => { await page.getByRole("button", { name: "Go to the demo" }).click(); await page.getByLabel("Query", { exact: true }).selectOption("chlamydia"); await page.getByRole("button", { name: "Fill fields" }).click(); - await page.getByLabel("Phone Number").fill(""); + // await page.getByLabel("Phone Number").fill(""); await page.getByRole("button", { name: "Search for patient" }).click(); await expect( page.getByRole("heading", { name: "Patient Record" }), From 56e8eac29dd3c8985bd823b31322dff8dcd82df3 Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 11:57:34 -0400 Subject: [PATCH 08/20] turn on video --- containers/tefca-viewer/playwright.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/containers/tefca-viewer/playwright.config.ts b/containers/tefca-viewer/playwright.config.ts index c2ab4b9b5..697b4cd3e 100644 --- a/containers/tefca-viewer/playwright.config.ts +++ b/containers/tefca-viewer/playwright.config.ts @@ -28,6 +28,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", + video: "on-first-retry", }, /* Configure projects for major browsers */ From 254feeb233aa5bc7fe4e04290b52077cfb9bc2c2 Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 12:18:20 -0400 Subject: [PATCH 09/20] save on fail --- containers/tefca-viewer/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/tefca-viewer/playwright.config.ts b/containers/tefca-viewer/playwright.config.ts index 697b4cd3e..095100ede 100644 --- a/containers/tefca-viewer/playwright.config.ts +++ b/containers/tefca-viewer/playwright.config.ts @@ -28,7 +28,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", - video: "on-first-retry", + video: "retain-on-failure", }, /* Configure projects for major browsers */ From 9a025e235b250789a5159239fb491c93b15cd418 Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 12:46:46 -0400 Subject: [PATCH 10/20] add to github actions --- .github/workflows/container-tefca-viewer.yaml | 5 +++++ containers/tefca-viewer/playwright.config.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/container-tefca-viewer.yaml b/.github/workflows/container-tefca-viewer.yaml index 24e19a93c..91a240883 100644 --- a/.github/workflows/container-tefca-viewer.yaml +++ b/.github/workflows/container-tefca-viewer.yaml @@ -105,3 +105,8 @@ jobs: - name: Playwright Tests working-directory: ./containers/${{env.CONTAINER}} run: npx playwright test e2e --reporter=list --config playwright.config.ts + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: test-results + path: test-results/ diff --git a/containers/tefca-viewer/playwright.config.ts b/containers/tefca-viewer/playwright.config.ts index 095100ede..697b4cd3e 100644 --- a/containers/tefca-viewer/playwright.config.ts +++ b/containers/tefca-viewer/playwright.config.ts @@ -28,7 +28,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", - video: "retain-on-failure", + video: "on-first-retry", }, /* Configure projects for major browsers */ From 5ad0ee8a78987e3312abd6ed6c1923041b2cae5e Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 12:59:39 -0400 Subject: [PATCH 11/20] try adding build path --- .github/workflows/container-tefca-viewer.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/container-tefca-viewer.yaml b/.github/workflows/container-tefca-viewer.yaml index 91a240883..83d21893e 100644 --- a/.github/workflows/container-tefca-viewer.yaml +++ b/.github/workflows/container-tefca-viewer.yaml @@ -109,4 +109,4 @@ jobs: if: ${{ !cancelled() }} with: name: test-results - path: test-results/ + path: ./containers/test-results/ From 83acf536f9baf4c0f1c924c39e8b3663b4493994 Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 13:08:18 -0400 Subject: [PATCH 12/20] add env var? --- .github/workflows/container-tefca-viewer.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/container-tefca-viewer.yaml b/.github/workflows/container-tefca-viewer.yaml index 83d21893e..56065eef4 100644 --- a/.github/workflows/container-tefca-viewer.yaml +++ b/.github/workflows/container-tefca-viewer.yaml @@ -109,4 +109,4 @@ jobs: if: ${{ !cancelled() }} with: name: test-results - path: ./containers/test-results/ + path: ./containers/${{env.CONTAINER}}/test-results/ From 2b948afb7367717d6beec24f8440439ad1b18550 Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 16:01:02 -0400 Subject: [PATCH 13/20] increase timeout --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index d4282b898..74452d542 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -122,6 +122,7 @@ test.describe("querying with the TryTEFCA viewer", () => { test("query using form-fillable demo patient by phone number", async ({ page, }) => { + test.slow(); await page.getByRole("button", { name: "Go to the demo" }).click(); await page.getByLabel("Query", { exact: true }).selectOption("syphilis"); @@ -150,6 +151,7 @@ test.describe("querying with the TryTEFCA viewer", () => { test("social determinants query with generalized function", async ({ page, }) => { + test.slow(); await page.getByRole("button", { name: "Go to the demo" }).click(); await page .getByLabel("Query", { exact: true }) From fae2a037aee1153858703cd6621d5bf37f2946bf Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 16:17:40 -0400 Subject: [PATCH 14/20] add wait for loading indicator --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index 74452d542..cf247e920 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -122,7 +122,6 @@ test.describe("querying with the TryTEFCA viewer", () => { test("query using form-fillable demo patient by phone number", async ({ page, }) => { - test.slow(); await page.getByRole("button", { name: "Go to the demo" }).click(); await page.getByLabel("Query", { exact: true }).selectOption("syphilis"); @@ -137,6 +136,7 @@ test.describe("querying with the TryTEFCA viewer", () => { // Among verification, make sure phone number is right await page.getByRole("button", { name: "Search for patient" }).click(); + await expect(page.getByText("Loading")).toHaveCount(0); await expect( page.getByRole("heading", { name: "Patient Record" }), ).toBeVisible(); @@ -151,7 +151,6 @@ test.describe("querying with the TryTEFCA viewer", () => { test("social determinants query with generalized function", async ({ page, }) => { - test.slow(); await page.getByRole("button", { name: "Go to the demo" }).click(); await page .getByLabel("Query", { exact: true }) @@ -169,8 +168,9 @@ test.describe("querying with the TryTEFCA viewer", () => { await page.getByRole("button", { name: "Go to the demo" }).click(); await page.getByLabel("Query", { exact: true }).selectOption("chlamydia"); await page.getByRole("button", { name: "Fill fields" }).click(); - // await page.getByLabel("Phone Number").fill(""); await page.getByRole("button", { name: "Search for patient" }).click(); + await expect(page.getByText("Loading")).toHaveCount(0); + await expect( page.getByRole("heading", { name: "Patient Record" }), ).toBeVisible(); From 49e7b1f59ed322b624e1c6b04debfba471e458d0 Mon Sep 17 00:00:00 2001 From: Rob Mitchell Date: Fri, 11 Oct 2024 16:28:06 -0400 Subject: [PATCH 15/20] removing default server --- .../src/app/query/components/searchForm/SearchForm.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx b/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx index a6f0d92a7..59da5947a 100644 --- a/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx +++ b/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx @@ -67,7 +67,7 @@ const SearchForm: React.FC = ({ const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); const [fhirServer, setFhirServer] = useState( - "Public HAPI: Direct", + // "Public HAPI: Direct", ); const [phone, setPhone] = useState(""); const [dob, setDOB] = useState(""); @@ -250,6 +250,7 @@ const SearchForm: React.FC = ({ name="fhir_server" value={fhirServer} defaultValue={""} + // defaultValue={"Public HAPI: Direct"} onChange={(event) => { setFhirServer(event.target.value as FHIR_SERVERS); }} From d5f21516c2c945e3286b1d03fdd6b2dabf5fd494 Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 15:39:03 -0400 Subject: [PATCH 16/20] pull playwright url into env var --- .../tefca-viewer/e2e/query_workflow.spec.ts | 9 ++++++++- containers/tefca-viewer/package.json | 3 ++- containers/tefca-viewer/playwright-setup.ts | 19 +++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index cf247e920..63c1ea787 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -1,11 +1,12 @@ // @ts-check import { test, expect } from "@playwright/test"; +import { TEST_URL } from "../playwright-setup"; test.describe("querying with the TryTEFCA viewer", () => { test.beforeEach(async ({ page }) => { // Start every test on our main landing page - await page.goto("http://localhost:3000/tefca-viewer"); + await page.goto(TEST_URL); }); test("landing page loads", async ({ page }) => { @@ -87,6 +88,12 @@ test.describe("querying with the TryTEFCA viewer", () => { await page.getByLabel("Phone Number").fill("5555555555"); await page.getByRole("button", { name: "Search for patient" }).click(); + await page.getByRole("link", { name: "Select patient" }).click(); + await expect( + page.getByRole("heading", { name: "Select a query" }), + ).toBeVisible(); + await page.getByRole("button", { name: "Submit" }).click(); + // Make sure we have a results page with a single patient // Non-interactive 'div' elements in the table should be located by text await expect( diff --git a/containers/tefca-viewer/package.json b/containers/tefca-viewer/package.json index 6e797e991..6dfa15412 100644 --- a/containers/tefca-viewer/package.json +++ b/containers/tefca-viewer/package.json @@ -7,7 +7,7 @@ "dev": "docker compose -f docker-compose-dev.yaml up -d && next dev", "dev-win": "start docker compose -f docker-compose-dev.yaml up && next dev", "dev:db": "docker compose -f docker-compose-dev.yaml up", - "dev:next": "dotenv -e ./tefca.env.local -e ./tefca.env -- next dev", + "dev:next": "dotenv -e ./.env -- next dev", "setup-local-env": "./setup-env.sh", "build": "next build && cp -r .next/static .next/standalone/.next && cp -r public .next/standalone/", "start": "NODE_TLS_REJECT_UNAUTHORIZED=0 node .next/standalone/server.js", @@ -17,6 +17,7 @@ "test:unit:watch": "jest --watch", "test:integration": "jest --testPathPattern=tests/integration", "test:playwright": "docker compose build --no-cache && docker compose up -d && npx playwright test --reporter=list", + "test:playwright:local": "dotenv -e ./.env -- npx playwright test --ui", "cypress:open": "cypress open", "cypress:run": "cypress run" }, diff --git a/containers/tefca-viewer/playwright-setup.ts b/containers/tefca-viewer/playwright-setup.ts index a41940cf7..37b607f06 100644 --- a/containers/tefca-viewer/playwright-setup.ts +++ b/containers/tefca-viewer/playwright-setup.ts @@ -1,27 +1,32 @@ /** * */ + +export const TEST_URL = + process.env.TEST_ENV ?? "http://localhost:3000/tefca-viewer"; + async function globalSetup() { - const url = "http://localhost:3000/tefca-viewer"; const maxRetries = 300; // Maximum number of retries const delay = 1000; // Delay between retries in milliseconds for (let attempts = 0; attempts < maxRetries; attempts++) { try { - const response = await fetch(url); // Fetch the URL + const response = await fetch(TEST_URL); // Fetch the TEST_URL if (response.status === 200) { - console.log(`Connected to ${url} successfully.`); + console.log(`Connected to ${TEST_URL} successfully.`); return; // Exit the function if the webpage loads successfully } else { console.log( - `Failed to connect to ${url}, status: ${response.status}. Retrying...`, + `Failed to connect to ${TEST_URL}, status: ${response.status}. Retrying...`, ); // Wait before the next attempt await new Promise((resolve) => setTimeout(resolve, delay)); } } catch (error) { console.log( - `Fetch failed for ${url}: ${(error as Error).message}. Retrying...`, + `Fetch failed for ${TEST_URL}: ${ + (error as Error).message + }. Retrying...`, ); await new Promise((resolve) => setTimeout(resolve, delay)); } @@ -29,7 +34,9 @@ async function globalSetup() { await new Promise((resolve) => setTimeout(resolve, delay)); } - throw new Error(`Unable to connect to ${url} after ${maxRetries} attempts.`); + throw new Error( + `Unable to connect to ${TEST_URL} after ${maxRetries} attempts.`, + ); } export default globalSetup; From 954fbefd32a3c16ee314dd39e47b1e7919b37300 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:29:00 +0000 Subject: [PATCH 17/20] [pre-commit.ci] auto fixes from pre-commit hooks --- .../src/app/query/components/searchForm/SearchForm.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx b/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx index 59da5947a..aedac810e 100644 --- a/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx +++ b/containers/tefca-viewer/src/app/query/components/searchForm/SearchForm.tsx @@ -66,9 +66,8 @@ const SearchForm: React.FC = ({ ); const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); - const [fhirServer, setFhirServer] = useState( - // "Public HAPI: Direct", - ); + const [fhirServer, setFhirServer] = useState(); + // "Public HAPI: Direct", const [phone, setPhone] = useState(""); const [dob, setDOB] = useState(""); const [mrn, setMRN] = useState(""); From 099c7431f40ae85d63346a99cf49e7e76a8e61ab Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 16:35:49 -0400 Subject: [PATCH 18/20] increase timeout for the loading exits --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index 63c1ea787..534f6866e 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -143,7 +143,7 @@ test.describe("querying with the TryTEFCA viewer", () => { // Among verification, make sure phone number is right await page.getByRole("button", { name: "Search for patient" }).click(); - await expect(page.getByText("Loading")).toHaveCount(0); + await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 }); await expect( page.getByRole("heading", { name: "Patient Record" }), ).toBeVisible(); @@ -176,7 +176,7 @@ test.describe("querying with the TryTEFCA viewer", () => { await page.getByLabel("Query", { exact: true }).selectOption("chlamydia"); await page.getByRole("button", { name: "Fill fields" }).click(); await page.getByRole("button", { name: "Search for patient" }).click(); - await expect(page.getByText("Loading")).toHaveCount(0); + await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 }); await expect( page.getByRole("heading", { name: "Patient Record" }), From a50704b7a68a8115b16052bc07d339744aaae8d6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:36:56 +0000 Subject: [PATCH 19/20] [pre-commit.ci] auto fixes from pre-commit hooks --- containers/tefca-viewer/playwright-setup.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/containers/tefca-viewer/playwright-setup.ts b/containers/tefca-viewer/playwright-setup.ts index 37b607f06..1592a4335 100644 --- a/containers/tefca-viewer/playwright-setup.ts +++ b/containers/tefca-viewer/playwright-setup.ts @@ -5,6 +5,9 @@ export const TEST_URL = process.env.TEST_ENV ?? "http://localhost:3000/tefca-viewer"; +/** + * + */ async function globalSetup() { const maxRetries = 300; // Maximum number of retries const delay = 1000; // Delay between retries in milliseconds From b38e81d47e4a65ef226be2e33fb654a54ac5888c Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Fri, 11 Oct 2024 16:56:40 -0400 Subject: [PATCH 20/20] add timeout for the successful flow --- containers/tefca-viewer/e2e/query_workflow.spec.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/containers/tefca-viewer/e2e/query_workflow.spec.ts b/containers/tefca-viewer/e2e/query_workflow.spec.ts index 534f6866e..5fd47b08f 100644 --- a/containers/tefca-viewer/e2e/query_workflow.spec.ts +++ b/containers/tefca-viewer/e2e/query_workflow.spec.ts @@ -87,12 +87,7 @@ test.describe("querying with the TryTEFCA viewer", () => { await page.getByLabel("Medical Record Number").fill("18091"); await page.getByLabel("Phone Number").fill("5555555555"); await page.getByRole("button", { name: "Search for patient" }).click(); - - await page.getByRole("link", { name: "Select patient" }).click(); - await expect( - page.getByRole("heading", { name: "Select a query" }), - ).toBeVisible(); - await page.getByRole("button", { name: "Submit" }).click(); + await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 }); // Make sure we have a results page with a single patient // Non-interactive 'div' elements in the table should be located by text