diff --git a/js/e2e/global-setup.ts b/js/e2e/global-setup.ts index b274a39b8..de4ee03cf 100644 --- a/js/e2e/global-setup.ts +++ b/js/e2e/global-setup.ts @@ -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'); diff --git a/js/e2e/src/aetna_test.ts b/js/e2e/src/aetna_test.ts index 220d0f01f..c8d67ecf2 100644 --- a/js/e2e/src/aetna_test.ts +++ b/js/e2e/src/aetna_test.ts @@ -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'}})}`); + } }); diff --git a/js/e2e/src/allscripts_test.ts b/js/e2e/src/allscripts_test.ts index 18093a88a..5e7a0bbbe 100644 --- a/js/e2e/src/allscripts_test.ts +++ b/js/e2e/src/allscripts_test.ts @@ -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("allison.allscripts@tw181unityfhir.edu"); - 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("allison.allscripts@tw181unityfhir.edu"); + 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'}})}`); + } }); diff --git a/js/e2e/src/athena_test.ts b/js/e2e/src/athena_test.ts index b1e3ec823..d54381e20 100644 --- a/js/e2e/src/athena_test.ts +++ b/js/e2e/src/athena_test.ts @@ -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("phrtest_preview@mailinator.com"); - 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("phrtest_preview@mailinator.com"); + 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'}})}`); + } }); diff --git a/js/e2e/src/careevolution_test.ts b/js/e2e/src/careevolution_test.ts index 270e3aa80..aa96b9be5 100644 --- a/js/e2e/src/careevolution_test.ts +++ b/js/e2e/src/careevolution_test.ts @@ -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'}})}`); + } }); diff --git a/js/e2e/src/cerner_test.ts b/js/e2e/src/cerner_test.ts index faf19b50e..59e8fd720 100644 --- a/js/e2e/src/cerner_test.ts +++ b/js/e2e/src/cerner_test.ts @@ -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'}})}`); + } }); diff --git a/js/e2e/src/cigna_test.ts b/js/e2e/src/cigna_test.ts index ae6d789db..2c3e4b859 100644 --- a/js/e2e/src/cigna_test.ts +++ b/js/e2e/src/cigna_test.ts @@ -2,32 +2,40 @@ import { test, expect } from "@playwright/test"; import {getEndpointDefinition} from '../utils'; import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url'; -test.skip("Cigna Login Flow", async ({page}) => { - //get the Cerner Sandbox endpoint definition - let endpointDefinition = await getEndpointDefinition('6c0454af-1631-4c4d-905d-5710439df983') - let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition) +test("Cigna 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('6c0454af-1631-4c4d-905d-5710439df983') + 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=Log in to share health information"); - await expect(page).toHaveTitle("myCigna - Auth Flow"); - await page.click("label[for='username']", { force: true }); - await page.keyboard.type("syntheticuser05"); - await page.click("label[for='password']", { force: true }); - await page.keyboard.type("5ynthU5er5"); - await page.click("button[type='submit']"); + // We are on login page + await page.waitForSelector("text=Log in to share health information"); + await expect(page).toHaveTitle("myCigna - Auth Flow"); + await page.click("label[for='username']", { force: true }); + await page.keyboard.type("syntheticuser05"); + await page.click("label[for='password']", { force: true }); + await page.keyboard.type("5ynthU5er5"); + await page.click("button[type='submit']"); - // We have logged in - await page.waitForSelector("label[for='termsAccept']"); - await expect(page).toHaveTitle("myCigna - Auth Flow"); - await page.click('label[for="termsAccept"]', { force: true }); - await page.click('button[type="submit"]'); + // We have logged in + await page.waitForSelector("label[for='termsAccept']"); + await expect(page).toHaveTitle("myCigna - Auth Flow"); + await page.click('label[for="termsAccept"]', { force: true }); + await page.click('button[type="submit"]'); - // 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'}})}`); + } }); diff --git a/js/e2e/src/eclinicalworks_test.ts b/js/e2e/src/eclinicalworks_test.ts index 9c3746b68..a9e10c825 100644 --- a/js/e2e/src/eclinicalworks_test.ts +++ b/js/e2e/src/eclinicalworks_test.ts @@ -2,39 +2,47 @@ import { test, expect } from "@playwright/test"; import {getEndpointDefinition} from '../utils'; import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url'; -test.skip("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"); - //this is a case-sensitive, but not exact match. It may break in the future. - 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."); +test("eClinicalWorks-Healow 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 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"); + //this is a case-sensitive, but not exact match. It may break in the future. + 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."); + 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'}})}`); + } }); diff --git a/js/e2e/src/epic_legacy_test.ts b/js/e2e/src/epic_legacy_test.ts index 32be8d558..87612894d 100644 --- a/js/e2e/src/epic_legacy_test.ts +++ b/js/e2e/src/epic_legacy_test.ts @@ -2,72 +2,81 @@ import { test, expect } from "@playwright/test"; import {getEndpointDefinition} from '../utils'; import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url'; -test.skip("Epic OAuth2 Legacy Login Flow", async ({page}) => { - //get the Epic Sandbox endpoint definition - let endpointDefinition = await getEndpointDefinition('fc94bfc7-684d-4e4d-aa6e-ceec01c21c81') - let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition) +test.skip("Epic OAuth2 Legacy 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 Epic Sandbox endpoint definition + let endpointDefinition = await getEndpointDefinition('fc94bfc7-684d-4e4d-aa6e-ceec01c21c81') + 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 MyChart login page - await page.waitForSelector("text=MyChart Username"); - await expect(page).toHaveTitle("MyChart - Login Page"); - await page.click("label[for='Login']", { force: true }); - await page.keyboard.type("fhirderrick"); - await page.click("label[for='Password']", { force: true }); - await page.keyboard.type("epicepic1"); - await page.click("text=Sign In"); + // We are on MyChart login page + await page.waitForSelector("text=MyChart Username"); + await expect(page).toHaveTitle("MyChart - Login Page"); + await page.click("label[for='Login']", { force: true }); + await page.keyboard.type("fhirderrick"); + await page.click("label[for='Password']", { force: true }); + await page.keyboard.type("epicepic1"); + await page.click("text=Sign In"); - // We have logged in to MyChart - await page.waitForSelector("text=Fasten Health has said that it:"); - await page.locator('text=Continue') //wait for continue button - await expect(page).toHaveTitle("MyChart - Are you sure?"); - await page.getByTitle("Continue to next page").click(); + // We have logged in to MyChart + await page.waitForSelector("text=Fasten Health has said that it:"); + await page.locator('text=Continue') //wait for continue button + await expect(page).toHaveTitle("MyChart - Are you sure?"); + await page.getByTitle("Continue to next page").click(); - // We are on the MyChart authorize page. Authorize our app for 1 hour. - await page.waitForSelector("text=What would you like to share?"); - await expect(page).toHaveTitle("MyChart - Are you sure?"); - // await page.click('text=3 months', { force: true, delay: 1000 }); - await page.click("text=Allow access", { force: true, delay: 500 }); + // We are on the MyChart authorize page. Authorize our app for 1 hour. + await page.waitForSelector("text=What would you like to share?"); + await expect(page).toHaveTitle("MyChart - Are you sure?"); + // await page.click('text=3 months', { force: true, delay: 1000 }); + await page.click("text=Allow access", { force: true, delay: 500 }); - // MyChart has granted access, redirecting back to app from MyChart - await page.waitForSelector("text=Epic FHIR Dynamic Registration Redirect"); + // MyChart has granted access, redirecting back to app from MyChart + await page.waitForSelector("text=Epic FHIR Dynamic Registration Redirect"); - // Should auto redirect if successful, but playwright Chrome seems to have issues so we'll manually click if needed - try { - await page.click("text=Back to main page", { force: true, delay: 5000 }); - } catch (e) {} + // Should auto redirect if successful, but playwright Chrome seems to have issues so we'll manually click if needed + try { + await page.click("text=Back to main page", { force: true, delay: 5000 }); + } catch (e) {} + + // If successful, Dynamic Client Registration Data should now be visible + await page.waitForSelector("text=Dynamic Client Registration Data"); - // If successful, Dynamic Client Registration Data should now be visible - await page.waitForSelector("text=Dynamic Client Registration Data"); + // await expect(page).toHaveTitle("MyChart - Are you sure?"); + // await page.getByTitle("Continue to next page").click({ + // force: true, + // delay: 1000, + // }); + // + // // We are on the MyChart authorize page. Authorize our app for 1 hour. + // await page.waitForSelector("text=What would you like to share?"); + // await expect(page).toHaveTitle("MyChart - Are you sure?"); + // // await page.click('text=3 months', { force: true, delay: 1000 }); + // await page.click("text=Allow access", { force: true, delay: 500 }); + // + // // Should auto redirect if successful, but playwright Chrome seems to have issues so we'll manually click if needed + // try { + // await page.click("text=Back to main page", { force: true, delay: 5000 }); + // } catch (e) {} + // + // // MyChart has granted access, redirecting back to app from MyChart + // await page.waitForSelector("text=Your account has been securely connected to FASTEN.") + // await expect((new URL(page.url())).searchParams.get("code")).toBeTruthy() - // await expect(page).toHaveTitle("MyChart - Are you sure?"); - // await page.getByTitle("Continue to next page").click({ - // force: true, - // delay: 1000, - // }); - // - // // We are on the MyChart authorize page. Authorize our app for 1 hour. - // await page.waitForSelector("text=What would you like to share?"); - // await expect(page).toHaveTitle("MyChart - Are you sure?"); - // // await page.click('text=3 months', { force: true, delay: 1000 }); - // await page.click("text=Allow access", { force: true, delay: 500 }); - // - // // Should auto redirect if successful, but playwright Chrome seems to have issues so we'll manually click if needed - // try { - // await page.click("text=Back to main page", { force: true, delay: 5000 }); - // } catch (e) {} - // - // // MyChart has granted access, redirecting back to app from MyChart - // await page.waitForSelector("text=Your account has been securely connected to FASTEN.") - // await expect((new URL(page.url())).searchParams.get("code")).toBeTruthy() + 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'}})}`); + } }); // // const expirationOptions = ["1 hour", "1 day", "1 week", "1 month", "3 months"]; diff --git a/js/e2e/src/kaiser_test.ts b/js/e2e/src/kaiser_test.ts index 39919ca78..46e719f30 100644 --- a/js/e2e/src/kaiser_test.ts +++ b/js/e2e/src/kaiser_test.ts @@ -2,34 +2,42 @@ import { test, expect } from "@playwright/test"; import {getEndpointDefinition} from '../utils'; import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url'; -test.skip("Kaiser Login Flow", async ({page}) => { - //get the Cerner Sandbox endpoint definition - let endpointDefinition = await getEndpointDefinition('9d0fa28a-0c5b-4065-9ee6-284ec9577a57') - let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition) +test("Kaiser 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 Kaiser Sandbox endpoint definition + let endpointDefinition = await getEndpointDefinition('9d0fa28a-0c5b-4065-9ee6-284ec9577a57') + 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=Sign in"); - await expect(page).toHaveTitle("Sign in "); - await page.click("label[for='username']", { force: true }); - await page.keyboard.type("Pvaluser1"); - await page.click("label[for='password']", { force: true }); - await page.keyboard.type("V@lidation1"); - await page.click("button[type='submit']"); + // We are on login page + await page.waitForSelector("text=Sign in"); + await expect(page).toHaveTitle("Sign in "); + await page.click("label[for='username']", { force: true }); + await page.keyboard.type("Pvaluser1"); + await page.click("label[for='password']", { force: true }); + await page.keyboard.type("V@lidation1"); + await page.click("button[type='submit']"); - // We have logged in - await page.waitForSelector("text=Please Be Aware"); - await expect(page).toHaveTitle("Consent Management"); - await page.click("input[name='subject']"); - await page.click("label[for='agreement']"); - await page.locator('div.accept-btn').locator('button[type="button"]').click(); + // We have logged in + await page.waitForSelector("text=Please Be Aware"); + await expect(page).toHaveTitle("Consent Management"); + await page.click("input[name='subject']"); + await page.click("label[for='agreement']"); + await page.locator('div.accept-btn').locator('button[type="button"]').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'}})}`); + } }); diff --git a/js/e2e/src/local_test.ts b/js/e2e/src/local_test.ts deleted file mode 100644 index 6ddec52d9..000000000 --- a/js/e2e/src/local_test.ts +++ /dev/null @@ -1,22 +0,0 @@ -// @ts-check -import { test, expect } from'@playwright/test'; - -// test('Local Testing', async ({ page },testInfo) => { -// -// try{ -// -// await page.evaluate(_ => {},`browserstack_executor: ${JSON.stringify({action: "setSessionName", arguments: {name:testInfo.project.name}})}`); -// -// await page.waitForTimeout(5000); -// -// await page.goto('https://www.example.com/'); -// -// await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'Local success'}})}`); -// -// } catch (e) { -// console.log(e); -// await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'failed',reason: 'Local fail'}})}`); -// -// } -// -// }); diff --git a/js/e2e/src/medicare_test.ts b/js/e2e/src/medicare_test.ts index c13af1489..eb55bc59d 100644 --- a/js/e2e/src/medicare_test.ts +++ b/js/e2e/src/medicare_test.ts @@ -2,40 +2,48 @@ import { test, expect } from "@playwright/test"; import {getEndpointDefinition} from '../utils'; import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url'; -test.skip("Medicare Login Flow", async ({page}) => { - //get the Cerner Sandbox endpoint definition - let endpointDefinition = await getEndpointDefinition('6ae6c14e-b927-4ce0-862f-91123cb8d774') - let authorizeData = await generateSourceAuthorizeUrl(endpointDefinition) +test.skip("Medicare 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 Medicare Sandbox endpoint definition + let endpointDefinition = await getEndpointDefinition('6ae6c14e-b927-4ce0-862f-91123cb8d774') + 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=Log in"); - // await expect(page).toHaveTitle("Cerner Health - Sign In"); - await page.click("label[for='username-textbox']", { force: true }); - await page.keyboard.type("BBUser00000"); - await page.click("label[for='password-textbox']", { force: true }); - await page.keyboard.type("PW00000!"); - await page.click("#login-button"); + // We are on login page + await page.waitForSelector("text=Log in"); + // await expect(page).toHaveTitle("Cerner Health - Sign In"); + await page.click("label[for='username-textbox']", { force: true }); + await page.keyboard.type("BBUser00000"); + await page.click("label[for='password-textbox']", { force: true }); + await page.keyboard.type("PW00000!"); + await page.click("#login-button"); - //INCOMPLETE - Need to add more steps to complete the login flow + //INCOMPLETE - Need to add more steps to complete the login flow - // // 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."); + // // 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'}})}`); + } }); diff --git a/js/e2e/src/nextgen_test.ts b/js/e2e/src/nextgen_test.ts index 2893e8d52..0d3af23c4 100644 --- a/js/e2e/src/nextgen_test.ts +++ b/js/e2e/src/nextgen_test.ts @@ -2,34 +2,42 @@ import { test, expect } from "@playwright/test"; import {getEndpointDefinition} from '../utils'; import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url'; -test.skip("Nextgen Login Flow", async ({page}) => { - //get the Cerner Sandbox endpoint definition - let endpointDefinition = await getEndpointDefinition('843f5c82-b4e3-43c6-8657-eff1390d7e44') - 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=NextGen HealthCare"); - await page.focus("#Username"); - await page.keyboard.type("patientapitest"); - await page.focus("#Password"); - await page.keyboard.type("Password1!"); - await page.click('button:text("Next")'); - - // We have logged in - await page.waitForSelector("text=Connect to Fasten Health - Sandbox"); - await page.click('#btnAllow'); - - // Keep me signed in. - await page.waitForSelector("text=Connect to Fasten Health - Sandbox"); - await page.click('button:text("Next")'); - - - // If successful, Fasten Lighthouse page should now be visible - await page.waitForSelector("text=Your account has been securely connected to FASTEN."); +test("Nextgen 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('843f5c82-b4e3-43c6-8657-eff1390d7e44') + 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=NextGen HealthCare"); + await page.focus("#Username"); + await page.keyboard.type("patientapitest"); + await page.focus("#Password"); + await page.keyboard.type("Password1!"); + await page.click('button:text("Next")'); + + // We have logged in + await page.waitForSelector("text=Connect to Fasten Health - Sandbox"); + await page.click('#btnAllow'); + + // Keep me signed in. + await page.waitForSelector("text=Connect to Fasten Health - Sandbox"); + await page.click('button:text("Next")'); + + + // 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'}})}`); + } }); diff --git a/js/e2e/src/sample_test.ts b/js/e2e/src/sample_test.ts deleted file mode 100644 index 2bb5b939e..000000000 --- a/js/e2e/src/sample_test.ts +++ /dev/null @@ -1,40 +0,0 @@ -// @ts-check -import { test, expect } from'@playwright/test'; - -// test('BstackDemo Add to cart', async ({ page },testInfo) => { -// -// try{ -// -// await page.evaluate(_ => {},`browserstack_executor: ${JSON.stringify({action: "setSessionName", arguments: {name:testInfo.project.name}})}`); -// await page.waitForTimeout(5000); -// -// await page.goto('https://www.bstackdemo.com/',{ waitUntil: 'networkidle' }); -// await page.locator('[id="\\32 "]').getByText('Add to cart').click(); -// await page.getByText('Checkout').click(); -// await page.locator('#username svg').click(); -// await page.locator('#react-select-2-option-0-0').click(); -// await page.locator('#password svg').click(); -// await page.locator('#react-select-3-option-0-0').click(); -// await page.getByRole('button', { name: 'Log In' }).click(); -// await page.getByLabel('First Name').click(); -// await page.getByLabel('First Name').fill('SampleFirst'); -// await page.getByLabel('Last Name').click(); -// await page.getByLabel('Last Name').fill('sampleLast'); -// await page.getByLabel('Address').click(); -// await page.getByLabel('Address').fill('sampleAddress'); -// await page.getByLabel('State/Province').click(); -// await page.getByLabel('State/Province').fill('SampleState'); -// await page.getByLabel('Postal Code').click(); -// await page.getByLabel('Postal Code').fill('123456'); -// await page.getByRole('button', { name: 'Submit' }).click(); -// await page.getByRole('button', { name: 'Continue Shopping ยป' }).click(); -// -// await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'Product added to cart'}})}`); -// -// } catch (e) { -// console.log(e); -// await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'failed',reason: 'Test failed'}})}`); -// -// } -// -// }); diff --git a/js/e2e/src/vahealth_test.ts b/js/e2e/src/vahealth_test.ts index 520245373..a79e70e30 100644 --- a/js/e2e/src/vahealth_test.ts +++ b/js/e2e/src/vahealth_test.ts @@ -2,43 +2,51 @@ import { test, expect } from "@playwright/test"; import {getEndpointDefinition} from '../utils'; import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url'; -test.skip("VAHealth Login Flow", async ({page}) => { - //get the Cerner Sandbox endpoint definition - let endpointDefinition = await getEndpointDefinition('71fd52e3-b9fe-4e3d-b983-99711e798bd8') - 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 landing page - await page.waitForSelector("text=Sign in to VA.gov"); - await expect(page).toHaveTitle("Choose Login Provider"); - await page.click("a.idme-signin", { force: true }); - - // We are on the ID.me login page - await page.waitForSelector("text=Sign in to ID.me"); - await page.click("label[for='user_email']", { force: true }); - await page.keyboard.type("va.api.user+001-2024@gmail.com"); - await page.click("label[for='user_password']", { force: true }); - await page.keyboard.type("SandboxPassword2024!"); - await page.click("input[type='submit']"); - - // We are on the ID.me 2FA page - await page.waitForSelector("text=Complete your sign in"); - await page.click("button[type='submit']"); - - // We are on the ID.me 2FA Completion Page - await page.waitForSelector("text=Complete your sign in"); - await page.click("button[type='submit']"); - - // We are on the VA.gov login page - await page.waitForSelector("text=FastenHealthIncKulatunga-1696557147"); - await expect(page).toHaveTitle("Department of Veteran Affairs Evaluation - Sign In"); - await page.click('button[value="Allow Access"]'); - - // If successful, Fasten Lighthouse page should now be visible - await page.waitForSelector("text=Your account has been securely connected to FASTEN."); +test.skip("VAHealth 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 VAHealth Sandbox endpoint definition + let endpointDefinition = await getEndpointDefinition('71fd52e3-b9fe-4e3d-b983-99711e798bd8') + 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 landing page + await page.waitForSelector("text=Sign in to VA.gov"); + await expect(page).toHaveTitle("Choose Login Provider"); + await page.click("a.idme-signin", { force: true }); + + // We are on the ID.me login page + await page.waitForSelector("text=Sign in to ID.me"); + await page.click("label[for='user_email']", { force: true }); + await page.keyboard.type("va.api.user+001-2024@gmail.com"); + await page.click("label[for='user_password']", { force: true }); + await page.keyboard.type("SandboxPassword2024!"); + await page.click("input[type='submit']"); + + // We are on the ID.me 2FA page + await page.waitForSelector("text=Complete your sign in"); + await page.click("button[type='submit']"); + + // We are on the ID.me 2FA Completion Page + await page.waitForSelector("text=Complete your sign in"); + await page.click("button[type='submit']"); + + // We are on the VA.gov login page + await page.waitForSelector("text=FastenHealthIncKulatunga-1696557147"); + await expect(page).toHaveTitle("Department of Veteran Affairs Evaluation - Sign In"); + await page.click('button[value="Allow Access"]'); + + // 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'}})}`); + } }); diff --git a/js/playwright.config.ts b/js/playwright.config.ts index 71856bac3..9c19c1d5d 100644 --- a/js/playwright.config.ts +++ b/js/playwright.config.ts @@ -53,26 +53,26 @@ export default { }, /* Configure projects for major browsers */ - // projects: [ - // // { - // // name: 'chrome@latest:Windows 11', - // // use: { - // // connectOptions: { wsEndpoint: getCdpEndpoint('chrome@latest:Windows 11','test1') }, - // // }, - // // } - // // { - // // name: 'playwright-webkit@latest:OSX Ventura', - // // use: { - // // connectOptions: { wsEndpoint: getCdpEndpoint('playwright-webkit@latest:OSX Ventura', 'test2') } - // // }, - // // }, - // { - // name: 'playwright-firefox:Windows 11', - // use: { - // connectOptions: { wsEndpoint: getCdpEndpoint('playwright-firefox:Windows 11', 'test3') } - // }, - // } - // ], + projects: [ + { + name: 'chrome@latest:Windows 11', + use: { + connectOptions: { wsEndpoint: getCdpEndpoint('chrome@latest:Windows 11','test1') }, + }, + } + // { + // name: 'playwright-webkit@latest:OSX Ventura', + // use: { + // connectOptions: { wsEndpoint: getCdpEndpoint('playwright-webkit@latest:OSX Ventura', 'test2') } + // }, + // }, + // { + // name: 'playwright-firefox:Windows 11', + // use: { + // connectOptions: { wsEndpoint: getCdpEndpoint('playwright-firefox:Windows 11', 'test3') } + // }, + // } + ], /* Folder for test artifacts such as screenshots, videos, traces, etc. */ // outputDir: 'test-results/',