Skip to content
Draft
Changes from 15 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 May 7, 2026
f8cc5a9
Address review comments
diattamo May 7, 2026
5bf3c5b
Merge branch 'master' into feat/contour-segments-interactions-duplicate
diattamo May 7, 2026
574fc78
Merge branch 'master' into feat/contour-segments-interactions-duplicate
diattamo May 13, 2026
33dbc16
Address review comments
diattamo May 13, 2026
7e65738
Address minor comment
diattamo May 13, 2026
0588987
remove 'd' from the SVG Inner elements
diattamo May 15, 2026
49d43c1
Refactor the getSVGPath to getSVGPAthAttribute - Update other tests t…
diattamo May 16, 2026
9b1509e
Merge branch 'master' into feat/contour-segments-interactions-duplicate
diattamo May 16, 2026
197b32c
Add validation for SVG path count for the contour segment before dupl…
diattamo May 16, 2026
710a50a
Address code review comments - refactor to update getSVGAtrribute calls
diattamo May 20, 2026
894d0c2
Merge remote-tracking branch 'upstream/master' into feat/contour-segm…
diattamo May 20, 2026
0511bf8
fix accidental deletion
diattamo May 20, 2026
97e2b8e
test: add navigation verification for duplicated contour segments
diattamo May 20, 2026
9c3d464
Merge branch 'master' into tests/duplicated-contour-navigation-issue
diattamo May 21, 2026
066df27
Merge branch 'master' into tests/duplicated-contour-navigation-issue
diattamo May 21, 2026
6fcc4fa
Merge branch 'tests/duplicated-contour-navigation-issue' of https://g…
diattamo May 21, 2026
f3fb318
Correct spelling of 'Threshold'
diattamo May 21, 2026
4bee07f
code review updates
diattamo May 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion tests/ContourSegmentDuplicate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
test,
visitStudy,
waitForViewportsRendered,
getSvgAttribute,
} from './utils';
import { getSvgAttribute } from './utils/getSvgAttribute';

const studyInstanceUID = '1.2.840.113619.2.290.3.3767434740.226.1600859119.501';
const defaultSegment0Name = 'Threshold';
Expand Down Expand Up @@ -107,3 +107,53 @@ test('should render the duplicated contour on the viewport', async ({
'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 slice 46 for the Threshhold segment').toHaveText('I:46 (46/47)');

// 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();
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated
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);
} );
Loading