test(contour): Add the ContourSegmentToggleLock.spec.ts test file to test contour locking (#6072)

This commit is contained in:
diattamo authored and GitHub committed 2026-06-23 01:52:35 -04:00
1 parent 1f6670c602
commit b24f039735
10 files changed
+253 -55

No files matched your search

+9 -1
View File
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test';
import { Locator, Page } from '@playwright/test';
import { expect } from 'playwright-test-coverage';
import { DOMOverlayPageObject } from '../pages';
@@ -65,3 +65,11 @@ export async function assertBoundingBoxIsContainedWithin({
export async function expectRowSelected(rowObject) {
await expect(rowObject.locator).toContainClass('bg-popover');
}
export async function expectRowLocked(rowObject: { lockIcon: Locator }) {
await expect(rowObject.lockIcon, 'Expected the row to show the lock icon').toHaveCount(1);
}
export async function expectRowUnlocked(rowObject: { lockIcon: Locator }) {
await expect(rowObject.lockIcon, 'Expected the row to not show the lock icon').toHaveCount(0);
}
+16
View File
@@ -0,0 +1,16 @@
import type { RightPanelPageObject } from '../pages';
// Hide all segments, to show only the nth one and makes it the active segment
export async function contourShowOnlyNthSegment({
segmentationPanel,
index = 0,
}: {
segmentationPanel: RightPanelPageObject['contourSegmentationPanel'];
index?: number;
}) {
await segmentationPanel.segmentsVisibilityToggle.click();
const segment = segmentationPanel.panel.nthSegment(index);
await segment.toggleVisibility();
await segment.click();
return segment;
}
+5 -4
View File
@@ -1,8 +1,5 @@
import { visitStudy } from './visitStudy';
import {
addOHIFConfiguration,
addOHIFGlobalCustomizations,
} from './OHIFConfiguration';
import { addOHIFConfiguration, addOHIFGlobalCustomizations } from './OHIFConfiguration';
import { checkForScreenshot } from './checkForScreenshot';
import { screenShotPaths } from './screenShotPaths';
import {
@@ -26,6 +23,8 @@ import { attemptAction } from './attemptAction';
import { addLengthMeasurement } from './addLengthMeasurement';
import { getSvgAttribute } from './getSvgAttribute';
import { navigateWithViewportArrow } from './navigateWithViewportArrow';
import { contourShowOnlyNthSegment } from './contourShowOnlyNthSegment';
import { visitStudyAndHydrate } from './visitStudyAndHydrate';
import { test, expect } from './fixture';
import { subscribeToMeasurementAdded } from './subscribeToMeasurement';
import {
@@ -60,6 +59,8 @@ export {
subscribeToMeasurementAdded,
getSvgAttribute,
navigateWithViewportArrow,
contourShowOnlyNthSegment,
visitStudyAndHydrate,
waitForAnyViewportNeedsRender,
waitForViewportsRendered,
waitForViewportRenderCycle,
+31
View File
@@ -0,0 +1,31 @@
import { Page } from '@playwright/test';
import { expect } from 'playwright-test-coverage';
import type { DOMOverlayPageObject, LeftPanelPageObject } from '../pages';
import { visitStudy } from './visitStudy';
import { waitForViewportsRendered } from './waitForViewportsRendered';
// Visits a study and accepts the segmentation hydration prompt
export async function visitStudyAndHydrate({
page,
leftPanelPageObject,
DOMOverlayPageObject,
studyInstanceUID,
modality,
mode = 'segmentation',
}: {
page: Page;
leftPanelPageObject: LeftPanelPageObject;
DOMOverlayPageObject: DOMOverlayPageObject;
studyInstanceUID: string;
modality: string;
mode?: string;
}) {
await visitStudy(page, studyInstanceUID, mode, 2000);
await leftPanelPageObject.loadSeriesByModality(modality);
await waitForViewportsRendered(page);
await expect(DOMOverlayPageObject.viewport.segmentationHydration.locator).toBeVisible();
await DOMOverlayPageObject.viewport.segmentationHydration.yes.click();
}