-
-
Notifications
You must be signed in to change notification settings - Fork 4k
tests(Playwright): Full implementation of Page Object Models (POMs) to Playwright tests #5608
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
base: master
Are you sure you want to change the base?
tests(Playwright): Full implementation of Page Object Models (POMs) to Playwright tests #5608
Conversation
✅ Deploy Preview for ohif-dev canceled.
|
|
@jbocce what is the status of this |
jbocce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great changes. A few comments to consider. Thanks.
| <FooterAction.Right> | ||
| <FooterAction.Secondary onClick={hide}>Cancel</FooterAction.Secondary> | ||
| <FooterAction.Secondary | ||
| dataCY="cancel-button" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making this more specific, like 'untracked-series-modal-cancel-button'
| Cancel | ||
| </FooterAction.Secondary> | ||
| <FooterAction.Primary | ||
| dataCY="confirm-button" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too.
| isSelected || !isVisible ? 'opacity-100' : 'opacity-0 group-hover:opacity-100' | ||
| }`} | ||
| aria-label={isVisible ? 'Hide' : 'Show'} | ||
| dataCY="visibilityToggle" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More specific.
| <div className="text-[11px] font-semibold text-white">{modality}</div> | ||
| <div | ||
| className="text-[11px] font-semibold text-white" | ||
| data-cy="series-modality-label" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is for a particular series consider adding something to distinguish it from the other series thumbnail, like series instance uid or something. If the locator though is straightforward, then maybe this is not so big a deal, but something to consider. This comment applies to the other data-cy values in this file too.
| }; | ||
| } | ||
|
|
||
| get viewport() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little surprised to see viewport here. Do we need this level of indirection? And why are things like the overlay menu not here? It is a bit confusing. And why not the context menu that is above too? I think I would expect to see everything that appears in a viewport in the viewport PageObject regardless of where it is in the DOM. Something to consider anyway.
| }; | ||
| }, | ||
| get contourMenuButton() { | ||
| const button = page.getByTestId('panelSegmentationWithToolsContour-btn'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This button and the labelMapMenuButton below are NOT part of the segmentation panel, but instead are the tabs/buttons to change what is displayed in the right panel. So please move these accessors directly into the RightPanelPageObject. Or maybe just rename them panelTabButton to make it clear these are the buttons to switch to that panel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have two segmentation panel page objects: one for contour and one for label map. They have different tools and are actually two separate panels.
| this.page = page; | ||
| } | ||
|
|
||
| get button() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird to have button always get the first dataOverlayMenu. Is it being used? If so rename to make it clear that it is a specific (i.e. the first) instance. If not please remove.
| await this.page.getByTestId(`${to}-SEG`).click(); | ||
| } | ||
|
|
||
| async remove() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently only ever removes the segmentation named (literally) SEGMENTATION. The name of the segmentation overlay should be passed in and templated into the selectors/locators.
| expectedCount: number; | ||
| }) { | ||
| await expect(page.locator('css=div[data-cy^="ModalityLoadBadge-"]')).toHaveCount(expectedCount); | ||
| const overlayPageObject = new OverlayPageObject(page); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this page object be one of those that get created in fixture.ts?
|
|
||
| await expect(page.getByTestId('data-row')).toContainText('Segment One'); | ||
| await expect(page.getByTestId('data-row')).not.toContainText('Segment 1'); | ||
| await expect(segment1.locator).toContainText('Segment One'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how this was all simplified. Good work!
Context
This PR finalizes the effort that was introduced at #5557, of the introduction of POMs to our tests, in a way that we'll benefit in terms of readability and reusability, allowing our test structure to grow without prejudicing maintainability.
This concludes the first step of the architecture enhancement of Playwright tests.
Changes & Results
Testing
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment