-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
test(segmentation): add labelmap segment color change E2E tests. #6054
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
diattamo
wants to merge
7
commits into
OHIF:master
Choose a base branch
from
diattamo:feat/labelmap-color-change
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
363d681
test(seg): add labelmap segmentation color change coverage
diattamo aeed014
Merge branch 'master' into feat/labelmap-color-change
diattamo f34d8f6
Merge remote-tracking branch 'origin/master' into feat/labelmap-color…
diattamo b8c2cdc
fix(tests): update label map segmentation screenshots for color changes
diattamo ad9717c
Merge branch 'master' into feat/labelmap-color-change
diattamo ebcf40a
Merge branch 'feat/labelmap-color-change' of https://github.com/diatt…
diattamo d3348cd
fix(tests): update labelmap segment color change logic to use color p…
diattamo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| import { | ||
| expect, | ||
| test, | ||
| visitStudy, | ||
| waitForViewportRenderCycle, | ||
| waitForViewportsRendered, | ||
| checkForScreenshot, | ||
| screenShotPaths, | ||
| } from './utils'; | ||
|
|
||
| const NEW_LABELMAP_SEGMENT_HEX = '#FF00FF'; | ||
| const NEW_LABELMAP_SEGMENT_HEX_CSS_RGB = 'rgb(255, 0, 255)'; | ||
|
|
||
| // Default color of segment 0 in the labelmap SEG study. | ||
| const LABELMAP_SEGMENT_0_DEFAULT_HEX = '#9D6CA2'; | ||
| const LABELMAP_SEGMENT_0_DEFAULT_CSS_RGB = 'rgb(157, 108, 162)'; | ||
|
|
||
| const STUDY_UID = '1.3.6.1.4.1.14519.5.2.1.256467663913010332776401703474716742458'; | ||
|
|
||
| test.beforeEach(async ({ page, leftPanelPageObject, DOMOverlayPageObject }) => { | ||
| await visitStudy(page, STUDY_UID, 'segmentation', 2000); | ||
|
|
||
| await leftPanelPageObject.loadSeriesByModality('SEG'); | ||
| await waitForViewportsRendered(page); | ||
|
|
||
| await expect(DOMOverlayPageObject.viewport.segmentationHydration.locator).toBeVisible(); | ||
| await DOMOverlayPageObject.viewport.segmentationHydration.yes.click(); | ||
| }); | ||
|
|
||
| test('opens the color edit popup when "Change Color" is clicked', async ({ | ||
| rightPanelPageObject, | ||
| DOMOverlayPageObject, | ||
| }) => { | ||
| const segment = rightPanelPageObject.labelMapSegmentationPanel.panel.nthSegment(0); | ||
| await segment.toggleVisibility(); | ||
|
|
||
| await segment.actions.openChangeColor(); | ||
|
|
||
| await expect(DOMOverlayPageObject.dialog.colorPicker.locator).toBeVisible(); | ||
| await expect(DOMOverlayPageObject.dialog.title).toHaveText('Segment Color'); | ||
| await expect(DOMOverlayPageObject.dialog.colorPicker.saveButton).toBeVisible(); | ||
| await expect(DOMOverlayPageObject.dialog.colorPicker.cancelButton).toBeVisible(); | ||
|
|
||
| await expect(DOMOverlayPageObject.dialog.colorPicker.hexInput).toHaveValue( | ||
| LABELMAP_SEGMENT_0_DEFAULT_HEX | ||
| ); | ||
| }); | ||
|
|
||
| test('changes the labelmap segment color when the user saves', async ({ | ||
| page, | ||
| rightPanelPageObject, | ||
| DOMOverlayPageObject, | ||
| viewportPageObject, | ||
| }) => { | ||
| await rightPanelPageObject.labelMapSegmentationPanel.segmentsVisibilityToggle.click(); | ||
| const segment = rightPanelPageObject.labelMapSegmentationPanel.panel.nthSegment(0); | ||
| await segment.toggleVisibility(); | ||
| await segment.click(); | ||
|
|
||
| await expect(segment.rowDataColorHex).toHaveCSS( | ||
| 'background-color', | ||
| LABELMAP_SEGMENT_0_DEFAULT_CSS_RGB | ||
| ); | ||
|
|
||
| const viewportPane = (await viewportPageObject.getById('default')).pane; | ||
| await checkForScreenshot({ | ||
| page, | ||
| locator: viewportPane, | ||
| screenshotPath: screenShotPaths.labelMapSegmentationColorChange.colorBeforeChange | ||
| }); | ||
|
|
||
| await segment.actions.openChangeColor(); | ||
| await DOMOverlayPageObject.dialog.colorPicker.fillHex(NEW_LABELMAP_SEGMENT_HEX); | ||
|
|
||
| const colorChangeCycle = waitForViewportRenderCycle(page); | ||
| await DOMOverlayPageObject.dialog.colorPicker.save(); | ||
| await colorChangeCycle; | ||
|
diattamo marked this conversation as resolved.
|
||
|
|
||
| await expect(DOMOverlayPageObject.dialog.colorPicker.locator).toBeHidden(); | ||
| await expect(segment.rowDataColorHex).toHaveCSS( | ||
| 'background-color', | ||
| NEW_LABELMAP_SEGMENT_HEX_CSS_RGB | ||
| ); | ||
|
|
||
| await checkForScreenshot({ | ||
| page, | ||
| locator: viewportPane, | ||
| screenshotPath: screenShotPaths.labelMapSegmentationColorChange.colorAfterChange | ||
| }); | ||
| }); | ||
|
|
||
| test('does not change the labelmap segment color when the user cancels', async ({ | ||
| page, | ||
| rightPanelPageObject, | ||
| DOMOverlayPageObject, | ||
| viewportPageObject, | ||
| }) => { | ||
| await rightPanelPageObject.labelMapSegmentationPanel.segmentsVisibilityToggle.click(); | ||
| const segment = rightPanelPageObject.labelMapSegmentationPanel.panel.nthSegment(0); | ||
| await segment.toggleVisibility(); | ||
| await segment.click(); | ||
|
|
||
| await expect(segment.rowDataColorHex).toHaveCSS( | ||
| 'background-color', | ||
| LABELMAP_SEGMENT_0_DEFAULT_CSS_RGB | ||
| ); | ||
|
|
||
| const viewportPane = (await viewportPageObject.getById('default')).pane; | ||
| await checkForScreenshot({ | ||
| page, | ||
| locator: viewportPane, | ||
| screenshotPath: screenShotPaths.labelMapSegmentationColorChange.colorBeforeCancel | ||
| }); | ||
|
|
||
| await segment.actions.cancelChangeColor(NEW_LABELMAP_SEGMENT_HEX); | ||
|
|
||
| await expect(DOMOverlayPageObject.dialog.colorPicker.locator).toBeHidden(); | ||
| await expect(segment.rowDataColorHex).toHaveCSS( | ||
| 'background-color', | ||
| LABELMAP_SEGMENT_0_DEFAULT_CSS_RGB | ||
| ); | ||
|
|
||
| await checkForScreenshot({ | ||
| page, | ||
| locator: viewportPane, | ||
| screenshotPath: screenShotPaths.labelMapSegmentationColorChange.colorAfterCancel | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+190 KB
...belMapSegmentationColorChange.spec.ts/labelMapSegmentationColor-afterCancel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+190 KB
...belMapSegmentationColorChange.spec.ts/labelMapSegmentationColor-afterChange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+190 KB
...elMapSegmentationColorChange.spec.ts/labelMapSegmentationColor-beforeCancel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+190 KB
...elMapSegmentationColorChange.spec.ts/labelMapSegmentationColor-beforeChange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.