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

working tests. #46

Merged
merged 11 commits into from
Jun 5, 2024
Prev Previous commit
Next Next commit
working eclinicalworks test.
  • Loading branch information
AnalogJ committed Jun 1, 2024
commit 01b04724a73e01fdfeb53b4f2ea2b367cc74780b
40 changes: 40 additions & 0 deletions js/e2e/src/eclinicalworks_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';

test("eClinicalWorks-Healow Login Flow", async ({page}) => {

//get the eClinicalWorks Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('f0a8629a-076c-4f78-b41a-7fc6ae81fa4d')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)

// authorizeData.sourceState
console.log(authorizeData.url.toString())

// Start login flow by clicking on button with text "Login to MyChart"
await page.goto(authorizeData.url.toString());

// We are on login page
await page.waitForSelector("text=FHIR R4 Prodtest EMR");
await expect(page).toHaveTitle("healow - Health and Online Wellness");
await page.focus("#username");
await page.keyboard.type("AdultFemaleFHIR");
await page.focus("#pwd");
await page.keyboard.type("e@CWFHIR1");
await page.click("#btnLoginSubmit");

// We have logged in
await page.waitForSelector("text=What you need to know about Fasten Health");
await expect(page).toHaveTitle("LoginUi");
await page.click('button:text(" Continue ")');


// We are on the agreement page
await page.waitForSelector("text=Personal Information Sharing");
await expect(page).toHaveTitle("LoginUi");
await page.click('button:text-is("Approve")');


// If successful, Fasten Lighthouse page should now be visible
await page.waitForSelector("text=Your account has been securely connected to FASTEN.");
});