fix: Integration test instability (#3597)
There are a couple of changes here which should improve stability of the tests. Hopefully that will be sufficient, but it is difficult to tell for sure if it is complete.
This commit is contained in:
1 parent
799d0793fd
commit
884577a23d
6 files changed
+51
-40
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
[submodule "testdata"]
|
[submodule "testdata"]
|
||||||
path = testdata
|
path = testdata
|
||||||
url = https://github.com/OHIF/viewer-testdata-dicomweb.git
|
url = https://github.com/OHIF/viewer-testdata-dicomweb.git
|
||||||
|
branch = main
|
||||||
@@ -54,12 +54,11 @@ export default async function init({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// For debugging large datasets
|
// For debugging large datasets, otherwise prefer the defaults
|
||||||
const MAX_CACHE_SIZE_1GB = 1073741824;
|
const { maxCacheSize } = appConfig;
|
||||||
const maxCacheSize = appConfig.maxCacheSize;
|
if (maxCacheSize) {
|
||||||
cornerstone.cache.setMaxCacheSize(
|
cornerstone.cache.setMaxCacheSize(maxCacheSize);
|
||||||
maxCacheSize ? maxCacheSize : MAX_CACHE_SIZE_1GB
|
}
|
||||||
);
|
|
||||||
|
|
||||||
initCornerstoneTools();
|
initCornerstoneTools();
|
||||||
|
|
||||||
|
|||||||
@@ -259,8 +259,9 @@ function TrackedCornerstoneViewport(props) {
|
|||||||
patientAge: PatientAge || '',
|
patientAge: PatientAge || '',
|
||||||
MRN: PatientID || '',
|
MRN: PatientID || '',
|
||||||
thickness: SliceThickness
|
thickness: SliceThickness
|
||||||
? `${parseFloat(SliceThickness).toFixed(2)}mm`
|
? `${parseFloat(SliceThickness).toFixed(2)}`
|
||||||
: '',
|
: '',
|
||||||
|
thicknessUnits: 'mm',
|
||||||
spacing:
|
spacing:
|
||||||
SpacingBetweenSlices !== undefined
|
SpacingBetweenSlices !== undefined
|
||||||
? `${parseFloat(SpacingBetweenSlices).toFixed(2)}mm`
|
? `${parseFloat(SpacingBetweenSlices).toFixed(2)}mm`
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ describe('OHIF Measurement Panel', function() {
|
|||||||
cy.initCommonElementsAliases();
|
cy.initCommonElementsAliases();
|
||||||
cy.initCornerstoneToolsAliases();
|
cy.initCornerstoneToolsAliases();
|
||||||
cy.resetViewport().wait(50);
|
cy.resetViewport().wait(50);
|
||||||
|
cy.waitDicomImage();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checks if Measurements right panel can be hidden/displayed', function() {
|
it('checks if Measurements right panel can be hidden/displayed', function() {
|
||||||
|
|||||||
@@ -56,14 +56,14 @@ Cypress.Commands.add('openStudy', PatientName => {
|
|||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'checkStudyRouteInViewer',
|
'checkStudyRouteInViewer',
|
||||||
(StudyInstanceUID, otherParams = '') => {
|
(StudyInstanceUID, otherParams = '', mode = '/basic-test') => {
|
||||||
cy.location('pathname').then($url => {
|
cy.location('pathname').then($url => {
|
||||||
cy.log($url);
|
cy.log($url);
|
||||||
if (
|
if (
|
||||||
$url === 'blank' ||
|
$url === 'blank' ||
|
||||||
!$url.includes(`/basic-test/${StudyInstanceUID}${otherParams}`)
|
!$url.includes(`${mode}/${StudyInstanceUID}${otherParams}`)
|
||||||
) {
|
) {
|
||||||
cy.openStudyInViewer(StudyInstanceUID, otherParams);
|
cy.openStudyInViewer(StudyInstanceUID, otherParams, mode);
|
||||||
cy.waitDicomImage();
|
cy.waitDicomImage();
|
||||||
// Very short wait to ensure pending updates are handled
|
// Very short wait to ensure pending updates are handled
|
||||||
cy.wait(25);
|
cy.wait(25);
|
||||||
@@ -74,8 +74,8 @@ Cypress.Commands.add(
|
|||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'openStudyInViewer',
|
'openStudyInViewer',
|
||||||
(StudyInstanceUID, otherParams = '') => {
|
(StudyInstanceUID, otherParams = '', mode = '/basic-test') => {
|
||||||
cy.visit(`/basic-test?StudyInstanceUIDs=${StudyInstanceUID}${otherParams}`);
|
cy.visit(`${mode}?StudyInstanceUIDs=${StudyInstanceUID}${otherParams}`);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -156,13 +156,13 @@ Cypress.Commands.add('addLine', (viewport, firstClick, secondClick) => {
|
|||||||
const [x1, y1] = firstClick;
|
const [x1, y1] = firstClick;
|
||||||
const [x2, y2] = secondClick;
|
const [x2, y2] = secondClick;
|
||||||
|
|
||||||
// TODO: Added a wait which appears necessary in Cornerstone Tools >4?
|
// The wait is necessary because of double click testing
|
||||||
cy.wrap($viewport)
|
cy.wrap($viewport)
|
||||||
.click(x1, y1, { force: true })
|
.click(x1, y1)
|
||||||
.wait(100)
|
.wait(250)
|
||||||
.trigger('mousemove', { clientX: x2, clientY: y2 })
|
.trigger('mousemove', { clientX: x2, clientY: y2 })
|
||||||
.click(x2, y2, { force: true })
|
.click(x2, y2)
|
||||||
.wait(100);
|
.wait(250);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -202,28 +202,33 @@ Cypress.Commands.add('expectMinimumThumbnails', (seriesToWait = 1) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Command to wait DICOM image to load into the viewport
|
//Command to wait DICOM image to load into the viewport
|
||||||
Cypress.Commands.add('waitDicomImage', () => {
|
Cypress.Commands.add(
|
||||||
cy.window()
|
'waitDicomImage',
|
||||||
.its('cornerstone')
|
(mode = '/basic-test', timeout = 50000) => {
|
||||||
.should($cornerstone => {
|
cy.window()
|
||||||
const enabled = $cornerstone.getEnabledElements();
|
.its('cornerstone')
|
||||||
if (enabled?.length) {
|
.should($cornerstone => {
|
||||||
enabled.forEach((item, i) => {
|
const enabled = $cornerstone.getEnabledElements();
|
||||||
if (
|
if (enabled?.length) {
|
||||||
item.viewport.viewportStatus !==
|
enabled.forEach((item, i) => {
|
||||||
$cornerstone.Enums.ViewportStatus.RENDERED
|
if (
|
||||||
) {
|
item.viewport.viewportStatus !==
|
||||||
throw new Error(
|
$cornerstone.Enums.ViewportStatus.RENDERED
|
||||||
`Viewport ${i} in state ${item.viewport.viewportStatus}`
|
) {
|
||||||
);
|
throw new Error(
|
||||||
}
|
`Viewport ${i} in state ${item.viewport.viewportStatus}`
|
||||||
});
|
);
|
||||||
} else {
|
}
|
||||||
throw new Error('No enabled elements');
|
});
|
||||||
}
|
} else {
|
||||||
});
|
throw new Error('No enabled elements');
|
||||||
cy.log('DICOM image loaded');
|
}
|
||||||
});
|
});
|
||||||
|
// This shouldn't be necessary, but seems to be.
|
||||||
|
cy.wait(250);
|
||||||
|
cy.log('DICOM image loaded');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
//Command to reset and clear all the changes made to the viewport
|
//Command to reset and clear all the changes made to the viewport
|
||||||
Cypress.Commands.add('resetViewport', () => {
|
Cypress.Commands.add('resetViewport', () => {
|
||||||
@@ -237,6 +242,7 @@ Cypress.Commands.add('resetViewport', () => {
|
|||||||
Cypress.Commands.add('imageZoomIn', () => {
|
Cypress.Commands.add('imageZoomIn', () => {
|
||||||
cy.initCornerstoneToolsAliases();
|
cy.initCornerstoneToolsAliases();
|
||||||
cy.get('@zoomBtn').click();
|
cy.get('@zoomBtn').click();
|
||||||
|
cy.wait(25);
|
||||||
|
|
||||||
//drags the mouse inside the viewport to be able to interact with series
|
//drags the mouse inside the viewport to be able to interact with series
|
||||||
cy.get('@viewport')
|
cy.get('@viewport')
|
||||||
@@ -248,6 +254,7 @@ Cypress.Commands.add('imageZoomIn', () => {
|
|||||||
Cypress.Commands.add('imageContrast', () => {
|
Cypress.Commands.add('imageContrast', () => {
|
||||||
cy.initCornerstoneToolsAliases();
|
cy.initCornerstoneToolsAliases();
|
||||||
cy.get('@wwwcBtnPrimary').click();
|
cy.get('@wwwcBtnPrimary').click();
|
||||||
|
cy.wait(25);
|
||||||
|
|
||||||
//drags the mouse inside the viewport to be able to interact with series
|
//drags the mouse inside the viewport to be able to interact with series
|
||||||
cy.get('@viewport')
|
cy.get('@viewport')
|
||||||
@@ -295,7 +302,9 @@ Cypress.Commands.add(
|
|||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'addAngleMeasurement',
|
'addAngleMeasurement',
|
||||||
(initPos = [180, 390], midPos = [300, 410], finalPos = [180, 450]) => {
|
(initPos = [180, 390], midPos = [300, 410], finalPos = [180, 450]) => {
|
||||||
|
cy.get('[data-cy="MeasurementTools-split-button-secondary"]').click();
|
||||||
cy.get('[data-cy="Angle"]').click();
|
cy.get('[data-cy="Angle"]').click();
|
||||||
|
|
||||||
cy.addAngle('.viewport-element', initPos, midPos, finalPos);
|
cy.addAngle('.viewport-element', initPos, midPos, finalPos);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
Submodule testdata updated: 4d59660c28...da63adc206.
Reference in new issue
Block a user