Conversation
| @@ -0,0 +1,294 @@ | |||
| import {StudyEnum} from '../../../dsm/component/navigation/enums/selectStudyNav-enum'; | |||
There was a problem hiding this comment.
Don't review .spec file.
aweng98
left a comment
There was a problem hiding this comment.
This is great. A lot of new classes and functions. I'd have written only what I needed for a new test and not write all at one time. :)
Took a first pass. Maybe we can talk about this tomorrow morning. Because I think we should pick out only needed files for a new test. Merge everything without accompanied tests is just confusing.
playwright-e2e/dsm/component/smid.ts
Outdated
| if (isInputVisible) { | ||
| await this.fillField(value, i); | ||
| selectCheckbox && await this.selectCheckbox(i); | ||
| } else { | ||
| await this.addField(); | ||
| await this.fillField(value, i); | ||
| selectCheckbox && await this.selectCheckbox(i); | ||
| } |
There was a problem hiding this comment.
How about this?
if (isInputVisible) {
await this.addField();
}
await this.fillField(value, i);
selectCheckbox && await this.selectCheckbox(i);
There was a problem hiding this comment.
I will improve that this way:
if (!isInputVisible) {
await this.addField();
}
await this.fillField(value, i);
selectCheckbox && await this.selectCheckbox(i);
| public get maxLength(): Promise<string | null> { | ||
| return this.toLocator().getAttribute('maxlength'); | ||
| } |
There was a problem hiding this comment.
async and get modifier are incompatible. It should be public async maxLength(): Promise<string | null>. If you don't use async modifier, eslint won't find error when calling functions not using await.
| return data?.trim() as string; | ||
| } | ||
|
|
||
| public async fillFaxSentDates(date1: FillDate, date2?: FillDate, date3?: FillDate): Promise<void> { |
There was a problem hiding this comment.
I think you want use rest parameter syntax: fillFaxSentDates(...date: FillDate)
There was a problem hiding this comment.
I believe I'd like to keep it as it is since it appears more readable to me. With just three parameters to define, there's no need for looping through them. However, I do acknowledge that the rest parameter is a fantastic feature in JavaScript.
| import Input from '../../../dss/component/input'; | ||
|
|
||
| export default class OncHistoryTable extends Table { | ||
| private readonly tissueInformationPage = new TissueInformationPage(this.page); |
There was a problem hiding this comment.
Hmm, I saw something else similar like this recently and I had to change because we should instatiate a new object like this outside the constructor. tissueInformationPage = new TissueInformationPage(this.page); should be inside the constructor because this.page is created when the constructor is running.
There was a problem hiding this comment.
I didn't encounter any issues with it, which is why I left it as is. However, I do acknowledge that your suggestion is a better approach, so I'll make the necessary adjustments. Thank you for pointing that out.
| public async selectDeselectRow(index: number): Promise<void> { | ||
| const selectRowCheckbox = this.selectRowCheckbox(index); | ||
| await expect(selectRowCheckbox, 'Select row checkbox is not visible').toBeVisible(); | ||
| await selectRowCheckbox.click(); | ||
| } |
There was a problem hiding this comment.
Function is little confusing to me. Is it deselect or select a checkbox?
There was a problem hiding this comment.
In fact, it has the capability to perform both actions. I hadn't initially implemented the functionality to check whether the checkbox is selected or not, but I now understand your perspective and agree with it. I will modify it into a select method that includes the necessary checks. Thank you for the suggestion.
| await this.fillDate(faxSentLocator, date); | ||
| } | ||
|
|
||
| private async fillDate(root: Locator, {date, today}: FillDate): Promise<void> { |
There was a problem hiding this comment.
Using calendar to select date is time consuming and slow. Can we just type in date string in input field? I'd code this if it's for a date-picker test.
There was a problem hiding this comment.
For the time being, let's retain it in its current state to align with the DSM flow, as selecting the date provides more immediate benefits.
| const checkbox = new Checkbox(this.page, {root}); | ||
| const isChecked = await checkbox.isChecked(); | ||
| const isDisabled = await checkbox.isCheckboxDisabled(); | ||
| if (check && !isChecked && !isDisabled) { |
There was a problem hiding this comment.
I don't think we should be checking isDisabled in this function because if user wants to check the checkbox. It is expected to be enabled. If it is disabled, nothing will happen (no error) and user assumes check was sucessful.
There was a problem hiding this comment.
This is necessary due to the buggy flow on this page. We might come across a disabled checkbox unexpectedly, so having this in place helps us handle such scenarios.
| } | ||
|
|
||
| private get participantDynamicInformationTableXPath(): string { | ||
| return `${this.pageXPath}/div/div[last()]/table[not(contains(@class, 'table'))]` |
There was a problem hiding this comment.
Brittle xpath. I'd expect this is going to be a problem in future.
I noticed you're not using any functions from table.ts when constructing xpath. Is there anying I can do to help?
There was a problem hiding this comment.
Yes, please assist in making your table component more versatile by ensuring it's compatible with DSM table components as well!
| await this.checkCheckbox(this.problemsWithTissueUnableToObtainCheckbox, unableToObtainSelection); | ||
| } | ||
|
|
||
| public async selectGender(gender: 'Male' | 'Female'): Promise<void> { |
There was a problem hiding this comment.
I think we have more gender types now than just two.
There was a problem hiding this comment.
I saw there only 2
aweng98
left a comment
There was a problem hiding this comment.
👍🏻 Thank you for your patience.
| private async addField(): Promise<void> { | ||
| await this.addBtn.click(); | ||
| } |
There was a problem hiding this comment.
Since this is a one liner function, it can be replaced by rename addBtn() to addFieldBtn()
await this.addFieldBtn.click();
playwright-e2e/utils/test-utils.ts
Outdated
| } | ||
| } | ||
|
|
||
| export async function waitForRequest(page: Page, { uri, timeout }: WaitForRequest): Promise<Request> { |
There was a problem hiding this comment.
Can you explain requirement. Why wait for a request before click?
fdc3843 to
bb4c6b2
Compare
| public async dates(columnName: string, { from: fromValue, to: toValue, additionalFilters }: Partial<DateConfig>): Promise<void> { | ||
| await this.setAdditionalFilters(columnName, additionalFilters); | ||
|
|
||
| if (!fromValue && !toValue) { return; } |
There was a problem hiding this comment.
Good check!
Question: check should be moved up to be the first line of code, right?
There was a problem hiding this comment.
Thanks.
No, because additional filters can still be applied.
aweng98
left a comment
There was a problem hiding this comment.
Can you also rename directory name from playwright-e2e/tests/dsm/tissueRequestFlow/ to playwright-e2e/tests/dsm/tissue-request/?
LGTM
playwright-e2e/dsm/pages/tissue-information-page/interfaces/tissue-information-interfaces.ts
Outdated
Show resolved
Hide resolved
| const oncHistoryTab = await participantPage.clickTab<OncHistoryTab>(TabEnum.ONC_HISTORY); | ||
| const oncHistoryTable = oncHistoryTab.table; | ||
|
|
||
| await test.step('Update Onc History data - Facility', async () => { |
There was a problem hiding this comment.
Format indentation is wrong in this file.
There was a problem hiding this comment.
What do you mean?
There was a problem hiding this comment.
Tab size/whitespaces on new line. File looks okay now but I saw 4 whitespaces before.
7355cb3 to
808875a
Compare

PEPPER-1125
Video from .spec file:
video.webm