|
| 1 | +import { expect } from '@playwright/test'; |
| 2 | +import { test } from 'fixtures/dsm-fixture'; |
| 3 | +import { Navigation } from 'dsm/component/navigation/navigation'; |
| 4 | +import Select from 'dss/component/select'; |
| 5 | +import { KitUploadInfo } from 'dsm/pages/kitUpload-page/models/kitUpload-model'; |
| 6 | +import {StudyEnum} from 'dsm/component/navigation/enums/selectStudyNav-enum'; |
| 7 | +import { KitTypeEnum } from 'dsm/component/kitType/enums/kitType-enum'; |
| 8 | +import ParticipantListPage from 'dsm/pages/participant-list-page'; |
| 9 | +import {StudyNavEnum} from 'dsm/component/navigation/enums/studyNav-enum'; |
| 10 | +import * as user from 'data/fake-user.json'; |
| 11 | +import crypto from 'crypto'; |
| 12 | +import KitUploadPage from 'dsm/pages/kitUpload-page/kitUpload-page'; |
| 13 | +import {SamplesNavEnum} from 'dsm/component/navigation/enums/samplesNav-enum'; |
| 14 | +import FamilyMemberTab from 'dsm/pages/participant-page/rgp/family-member-tab'; |
| 15 | +import { FamilyMember } from 'dsm/component/tabs/enums/familyMember-enum'; |
| 16 | +import KitsWithoutLabelPage from 'dsm/pages/kitsInfo-pages/kitsWithoutLabel-page'; |
| 17 | +import {KitsColumnsEnum} from 'dsm/pages/kitsInfo-pages/enums/kitsColumns-enum'; |
| 18 | +import KitsSentPage from 'dsm/pages/kitsInfo-pages/kitsSentPage'; |
| 19 | +import KitsReceivedPage from 'dsm/pages/kitsInfo-pages/kitsReceived-page/kitsReceivedPage'; |
| 20 | +import TrackingScanPage from 'dsm/pages/scanner-pages/trackingScan-page'; |
| 21 | +import RgpFinalScanPage from 'dsm/pages/scanner-pages/rgpFinalScan-page' |
| 22 | +import { simplifyShortID } from 'utils/faker-utils'; |
| 23 | +import { saveParticipantGuid } from 'utils/faker-utils'; |
| 24 | +import { ParticipantListTable } from 'dsm/component/tables/participant-list-table'; |
| 25 | + |
| 26 | +test.describe('Blood & RNA Kit Upload', () => { |
| 27 | +test.skip('Verify that a blood & rna kit can be uploaded @rgp @functional @upload', async ({ page, request}, testInfo) => { |
| 28 | + const testResultDirectory = testInfo.outputDir; |
| 29 | + |
| 30 | + const study = StudyEnum.RGP; |
| 31 | + const kitType = KitTypeEnum.BLOOD_AND_RNA; |
| 32 | + const expectedKitTypes = [KitTypeEnum.BLOOD, KitTypeEnum.BLOOD_AND_RNA]; //Later will be just Blood & RNA kit type for RGP |
| 33 | + |
| 34 | + //Go into DSM |
| 35 | + const navigation = new Navigation(page, request); |
| 36 | + |
| 37 | + //select RGP study |
| 38 | + await new Select(page, { label: 'Select study' }).selectOption('RGP'); |
| 39 | + |
| 40 | + //Go to recently created playwright test participant to get their short id |
| 41 | + const participantListPage = await navigation.selectFromStudy<ParticipantListPage>(StudyNavEnum.PARTICIPANT_LIST); |
| 42 | + await participantListPage.assertPageTitle(); |
| 43 | + await participantListPage.waitForReady(); |
| 44 | + |
| 45 | + const participantListTable = new ParticipantListTable(page); |
| 46 | + const participantGuid = await participantListTable.getGuidOfMostRecentAutomatedParticipant(user.patient.firstName, true); |
| 47 | + saveParticipantGuid(participantGuid); |
| 48 | + |
| 49 | + await participantListPage.filterListByParticipantGUID(user.patient.participantGuid); |
| 50 | + await participantListTable.openParticipantPageAt(0); |
| 51 | + |
| 52 | + //For RGP, the short id needed for the kit upload is the family member's subject id |
| 53 | + const proband = new FamilyMemberTab(page, FamilyMember.PROBAND); |
| 54 | + proband.relationshipID = user.patient.relationshipID; |
| 55 | + |
| 56 | + const probandTab = proband.getFamilyMemberTab(); |
| 57 | + await expect(probandTab).toBeVisible(); |
| 58 | + await probandTab.click(); |
| 59 | + await expect(probandTab).toHaveClass('nav-link active');//Make sure the tab is in view and selected |
| 60 | + |
| 61 | + const participantInfoSection = proband.getParticipantInfoSection(); |
| 62 | + await participantInfoSection.click(); |
| 63 | + |
| 64 | + const probandSubjectID = proband.getSubjectID(); |
| 65 | + await expect(probandSubjectID).not.toBeEmpty(); |
| 66 | + const shortID = await probandSubjectID.inputValue(); |
| 67 | + const simpleShortId = simplifyShortID(shortID, 'RGP'); |
| 68 | + |
| 69 | + //Deactivate existing kits for participant |
| 70 | + //Note: no blood kits are automatically created for RGP - preliminary deactivation of existing kits is done in case of prior test run |
| 71 | + const kitsWithoutLabelPage = await navigation.selectFromSamples<KitsWithoutLabelPage>(SamplesNavEnum.KITS_WITHOUT_LABELS); |
| 72 | + await kitsWithoutLabelPage.waitForLoad(); |
| 73 | + await kitsWithoutLabelPage.assertPageTitle(); |
| 74 | + await kitsWithoutLabelPage.selectKitType(kitType); |
| 75 | + await kitsWithoutLabelPage.assertCreateLabelsBtn(); |
| 76 | + await kitsWithoutLabelPage.assertReloadKitListBtn(); |
| 77 | + await kitsWithoutLabelPage.assertTableHeader(); |
| 78 | + await kitsWithoutLabelPage.deactivateAllKitsFor(simpleShortId); |
| 79 | + |
| 80 | + //The rest of the kit upload information - RGP kits are by family member instead of by account - using the proband's info to make a kit |
| 81 | + const kitUploadInfo = new KitUploadInfo(shortID, user.patient.firstName, user.patient.lastName); |
| 82 | + kitUploadInfo.street1 = user.patient.streetAddress; |
| 83 | + kitUploadInfo.city = user.patient.city; |
| 84 | + kitUploadInfo.postalCode = user.patient.zip; |
| 85 | + kitUploadInfo.state = user.patient.state.abbreviation; |
| 86 | + kitUploadInfo.country = user.patient.country.abbreviation; |
| 87 | + |
| 88 | + //Upload a Blood & RNA kit |
| 89 | + const kitUploadPage = await navigation.selectFromSamples<KitUploadPage>(SamplesNavEnum.KIT_UPLOAD); |
| 90 | + await kitUploadPage.waitForLoad(); |
| 91 | + await kitUploadPage.assertPageTitle(); |
| 92 | + await kitUploadPage.assertDisplayedKitTypes(expectedKitTypes); |
| 93 | + await kitUploadPage.selectKitType(kitType); |
| 94 | + await kitUploadPage.assertBrowseBtn(); |
| 95 | + await kitUploadPage.assertUploadKitsBtn(); |
| 96 | + await kitUploadPage.assertInstructionSnapshot(); |
| 97 | + await kitUploadPage.uploadFile(kitType, [kitUploadInfo], study, testResultDirectory); |
| 98 | + |
| 99 | + //Go to Kits w/o Label to extract a shipping ID |
| 100 | + await navigation.selectFromSamples<KitsWithoutLabelPage>(SamplesNavEnum.KITS_WITHOUT_LABELS); |
| 101 | + await kitsWithoutLabelPage.waitForLoad(); |
| 102 | + await kitsWithoutLabelPage.selectKitType(kitType); |
| 103 | + await kitsWithoutLabelPage.assertCreateLabelsBtn(); |
| 104 | + await kitsWithoutLabelPage.assertReloadKitListBtn(); |
| 105 | + await kitsWithoutLabelPage.assertTableHeader(); |
| 106 | + await kitsWithoutLabelPage.assertPageTitle(); |
| 107 | + |
| 108 | + await kitsWithoutLabelPage.search(KitsColumnsEnum.SHORT_ID, simpleShortId); |
| 109 | + const shippingID = (await kitsWithoutLabelPage.getData(KitsColumnsEnum.SHIPPING_ID)).trim(); |
| 110 | + |
| 111 | + //Tracking scan |
| 112 | + const labelNumber = crypto.randomUUID().toString().substring(0, 10); |
| 113 | + const kitLabel = `RGP_${labelNumber}`; |
| 114 | + const trackingScanPage = await navigation.selectFromSamples<TrackingScanPage>(SamplesNavEnum.TRACKING_SCAN); |
| 115 | + await trackingScanPage.assertPageTitle(); |
| 116 | + const trackingLabel = `tracking-${crypto.randomUUID().toString().substring(0, 10)}`; |
| 117 | + await trackingScanPage.fillScanPairs([trackingLabel, kitLabel]); |
| 118 | + await trackingScanPage.save(); |
| 119 | + |
| 120 | + //RGP final scan page - RNA labels must have the prefix 'RNA' (all caps) |
| 121 | + const finalScanPage = await navigation.selectFromSamples<RgpFinalScanPage>(SamplesNavEnum.RGP_FINAL_SCAN); |
| 122 | + const rnaNumber = crypto.randomUUID().toString().substring(0, 10); |
| 123 | + const rnaLabel = `RNA${rnaNumber}`; |
| 124 | + await finalScanPage.assertPageTitle(); |
| 125 | + await finalScanPage.fillScanTrio(kitLabel, rnaLabel, shippingID, 1); |
| 126 | + await finalScanPage.save(); |
| 127 | + |
| 128 | + //Kits Sent Page |
| 129 | + const kitsSentPage = await navigation.selectFromSamples<KitsSentPage>(SamplesNavEnum.SENT); |
| 130 | + await kitsSentPage.waitForLoad(); |
| 131 | + await kitsSentPage.assertPageTitle(); |
| 132 | + await kitsSentPage.assertDisplayedKitTypes(expectedKitTypes); |
| 133 | + await kitsSentPage.selectKitType(kitType); |
| 134 | + |
| 135 | + //Check for the sent blood kit |
| 136 | + await kitsSentPage.search(KitsColumnsEnum.MF_CODE, kitLabel); |
| 137 | + await kitsSentPage.assertDisplayedRowsCount(1); |
| 138 | + |
| 139 | + //Check for the sent RNA kit |
| 140 | + await kitsSentPage.search(KitsColumnsEnum.MF_CODE, rnaLabel); |
| 141 | + await kitsSentPage.assertDisplayedRowsCount(1); |
| 142 | + |
| 143 | + //Kits Received Page |
| 144 | + const kitsReceivedPage = await navigation.selectFromSamples<KitsReceivedPage>(SamplesNavEnum.RECEIVED); |
| 145 | + await kitsReceivedPage.waitForLoad(); |
| 146 | + await kitsReceivedPage.assertPageTitle(); |
| 147 | + await kitsReceivedPage.kitReceivedRequest(kitLabel); //Mark the blood kit as received |
| 148 | + await kitsReceivedPage.kitReceivedRequest(rnaLabel); //Mark the RNA kit as received |
| 149 | + await kitsReceivedPage.assertDisplayedKitTypes(expectedKitTypes); |
| 150 | + await kitsReceivedPage.selectKitType(kitType); |
| 151 | + |
| 152 | + //Check for the received blood kit |
| 153 | + await kitsReceivedPage.search(KitsColumnsEnum.MF_CODE, kitLabel); |
| 154 | + await kitsReceivedPage.assertDisplayedRowsCount(1); |
| 155 | + |
| 156 | + //Check for the received RNA kit |
| 157 | + await kitsReceivedPage.search(KitsColumnsEnum.MF_CODE, rnaLabel); |
| 158 | + await kitsReceivedPage.assertDisplayedRowsCount(1); |
| 159 | + }); |
| 160 | +}); |
0 commit comments