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 all 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
6 changes: 6 additions & 0 deletions .circleci/export-playwright-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ echo "export SITE_PASSWORD=$sitePwd" >> playwright-env/envvars
export bspToken=$(vault read --format=json secret/pepper/test/v1/e2e | jq -r ".data.bsp | .[] | select(.env==\"$ENV\") | .token")
echo "export BSP_TOKEN=$bspToken" >> playwright-env/envvars

export pubsubTopicName=$(vault read --format=json secret/pepper/test/v1/e2e | jq -r ".data.mercury | .[] | select(.env==\"$ENV\") | .pubsubTopicName")
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we aren't dipping into pubsub for these tests. Do we need these values for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep - I use them in placeMercuryOrder():
Screenshot 2024-10-15 at 6 00 18 AM

I'm using the method shown here: https://cloud.google.com/pubsub/docs/publisher#node.js_1

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you say a bit more about why we need to interact with pubsub directly when there's a "place order" button on the UI?

Copy link
Contributor Author

@Rinchan20 Rinchan20 Oct 15, 2024

Choose a reason for hiding this comment

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

yeah - the "place order" button usually just fills the Latest Sequencing Order Date column and the Latest Order Number column. I need to use pubsub in order to make sure that the Latest Order Status and Latest PDO Number are also filled out.
Below is state of the orders with just "place order" used (see the ones with "10/15/2024" as the Latest Sequencing Order Date):
Screenshot 2024-10-15 at 9 51 11 AM

Below is after using pubsub (Latest Order Status and Latest PDO Number are now filled out):
Screenshot 2024-10-15 at 9 53 36 AM

attaching the doc that has the testing steps since video reference is too big to attach: https://docs.google.com/document/d/1TGCnJGNz-HPYo1zO7wEeVHjkhm0NEgOEQHwyoCU12aI/edit?tab=t.0

echo "export MERCURY_PUBSUB_TOPIC_NAME=$pubsubTopicName" >> playwright-env/envvars

export pubsubProjectId=$(vault read --format=json secret/pepper/test/v1/e2e | jq -r ".data.mercury | .[] | select(.env==\"$ENV\") | .pubsubProjectId")
echo "export MERCURY_PUBSUB_PROJECT_ID=$pubsubProjectId" >> playwright-env/envvars

export dsmUser1=$(vault read --format=json secret/pepper/test/v1/e2e | jq -r ".data.users | .[] | select(.app==\"dsm\") | .users[0] | .userName")
export dsmUser1Password=$(vault read --format=json secret/pepper/test/v1/e2e | jq -r ".data.users | .[] | select(.app==\"dsm\") | .users[0] | .password")
echo "export DSM_USER1_EMAIL=$dsmUser1" >> playwright-env/envvars
Expand Down
2 changes: 2 additions & 0 deletions playwright-e2e/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ SITE_PASSWORD=

# PEPPER
API_BASE_URL=https://pepper-dev.datadonationplatform.org
MERCURY_PUBSUB_TOPIC_NAME=
MERCURY_PUBSUB_PROJECT_ID=

# ATCP
ATCP_BASE_URL=https://atcp.dev.datadonationplatform.org
Expand Down
2 changes: 2 additions & 0 deletions playwright-e2e/config/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ SITE_PASSWORD=

# PEPPER
API_BASE_URL=https://pepper-dev.datadonationplatform.org
MERCURY_PUBSUB_TOPIC_NAME=
MERCURY_PUBSUB_PROJECT_ID=

# ATCP
ATCP_BASE_URL=https://atcp.dev.datadonationplatform.org
Expand Down
2 changes: 2 additions & 0 deletions playwright-e2e/config/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ SITE_PASSWORD=

# PEPPER
API_BASE_URL=https://pepper-test.datadonationplatform.org
MERCURY_PUBSUB_TOPIC_NAME=
MERCURY_PUBSUB_PROJECT_ID=

# ATCP
ATCP_BASE_URL=https://atcp.test.datadonationplatform.org
Expand Down
34 changes: 28 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 Expand Up @@ -787,3 +788,24 @@ export enum ParticipantListPageOptions {
SAVE_CURRENT_VIEW = 'Save Current View',
SAVED_FILTERS = 'Saved Filters',
}

export enum SequencingOrderColumn {
SAMPLE_TYPE = 'Sample Type',
SAMPLE = 'Sample',
SAMPLE_STATUS = 'Sample Status',
COLLECTION_DATE = 'Collection Date',
LATEST_SEQUENCING_ORDER_DATE = 'Latest Sequencing Order Date',
LATEST_ORDER_STATUS = 'Latest Order Status',
LATEST_ORDER_NUMBER = 'Latest Order Number',
LATEST_PDO_NUMBER = 'Latest PDO Number',
}

export enum ClinicalOrdersColumn {
SHORT_ID = 'Short ID',
SAMPLE_TYPE = 'Sample Type',
SAMPLE = 'Sample',
ORDER_NUMBER = 'Order Number',
ORDER_DATE = 'Order Date',
STATUS = 'Status',
STATUS_DETAIL = 'Status Detail'
}
14 changes: 14 additions & 0 deletions playwright-e2e/dsm/pages/clinical-orders-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,30 @@ import { expect, Locator, Page } from '@playwright/test';

export default class ClinicalOrdersPage {
protected PAGE_TITLE = 'Clinical Orders';
private readonly DOWNLOAD_INFO = 'Download list includes additional fields "Order Message & Status Message"';

constructor(private readonly page: Page) {}

public async waitForReady(): Promise<void> {
const downloadListButton = this.getDownloadListButton();
const reloadListButton = this.getReloadListButton();
const downloadHelpText = this.getDownloadHelpText();
const clinicalOrdersTable = await this.getClinicalOrdersTable();
const amountOfClinicalOrders = clinicalOrdersTable.length;

await expect(downloadListButton, 'Clinical Orders Page -> Download List button is not visible').toBeVisible();
await expect(reloadListButton, 'Clinical Orders Page -> Reload List button is not visible').toBeVisible();
await expect(downloadHelpText, `Clinical Orders Page -> help text: "${this.DOWNLOAD_INFO}" is not visible`).toBeVisible();
expect.soft(amountOfClinicalOrders).toBeGreaterThanOrEqual(1); //Just in case there's times where there aren't clinical orders
}

public getClinicalOrderRow(opts: { sampleType: 'Normal' | 'Tumor', orderNumber: string }): Locator {
const { sampleType, orderNumber } = opts;
return this.page.locator(
`//app-clinical-page//td[contains(text(), '${orderNumber}')]/preceding-sibling::td[contains(text(), '${sampleType}')]/parent::tr`
);
}

/* Locators */
private getDownloadListButton(): Locator {
return this.page.getByRole('button', { name: 'Download list' });
Expand All @@ -28,4 +38,8 @@ export default class ClinicalOrdersPage {
private async getClinicalOrdersTable(): Promise<Locator[]> {
return this.page.locator('//table//tbody//tr').all();
}

private getDownloadHelpText(): Locator {
return this.page.getByText(this.DOWNLOAD_INFO);
}
}
10 changes: 10 additions & 0 deletions playwright-e2e/dsm/pages/participant-list-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,4 +730,14 @@ export default class ParticipantListPage extends DsmPageBase {
const { optionName } = opts;
return this.page.locator(`//text()[normalize-space()='${optionName}']/preceding-sibling::button`);
}

public async refreshParticipantListUsingShortID(opts: { ID: string }): Promise<void> {
const { ID } = opts;
const searchPanel = this.filters.searchPanel;
await searchPanel.open();
const shortIDField = this.page.locator(`//app-filter-column//input[contains(@data-placeholder, 'Short ID')]`);
await expect(shortIDField, 'Search Panel -> Short ID column is not visible, it may need to be added to the Participant List').toBeVisible();
await searchPanel.text(Label.SHORT_ID, { textValue: ID });
await searchPanel.search();
}
}
49 changes: 47 additions & 2 deletions playwright-e2e/dsm/pages/tablist/sequencing-order-tab.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Locator, Page, expect } from '@playwright/test';
import { getDate } from 'utils/date-utils';
import { getDate, getDateinISOFormat, getToday } from 'utils/date-utils';
import TabBase from './tab-base';
import { Tab } from 'dsm/enums';
import { SequencingOrderColumn, Tab } from 'dsm/enums';
import { getColumnHeaderIndex } from 'utils/test-utils';

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_CLINICAL_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 +40,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_CLINICAL_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 +121,25 @@ 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();
}

public async fillCollectionDateIfNeeded(normalSample: Locator): Promise<void> {
const collectionDateColumnIndex = await getColumnHeaderIndex(SequencingOrderColumn.COLLECTION_DATE, this.page);
const unfilledCollectionDateColumn = normalSample.locator(`//td[${collectionDateColumnIndex}]/app-field-datepicker//input`);
if (await unfilledCollectionDateColumn.isVisible()) {
await normalSample.locator(`//td[${collectionDateColumnIndex}]//button[normalize-space(text())='Today']`).click();

//Assert that the correct date was inputted
const today = getToday();
const collectionDateInISOFormat = getDateinISOFormat(today);
const collectionDateColumn = normalSample.locator(`//td[${collectionDateColumnIndex}]`);
await expect(collectionDateColumn).toHaveText(collectionDateInISOFormat);
}
}

private getCheckboxOfSample(sample: Locator): Locator {
return sample.locator('//mat-checkbox');
}
Expand Down
Loading
Loading