Skip to content

Playwright_PECGS_Samples received_saliva first and then tumor #2193

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 17 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
10 changes: 10 additions & 0 deletions playwright-e2e/dsm/component/filters/sections/customize-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,14 @@ export class CustomizeView {
private columnPathXPath(columnName: string): string {
return `/ul/li/mat-checkbox[label[.//*[text()[normalize-space()='${columnName}']]]]`;
}

public async isColumnGroupDisplayed(columnGroupName: string): Promise<boolean> {
//Note: Some studies have column groups that share the same name
const numberOfMatches = await this.page.locator(`//button[contains(@data-toggle, 'dropdown') and contains(., '${columnGroupName}')]`).count();
if (numberOfMatches > 0) {
return true;
} else {
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,76 @@ export enum CustomViewColumns {
RESEARCH_CONSENT_FORM = 'Research Consent Form Columns',
SAMPLE = 'Sample Columns',
}

/* Participant Column group related enums */

export enum ParticipantColumns {
CONSENT_BLOOD = 'Consent Blood',
CONSENT_TISSUE = 'Consent Tissue',
COUNTRY = 'Country',
DATE_OF_BIRTH = 'Date of Birth',
DATE_OF_MAJORITY = 'Date of Majority',
DDP = 'DDP',
DIAGNOSIS_MONTH = 'Diagnosis Month',
DIAGNOSIS_YEAR = 'Diagnosis Year',
DO_NOT_CONTACT = 'Do Not Contact',
EMAIL = 'Email',
FILE_UPLOAD_TIME = 'File Upload Time',
FIRST_NAME = 'First Name',
LAST_NAME = 'Last Name',
PARTICIPANT_ID = 'Participant ID',
PREFERRED_LANGUAGE = 'Preferred Language',
REGISTRATION_DATE = 'Registration Date',
SHORT_ID = 'Short ID',
STATUS = 'Status',
UPLOADED_FILE_NAME = 'Uploaded File Name',
}

export enum EnrollmentStatus {
REGISTERED = 'Registered',
EXITED_BEFORE_ENROLLMENT = 'Exited before Enrollment',
EXITED_AFTER_ENROLLMENT = 'Exited after Enrollment',
ENROLLED = 'Enrolled',
LOST_TO_FOLLOWUP = 'Lost to Followup',
COMPLETED = 'Completed',
}

/* Sample Column group related enums */

export enum SampleColumns {
COLLABORATOR_PARTICIPANT_ID = 'Collaborator Participant ID',
COLLECTION_DATE = 'Collection Date',
MF_CODE = 'MF code',
NORMAL_COLLABORATOR_SAMPLE_ID = 'Normal Collaborator Sample ID',
SAMPLE_DEACTIVATION = 'Sample Deactivation',
SAMPLE_NOTES = 'Sample Notes',
SAMPLE_RECEIVED = 'Sample Received',
SAMPLE_SENT = 'Sample Sent',
SAMPLE_TYPE = 'Sample Type',
SEQUENCING_RESTRICTION = 'Sequencing Restriction',
STATUS = 'Status',
TRACKING_IN = 'Tracking-in',
TRACKING_OUT = 'Tracking-out',
}

export enum KitStatus {
WAITING_ON_GP = 'Waiting on GP',
GP_MANUAL_LABEL = 'GP manual Label',
DEACTIVATED = 'Deactivated',
SHIPPED = 'Shipped',
RECEIVED = 'Received',
}

/* Contact Information Columns group enums */

export enum ContactInformation {
CITY = 'City',
COUNTRY = 'Country',
MAIL_TO_NAME = 'Mail To Name',
PHONE = 'Phone',
STATE = 'State',
STREET_ONE = 'Street 1',
STREET_TWO = 'Street 2',
VALID = 'Valid',
ZIP = 'Zip',
}
77 changes: 76 additions & 1 deletion playwright-e2e/dsm/component/filters/sections/search/search.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { expect, Locator, Page } from '@playwright/test';
import DatePicker from 'dsm/component/date-picker';
import { CheckboxConfig, DateConfig, RadioButtonConfig, TextConfig } from 'dsm/component/filters/sections/search/search-types';
import { AdditionalFilter } from 'dsm/component/filters/sections/search/search-enums';
import { AdditionalFilter, EnrollmentStatus, KitStatus, ParticipantColumns, SampleColumns } from 'dsm/component/filters/sections/search/search-enums';
import { waitForNoSpinner, waitForResponse } from 'utils/test-utils';
import { logError } from 'utils/log-utils';
import { KitTypeEnum } from 'dsm/component/kitType/enums/kitType-enum';
import { ParticipantListTable } from 'dsm/component/tables/participant-list-table';

export class Search {
private readonly enUSDateRegExp = new RegExp(/\b(0[1-9]|1[012])([/])(0[1-9]|[12]\d|3[01])\2(\d{4})/);
Expand Down Expand Up @@ -155,6 +157,79 @@ export class Search {
return isDisabled || false;
}

public async searchForParticipantsWithEnrollmentStatus(enrollmentStatuses: EnrollmentStatus[]): Promise<void> {
await this.open();
await this.checkboxes(ParticipantColumns.STATUS, { checkboxValues: enrollmentStatuses });
await this.search();
}

public async searchForKitSampleStatus(kitTypes: KitTypeEnum[], kitStatus: KitStatus): Promise<void> {
await this.open();
await this.checkboxes(SampleColumns.SAMPLE_TYPE, { checkboxValues: kitTypes });
await this.radioButton(SampleColumns.STATUS, { radioButtonValue: kitStatus });
await this.search();
}

public async searchForParticipantWithUnsentSalivaKit(): Promise<string> {
const [filterListReponse] = await Promise.all([
this.page.waitForResponse(response => response.url().includes('/ui/filterList') && response.status() === 200),
this.searchForKitSampleStatus([KitTypeEnum.SALIVA], KitStatus.WAITING_ON_GP),
]);
let responseBody = JSON.parse(await filterListReponse.text());

const participantListTable = new ParticipantListTable(this.page);
const amountOfRowsDisplayed = await participantListTable.rowsCount;
let validTestParticipantShortIDFound;

//Check for a participant with a saliva kit that neither has scanDate or deactivatedDate
for (let index = 0; index < amountOfRowsDisplayed; index++) {
if (await participantListTable.onLastPage()) {
console.log('On last page');
break;
}
console.log(`Participant ${index}'s information: ${responseBody.participants[index].esData.profile.hruid}`);
const kitInformation = responseBody.participants[index].kits;
const amountOfKits = kitInformation.length;
console.log(`Participant kit amount: ${kitInformation.length}`);
for (let kitNumber = 0; kitNumber < amountOfKits; kitNumber++) {
console.log(`Participant kit info: ${kitInformation[kitNumber].kitTypeName}`);
if ((kitInformation[kitNumber].kitTypeName) === KitTypeEnum.SALIVA) {
if (kitInformation[kitNumber].scanDate === undefined && kitInformation[kitNumber].deactivatedDate === undefined) {
console.log(`ALERT: Valid participant found!`);
validTestParticipantShortIDFound = responseBody.participants[index].esData.profile.hruid;
break;
}
}
}

if (validTestParticipantShortIDFound) {
break;
}

if (this.isReadyToGoToTheNextPage(index, amountOfRowsDisplayed)) {
const [nextResponse] = await Promise.all([
this.page.waitForResponse(response => response.url().includes('/ui/filterList') && response.status() === 200),
await participantListTable.nextPage(),
]);
await participantListTable.waitForReady();
responseBody = JSON.parse(await nextResponse.text());
index = -1;
console.log('Should be on the next page now');
}
}
return validTestParticipantShortIDFound;
}

/**
* Determines if it's time to go to the next page based on the current index used in a for-loop & whether the last row was looked at
* @param index Current index being used in a for-loop in a different method
* @param amountOfRowsDisplayed The amount of rows currently displayed in the DSM Participant List
* @returns if it's time to turn the page
*/
private isReadyToGoToTheNextPage(index: number, amountOfRowsDisplayed: number): boolean {
return (index > 0) && (index % (amountOfRowsDisplayed - 1) === 0);
}

/* Locators */

private checkboxLocator(columnName: string, checkboxName: string): Locator {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum ScreenReaderText {
CURRENT_PAGE = `You're on page`,
GENERAL_PAGE = `page`,
}
39 changes: 39 additions & 0 deletions playwright-e2e/dsm/component/tables/participant-list-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { getDate, offsetDaysFromToday } from 'utils/date-utils';
import { waitForNoSpinner } from 'utils/test-utils';
import { AdditionalFilter } from 'dsm/component/filters/sections/search/search-enums';
import ParticipantListPage from 'dsm/pages/participant-list-page';
import { ScreenReaderText } from 'dsm/component/navigation/enums/accessibility-enum';

export class ParticipantListTable extends Table {
private readonly _participantPage: ParticipantPage = new ParticipantPage(this.page);
Expand Down Expand Up @@ -112,11 +113,49 @@ export class ParticipantListTable extends Table {
return this.page.locator(`//table/tbody/tr`).nth(position);
}

/**
* Returns the number of the last page of the participant list
* @type pagebuttonContents - 0 based- string array that splits "page" and {page number}
* @returns The number of the last page button e.g. if there are 3 pages, this method returns: 3
*/
public async getLastPageNumber(): Promise<number> {
const lastPageButton = this.lastPage;
const pageButtonContents = (await lastPageButton.innerText()).split(ScreenReaderText.GENERAL_PAGE);
const pageNumber = pageButtonContents[1].trim();
return parseInt(pageNumber);
}

/**
* Return the current page number
* @returns @type pagebuttonContents - 0 based- string array that splits "You're on page" and {page number}
*/
public async getCurrentPageNumber(): Promise<number> {
const currentPageButton = this.currentPage;
const pageButtonContents = (await currentPageButton.innerText()).split(ScreenReaderText.CURRENT_PAGE);
const pageNumber = pageButtonContents[1].trim();
return parseInt(pageNumber);
}

public async onLastPage(): Promise<boolean> {
if (await this.getCurrentPageNumber() === await this.getLastPageNumber()) {
return true;
}
return false;
}

/* Locators */
public get rowsCount(): Promise<number> {
return this.getRowsCount();
}

public get lastPage(): Locator {
return this.page.locator(`//li[contains(@class, 'pagination-next')]/preceding-sibling::li[1]`);
}

public get currentPage(): Locator {
return this.page.locator(`//li[contains(@class, 'current')]`);
}

/* XPaths */
private participantDataByXPath(columnName: string, columnValue: string, xColumnName: string): string {
return (
Expand Down
58 changes: 58 additions & 0 deletions playwright-e2e/dsm/component/tabs/enums/oncHistory-enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
export enum OncHistoryRequestStatus {
NEEDS_REVIEW = 'Needs Review',
DONT_REQUEST = `Don't Request`,
ON_HOLD = 'On Hold',
REQUEST = 'Request',
SENT = 'Sent',
RECEIVED = 'Received',
RETURNED = 'Returned',
UNABLE_TO_OBTAIN = 'Unable To Obtain',
}

export enum Decalcification {
NITRIC_ACID = `Nitric Acid (includes Perenyi's fluid)`,
HYDROCHLORIC_ACID = `Hydrochloric Acid (includes Von Ebner's solution)`,
FORMIC_ACID = `Formic Acid (includes Evans/Kajian, Kristensen/Gooding/Stewart)`,
ACID_NOS = 'Acid NOS',
EDTA = 'EDTA',
SAMPLE_NOT_DECALCIFIED = 'Sample not decalcified',
OTHER = 'Other',
UNKNOWN = 'Unknown',
IMMUNOCAL = 'Immunocal/Soft Decal',
BLANK = '',
}

export enum GeneralAnswer {
YES = 'Yes',
NO = 'No',
UNKNOWN = 'Unknown',
BLANK = '',
}

/* Lists the placements of certain columns in the onc history. Note: Number assumes 0-based/counting from zero */
export enum OncHistoryColumn {
DATE_OF_PX = 2,
TYPE_OF_PX = 3,
LOCATION_OF_PX = 4,
HISTOLOGY = 5,
ACCESSION_NUMBER = 6,
FACILITY = 7,
PHONE = 8,
FAX = 9,
DESTRUCTION_POLICY = 10,
OS2_LOCAL_CONTROL = 11,
LMS_TUMOR_SIZE = 11,
LMS_SLIDES_TO_REQUEST = 12,
OS2_TUMOR_SIZE = 12,
LMS_FACILITY_WHERE_SAMPLE_REVIEWED = 13,
OS2_BLOCKS_WITH_TUMOR = 11,
LMS_SLIDES_TOTAL = 14,
LMS_BLOCKS_TO_REQUEST = 15,
OS2_NECROSIS = 14,
LMS_TREATMENT_EFFECT = 16,
OS2_FFPE = 16,
OS2_DECALCIFICATION = 17,
VIABLE_TUMOR = 17,
LMS_NECROSIS = 18,
REQUEST_STATUS = 21,
}
1 change: 1 addition & 0 deletions playwright-e2e/dsm/component/tabs/enums/tab-enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export enum TabEnum {
INVITAE = 'Invitae',
SAMPLE_INFORMATION = 'Sample Information',
SURVEY_DATA = 'Survey Data',
ONC_HISTORY = 'Onc History',
}
29 changes: 29 additions & 0 deletions playwright-e2e/dsm/component/tabs/model/oncHistoryDetailModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Decalcification, GeneralAnswer, OncHistoryRequestStatus } from 'dsm/component/tabs/enums/oncHistory-enum'

export interface OncHistoryDetail {
oncHistoryID?: number,
requestOncHistoryDetail(): Promise<void>,
accessTissueRequestPage(): Promise<void>,
dateOfPX?: string,
typeOfPX?: string,
locationOfPX?: string,
histology?: string,
accessionNumber?: string,
facility?: string,
phone?: string,
fax?: string,
destructionPolicy?: string | number,
localControl?: GeneralAnswer,
decalcification?: Decalcification,
ffpe?: GeneralAnswer,
blocksWithTumor?: string,
tumorSize?: string,
blockToRequest?: string,
necrosis?: string,
viableTumor?: string,
slidesToRequest?: string,
facilityWhereSampleWasReviewed?: string,
slidesTotal?: string,
treatmentEffect?: string,
setOncHistoryRequestStatus(status: OncHistoryRequestStatus): Promise<void>,
}
Loading