-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Tests/duplicated contour navigation issue #6033
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
diattamo
wants to merge
19
commits into
OHIF:master
Choose a base branch
from
diattamo:tests/duplicated-contour-navigation-issue
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.
+51
−3
Draft
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
2b5d01f
feat(tests): Add tests for duplicating contour segments
diattamo f8cc5a9
Address review comments
diattamo 5bf3c5b
Merge branch 'master' into feat/contour-segments-interactions-duplicate
diattamo 574fc78
Merge branch 'master' into feat/contour-segments-interactions-duplicate
diattamo 33dbc16
Address review comments
diattamo 7e65738
Address minor comment
diattamo 0588987
remove 'd' from the SVG Inner elements
diattamo 49d43c1
Refactor the getSVGPath to getSVGPAthAttribute - Update other tests t…
diattamo 9b1509e
Merge branch 'master' into feat/contour-segments-interactions-duplicate
diattamo 197b32c
Add validation for SVG path count for the contour segment before dupl…
diattamo 710a50a
Address code review comments - refactor to update getSVGAtrribute calls
diattamo 894d0c2
Merge remote-tracking branch 'upstream/master' into feat/contour-segm…
diattamo 0511bf8
fix accidental deletion
diattamo 97e2b8e
test: add navigation verification for duplicated contour segments
diattamo 9c3d464
Merge branch 'master' into tests/duplicated-contour-navigation-issue
diattamo 066df27
Merge branch 'master' into tests/duplicated-contour-navigation-issue
diattamo 6fcc4fa
Merge branch 'tests/duplicated-contour-navigation-issue' of https://g…
diattamo f3fb318
Correct spelling of 'Threshold'
diattamo 4bee07f
code review updates
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
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,160 @@ | ||
| import { | ||
| expect, | ||
| test, | ||
| visitStudy, | ||
| waitForViewportsRendered, | ||
| } from './utils'; | ||
| import { getSvgAttribute } from './utils/getSvgAttribute'; | ||
|
|
||
| const studyInstanceUID = '1.2.840.113619.2.290.3.3767434740.226.1600859119.501'; | ||
| const defaultSegment0Name = 'Threshold'; | ||
| const defaultSegment1Name = 'Big Sphere'; | ||
|
|
||
| test.beforeEach(async ({ | ||
| page, | ||
| leftPanelPageObject, | ||
| DOMOverlayPageObject, | ||
| }) => { | ||
| const mode = 'segmentation'; | ||
| await visitStudy(page, studyInstanceUID, mode, 2000); | ||
|
|
||
| await leftPanelPageObject.loadSeriesByModality('RTSTRUCT'); | ||
| await waitForViewportsRendered(page); | ||
| await expect(DOMOverlayPageObject.viewport.segmentationHydration.locator).toBeVisible(); | ||
|
|
||
| await DOMOverlayPageObject.viewport.segmentationHydration.yes.click(); | ||
| }); | ||
|
|
||
| test('should duplicate a contour segment and add a new row to the panel', async ({ | ||
| page, | ||
| rightPanelPageObject, | ||
| }) => { | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| const panel = rightPanelPageObject.contourSegmentationPanel.panel; | ||
|
|
||
| const initialCount = await panel.getSegmentCount(); | ||
| expect(initialCount, 'Expected to load with 4 segments').toBe(4); | ||
|
|
||
| const segment0 = panel.nthSegment(0); | ||
| await expect(segment0.title).toHaveText(defaultSegment0Name); | ||
|
|
||
| await segment0.actions.duplicate(); | ||
|
|
||
| const countAfterDuplicate = await panel.getSegmentCount(); | ||
| expect(countAfterDuplicate, 'Expected one additional segment row after duplicating').toBe(5); | ||
|
|
||
| //New segment's default name is formatted as "Segment {segmentCount}" | ||
| const newSegmentLocator = panel.nthSegment(initialCount).title; | ||
| await expect(newSegmentLocator, 'Expected correct title for duplicated segment').toHaveText(`Segment 5`); | ||
|
|
||
| // Original segment titles should be unchanged | ||
| await expect(panel.nthSegment(0).title).toHaveText(defaultSegment0Name); | ||
| await expect(panel.nthSegment(1).title).toHaveText(defaultSegment1Name); | ||
| }); | ||
|
|
||
| test('should duplicate the same segment multiple times', async ({ | ||
| page, | ||
| rightPanelPageObject, | ||
| }) => { | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| const panel = rightPanelPageObject.contourSegmentationPanel.panel; | ||
|
|
||
| const segment0 = panel.nthSegment(0); | ||
|
|
||
| await segment0.actions.duplicate(); | ||
| expect(await panel.getSegmentCount(), 'Expected one additional segment row after duplicating').toBe(5); | ||
|
|
||
| const firstDuplicateTitleLocator = panel.nthSegment(4).title; | ||
| await expect(firstDuplicateTitleLocator, 'Expected correct title for first duplicated segment').toHaveText(`Segment 5`); | ||
|
|
||
| await segment0.actions.duplicate(); | ||
| expect(await panel.getSegmentCount(), 'Expected another segment row after duplicating the same segment again').toBe(6); | ||
|
|
||
| const secondDuplicateTitleLocator = panel.nthSegment(5).title; | ||
| await expect(secondDuplicateTitleLocator, 'Expected correct title for second duplicated segment').toHaveText(`Segment 6`); | ||
| }); | ||
|
|
||
| test('should render the duplicated contour on the viewport', async ({ | ||
| rightPanelPageObject, | ||
| viewportPageObject, | ||
| }) => { | ||
| const panel = rightPanelPageObject.contourSegmentationPanel.panel; | ||
|
|
||
| // Hide everything, to be able to grab only the SVG path of the segment to duplicate | ||
| await rightPanelPageObject.contourSegmentationPanel.segmentsVisibilityToggle.click(); | ||
| const segment0 = panel.nthSegment(0); | ||
| await segment0.toggleVisibility(); | ||
| await segment0.click(); | ||
|
|
||
| const sourceSvgPath = await getSvgAttribute({viewportPageObject, svgInnerElement: 'path', attributeName: 'd'}); | ||
| expect(sourceSvgPath, 'Expected a visible SVG path for the source segment').not.toBeNull(); | ||
| const sourceSvgPaths = (await viewportPageObject.getById('default')).svg('path'); | ||
| expect(sourceSvgPaths, 'Expected only one SVG path element for the original segment').toHaveCount(1); | ||
|
|
||
| // New segment is at index 4 | ||
| await segment0.actions.duplicate(); | ||
| const duplicatedSegment = panel.nthSegment(4); | ||
|
|
||
| // Hide again to show duplicate only | ||
| await segment0.toggleVisibility(); | ||
| await duplicatedSegment.click(); | ||
|
|
||
| const duplicatedSvgPath = await getSvgAttribute({viewportPageObject, svgInnerElement: 'path', attributeName: 'd'}); | ||
| expect(duplicatedSvgPath, 'Expected a visible SVG path for the duplicated segment').not.toBeNull(); | ||
| const duplicatedSvgPaths = (await viewportPageObject.getById('default')).svg('path'); | ||
| expect(duplicatedSvgPaths, 'Expected only one SVG path element for the duplicated segment').toHaveCount(1); | ||
|
|
||
| expect( | ||
| duplicatedSvgPath, | ||
| 'Expected the duplicated segment to have the same SVG path as the source' | ||
| ).toBe(sourceSvgPath); | ||
| }); | ||
|
|
||
|
|
||
| test.skip('should navigate to the correct instance number when a duplicated contour segment is selected', async ({ | ||
| rightPanelPageObject, | ||
| viewportPageObject, | ||
| }) => { | ||
| const panel = rightPanelPageObject.contourSegmentationPanel.panel; | ||
|
|
||
| // get instance overlay of the contour segment at index 0 | ||
| const originalSegment = panel.nthSegment(0); | ||
| await originalSegment.click(); | ||
| const originalSegmentInstanceInfo = (await viewportPageObject.getById('default')).overlayText.bottomRight.instanceNumber; | ||
| expect(originalSegmentInstanceInfo, 'Expected instance information to be displayed in the viewport overlay').not.toBeNull(); | ||
| await expect(originalSegmentInstanceInfo, 'Expected instance information to be 46 for the Threshhold segment').toHaveText('I:46 (46/47)'); | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Duplicate segment so new segment is at index 4 | ||
| await originalSegment.actions.duplicate(); | ||
|
|
||
| //click another segment to ensure instance number changes accordingly | ||
| await panel.nthSegment(2).click(); | ||
| const anotherSegmentInstanceInfo = (await viewportPageObject.getById('default')).overlayText.bottomRight.instanceNumber; | ||
| expect(anotherSegmentInstanceInfo, 'Expected instance information to be displayed in the viewport overlay').not.toBeNull(); | ||
| await expect(anotherSegmentInstanceInfo, 'Expected instance information to be different from original contour').not.toHaveText('I:46 (46/47)'); | ||
|
|
||
| //click duplicated segment to ensure instance number is consistent with original segment | ||
| const duplicatedSegment = panel.nthSegment(4); | ||
| await duplicatedSegment.click(); | ||
| const duplicatedSegmentInstanceInfoAfter = (await viewportPageObject.getById('default')).overlayText.bottomRight.instanceNumber; | ||
| expect(duplicatedSegmentInstanceInfoAfter, 'Expected instance information to be displayed in the viewport overlay').not.toBeNull(); | ||
| await expect(duplicatedSegmentInstanceInfoAfter, 'Expected instance information to be same as original contour after clicking duplicated segment').toHaveText('I:46 (46/47)'); | ||
|
|
||
| //verify the svg paths are the same for the original and duplicated segments | ||
| await rightPanelPageObject.contourSegmentationPanel.segmentsVisibilityToggle.click(); | ||
| await originalSegment.toggleVisibility(); | ||
| await originalSegment.click(); | ||
| const originalSegmentSvgPath = await getSvgAttribute({viewportPageObject, svgInnerElement: 'path', attributeName: 'd'}); | ||
| expect(originalSegmentSvgPath, 'Expected a visible SVG path for the original segment').not.toBeNull(); | ||
|
|
||
| // hide original segment to show duplicate only | ||
| await originalSegment.toggleVisibility(); | ||
|
|
||
| await duplicatedSegment.toggleVisibility(); | ||
| await duplicatedSegment.click(); | ||
| const duplicatedSegmentSvgPath = await getSvgAttribute({viewportPageObject, svgInnerElement: 'path', attributeName: 'd'}); | ||
| expect(duplicatedSegmentSvgPath, 'Expected a visible SVG path for the duplicated segment').not.toBeNull(); | ||
|
|
||
| expect( | ||
| duplicatedSegmentSvgPath, | ||
| 'Expected the duplicated segment to have the same SVG path as the original segment' | ||
| ).toBe(originalSegmentSvgPath); | ||
| } ); | ||
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
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.