fix(overlay-menu): Adding, changing and removing segmentation overlays should update the overlay menu instantly (#5181)

This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2025-07-07 18:09:32 -04:00
1 parent b8b14b8940
commit f08cc303e6
21 files changed
+164 -12

No files matched your search

+78
View File
@@ -0,0 +1,78 @@
import { test } from 'playwright-test-coverage';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
import { press } from './utils/keyboardUtils';
test('should display added, selected and removed segmentation promptly', async ({ page }) => {
const studyInstanceUID = '1.3.6.1.4.1.32722.99.99.239341353911714368772597187099978969331';
const mode = 'segmentation';
await visitStudy(page, studyInstanceUID, mode, 2000);
// Add a segmentation overlay and ensure the overlay menu reflects this change.
await page.getByTestId('dataOverlayMenu-default-btn').click();
await page.getByTestId('AddSegmentationDataOverlay-default').click();
await page.getByText('SELECT A SEGMENTATION').click();
await page.getByTestId('2d-tta_nnU-Net_Segmentation').click();
await checkForScreenshot({
page,
screenshotPath:
screenShotPaths.dataOverlayMenu.overlayMenuWith2d_tta_nnU_Net_SegmentationSelected,
});
// Hide the overlay menu.
await page.getByTestId('dataOverlayMenu-default-btn').click();
// navigate to the 51st image and ensure the correct overlay is displayed
await press({ page, key: 'ArrowDown', nTimes: 50 });
await checkForScreenshot({
page,
screenshotPath: screenShotPaths.dataOverlayMenu.overlay2d_tta_nnU_Net_Segmentation,
});
// Show the overlay menu.
await page.getByTestId('dataOverlayMenu-default-btn').click();
// Change the segmentation overlay to a different one and ensure the overlay menu reflects this change.
await page.getByTestId('overlay-ds-select-value-2D-TTA_NNU-NET_SEGMENTATION').click();
await page.getByTestId('Segmentation-SEG').click();
await checkForScreenshot({
page,
screenshotPath: screenShotPaths.dataOverlayMenu.overlayMenuWithSegmentationSelected,
});
// Hide the overlay menu.
await page.getByTestId('dataOverlayMenu-default-btn').click();
// navigate to the 51st image and ensure the correct overlay is displayed
await press({ page, key: 'ArrowDown', nTimes: 50 });
await checkForScreenshot({
page,
screenshotPath: screenShotPaths.dataOverlayMenu.overlaySegmentation,
});
// Show the overlay menu.
await page.getByTestId('dataOverlayMenu-default-btn').click();
// Remove the segmentation overlay and ensure the overlay menu reflects this change.
await page.getByTestId('overlay-ds-more-button-SEGMENTATION').click();
await page.getByTestId('overlay-ds-remove-button-SEGMENTATION').click();
await checkForScreenshot({
page,
screenshotPath: screenShotPaths.dataOverlayMenu.overlayMenuWithSegmentationOverlaysRemoved,
});
// Hide the overlay menu.
await page.getByTestId('dataOverlayMenu-default-btn').click();
// navigate to the 51st image and ensure no overlay is displayed
await press({ page, key: 'ArrowDown', nTimes: 50 });
await checkForScreenshot({
page,
screenshotPath: screenShotPaths.dataOverlayMenu.noOverlay,
});
});
+6 -2
View File
@@ -10,11 +10,12 @@ test.beforeEach(async ({ page }) => {
test('should launch MPR with unhydrated RTSTRUCT chosen from the data overlay menu', async ({
page,
}) => {
await page.getByTestId('side-panel-header-right').click();
await page.getByTestId('Layout').click();
await page.getByTestId('MPR').click();
// Wait 5 seconds for MPR to load. This is necessary in particular when screen shots are added or replaced.
await page.waitForTimeout(5000);
await checkForScreenshot(
page,
page,
@@ -31,6 +32,9 @@ test('should launch MPR with unhydrated RTSTRUCT chosen from the data overlay me
// Hide the overlay menu.
await page.getByTestId('dataOverlayMenu-mpr-sagittal-btn').click();
// Wait 5 seconds for RT to load. This is necessary in particular when screen shots are added or replaced.
await page.waitForTimeout(5000);
await checkForScreenshot(
page,
page,
Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 KiB

After

Width:  |  Height:  |  Size: 274 KiB

+2 -2
View File
@@ -3,7 +3,7 @@ import { Locator, Page } from 'playwright';
type CheckForScreenshotProps = {
page: Page;
locator: Locator | Page;
locator?: Locator | Page;
screenshotPath: string;
attempts?: number;
delay?: number;
@@ -14,7 +14,7 @@ type CheckForScreenshotProps = {
const _checkForScreenshot = async (props: CheckForScreenshotProps) => {
const {
page,
locator,
locator = page,
screenshotPath,
attempts = 10,
delay = 500,
+9
View File
@@ -164,6 +164,15 @@ const screenShotPaths = {
jumpToMeasurementAfterSeriesChange:
'jumpToMeasurementMPR-jumpToMeasurementAfterSeriesChange.png',
},
dataOverlayMenu: {
overlayMenuWithSegmentationSelected: 'overlayMenuWithSegmentationSelected.png',
overlayMenuWith2d_tta_nnU_Net_SegmentationSelected:
'overlayMenuWith2d_tta_nnU_Net_SegmentationSelected.png',
overlayMenuWithSegmentationOverlaysRemoved: 'overlayMenuWithSegmentationOverlaysRemoved.png',
overlay2d_tta_nnU_Net_Segmentation: 'overlay2d_tta_nnU_Net_Segmentation.png',
overlaySegmentation: 'overlaySegmentation.png',
noOverlay: 'noOverlay.png',
},
};
export { screenShotPaths };