Skip to content

test(contour): add fill, outline and opacity contour display coverage - #6260

Open
diattamo wants to merge 4 commits into
OHIF:masterfrom
diattamo:test/contour-fill-outline-opacity
Open

test(contour): add fill, outline and opacity contour display coverage#6260
diattamo wants to merge 4 commits into
OHIF:masterfrom
diattamo:test/contour-fill-outline-opacity

Conversation

@diattamo

@diattamo diattamo commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Context

The contour segmentation appearance config had no E2E coverage: nothing asserted that the
display mode tabs (fill / outline / fill & outline), the fill opacity and the outline width
actually change what is rendered. This adds that coverage and extends the contour test suite
(#6117, #6206, #6236).

Changes & Results

New spec (ContourSegmentationFillOutlineOpacity.spec.ts, 6 tests)

  • A panel-created contour renders with both fill and outline by default.
  • Switching display modes toggles fill and outline on the rendered contour.
  • A display mode applies to contours drawn afterwards and re-renders existing ones, across
    two segments.
  • Typing an opacity value changes the fill alpha, leaves the outline untouched, and a zero
    alpha does not silently turn the fill display off.
  • Typing a border value changes the outline width and leaves the fill untouched.
  • Changing the opacity while in outline mode keeps the fill hidden, and re-enabling fill
    applies the alpha chosen while it was hidden.

Every assertion reads the rendered SVG (fill-opacity, stroke-width, fill) rather than the
state of the panel control, so the tests verify the effect rather than the widget. No
screenshots were added.

Page object (RightPanelPageObject)

  • The contour and labelmap appearance config are unified into getSegmentationConfig(typeSuffix)
    and getNumericConfig(control, typeSuffix), replacing two near-identical copies. The display
    tabs now expose the button locator, which carries the data-state reflecting the selected
    mode.
  • Config actions expand the section themselves, so a caller no longer has to remember to open it
    first, matching the way MainToolbarPageObject combines opening a menu with clicking one of
    its items. The expand is guarded on the section already being visible, because the toggle
    collapses a section that is already expanded.
  • The three call sites that used config.toggle.click() to open the section now call
    config.open(). This removes a latent race: the raw toggle never waited for the section to
    settle, so a following action could run against a section that had not finished expanding.
    toggle remains for deliberately collapsing.

New utility

  • drawFreehandContour({ segmentationPanel, viewport, path, activateTool }) draws a closed
    freehand contour along a normalized viewport path, with activateTool: false for the case
    where the tool is still armed from a previous contour.

Testing

pnpm run test:e2e tests/ContourSegmentationFillOutlineOpacity.spec.ts tests/SegmentationPanel.spec.ts

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • OS: macOS 26.5.1 (arm64)
  • Node version: 25.4.0 (pnpm 11.5.2)
  • Browser: Playwright 1.56.1 bundled Chromium 141.0.7390.37

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@netlify

netlify Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit 4da4f53
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/6aa0620c8be107000888486c
😎 Deploy Preview https://deploy-preview-6260--ohif-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 028cca74-3529-425c-9e5b-081299594153

📥 Commits

Reviewing files that changed from the base of the PR and between db39fec and 4da4f53.

📒 Files selected for processing (1)
  • tests/pages/RightPanelPageObject.ts
💤 Files with no reviewable changes (1)
  • tests/pages/RightPanelPageObject.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The changes centralize segmentation configuration access, add a reusable freehand contour drawing helper, and add Playwright coverage for contour fill opacity, outline width, display modes, and re-rendering.

Changes

Segmentation display tests

Layer / File(s) Summary
Shared segmentation configuration access
tests/pages/RightPanelPageObject.ts
Segmentation page objects share configuration opening, display mode controls, numeric controls, and updated panel APIs.
Freehand contour drawing utility
tests/utils/drawFreehandContour.ts, tests/utils/index.ts
Adds and exports a helper that activates the freehand tool and draws a normalized contour path.
Contour display behavior coverage
tests/ContourSegmentationFillOutlineOpacity.spec.ts, tests/ContourCombineOperations.spec.ts, tests/SegmentationPanel.spec.ts
Adds rendering assertions for display modes, opacity, border width, existing contours, and configuration setup updates.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 4da4f

This change adds contour appearance test coverage and supporting test utilities; no current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 6 files.
Linked Issues check ✅ Passed The description references issues #6117, #6206, and #6236, which relate to the contour test coverage changes.
Out of Scope Changes check ✅ Passed The changes remain within scope: contour appearance tests, shared page-object configuration helpers, call-site updates, and a contour drawing utility.
Title check ✅ Passed The title is concise, uses the semantic-release test format, and accurately identifies the added contour display coverage for fill, outline, and opacity behavior.
Description check ✅ Passed The description includes context, detailed changes and results, testing instructions, and completed checklist items. It clearly explains the new E2E coverage, page-object updates, utility addition, an…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@diattamo
diattamo deployed to fork-pr-approval September 8, 2026 19:29 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant