Skip to content

Pepper 1251 playwright place an order in mercury #2412

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

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
66c1857
WIP
Rinchan20 Aug 27, 2024
77f02ad
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Aug 29, 2024
36ba812
putting in method to get relevant ptps
Rinchan20 Aug 30, 2024
c9eb0d1
in sequencing order tab
Rinchan20 Sep 4, 2024
cc32002
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Sep 4, 2024
414dacf
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Sep 4, 2024
bfbfb5b
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Sep 5, 2024
fb683a5
continuing with placing a clinical order
Rinchan20 Sep 6, 2024
5571344
beginnings of placing a mercury order also installed gcp pubsub library
Rinchan20 Sep 9, 2024
0bbe6cb
ran npm audit fix to fix some vulnerabilities
Rinchan20 Sep 9, 2024
a106f63
placed mercury order and checking for the resulting order in Clinical…
Rinchan20 Sep 10, 2024
e03e40f
small fixes
Rinchan20 Sep 10, 2024
b8c5a2c
took out topic line
Rinchan20 Sep 10, 2024
36b7572
test for putting in mercury order for lost to followup pediatric ptp …
Rinchan20 Sep 10, 2024
103ac23
inputting test case for a lost to followup ptp whose residence is in …
Rinchan20 Sep 10, 2024
28c11bb
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Sep 10, 2024
667f73c
adding LMS to test
Rinchan20 Sep 13, 2024
feb2e22
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Sep 16, 2024
6a6d495
making changes to allow LMS to be used
Rinchan20 Sep 19, 2024
89143da
slight changes
Rinchan20 Sep 30, 2024
b9b6a9b
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Sep 30, 2024
81adeef
get rid of empty method
Rinchan20 Sep 30, 2024
b00e788
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Oct 11, 2024
acce255
cleanup
Rinchan20 Oct 11, 2024
88f4a47
got rid of space
Rinchan20 Oct 11, 2024
31085ef
more cleanup
Rinchan20 Oct 11, 2024
560f169
connecting to mercury info in vault
Rinchan20 Oct 11, 2024
e2b5faf
implement feedback
Rinchan20 Oct 15, 2024
bc42eec
decreasing intervals for waiting for expectToPass
Rinchan20 Oct 15, 2024
20890c8
adding expectToPass since it seems it might need it on a circleci run
Rinchan20 Oct 15, 2024
d7af043
checking if timing works better for circleci since it passes locally
Rinchan20 Oct 15, 2024
52b6429
adding more logging to try to find where test is failing in circleci
Rinchan20 Oct 15, 2024
0d30582
description change
Rinchan20 Oct 17, 2024
cb7b72d
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Nov 21, 2024
cf0b52b
attempting to fix one pixel difference error
Rinchan20 Nov 22, 2024
ac69c59
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Dec 13, 2024
b8c63e5
Merge branch 'develop' into pepper-1251-playwright-place-an-order-in-…
Rinchan20 Dec 17, 2024
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
13 changes: 7 additions & 6 deletions playwright-e2e/dsm/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ export enum KitSampleType {
}

export enum DataFilter {
NOT_EMPTY = 'Not Empty',
EXACT_MATCH = 'Exact Match',
RANGE = 'Range',
EMPTY = 'Empty',
ENROLLED = 'Enrolled',
REQUEST = 'Request',
RECEIVED = 'Received',
EXACT_MATCH = 'Exact Match',
LOST_TO_FOLLOWUP = 'Lost to Followup',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just moved things into alphabetical order

NO = 'No',
YES = 'Yes',
NOT_EMPTY = 'Not Empty',
RANGE = 'Range',
RECEIVED = 'Received',
REGISTERED = 'Registered',
REQUEST = 'Request',
YES = 'Yes',
}

export enum FieldSettingInputType {
Expand Down
30 changes: 30 additions & 0 deletions playwright-e2e/dsm/pages/tablist/sequencing-order-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default class SequeuncingOrderTab extends TabBase {
private readonly SAMPLE_ROW_XPATH = '//app-sequencing-order//tr';
private readonly DATE_FIELD_XPATH = `//input[@data-placeholder='mm/dd/yyyy']`;
private readonly NOT_ELIGIBLE_DUE_TO_RESIDENCE = `Error: Participant lives in New York or Canada and is not eligible for clinical sequencing`;
private readonly PLACE_ORDER_MODAL_TEXT = `Are you sure you want to place a clinical sequencing order for the following samples:`;

constructor(page: Page) {
super(page, Tab.SEQUENCING_ORDER);
Expand Down Expand Up @@ -38,11 +39,35 @@ export default class SequeuncingOrderTab extends TabBase {
await expect(placeOrderButton).not.toBeVisible();
}

public async assertPlaceOrderButtonDisplayed(): Promise<void> {
const placeOrderButton = this.getPlaceOrderButton();
await placeOrderButton.scrollIntoViewIfNeeded();
await expect(placeOrderButton, 'The Place Order button is not visible to the current DSM user').toBeVisible();
}

public async assertParticipantNotEligibleForClinicalSequencing(): Promise<void> {
const validationMessage = this.page.getByText(this.NOT_ELIGIBLE_DUE_TO_RESIDENCE);
await expect(validationMessage).toBeVisible();
}

public async assertClinicalOrderModalDisplayed(): Promise<void> {
const placeOrderModal = this.page.locator(`//div[contains(text(), '${this.PLACE_ORDER_MODAL_TEXT}')]`);
await placeOrderModal.scrollIntoViewIfNeeded();
await expect(placeOrderModal, 'Place Order modal is not visible - clinical order cannot be placed').toBeVisible();
}

public async closeClinicalOrderModal(): Promise<void> {
const button = this.page.locator(`//div[@class='modal-content']/div[@class='modal-footer']//button[normalize-space(text())='Close']`);
await expect(button, 'Clinical Order modal -> [Close] button is not visible').toBeVisible();
await button.click();
}

public async submitClinicalOrder(): Promise<void> {
const button = this.page.locator(`//div[@class='modal-content']/div[@class='modal-footer']//button[normalize-space(text())='Submit']`);
await expect(button, 'Clinical Order modal -> [Submit] button is not visible').toBeVisible();
await button.click();
}

public async fillAvailableCollectionDateFields(opts: {canPlaceClinicalOrder?: boolean}): Promise<void> {
const { canPlaceClinicalOrder = true } = opts;
const collectionDateIndex = canPlaceClinicalOrder ? 5 : 4; //Index depending on whether test user has permission to place clinical order
Expand Down Expand Up @@ -95,6 +120,11 @@ export default class SequeuncingOrderTab extends TabBase {
return this.toLocator.getByRole('button', { name: 'Place order' });
}

public async selectSampleCheckbox(sample: Locator): Promise<void> {
const checkbox = sample.locator('//mat-checkbox');
await checkbox.click();
}

private getCheckboxOfSample(sample: Locator): Locator {
return sample.locator('//mat-checkbox');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import { expect, Locator } from '@playwright/test';
import { ParticipantListTable } from 'dsm/component/tables/participant-list-table';
import { CustomizeView, DataFilter, Label, Tab } from 'dsm/enums';
import { Navigation, Study, StudyName } from 'dsm/navigation';
import ParticipantListPage from 'dsm/pages/participant-list-page';
import ParticipantPage from 'dsm/pages/participant-page';
import SequeuncingOrderTab from 'dsm/pages/tablist/sequencing-order-tab';
import Select from 'dss/component/select';
import { test } from 'fixtures/dsm-fixture';
import { studyShortName } from 'utils/test-utils';

const pecgsStudies = [StudyName.OSTEO2]; //Checking OS2 first
test.describe.serial('Verify that clinical orders can be placed in mercury @dsm @functional', () => {
let navigation;
let shortID;
let participantPage: ParticipantPage;
let sequencingOrderTab: SequeuncingOrderTab;
let normalSample: Locator;
let tumorSample: Locator;
let previousLatestOrderNumber: string;

for (const study of pecgsStudies) {
test(`${study}: Verify a clinical order can be placed for a participant with Enrolled status`, async ({ page, request }) => {
navigation = new Navigation(page, request);
await new Select(page, { label: 'Select study' }).selectOption(study);

const participantListPage = await navigation.selectFromStudy<ParticipantListPage>(Study.PARTICIPANT_LIST);
await participantListPage.waitForReady();
const participantListTable = participantListPage.participantListTable;

await test.step('Chose an enrolled participant that will get a clinical order placed', async () => {
shortID = await findParticipantForGermlineSequencing({
enrollmentStatus: DataFilter.ENROLLED,
participantList: participantListPage,
participantTable: participantListTable,
studyName: study
});

await participantListPage.filterListByShortId(shortID);
participantPage = await participantListTable.openParticipantPageAt({ position: 0 });
await participantPage.waitForReady();
});

await test.step('Make sure that the Sequencing Order tab is visible', async () => {
await participantPage.tablist(Tab.SEQUENCING_ORDER).isVisible();
sequencingOrderTab = await participantPage.tablist(Tab.SEQUENCING_ORDER).click<SequeuncingOrderTab>();
await sequencingOrderTab.waitForReady();
});

await test.step('Place a clinical order using the Sequencing Order tab', async () => {
normalSample = await sequencingOrderTab.getFirstAvailableNormalSample();
await sequencingOrderTab.selectSampleCheckbox(normalSample);

tumorSample = await sequencingOrderTab.getFirstAvailableTumorSample();
await sequencingOrderTab.selectSampleCheckbox(tumorSample);

await sequencingOrderTab.assertPlaceOrderButtonDisplayed();
await sequencingOrderTab.placeOrder();

await sequencingOrderTab.assertClinicalOrderModalDisplayed();
await sequencingOrderTab.submitClinicalOrder();
});

/* NOTE: Need to go from Participant Page -> Participant List -> (refresh) -> Participant Page in order to see the new info */
await test.step('Use the new Latest Order Number to place the order in mercury', async () => {
//Verify that Latest Sequencing Order Date is the current date and Latest Order Number has received new input
});
})

test(`${study}: Verify a clinical order can be placed for a participant with Lost-to-FollowUp status`, async ({ page, request }) => {
navigation = new Navigation(page, request);
await new Select(page, { label: 'Select study' }).selectOption(study);

const participantListPage = await navigation.selectFromStudy<ParticipantListPage>(Study.PARTICIPANT_LIST);
await participantListPage.waitForReady();

const participantListTable = participantListPage.participantListTable;
})
}
})

async function findParticipantForGermlineSequencing(opts: {
enrollmentStatus: DataFilter.ENROLLED | DataFilter.LOST_TO_FOLLOWUP,
participantList: ParticipantListPage,
participantTable: ParticipantListTable,
studyName: StudyName,
usePediatricParticipant?: boolean,
residenceInUSTerritory?: boolean
}): Promise<string> {
const { enrollmentStatus, participantList, participantTable, studyName, usePediatricParticipant = false, residenceInUSTerritory = false } = opts;

const studyInformation = studyShortName(studyName);
let participantPrefix = studyInformation.playwrightPrefixAdult;
if (usePediatricParticipant) {
participantPrefix = studyInformation.playwrightPrefixChild;
}
console.log(`prefix: ${participantPrefix}`);

const customizeViewPanel = participantList.filters.customizeViewPanel;
await customizeViewPanel.open();
await customizeViewPanel.selectColumns(CustomizeView.CLINICAL_ORDERS, [
Label.CLINICAL_ORDER_DATE,
Label.CLINICAL_ORDER_ID,
Label.CLINICAL_ORDER_PDO_NUMBER,
Label.CLINICAL_ORDER_STATUS,
Label.CLINICAL_ORDER_STATUS_DATE
]);
await customizeViewPanel.selectColumns(CustomizeView.CONTACT_INFORMATION, [Label.CITY, Label.COUNTRY]);
await customizeViewPanel.close();

const searchPanel = participantList.filters.searchPanel;
await searchPanel.open();
await searchPanel.text(Label.FIRST_NAME, { textValue: participantPrefix, additionalFilters: [DataFilter.EXACT_MATCH], exactMatch: false });
await searchPanel.checkboxes(Label.STATUS, { checkboxValues: [enrollmentStatus] });
await searchPanel.dates(Label.CLINICAL_ORDER_DATE, { additionalFilters: [DataFilter.NOT_EMPTY] });
await searchPanel.text(Label.CLINICAL_ORDER_ID, { additionalFilters: [DataFilter.NOT_EMPTY] });

if (residenceInUSTerritory) {
//Location used: Yigo, Guam
await searchPanel.text(Label.CITY, { textValue: 'YIGO' });
await searchPanel.text(Label.COUNTRY, { textValue: 'GU' });
} else {
await searchPanel.text(Label.CITY, { textValue: 'CAMBRIDGE' });
await searchPanel.text(Label.COUNTRY, { textValue: 'US' });
}

await searchPanel.search({ uri: 'filterList' });

const numberOfReturnedParticipants = await participantTable.getRowsCount();
expect(numberOfReturnedParticipants).toBeGreaterThanOrEqual(1);

//Randomly chose a participant to get a clinical order who had previously had an order placed
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for choosing a ptp who previously had an order placed: test is a bit smaller if it does not need to send+receive a kit and accession sm-ids

const randomizedParticipantRows = await participantTable.randomizeRows();
const rowNumber = randomizedParticipantRows[0];

const shortID = await participantTable.getParticipantDataAt(rowNumber, Label.SHORT_ID);
console.log(`Participant chosen for clinical order: ${shortID}`);

return shortID;
}