ohif-viewer/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionVTK.spec.js
Igor Octaviano 42c22df1b6
Segmentation UI for VTKjs (#1685)
* Add single viewport configuration

* Multiple viewport configuration

* Improve performance by using independent set methods

* Add jump to slice command

* Add context configuration

* Cache panel visibility

* Fix sync between vtk and cornerstone

* Remove apis index

* Add approach

* Add loading to update volumes

* Fix broken configuration

* Bump vtk version

* Use loading label

* Update cy tests after vtk loading label changed

* Remove loading for segs
2020-05-06 18:17:44 +01:00

94 lines
2.7 KiB
JavaScript

describe('Visual Regression - OHIF VTK Extension', () => {
before(() => {
cy.checkStudyRouteInViewer(
'1.3.6.1.4.1.25403.345050719074.3824.20170125113417.1'
);
cy.expectMinimumThumbnails(7);
//Waiting for the desired thumbnail content to be displayed
cy.get('[data-cy="thumbnail-list"]').should($list => {
expect($list).to.contain('Chest 1x10 Soft');
});
// Drag and drop thumbnail into viewport
cy.get('[data-cy="thumbnail-list"]')
.contains('Chest 1x10 Soft')
.drag('.viewport-drop-target');
//Select 2D MPR button
cy.get('[data-cy="2d mpr"]').click();
//Wait waitVTKLoading Images
cy.waitVTKwaitVTKLoading();
});
beforeEach(() => {
cy.initVTKToolsAliases();
cy.wait(1000); //Wait toolbar to finish loading
});
afterEach(() => {
cy.wait(5000); //wait screen loads back after screenshot
//Select Exit 2D MPR button
cy.get('[data-cy="exit 2d mpr"]').should($btn => {
expect($btn).to.be.visible;
$btn.click();
});
//Select 2D MPR button
cy.get('[data-cy="2d mpr"]').click();
});
it('checks if VTK buttons are displayed on the toolbar', () => {
// Visual comparison
cy.percyCanvasSnapshot(
'VTK initial state - Should display toolbar and 3 viewports'
);
});
it('checks Crosshairs tool', () => {
cy.get('@crosshairsBtn').click();
// Click and Move the mouse inside the viewport
cy.get('[data-cy="viewport-container-0"]')
.trigger('mousedown', 'center', { which: 1 })
.trigger('mousemove', 'top', { which: 1 })
.trigger('mouseup');
// Visual comparison
cy.percyCanvasSnapshot(
"VTK Crosshairs tool - Should display crosshairs' green lines"
);
});
it('checks WWWC tool', () => {
cy.get('@wwwcBtn').click();
// Click and Move the mouse inside the viewport
cy.get('[data-cy="viewport-container-0"]')
.trigger('mousedown', 'center', { which: 1 })
.trigger('mousemove', 'top', { which: 1 })
.trigger('mousedown', 'center', { which: 1 })
.trigger('mousemove', 'top', { which: 1 })
.trigger('mouseup', { which: 1 });
// Visual comparison
cy.percyCanvasSnapshot('VTK WWWC tool - Canvas should be bright');
});
it('checks Rotate tool', () => {
cy.get('@rotateBtn').click();
// Click and Move the mouse inside the viewport
cy.get('[data-cy="viewport-container-0"]')
.trigger('mousedown', 'center', { which: 1 })
.trigger('mousemove', 'top', { which: 1 })
.trigger('mousedown', 'center', { which: 1 })
.trigger('mousemove', 'top', { which: 1 })
.trigger('mouseup', { which: 1 });
// Visual comparison
cy.percyCanvasSnapshot('VTK Rotate tool - Should rotate image');
});
});