Skip to content

Commit

Permalink
added dynamichealthit
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Jun 22, 2024
1 parent a054a62 commit ebc057b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions js/e2e/src/dynamichealthit_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';
import process from 'process';

test("DynamicHealthIT Login Flow", async ({page}, testInfo) => {
try {
await page.evaluate(_ => {},`browserstack_executor: ${JSON.stringify({action: "setSessionName", arguments: {name:testInfo.title}})}`);
await page.waitForTimeout(5000);
//get the NextGen Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('5f928520-2b73-4a47-b1a1-30ed6c3d9e9b')
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=Account Login");
await page.focus("#username");
await page.keyboard.type(process.env.PW_DYNAMICHEALTHIT_USERNAME);
await page.focus("#password");
await page.keyboard.type(process.env.PW_DYNAMICHEALTHIT_PASSWORD);
await page.click('button:text("Sign In")');

// We have logged in
await page.waitForSelector("text=RebeccaF Larson");
await page.click('button:text("Select")');

// Keep me signed in.
await page.waitForSelector("text=Remember My Decision");
await page.click('button:text("Yes, Allow")');


// If successful, Fasten Lighthouse page should now be visible
await page.waitForSelector("text=Your account has been securely connected to FASTEN.");
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'Authentication Successful'}})}`);
} catch (e) {
console.log(e);
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'failed',reason: 'Test failed'}})}`);
}
});
2 changes: 1 addition & 1 deletion js/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default {
// }
{
name: 'wip',
testMatch: /.*humana_test.ts/,
testMatch: /.*dynamichealthit_test.ts/,
use: { ...devices['Desktop Chrome'] },
}
],
Expand Down

0 comments on commit ebc057b

Please sign in to comment.