fix(cine): prevent crash on second view/hydration of SR series (#5724)

* test: add Playwright test for SR series reload after hydration

* docs: remove Playwright VSCode extension video
This commit is contained in:
Ghadeer Albattarni 2026-02-09 21:20:11 -05:00 committed by GitHub
parent 7bcb6b8a94
commit f70c9b932d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 47 additions and 7 deletions

View File

@ -2,6 +2,11 @@ import { cache, Types } from '@cornerstonejs/core';
import { utilities } from '@cornerstonejs/tools';
function _getVolumeFromViewport(viewport: Types.IBaseVolumeViewport) {
// Handle non-volume viewports that don't have getAllVolumeIds
if (!viewport?.getAllVolumeIds) {
return null;
}
const volumeIds = viewport.getAllVolumeIds();
const volumes = volumeIds.map(id => cache.getVolume(id));
const dynamicVolume = volumes.find(volume => volume.isDynamicVolume());

View File

@ -162,14 +162,9 @@ If you would like to access the cornerstone3D, services, or command managers in
}, await page.evaluateHandle('window'));
```
## Playwright VSCode Extension and Recording Tests
## Writing Playwright Tests
If you are using VSCode, you can use the Playwright extension to help you write your tests. The extension provides a test runner and many great features such as picking a locator using your mouse, recording a new test, and more. You can install the extension by searching for `Playwright` in the extensions tab in VSCode or by visiting the [Playwright extension page](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright).
<div style={{padding:"56.25% 0 0 0", position:"relative"}}>
<iframe src="https://player.vimeo.com/video/949208495?badge=0&amp;autopause=0&amp;player_id=0&amp;app_id=58479"
frameBorder="0" allow="cross-origin-isolated" allowFullScreen style= {{ position:"absolute",top:0,left:0,width:"100%",height:"100%"}} title="Playwright Extension"></iframe>
</div>
The following video is an example for adding a `Playwright` test to OHIF.
<div style={{padding:"56.25% 0 0 0", position:"relative"}}>

View File

@ -0,0 +1,36 @@
import { checkForScreenshot, screenShotPaths, test, visitStudy } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.7310.5101.860473186348887719777907797922';
const mode = 'viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
test('should properly reload SR series after hydration', async ({
page,
DOMOverlayPageObject,
leftPanelPageObject,
rightPanelPageObject,
}) => {
await rightPanelPageObject.toggle();
await rightPanelPageObject.measurementsPanel.select();
await leftPanelPageObject.loadSeriesByModality('SR');
await page.waitForTimeout(2000);
await DOMOverlayPageObject.viewport.segmentationHydration.yes.click();
await page.waitForTimeout(2000);
await checkForScreenshot(page, page, screenShotPaths.srHydrationThenReload.srAfterHydration);
const measurementCount = await rightPanelPageObject.measurementsPanel.panel.getMeasurementCount();
if (measurementCount > 1) {
await rightPanelPageObject.measurementsPanel.panel.nthMeasurement(1).click();
await page.waitForTimeout(1000);
}
await leftPanelPageObject.loadSeriesByModality('SR');
await page.waitForTimeout(2000);
await checkForScreenshot(page, page, screenShotPaths.srHydrationThenReload.srAfterReload);
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 KiB

View File

@ -124,6 +124,10 @@ const screenShotPaths = {
srPreHydration: 'srPreHydration.png',
srJumpToMeasurement: 'srJumpToMeasurement.png',
},
srHydrationThenReload: {
srAfterHydration: 'srAfterHydration.png',
srAfterReload: 'srAfterReload.png',
},
segHydration: {
segPostHydration: 'segPostHydration.png',
segPreHydration: 'segPreHydration.png',