diff --git a/extensions/cornerstone/src/initCineService.ts b/extensions/cornerstone/src/initCineService.ts index 60843b35b..391fdb624 100644 --- a/extensions/cornerstone/src/initCineService.ts +++ b/extensions/cornerstone/src/initCineService.ts @@ -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()); diff --git a/platform/docs/docs/development/playwright-testing.md b/platform/docs/docs/development/playwright-testing.md index e52e475d1..d0b1a94cd 100644 --- a/platform/docs/docs/development/playwright-testing.md +++ b/platform/docs/docs/development/playwright-testing.md @@ -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). - -
- -
+The following video is an example for adding a `Playwright` test to OHIF.
diff --git a/tests/SRHydrationThenReload.spec.ts b/tests/SRHydrationThenReload.spec.ts new file mode 100644 index 000000000..6bb5887fc --- /dev/null +++ b/tests/SRHydrationThenReload.spec.ts @@ -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); +}); diff --git a/tests/screenshots/chromium/SRHydrationThenReload.spec.ts/srAfterHydration.png b/tests/screenshots/chromium/SRHydrationThenReload.spec.ts/srAfterHydration.png new file mode 100644 index 000000000..2504cea36 Binary files /dev/null and b/tests/screenshots/chromium/SRHydrationThenReload.spec.ts/srAfterHydration.png differ diff --git a/tests/screenshots/chromium/SRHydrationThenReload.spec.ts/srAfterReload.png b/tests/screenshots/chromium/SRHydrationThenReload.spec.ts/srAfterReload.png new file mode 100644 index 000000000..2c5b50cc8 Binary files /dev/null and b/tests/screenshots/chromium/SRHydrationThenReload.spec.ts/srAfterReload.png differ diff --git a/tests/utils/screenShotPaths.ts b/tests/utils/screenShotPaths.ts index 1de6fbeb4..3ebda67a4 100644 --- a/tests/utils/screenShotPaths.ts +++ b/tests/utils/screenShotPaths.ts @@ -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',