-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
cigna_test.ts
35 lines (28 loc) · 1.49 KB
/
cigna_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { test, expect } from "@playwright/test";
import {getEndpointDefinition} from '../utils';
import {generateSourceAuthorizeUrl} from '../../src/connect/authorization-url';
test("Cigna Login Flow", async ({page}) => {
test.skip()
//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())
// 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 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.");
});