test: Adding Percy Snapshot on VTK, PDF and Microscopy tests (#1059)

* Adding Percy Snapshot on VTK, PDF and Microscopy tests

* Small improvement to always click on first search result

* Wait for search result

* Added timouts all over the code to avoid intermitted failures in CI

* Increasing Default Timeout and other configs

* Cleaning up the code

* try force enabling gpu

* Try custom executor with newer version of chrome

* Fix based on review comments

* Increased minimum thumbnails expected on VTK test

* Fix config validation

* Make sure we're using the chrome browser
This commit is contained in:
Mirna Silva authored and Danny Brown committed 2019-10-21 14:30:50 -04:00
1 parent a6c1e6c717
commit dea0ceab57
12 files changed
+172 -54

No files matched your search

@@ -2,7 +2,7 @@ describe('OHIF Cornerstone Toolbar', () => {
before(() => {
cy.openStudy('MISTER^MR');
cy.waitDicomImage();
cy.expectMinimumThumbnails(1);
cy.expectMinimumThumbnails(3);
});
beforeEach(() => {
@@ -202,6 +202,9 @@ describe('OHIF Cornerstone Toolbar', () => {
});
it('checks if CINE tool will prompt a modal with working controls', () => {
cy.server();
cy.route('GET', '/**/studies/**/').as('studies');
//Click on button
cy.get('@cineBtn').click();
//Vefiry if cine control overlay is being displayed
@@ -216,26 +219,49 @@ describe('OHIF Cornerstone Toolbar', () => {
.click();
let expectedText = 'Img: 1 1/26';
cy.get('@viewportInfoBottomLeft').should('not.have.text', expectedText);
cy.get('@viewportInfoBottomLeft', { timeout: 15000 }).should(
'not.have.text',
expectedText
);
//Test SKIP TO FIRST IMAGE button
cy.get('[title="Skip to first Image"]').click();
cy.get('@viewportInfoBottomLeft').should('contain.text', expectedText);
cy.get('[title="Skip to first Image"]')
.click()
.wait(1000);
cy.get('@viewportInfoBottomLeft', { timeout: 15000 }).should(
'contain.text',
expectedText
);
//Test NEXT IMAGE button
cy.get('[title="Next Image"]').click();
cy.get('[title="Next Image"]')
.click()
.wait(1000);
expectedText = 'Img: 2 2/26';
cy.get('@viewportInfoBottomLeft').should('contain.text', expectedText);
cy.get('@viewportInfoBottomLeft', { timeout: 15000 }).should(
'contain.text',
expectedText
);
//Test SKIP TO LAST IMAGE button
cy.get('[title="Skip to last Image"]').click();
cy.get('[title="Skip to last Image"]')
.click()
.wait(2000);
expectedText = 'Img: 27 26/26';
cy.get('@viewportInfoBottomLeft').should('contain.text', expectedText);
cy.get('@viewportInfoBottomLeft', { timeout: 15000 }).should(
'contain.text',
expectedText
);
//Test PREVIOUS IMAGE button
cy.get('[title="Previous Image"]').click();
cy.get('[title="Previous Image"]')
.click()
.wait(1000);
expectedText = 'Img: 26 25/26';
cy.get('@viewportInfoBottomLeft').should('contain.text', expectedText);
cy.get('@viewportInfoBottomLeft', { timeout: 15000 }).should(
'contain.text',
expectedText
);
//Click on Cine button
cy.get('@cineBtn').click();
@@ -13,7 +13,11 @@ describe('OHIFStandaloneViewer', () => {
});
it('first 2 rows has values', () => {
cy.get('#studyListData > :nth-child(1) > .patientId').should('be.visible');
cy.get('#studyListData > :nth-child(2) > .patientId').should('be.visible');
cy.get('#studyListData > :nth-child(1) > .patientId', {
timeout: 15000,
}).should('be.visible');
cy.get('#studyListData > :nth-child(2) > .patientId', {
timeout: 15000,
}).should('be.visible');
});
});
@@ -2,7 +2,7 @@ describe('OHIF Study Viewer Page', () => {
before(() => {
cy.openStudy('MISTER^MR');
cy.waitDicomImage();
cy.expectMinimumThumbnails(1);
cy.expectMinimumThumbnails(6);
});
beforeEach(() => {
@@ -14,13 +14,13 @@ describe('OHIF Study Viewer Page', () => {
cy.screenshot();
cy.percySnapshot();
cy.get('.ThumbnailEntryContainer')
cy.get('[data-cy="thumbnail-list"]')
.its('length')
.should('be.gt', 1);
});
it('drags and drop a series thumbnail into viewport', () => {
cy.get('.ThumbnailEntryContainer:nth-child(2)') //element to be dragged
cy.get('[data-cy="thumbnail-list"]:nth-child(2)') //element to be dragged
.drag('.cornerstone-canvas'); //dropzone element
const expectedText =
@@ -1,7 +1,7 @@
describe('OHIF HTML Extension', () => {
before(() => {
cy.openStudy('Dummy');
cy.expectMinimumThumbnails(1);
cy.expectMinimumThumbnails(5);
});
it('checks if series thumbnails are being displayed', () => {
@@ -14,6 +14,7 @@ describe('OHIF HTML Extension', () => {
it('drags and drop a SR thumbnail into viewport', () => {
cy.get('[data-cy="thumbnail-list"]')
.contains('SR')
.first()
.drag('.viewport-drop-target');
cy.get(':nth-child(2) > h1').should(
@@ -0,0 +1,27 @@
describe('OHIF Microscopy Extension', () => {
before(() => {
cy.openStudyModality('SM');
cy.expectMinimumThumbnails(6);
});
it('checks if series thumbnails are being displayed', () => {
cy.get('[data-cy="thumbnail-list"]')
.contains('SM')
.its('length')
.should('to.be.at.least', 1);
});
it('drags and drop a SM thumbnail into viewport', () => {
cy.get('[data-cy="thumbnail-list"]')
.contains('SM')
.drag('.viewport-drop-target');
cy.get('.DicomMicroscopyViewer')
.its('length')
.should('be.eq', 1);
cy.wait(3000); //Waiting for image to render before taking the snapshot
cy.screenshot();
cy.percySnapshot();
});
});
@@ -1,7 +1,7 @@
describe('OHIF PDF Extension', () => {
before(() => {
cy.openStudy('Dummy');
cy.expectMinimumThumbnails(1);
cy.expectMinimumThumbnails(6);
});
it('checks if series thumbnails are being displayed', () => {
@@ -19,5 +19,8 @@ describe('OHIF PDF Extension', () => {
cy.get('.DicomPDFViewport')
.its('length')
.should('be.eq', 1);
cy.screenshot();
cy.percySnapshot();
});
});
@@ -2,7 +2,7 @@ describe('OHIF VTK Extension', () => {
before(() => {
cy.openStudy('Juno');
cy.waitDicomImage();
cy.expectMinimumThumbnails(1);
cy.expectMinimumThumbnails(7);
});
beforeEach(() => {
@@ -11,7 +11,7 @@ describe('OHIF VTK Extension', () => {
// has data from a drag-n-drop
// Drag and drop first thumbnail into first viewport
cy.get('[data-cy="thumbnail-list"]:nth-child(3)').drag(
'.cornerstone-canvas'
'.viewport-drop-target'
);
cy.get('.PluginSwitch > .toolbar-button')
@@ -22,12 +22,15 @@ describe('OHIF VTK Extension', () => {
btn.click();
}
});
//wait VTK toolbar and images to be loaded
cy.wait(3000);
cy.initVTKToolsAliases();
cy.wait(1000);
});
it('checks if VTK buttons are displayed on the toolbar', () => {
cy.screenshot();
cy.percySnapshot();
cy.get('@crosshairsBtn')
.should('be.visible')
.contains('Crosshairs');