test(hyrdation): weekly tests PR (#4263)

This commit is contained in:
Ibrahim 2024-06-25 22:17:12 -04:00 committed by GitHub
parent ff1d97f76e
commit 75ef99d3b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 88 additions and 3 deletions

View File

@ -46,11 +46,13 @@ function _askHydrate(uiViewportDialogService: AppTypes.UIViewportDialogService,
const message = 'Do you want to open this Segmentation?'; const message = 'Do you want to open this Segmentation?';
const actions = [ const actions = [
{ {
id: 'no-hydrate',
type: ButtonEnums.type.secondary, type: ButtonEnums.type.secondary,
text: 'No', text: 'No',
value: RESPONSE.CANCEL, value: RESPONSE.CANCEL,
}, },
{ {
id: 'yes-hydrate',
type: ButtonEnums.type.primary, type: ButtonEnums.type.primary,
text: 'Yes', text: 'Yes',
value: RESPONSE.HYDRATE_SEG, value: RESPONSE.HYDRATE_SEG,

View File

@ -44,11 +44,13 @@ function _askHydrate(uiViewportDialogService, viewportId) {
const message = 'Do you want to open this Segmentation?'; const message = 'Do you want to open this Segmentation?';
const actions = [ const actions = [
{ {
id: 'no-hydrate',
type: ButtonEnums.type.secondary, type: ButtonEnums.type.secondary,
text: 'No', text: 'No',
value: RESPONSE.CANCEL, value: RESPONSE.CANCEL,
}, },
{ {
id: 'yes-hydrate',
type: ButtonEnums.type.primary, type: ButtonEnums.type.primary,
text: 'Yes', text: 'Yes',
value: RESPONSE.HYDRATE_SEG, value: RESPONSE.HYDRATE_SEG,

View File

@ -7,6 +7,7 @@ const frameView: Types.HangingProtocol.Protocol = {
icon: 'tool-stack-scroll', icon: 'tool-stack-scroll',
isPreset: true, isPreset: true,
toolGroupIds: ['default'], toolGroupIds: ['default'],
protocolMatchingRules: [],
displaySetSelectors: { displaySetSelectors: {
defaultDisplaySetId: { defaultDisplaySetId: {
seriesMatchingRules: [ seriesMatchingRules: [

View File

@ -7,6 +7,7 @@ import {
getEnabledElementByIds, getEnabledElementByIds,
utilities as csUtils, utilities as csUtils,
volumeLoader, volumeLoader,
StackViewport,
} from '@cornerstonejs/core'; } from '@cornerstonejs/core';
import { import {
Enums as csToolsEnums, Enums as csToolsEnums,
@ -770,8 +771,8 @@ class SegmentationService extends PubSubService {
const segmentIndices = segmentIndex const segmentIndices = segmentIndex
? [segmentIndex] ? [segmentIndex]
: segmentation.segments : segmentation.segments
.filter(segment => segment?.segmentIndex) .filter(segment => segment?.segmentIndex)
.map(segment => segment.segmentIndex); .map(segment => segment.segmentIndex);
const segmentIndicesSet = new Set(segmentIndices); const segmentIndicesSet = new Set(segmentIndices);
@ -884,7 +885,13 @@ class SegmentationService extends PubSubService {
// @ts-ignore // @ts-ignore
for (const { viewportId, renderingEngineId } of viewportsInfo) { for (const { viewportId, renderingEngineId } of viewportsInfo) {
const { viewport } = getEnabledElementByIds(viewportId, renderingEngineId); const { viewport } = getEnabledElementByIds(viewportId, renderingEngineId);
cstUtils.viewport.jumpToWorld(viewport, world); if (viewport instanceof StackViewport) {
const { element } = viewport;
const index = csUtils.getClosestStackImageIndexForPoint(world, viewport)
cstUtils.viewport.jumpToSlice(element, { imageIndex: index })
} else {
cstUtils.viewport.jumpToWorld(viewport, world);
}
} }
if (highlightSegment) { if (highlightSegment) {
@ -1250,6 +1257,7 @@ class SegmentationService extends PubSubService {
{ {
[segmentIndex]: { [segmentIndex]: {
CONTOUR: { CONTOUR: {
outlineOpacity: reversedProgress,
fillAlpha: reversedProgress, fillAlpha: reversedProgress,
}, },
}, },

View File

@ -50,11 +50,13 @@ function _askTrackMeasurements(uiViewportDialogService, viewportId) {
const message = 'Do you want to continue tracking measurements for this study?'; const message = 'Do you want to continue tracking measurements for this study?';
const actions = [ const actions = [
{ {
id: 'no-hydrate',
type: ButtonEnums.type.secondary, type: ButtonEnums.type.secondary,
text: 'No', text: 'No',
value: RESPONSE.CANCEL, value: RESPONSE.CANCEL,
}, },
{ {
id: 'yes-hydrate',
type: ButtonEnums.type.primary, type: ButtonEnums.type.primary,
text: 'Yes', text: 'Yes',
value: RESPONSE.HYDRATE_REPORT, value: RESPONSE.HYDRATE_REPORT,

18
tests/RTHydration.spec.ts Normal file
View File

@ -0,0 +1,18 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '1.2.840.113619.2.290.3.3767434740.226.1600859119.501';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
test('should hydrate RT reports correctly', async ({ page }) => {
await page.getByTestId('side-panel-header-right').click();
await page.getByTestId('study-browser-thumbnail-no-image').dblclick();
await checkForScreenshot(page, page, screenShotPaths.rtHydration.rtPreHydration);
await page.getByTestId('yes-hydrate-btn').click();
await checkForScreenshot(page, page, screenShotPaths.rtHydration.rtPostHydration);
await page.getByText('Small Sphere').click();
await checkForScreenshot(page, page, screenShotPaths.rtHydration.rtJumpToStructure);
});

View File

@ -0,0 +1,18 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.256467663913010332776401703474716742458';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
test('should hydrate SEG reports correctly', async ({ page }) => {
await page.getByTestId('side-panel-header-right').click();
await page.getByTestId('study-browser-thumbnail-no-image').dblclick();
await checkForScreenshot(page, page, screenShotPaths.segHydration.segPreHydration);
await page.getByTestId('yes-hydrate-btn').click();
await checkForScreenshot(page, page, screenShotPaths.segHydration.segPostHydration);
await page.getByText('Esophagus').click();
await checkForScreenshot(page, page, screenShotPaths.segHydration.segJumpToSegment);
});

19
tests/SRHydration.spec.ts Normal file
View File

@ -0,0 +1,19 @@
import { test } from '@playwright/test';
import { visitStudy, checkForScreenshot, screenShotPaths } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '1.3.6.1.4.1.14519.5.2.1.7695.4007.324475281161490036195179843543';
const mode = 'Basic Viewer';
await visitStudy(page, studyInstanceUID, mode, 2000);
});
test('should hydrate SR reports correctly', async ({ page }) => {
await page.getByTestId('side-panel-header-right').click();
await page.getByTestId('trackedMeasurements-btn').click();
await page.getByTestId('study-browser-thumbnail-no-image').dblclick();
await checkForScreenshot(page, page, screenShotPaths.srHydration.srPreHydration);
await page.getByTestId('yes-hydrate-btn').click();
await checkForScreenshot(page, page, screenShotPaths.srHydration.srPostHydration);
await page.getByTestId('measurement-item').first().click();
await checkForScreenshot(page, page, screenShotPaths.srHydration.srJumpToMeasurement);
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

View File

@ -65,6 +65,21 @@ const screenShotPaths = {
reset: { reset: {
resetDisplayedCorrectly: 'resetDisplayedCorrectly.png', resetDisplayedCorrectly: 'resetDisplayedCorrectly.png',
}, },
srHydration: {
srPostHydration: 'srPostHydration.png',
srPreHydration: 'srPreHydration.png',
srJumpToMeasurement: 'srJumpToMeasurement.png',
},
segHydration: {
segPostHydration: 'segPostHydration.png',
segPreHydration: 'segPreHydration.png',
segJumpToSegment: 'segJumpToSegment.png',
},
rtHydration: {
rtPostHydration: 'rtPostHydration.png',
rtPreHydration: 'rtPreHydration.png',
rtJumpToStructure: 'rtJumpToStructure.png',
}
}; };
export { screenShotPaths }; export { screenShotPaths };