Skip to content

Commit

Permalink
Merge pull request #48 from fastenhealth/addl_platforms
Browse files Browse the repository at this point in the history
adding more tests
  • Loading branch information
AnalogJ committed Jun 23, 2024
2 parents 0efce31 + 0fc41e8 commit 9a52b05
Show file tree
Hide file tree
Showing 11 changed files with 358 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
PW_ONEMEDICAL_USERNAME: ${{ secrets.PW_ONEMEDICAL_USERNAME }}
PW_ONEMEDICAL_PASSWORD: ${{ secrets.PW_ONEMEDICAL_PASSWORD }}
PW_PRACTICEFUSION_USERNAME: ${{ secrets.PW_PRACTICEFUSION_USERNAME }}
PW_PRACTICEFUSION_PASSWORD: ${{ secrets.PW_PRACTICEFUSION_PASSWORD }}
PW_MAXIMEYES_USERNAME: ${{ secrets.PW_MAXIMEYES_USERNAME }}
PW_MAXIMEYES_PASSWORD: ${{ secrets.PW_MAXIMEYES_PASSWORD }}

steps:
- uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test-js: deps-js
# make test-js-project PROJECT=athena
.PHONY: test-js-project
test-js-project: deps-js
cd js && yarn run e2e --project=$(PROJECT)
cd js && yarn run e2e --headed --debug --project=$(PROJECT)

# Steps related to building and publishing fasten-sources-js library.
.PHONY: build-js
Expand Down
26 changes: 13 additions & 13 deletions PLATFORM_LIST.md

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions js/e2e/src/drchrono_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';
import process from 'process';

test("DrChrono 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 DrChrono Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('6a01ffff-d73e-4728-a315-9b23bd77a4cc')
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_DRCHRONO_USERNAME);
await page.focus("#password");
await page.keyboard.type(process.env.PW_DRCHRONO_PASSWORD);
await page.click('button:text("Sign In")');

// We have logged in
await page.waitForSelector("text=Charlie DeBraga");
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'}})}`);
}
});
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'}})}`);
}
});
38 changes: 38 additions & 0 deletions js/e2e/src/humana_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';

test("Humana 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 Humana Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('457d23f4-f893-4d4d-a529-83e7488de78b')
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=Connect Your Health Data");
await page.focus("#username");
await page.keyboard.type("HUser00001");
await page.focus("#password");
await page.keyboard.type("PW00001!");
await page.click('button:text("Sign in")');

// We have logged in
await page.waitForSelector("text=Fasten Health");
await page.click('#submitButton');

// 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'}})}`);
}
});
44 changes: 44 additions & 0 deletions js/e2e/src/maximeyes_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("MaximEyes 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 Maximeyes Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('f4ea79fc-9a1b-43f0-be95-24247d666514')
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=Forgot my password");
await page.focus("#Username");
await page.keyboard.type(process.env.PW_MAXIMEYES_USERNAME);
await page.focus("#Password");
await page.keyboard.type(process.env.PW_MAXIMEYES_PASSWORD);
await page.click('input[value="Sign in"]');

// We have logged in
await page.waitForSelector("text=Reed");
await page.click("input[value='Select']");

// We have logged in
await page.waitForSelector("text=Access");
await page.click("input[value='Yes']");


// 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'}})}`);
}
});
35 changes: 35 additions & 0 deletions js/e2e/src/medhost_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';
import process from 'process';

test("MedHost 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 Medhost Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('9e5d5b7a-880f-481b-8ae4-77a3d24cfa49')
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=YourCare Everywhere");
await page.focus("#j_username");
await page.keyboard.type(process.env.PW_MEDHOST_USERNAME);
await page.focus("#j_password");
await page.keyboard.type(process.env.PW_MEDHOST_PASSWORD);
await page.click('#signin');

// 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'}})}`);
}
});
39 changes: 39 additions & 0 deletions js/e2e/src/onemedical_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';
import process from 'process';

test("OneMedical 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 OneMedical Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('c835742c-c896-4b93-beb5-28df18f16bd8')
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=Log in to continue");
await page.focus("#email");
await page.keyboard.type(process.env.PW_ONEMEDICAL_USERNAME);
await page.focus("#password");
await page.keyboard.type(process.env.PW_ONEMEDICAL_PASSWORD);
await page.click('#btn-login');

// We have logged in
await page.waitForSelector("text=Connect Your Records");
await page.click('#scope-selection-submit');

// 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'}})}`);
}
});
40 changes: 40 additions & 0 deletions js/e2e/src/practicefusion_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';
import process from 'process';

test("Practice Fusion 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 Practice Fusion Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('8b340f03-7643-4315-9bb6-6b01e31e5402')
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 scope page
await page.waitForSelector("text=This application would like access to your information");
await page.click('button:text("Allow")');

// We are on login page
await page.waitForSelector("text=Don't remember your password?");
await page.focus("input[name='username']");
await page.keyboard.type(process.env.PW_PRACTICEFUSION_USERNAME);
await page.focus("input[name='password']");
await page.keyboard.type(process.env.PW_PRACTICEFUSION_PASSWORD);
await page.click("button[name='submit']");


// 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'}})}`);
}
});
Loading

0 comments on commit 9a52b05

Please sign in to comment.