From ccca9e730b0cac79c82a863fd8cf33ce9b2c9f9a Mon Sep 17 00:00:00 2001 From: Kiara Westbrooks Date: Mon, 28 Aug 2023 16:16:32 -0400 Subject: [PATCH 1/3] unskipping rgp tests and fixing family tab selection --- playwright-e2e/data/fake-user.json | 4 +-- .../participant-page/rgp/family-member-tab.ts | 27 ++++++++++++++++--- .../blood-and-rna-kit-upload-flow.spec.ts | 2 +- .../tests/rgp/adult-enrollment.spec.ts | 2 +- .../tests/rgp/dsm-family-enrollment.spec.ts | 18 ++++++------- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/playwright-e2e/data/fake-user.json b/playwright-e2e/data/fake-user.json index 51ae06c967..5dee133ca9 100644 --- a/playwright-e2e/data/fake-user.json +++ b/playwright-e2e/data/fake-user.json @@ -30,12 +30,12 @@ }, "brother": { "firstName": "Test Brother", "lastName": "Playwright", - "relationshipID": "14" + "relationshipID": "89" }, "maternalGrandFather": { "firstName": "Test Maternal Grandfather", "lastName": "Playwright", - "relationshipID": "70" + "relationshipID": "97" }, "doctor": { "name": "John Strange", diff --git a/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts b/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts index 0cf462c4af..94242d70ab 100644 --- a/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts +++ b/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts @@ -77,7 +77,7 @@ export default class FamilyMemberTab { * @returns the family id from the family member tab */ public async getFamilyIDFromFamilyMemberTab(): Promise { - 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} @@ -91,9 +91,30 @@ 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 { //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_')]`)]; + console.log(`Amount of tabs: ${familyMemberTabs.length}`); + let relationID; + let familyID; + let familyMemberTab: Locator; + for (let familyMemberIndex = 0; familyMemberIndex < familyMemberTabs.length; familyMemberIndex++) { + const familyMember = familyMemberTabs[familyMemberIndex]; + console.log(`Current tab: ${familyMember}`); + 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; + console.log(`Family ID: ${familyID}`); + familyMemberTab = this.page.locator(`//li//a[contains(., 'RGP') and contains(., '${familyID}_${relationID}')]`); + break; + } + } + return familyMemberTab!; } public getJumpToMenuText(): Locator { diff --git a/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts b/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts index af33d10a41..4b3b0c7431 100644 --- a/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts +++ b/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts @@ -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; diff --git a/playwright-e2e/tests/rgp/adult-enrollment.spec.ts b/playwright-e2e/tests/rgp/adult-enrollment.spec.ts index 7559432110..a4141dca8b 100644 --- a/playwright-e2e/tests/rgp/adult-enrollment.spec.ts +++ b/playwright-e2e/tests/rgp/adult-enrollment.spec.ts @@ -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); diff --git a/playwright-e2e/tests/rgp/dsm-family-enrollment.spec.ts b/playwright-e2e/tests/rgp/dsm-family-enrollment.spec.ts index 388483c5cb..6b517e4ba6 100644 --- a/playwright-e2e/tests/rgp/dsm-family-enrollment.spec.ts +++ b/playwright-e2e/tests/rgp/dsm-family-enrollment.spec.ts @@ -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 @@ -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); @@ -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 @@ -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); @@ -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(); @@ -597,7 +597,7 @@ 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(); @@ -605,7 +605,7 @@ test.describe.serial('DSM Family Enrollment Handling', () => { 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); @@ -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(); @@ -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(); From ce860b40005f75a1da553de315120090b6d8a779 Mon Sep 17 00:00:00 2001 From: Kiara Westbrooks Date: Mon, 28 Aug 2023 16:31:25 -0400 Subject: [PATCH 2/3] might be fixed --- playwright-e2e/data/fake-user.json | 4 ++-- .../pages/participant-page/rgp/family-member-tab.ts | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/playwright-e2e/data/fake-user.json b/playwright-e2e/data/fake-user.json index 5dee133ca9..bfe4b412db 100644 --- a/playwright-e2e/data/fake-user.json +++ b/playwright-e2e/data/fake-user.json @@ -30,12 +30,12 @@ }, "brother": { "firstName": "Test Brother", "lastName": "Playwright", - "relationshipID": "89" + "relationshipID": "8" }, "maternalGrandFather": { "firstName": "Test Maternal Grandfather", "lastName": "Playwright", - "relationshipID": "97" + "relationshipID": "77" }, "doctor": { "name": "John Strange", diff --git a/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts b/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts index 94242d70ab..fd5e3a7326 100644 --- a/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts +++ b/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts @@ -93,14 +93,14 @@ export default class FamilyMemberTab { */ public async getFamilyMemberTab(): Promise { //todo Needs a better general locator - the last contains could capture more webelements than intended once family id is in 3,000's - const familyMemberTabs = [this.page.locator(`//li//a[contains(., 'RGP_')]`)]; - console.log(`Amount of tabs: ${familyMemberTabs.length}`); + const familyMemberTabs = this.page.locator(`//li//a[contains(., 'RGP_')]`).all(); + console.log(`Amount of tabs: ${(await familyMemberTabs).length}`); + const amountOfFamilyMembers = (await familyMemberTabs).length; let relationID; let familyID; let familyMemberTab: Locator; - for (let familyMemberIndex = 0; familyMemberIndex < familyMemberTabs.length; familyMemberIndex++) { - const familyMember = familyMemberTabs[familyMemberIndex]; - console.log(`Current tab: ${familyMember}`); + 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; @@ -109,7 +109,6 @@ export default class FamilyMemberTab { } if (relationID === this._relationshipID) { familyID = familyMemberTabParts[1] as string; - console.log(`Family ID: ${familyID}`); familyMemberTab = this.page.locator(`//li//a[contains(., 'RGP') and contains(., '${familyID}_${relationID}')]`); break; } From e0335acb5ae5808b35a349be378b507930b5d46c Mon Sep 17 00:00:00 2001 From: Kiara Westbrooks Date: Mon, 28 Aug 2023 16:42:38 -0400 Subject: [PATCH 3/3] needed an await added to kit upload --- .../dsm/pages/participant-page/rgp/family-member-tab.ts | 1 - .../dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts b/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts index fd5e3a7326..d986014450 100644 --- a/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts +++ b/playwright-e2e/dsm/pages/participant-page/rgp/family-member-tab.ts @@ -94,7 +94,6 @@ export default class FamilyMemberTab { public async getFamilyMemberTab(): Promise { //todo Needs a better general locator - the last contains could capture more webelements than intended once family id is in 3,000's const familyMemberTabs = this.page.locator(`//li//a[contains(., 'RGP_')]`).all(); - console.log(`Amount of tabs: ${(await familyMemberTabs).length}`); const amountOfFamilyMembers = (await familyMemberTabs).length; let relationID; let familyID; diff --git a/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts b/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts index 4b3b0c7431..0c71f6a893 100644 --- a/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts +++ b/playwright-e2e/tests/dsm/kitUploadFlow/blood-and-rna-kit-upload-flow.spec.ts @@ -53,7 +53,7 @@ test('Verify that a blood & rna kit can be uploaded @rgp @functional @upload', a 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