test(contour): add test for RT contour position after viewport maximize/restore - #6036
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
✅ Deploy Preview for ohif-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| await leftPanelPageObject.loadSeriesByModality('RTSTRUCT'); | ||
|
|
||
| let viewportRenderCycle = waitForViewportRenderCycle(page); | ||
| await DOMOverlayPageObject.viewport.segmentationHydration.yes.click(); | ||
| await viewportRenderCycle; |
There was a problem hiding this comment.
Missing wait after
loadSeriesByModality
Other RT hydration tests in this repo (e.g. ContourSegNavigation.spec.ts) call await page.waitForTimeout(5000) between loadSeriesByModality and clicking the hydration button to let the RTSTRUCT series finish loading and the hydration prompt appear. Without this, the waitForViewportRenderCycle polling could catch an unrelated render cycle that completes before the hydration is triggered — or getSvgAttribute could run before the contours are actually rendered. This is a potential source of intermittent test failures.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/RTContourViewportLayoutChange.spec.ts
Line: 14-18
Comment:
**Missing wait after `loadSeriesByModality`**
Other RT hydration tests in this repo (e.g. `ContourSegNavigation.spec.ts`) call `await page.waitForTimeout(5000)` between `loadSeriesByModality` and clicking the hydration button to let the RTSTRUCT series finish loading and the hydration prompt appear. Without this, the `waitForViewportRenderCycle` polling could catch an unrelated render cycle that completes before the hydration is triggered — or `getSvgAttribute` could run before the contours are actually rendered. This is a potential source of intermittent test failures.
How can I resolve this? If you propose a fix, please make it concise.|
|
||
| const initialSvgPath = await getSvgAttribute({ | ||
| viewportPageObject, | ||
| svgInnerElement: 'path', |
There was a problem hiding this comment.
expect assertions missing descriptive messages
Every expect call in this test omits the descriptive message string that the rest of the contour test files use (e.g. expect(seg0, 'Segment at index 0: expected a non-null SVG path').not.toBeNull()). Without these messages, test failures in CI will just report expect(received).not.toBeNull() with no indication of what was being verified or at which step the test broke. The same applies to the not.toBeNull() on line 42 and both assertions on lines 44–45.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/RTContourViewportLayoutChange.spec.ts
Line: 22
Comment:
**`expect` assertions missing descriptive messages**
Every `expect` call in this test omits the descriptive message string that the rest of the contour test files use (e.g. `expect(seg0, 'Segment at index 0: expected a non-null SVG path').not.toBeNull()`). Without these messages, test failures in CI will just report `expect(received).not.toBeNull()` with no indication of what was being verified or at which step the test broke. The same applies to the `not.toBeNull()` on line 42 and both assertions on lines 44–45.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Context
Fixes #6025
Adds a playwright test to verify that contour stays in the correct position after the user hydrates RT STRUCT series, clicks double clicks and double clicks again to go back to the original layout.
Updated Cornerstone3D to v4.22.10
Changes & Results
Add
RTContourViewportLayoutChange.spec.tsTesting
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment
Greptile Summary
This PR adds a Playwright regression test covering the bug where RT contour SVG paths shift position after maximizing a viewport and restoring the original multi-viewport layout. It also bumps Cornerstone3D from v4.22.8 to v4.22.10 across all extension and platform packages.
RTContourViewportLayoutChange.spec.ts): hydrates an RTSTRUCT series in segmentation mode, captures the initial SVGpathdattribute, performs two double-clicks to maximize then restore the layout, and asserts the path is identical after the cycle.@cornerstonejs/*packages (core, tools, adapters, ai, dicom-image-loader, labelmap-interpolation, polymorphic-segmentation) bumped uniformly to 4.22.10, with lock files updated accordingly.Confidence Score: 4/5
Safe to merge; changes are additive (a new test) plus a routine patch-version dependency bump with no production logic changes.
The test is logically correct and follows the established
waitForViewportRenderCyclepattern used elsewhere in the repo. The missing post-loadSeriesByModalitywait and absent descriptiveexpectmessages could cause occasional intermittent CI failures but do not affect production behavior.tests/RTContourViewportLayoutChange.spec.ts deserves a second look for timing robustness before landing.
Important Files Changed
waitForViewportRenderCyclepattern but is missing a post-loadSeriesByModalitywait and descriptiveexpectmessages present in peer tests.Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "chore: update Cornerstone3D to v4.22.10" | Re-trigger Greptile