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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixing tests, sending to Browserstack.
  • Loading branch information
AnalogJ committed Jun 2, 2024
commit 8483d495b085eccfa4d6603729798a90bb28eb50
2 changes: 1 addition & 1 deletion js/e2e/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default async function setup() {
bsLocal.start(BS_LOCAL_ARGS, (err) => {
if (err) {
console.error(
`${redColour}Error starting BrowserStackLocal${whiteColour}`
`${redColour}Error starting BrowserStackLocal${whiteColour}`, err
);
} else {
console.log('BrowserStackLocal Started');
Expand Down
46 changes: 28 additions & 18 deletions js/e2e/src/aetna_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,36 @@ import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';

test.skip("Aetna Login Flow", async ({page}) => {
//get the Cerner Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('ac8308d1-90de-4994-bb3d-fe404832714c')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)
test("Aetna Login Flow", async ({page}, testInfo) => {
try {
await page.evaluate(_ => {},`browserstack_executor: ${JSON.stringify({action: "setSessionName", arguments: {name:testInfo.title}})}`);
await page.waitForTimeout(5000);

// authorizeData.sourceState
console.log(authorizeData.url.toString())
//get the Cerner Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('ac8308d1-90de-4994-bb3d-fe404832714c')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)

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

// We are on login page
await page.waitForSelector("text=Welcome to Aetna");
// await expect(page).toHaveTitle("Cerner Health - Sign In");
await page.click("label[for='username']", { force: true });
await page.keyboard.type("aetnaTestUser3 ");
await page.click("label[for='password']", { force: true });
await page.keyboard.type("FHIRdemo2020");
await page.click("#loginButton");
// Start login flow by clicking on button with text "Login to MyChart"
await page.goto(authorizeData.url.toString());

// If successful, Fasten Lighthouse page should now be visible
await page.waitForSelector("text=Your account has been securely connected to FASTEN.");
// We are on login page
await page.waitForSelector("text=Welcome to Aetna");
// await expect(page).toHaveTitle("Cerner Health - Sign In");
await page.click("label[for='username']", { force: true });
await page.keyboard.type("aetnaTestUser3 ");
await page.click("label[for='password']", { force: true });
await page.keyboard.type("FHIRdemo2020");
await page.click("#loginButton");

// 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'}})}`);
}
});
62 changes: 36 additions & 26 deletions js/e2e/src/allscripts_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,40 @@ import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';

test.skip("Allscripts Login Flow", async ({page}) => {
//get the Allscripts - Veradigm Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('7682675b-8247-4fda-b2cd-048bfeafc8af')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)

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

await page.goto(authorizeData.url.toString());

// We are on login page
await page.waitForSelector("text=Allscripts Health Connect Core");
await expect(page).toHaveTitle("Allscripts FHIR Authorization - ");
await page.focus("#username");
await page.keyboard.type("[email protected]");
await page.focus("#passwordEntered");
await page.keyboard.type("Allscripts#1");
await page.click("#local-login");

// We have logged in
await page.waitForSelector("text=Uncheck the permissions you do not wish to grant.");
await expect(page).toHaveTitle("Allscripts FHIR Authorization - ");
await page.click('button[value="yes"]');

// If successful, Fasten Lighthouse page should now be visible
await page.waitForSelector("text=Your account has been securely connected to FASTEN.");
test("Allscripts 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 Allscripts - Veradigm Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('7682675b-8247-4fda-b2cd-048bfeafc8af')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)

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

await page.goto(authorizeData.url.toString());

// We are on login page
await page.waitForSelector("text=Allscripts Health Connect Core");
await expect(page).toHaveTitle("Allscripts FHIR Authorization - ");
await page.focus("#username");
await page.keyboard.type("[email protected]");
await page.focus("#passwordEntered");
await page.keyboard.type("Allscripts#1");
await page.click("#local-login");

// We have logged in
await page.waitForSelector("text=Uncheck the permissions you do not wish to grant.");
await expect(page).toHaveTitle("Allscripts FHIR Authorization - ");
await page.click('button[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'}})}`);
}
});
53 changes: 31 additions & 22 deletions js/e2e/src/athena_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,40 @@ import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';

test.skip("Athena Login Flow", async ({page}) => {
//get the Cerner Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('950e9092-8ce7-4926-ad87-64616f00cb4c')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)
test("Athena 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 Cerner Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('950e9092-8ce7-4926-ad87-64616f00cb4c')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)

// authorizeData.sourceState
console.log(authorizeData.url.toString())
// 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());
// 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=Fasten Health - preview");
await expect(page).toHaveTitle("Login");
await page.click("label[for='okta-signin-username']", { force: true });
await page.keyboard.type("[email protected]");
await page.click("label[for='okta-signin-password']", { force: true });
await page.keyboard.type("Password1");
await page.click("#okta-signin-submit");
// We are on login page
await page.waitForSelector("text=Fasten Health - preview");
await expect(page).toHaveTitle("Login");
await page.click("label[for='okta-signin-username']", { force: true });
await page.keyboard.type("[email protected]");
await page.click("label[for='okta-signin-password']", { force: true });
await page.keyboard.type("Password1");
await page.click("#okta-signin-submit");

// We have logged in
await page.waitForSelector("text=Select a health record");
await expect(page).toHaveTitle("Login");
await page.locator("text=Jake Medlock (you)").click();
// We have logged in
await page.waitForSelector("text=Select a health record");
await expect(page).toHaveTitle("Login");
await page.locator("text=Jake Medlock (you)").click();

// If successful, Fasten Lighthouse page should now be visible
await page.waitForSelector("text=Your account has been securely connected to FASTEN.");
// 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'}})}`);
}
});
53 changes: 31 additions & 22 deletions js/e2e/src/careevolution_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,40 @@ import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';

test.skip("CareEvolution Login Flow", async ({page}) => {
//get the CareEvolution Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('8b47cf7b-330e-4ede-9967-4caa7be623aa')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)
test("CareEvolution Login Flow", async ({page}, testInfo) => {
try {
await page.evaluate(_ => {},`browserstack_executor: ${JSON.stringify({action: "setSessionName", arguments: {name:testInfo.title}})}`);
await page.waitForTimeout(5000);

// authorizeData.sourceState
console.log(authorizeData.url.toString())
//get the CareEvolution Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('8b47cf7b-330e-4ede-9967-4caa7be623aa')
let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition)

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

// We are on login page
await page.waitForSelector("#login-button");
await page.focus("#Username");
await page.keyboard.type("CEPatient");
await page.focus("#Password");
await page.keyboard.type("CEPatient2018");
await page.click("#login-button");
// Start login flow by clicking on button with text "Login to MyChart"
await page.goto(authorizeData.url.toString());

// We have logged in
await page.waitForSelector("text=Whose record do you want to allow access to?");
// await expect(page).toHaveText("Authorization Request");
await page.locator("text=Fran Demoski (28)").click();
await page.click('input[value="Agree"]');
// We are on login page
await page.waitForSelector("#login-button");
await page.focus("#Username");
await page.keyboard.type("CEPatient");
await page.focus("#Password");
await page.keyboard.type("CEPatient2018");
await page.click("#login-button");

// If successful, Fasten Lighthouse page should now be visible
await page.waitForSelector("text=Your account has been securely connected to FASTEN.");
// We have logged in
await page.waitForSelector("text=Whose record do you want to allow access to?");
// await expect(page).toHaveText("Authorization Request");
await page.locator("text=Fran Demoski (28)").click();
await page.click('input[value="Agree"]');

// 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'}})}`);
}
});
78 changes: 44 additions & 34 deletions js/e2e/src/cerner_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,48 @@ import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';

test.skip("Cerner Login Flow", async ({page}) => {
//get the Cerner Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('3290e5d7-978e-42ad-b661-1cf8a01a989c')
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=FhirPlay Non-Prod");
await expect(page).toHaveTitle("Cerner Health - Sign In");
await page.click("label[for='id_login_username']", { force: true });
await page.keyboard.type("nancysmart");
await page.click("label[for='id_login_password']", { force: true });
await page.keyboard.type("Cerner01");
await page.click("#signin");

// We have logged in
await page.waitForSelector("text=Warning: Unknown app");
await expect(page).toHaveTitle("Authorization Needed");
await page.click('#proceedButton');

// We are on the Select Patient page.
await page.waitForSelector("text=SMART II, NANCY (Self, 33)");
await expect(page).toHaveTitle("Authorization Needed");
await page.click("label[for='12724066']", { force: true, delay: 500 });
await page.click("#allowButton");


// If successful, Fasten Lighthouse page should now be visible
await page.waitForSelector("text=Your account has been securely connected to FASTEN.");
test("Cerner 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 Cerner Sandbox endpoint definition
let endpointDefinition = await getEndpointDefinition('3290e5d7-978e-42ad-b661-1cf8a01a989c')
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=FhirPlay Non-Prod");
await expect(page).toHaveTitle("Cerner Health - Sign In");
await page.click("label[for='id_login_username']", { force: true });
await page.keyboard.type("nancysmart");
await page.click("label[for='id_login_password']", { force: true });
await page.keyboard.type("Cerner01");
await page.click("#signin");

// We have logged in
await page.waitForSelector("text=Warning: Unknown app");
await expect(page).toHaveTitle("Authorization Needed");
await page.click('#proceedButton');

// We are on the Select Patient page.
await page.waitForSelector("text=SMART II, NANCY (Self, 33)");
await expect(page).toHaveTitle("Authorization Needed");
await page.click("label[for='12724066']", { force: true, delay: 500 });
await page.click("#allowButton");


// 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
Loading