Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions extensions/cornerstone/src/initCineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
9 changes: 2 additions & 7 deletions platform/docs/docs/development/playwright-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}>
Expand Down
36 changes: 36 additions & 0 deletions tests/SRHydrationThenReload.spec.ts
Original file line number Diff line number Diff line change
@@ -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);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions tests/utils/screenShotPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down