Skip to content

Playwright_RGP_turn on tests and fix family member tab selection #2201

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

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions playwright-e2e/data/fake-user.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
}, "brother": {
"firstName": "Test Brother",
"lastName": "Playwright",
"relationshipID": "14"
"relationshipID": "8"
},
"maternalGrandFather": {
"firstName": "Test Maternal Grandfather",
"lastName": "Playwright",
"relationshipID": "70"
"relationshipID": "77"
},
"doctor": {
"name": "John Strange",
Expand Down
25 changes: 22 additions & 3 deletions playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class FamilyMemberTab {
* @returns the family id from the family member tab
*/
public async getFamilyIDFromFamilyMemberTab(): Promise<number> {
const familyMemberTab = this.getFamilyMemberTab();
const familyMemberTab = await this.getFamilyMemberTab();
const memberTabParts = (await familyMemberTab.innerText()).split('-'); //Family member tabs are usually {first name} - {subject id}
const retreivedSubjectID = memberTabParts[1];
const subjectIDParts = retreivedSubjectID.split('_'); //Subject id is usually in the format of RGP_{family id here}_{relationship id here}
Expand All @@ -91,9 +91,28 @@ export default class FamilyMemberTab {
* Uses the relationshipID to find the family member tab to be returned, must be ran only after setting the relationshipID
* @returns locator for a family member's tab
*/
public getFamilyMemberTab(): Locator {
public async getFamilyMemberTab(): Promise<Locator> {
//todo Needs a better general locator - the last contains could capture more webelements than intended once family id is in 3,000's
return this.page.locator(`//li//a[contains(., 'RGP') and contains(., '_${this.relationshipID}')]`);
const familyMemberTabs = this.page.locator(`//li//a[contains(., 'RGP_')]`).all();
const amountOfFamilyMembers = (await familyMemberTabs).length;
let relationID;
let familyID;
let familyMemberTab: Locator;
for (let familyMemberIndex = 0; familyMemberIndex < amountOfFamilyMembers; familyMemberIndex++) {
const familyMember = (await familyMemberTabs)[familyMemberIndex];
const tabText = await familyMember.innerText();
const familyMemberTabParts = tabText.split('_');
relationID = familyMemberTabParts[2] as string;
if (!(relationID === this._relationshipID)) {
continue;
}
if (relationID === this._relationshipID) {
familyID = familyMemberTabParts[1] as string;
familyMemberTab = this.page.locator(`//li//a[contains(., 'RGP') and contains(., '${familyID}_${relationID}')]`);
break;
}
}
return familyMemberTab!;
}

public getJumpToMenuText(): Locator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { saveParticipantGuid } from 'utils/faker-utils';
import { ParticipantListTable } from 'dsm/component/tables/participant-list-table';

test.describe('Blood & RNA Kit Upload', () => {
test.skip('Verify that a blood & rna kit can be uploaded @rgp @functional @upload', async ({ page, request}, testInfo) => {
test('Verify that a blood & rna kit can be uploaded @rgp @functional @upload', async ({ page, request}, testInfo) => {
const testResultDirectory = testInfo.outputDir;

const study = StudyEnum.RGP;
Expand Down Expand Up @@ -53,7 +53,7 @@ test.skip('Verify that a blood & rna kit can be uploaded @rgp @functional @uploa
const proband = new FamilyMemberTab(page, FamilyMember.PROBAND);
proband.relationshipID = user.patient.relationshipID;

const probandTab = proband.getFamilyMemberTab();
const probandTab = await proband.getFamilyMemberTab();
await expect(probandTab).toBeVisible();
await probandTab.click();
await expect(probandTab).toHaveClass('nav-link active');//Make sure the tab is in view and selected
Expand Down
2 changes: 1 addition & 1 deletion playwright-e2e/tests/rgp/adult-enrollment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test.describe.serial('Adult Self Enrollment', () => {
});

//Skipping until PEPPER-692 is done - which will let this pass consistently in dev and not just test
test.skip('Go to DSM to verify the newly created account can be found @functional @rgp', async ({ page, request }) => {
test('Go to DSM to verify the newly created account can be found @functional @rgp', async ({ page, request }) => {
//Go to DSM to verify the newly created account can be found there
await login(page);
const navigation = new Navigation(page, request);
Expand Down
18 changes: 9 additions & 9 deletions playwright-e2e/tests/rgp/dsm-family-enrollment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { calculateAge } from 'utils/date-utils';
let rgpEmail: string;

test.describe.serial('DSM Family Enrollment Handling', () => {
test.skip('Verify the display and functionality of family account dynamic fields @functional @rgp', async ({ page, request}) => {
test('Verify the display and functionality of family account dynamic fields @functional @rgp', async ({ page, request}) => {
const navigation = new Navigation(page, request);

//select RGP study
Expand Down Expand Up @@ -84,7 +84,7 @@ test.describe.serial('DSM Family Enrollment Handling', () => {


//Skipping until housekeeping stuff is fixed
test.skip('Verify that the proband family member tab can be filled out @functional @rgp @proband', async ({ page, request }) => {
test('Verify that the proband family member tab can be filled out @functional @rgp @proband', async ({ page, request }) => {
//Go into DSM
const navigation = new Navigation(page, request);

Expand All @@ -110,7 +110,7 @@ test.describe.serial('DSM Family Enrollment Handling', () => {
//Initial setup
proband.relationshipID = user.patient.relationshipID;

const probandTab = proband.getFamilyMemberTab();
const probandTab = await proband.getFamilyMemberTab();
await expect(probandTab).toBeVisible();

//Verify that the dynamic form menu is present
Expand Down Expand Up @@ -518,7 +518,7 @@ test.describe.serial('DSM Family Enrollment Handling', () => {
await redCapSurveyCompletedDate.fill(`${currentDate[0]}/${currentDate[1]}/${currentDate[2]}`);//[0] is MM, [1] is DD, [2] is YYYY
});

test.skip('Verify that a family member can be added without copying proband info @rgp @functional', async ({ page, request }) => {
test('Verify that a family member can be added without copying proband info @rgp @functional', async ({ page, request }) => {
//Add a new family member
//Go into DSM
const navigation = new Navigation(page, request);
Expand Down Expand Up @@ -558,7 +558,7 @@ test.describe.serial('DSM Family Enrollment Handling', () => {
});

//Check that the expected Participant Info fields have been filled after non-copied family member creation
const maternalGrandFatherFamilyMemberTab = grandfather.getFamilyMemberTab();
const maternalGrandFatherFamilyMemberTab = await grandfather.getFamilyMemberTab();
await maternalGrandFatherFamilyMemberTab.scrollIntoViewIfNeeded();
await expect(maternalGrandFatherFamilyMemberTab).toBeVisible();

Expand Down Expand Up @@ -597,15 +597,15 @@ test.describe.serial('DSM Family Enrollment Handling', () => {
const proband = new FamilyMemberTab(page, FamilyMember.PROBAND);
proband.relationshipID = user.patient.relationshipID;

const probandFamilyMemberTab = proband.getFamilyMemberTab();
const probandFamilyMemberTab = await proband.getFamilyMemberTab();
await expect(probandFamilyMemberTab).toBeVisible();
const probandFamilyID = await proband.getFamilyIDFromFamilyMemberTab();

console.log(`grandfather family id ${maternalGrandfatherFamilyID} vs proband family id: ${probandFamilyID}`);
await expect(maternalGrandfatherFamilyID).toEqual(probandFamilyID);
});

test.skip('Verify that a family member can be added using copied proband info @rgp @functional', async ({ page, request }) => {
test('Verify that a family member can be added using copied proband info @rgp @functional', async ({ page, request }) => {
//Go into DSM
const navigation = new Navigation(page, request);

Expand Down Expand Up @@ -652,7 +652,7 @@ test.describe.serial('DSM Family Enrollment Handling', () => {
});

await test.step(`Check that brother's info matches proband info`, async () => {
const brotherFamilyMemberTab = brother.getFamilyMemberTab();
const brotherFamilyMemberTab = await brother.getFamilyMemberTab();
await brotherFamilyMemberTab.scrollIntoViewIfNeeded();
await expect(brotherFamilyMemberTab).toBeVisible();
await brotherFamilyMemberTab.click();
Expand Down Expand Up @@ -704,7 +704,7 @@ test.describe.serial('DSM Family Enrollment Handling', () => {
const brotherMixedRaceNotes = await brother.getMixedRaceNotesContent();

//Do Participant Info comparison of proband and brother
const probandTab = proband.getFamilyMemberTab();
const probandTab = await proband.getFamilyMemberTab();
await probandTab.click();

const probandParticipantInfoSection = proband.getParticipantInfoSection();
Expand Down