From d9999c1ae45c31648a1ffd869e1b95cbc3c4f16b Mon Sep 17 00:00:00 2001 From: Mirna Silva Date: Tue, 17 Mar 2020 15:14:04 -0300 Subject: [PATCH] ci: Added verification on Before hook to avoid navigating again to viewer page (#1505) * Added verification on Before hook to avoid navigating again to viewer page * Removed unecessary screenshots and duplicated test cases * Navigation Fix for HTML extension and improved Flip button verification Co-authored-by: Danny Brown --- .../common/OHIFCornerstoneHotkeys.spec.js | 20 +++---- .../common/OHIFCornerstoneToolbar.spec.js | 36 ++++--------- .../common/OHIFDownloadSnapshotFile.spec.js | 7 ++- .../integration/common/OHIFStudyList.spec.js | 19 ++++++- .../common/OHIFStudyViewer.spec.js | 14 ++--- .../common/OHIFUserPreferences.spec.js | 19 ------- ...L.spec.js => OHIFExtensionHTMLPDF.spec.js} | 36 ++++++++++++- .../integration/pwa/OHIFExtensionPDF.spec.js | 27 ---------- .../integration/pwa/OHIFExtensionVTK.spec.js | 54 +++++++++---------- .../pwa/OHIFSaveMeasurements.spec.js | 5 +- .../PercyCheckOHIFCornerstoneHotkeys.spec.js | 7 +-- .../PercyCheckOHIFCornerstoneToolbar.spec.js | 5 +- ...PercyCheckOHIFDownloadSnapshotFile.spec.js | 5 +- .../PercyCheckOHIFExtensionPDF.spec.js | 8 +-- .../PercyCheckOHIFExtensionVTK.spec.js | 7 +-- .../PercyCheckOHIFStudyViewer.spec.js | 9 ++-- platform/viewer/cypress/support/commands.js | 10 ++++ platform/viewer/package.json | 1 + 18 files changed, 140 insertions(+), 149 deletions(-) rename platform/viewer/cypress/integration/pwa/{OHIFExtensionHTML.spec.js => OHIFExtensionHTMLPDF.spec.js} (58%) delete mode 100644 platform/viewer/cypress/integration/pwa/OHIFExtensionPDF.spec.js diff --git a/platform/viewer/cypress/integration/common/OHIFCornerstoneHotkeys.spec.js b/platform/viewer/cypress/integration/common/OHIFCornerstoneHotkeys.spec.js index 35d68dc08..dd058ab9d 100644 --- a/platform/viewer/cypress/integration/common/OHIFCornerstoneHotkeys.spec.js +++ b/platform/viewer/cypress/integration/common/OHIFCornerstoneHotkeys.spec.js @@ -1,8 +1,9 @@ describe('OHIF Cornerstone Hotkeys', () => { before(() => { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); - cy.expectMinimumThumbnails(3); + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); + cy.expectMinimumThumbnails(5); }); beforeEach(() => { @@ -42,13 +43,6 @@ describe('OHIF Cornerstone Hotkeys', () => { cy.get('@viewportInfoMidTop').should('contains.text', 'P'); }); - it('checks if hotkey "I" can invert the image', () => { - // Hotkey I - cy.get('body').type('I'); - // Visual comparison - cy.screenshot('Hotkey I - Should Invert Image'); - }); - it('checks if hotkeys "+", "-" and "=" can zoom in, out and fit to viewport', () => { // Hotkey + cy.get('body').type('+++'); // Press hotkey 3 times @@ -73,9 +67,6 @@ describe('OHIF Cornerstone Hotkeys', () => { cy.get('@viewportInfoMidLeft').should('contains.text', 'R'); cy.get('@viewportInfoMidTop').should('contains.text', 'A'); cy.get('@viewportInfoBottomRight').should('contains.text', 'Zoom: 211%'); - - // Visual comparison to make sure the 'inverted' image was reset - cy.screenshot('Hotkey SPACEBAR - Should Reset Image'); }); it('uses hotkeys "RightArrow" and "LeftArrow" to navigate between multiple viewports', () => { @@ -126,6 +117,9 @@ describe('OHIF Cornerstone Hotkeys', () => { cy.get('@viewport2InfoMidLeft').should('contains.text', 'A'); cy.get('@viewport2InfoMidTop').should('contains.text', 'H'); cy.get('@viewport2InfoBottomRight').should('contains.text', 'Zoom: 45%'); + + //Select viewport layout (1,1) + cy.setLayout(1, 1); }); //TO-DO: This test is blocked by issue #1095 (https://github.com/OHIF/Viewers/issues/1095) diff --git a/platform/viewer/cypress/integration/common/OHIFCornerstoneToolbar.spec.js b/platform/viewer/cypress/integration/common/OHIFCornerstoneToolbar.spec.js index 85b54ef31..4854a11a1 100644 --- a/platform/viewer/cypress/integration/common/OHIFCornerstoneToolbar.spec.js +++ b/platform/viewer/cypress/integration/common/OHIFCornerstoneToolbar.spec.js @@ -1,7 +1,8 @@ describe('OHIF Cornerstone Toolbar', () => { before(() => { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); cy.expectMinimumThumbnails(5); }); @@ -116,9 +117,6 @@ describe('OHIF Cornerstone Toolbar', () => { .trigger('mousedown', 'center', { which: 1 }) .trigger('mousemove', 'bottom', { which: 1 }) .trigger('mouseup', 'bottom'); - - // Visual comparison - cy.screenshot('Pan tool moved the image inside the viewport'); }); it('checks if Length annotation can be added on viewport and on measurements panel', () => { @@ -425,19 +423,6 @@ describe('OHIF Cornerstone Toolbar', () => { }); }); - it('check if Invert tool will change the colors of the image in the viewport', () => { - // Click on More button - cy.get('@moreBtn').click(); - // Verify if overlay is displayed - cy.get('.tooltip-toolbar-overlay').should('be.visible'); - - // Click on Invert button - cy.get('[data-cy="invert"]').click(); - - // Visual comparison - cy.screenshot('Invert tool - Should Invert Canvas'); - }); - it('check if Rotate tool will change the image orientation in the viewport', () => { //Click on More button cy.get('@moreBtn').click(); @@ -447,10 +432,9 @@ describe('OHIF Cornerstone Toolbar', () => { .then(() => { //Click on Rotate button cy.get('[data-cy="rotate right"]').click({ force: true }); + cy.get('@viewportInfoMidLeft').should('contains.text', 'F'); + cy.get('@viewportInfoMidTop').should('contains.text', 'R'); }); - - // Visual comparison - cy.screenshot('Rotate tool - Should Rotate Image to Right'); }); it('check if Flip H tool will flip the image horizontally in the viewport', () => { @@ -461,9 +445,8 @@ describe('OHIF Cornerstone Toolbar', () => { //Click on Flip H button cy.get('[data-cy="flip h"]').click(); - - // Visual comparison - cy.screenshot('Flip H tool - Should Flip Image on Y axis'); + cy.get('@viewportInfoMidLeft').should('contains.text', 'L'); + cy.get('@viewportInfoMidTop').should('contains.text', 'H'); }); it('check if Flip V tool will flip the image vertically in the viewport', () => { @@ -474,8 +457,7 @@ describe('OHIF Cornerstone Toolbar', () => { //Click on Flip V button cy.get('[data-cy="flip v"]').click(); - - // Visual comparison - cy.screenshot('Flip V tool - Should Flip Image on X axis'); + cy.get('@viewportInfoMidLeft').should('contains.text', 'R'); + cy.get('@viewportInfoMidTop').should('contains.text', 'F'); }); }); diff --git a/platform/viewer/cypress/integration/common/OHIFDownloadSnapshotFile.spec.js b/platform/viewer/cypress/integration/common/OHIFDownloadSnapshotFile.spec.js index 222fb8891..41e11ff54 100644 --- a/platform/viewer/cypress/integration/common/OHIFDownloadSnapshotFile.spec.js +++ b/platform/viewer/cypress/integration/common/OHIFDownloadSnapshotFile.spec.js @@ -1,7 +1,8 @@ describe('OHIF Download Snapshot File', () => { before(() => { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); cy.expectMinimumThumbnails(5); }); @@ -105,8 +106,6 @@ describe('OHIF Download Snapshot File', () => { cy.get('[data-cy="show-annotations"]').check(); // Check image preview cy.get('[data-cy="image-preview"]').scrollIntoView(); - // Visual comparison - cy.screenshot('Download Image Modal - Show Annotations checked'); //Compare classes that exists on Image Preview with Annotations and Without Annotation cy.get('[data-cy="modal-content"]') .find('canvas') diff --git a/platform/viewer/cypress/integration/common/OHIFStudyList.spec.js b/platform/viewer/cypress/integration/common/OHIFStudyList.spec.js index ea5497edc..0e40c8688 100644 --- a/platform/viewer/cypress/integration/common/OHIFStudyList.spec.js +++ b/platform/viewer/cypress/integration/common/OHIFStudyList.spec.js @@ -2,10 +2,19 @@ //this is intended to be running in a controled docker environment with test data. describe('OHIF Study List', function() { context('Desktop resolution', function() { + before(function() { + cy.openStudyList(); + }); + beforeEach(function() { cy.viewport(1750, 720); - cy.openStudyList(); cy.initStudyListAliasesOnDesktop(); + //Clear all text fields + cy.get('@PatientName').clear(); + cy.get('@MRN').clear(); + cy.get('@AccessionNumber').clear(); + cy.get('@StudyDescription').clear(); + cy.get('@modalities').clear(); }); it('searches Patient Name with exact string', function() { @@ -101,10 +110,16 @@ describe('OHIF Study List', function() { }); context('Tablet resolution', function() { + before(function() { + cy.openStudyList(); + }); + beforeEach(function() { cy.viewport(1000, 660); - cy.openStudyList(); cy.initStudyListAliasesOnTablet(); + //Clear all text fields + cy.get('@patientNameOrMRN').clear(); + cy.get('@accessionModalityDescription').clear(); }); it('searches Patient Name with exact string', function() { diff --git a/platform/viewer/cypress/integration/common/OHIFStudyViewer.spec.js b/platform/viewer/cypress/integration/common/OHIFStudyViewer.spec.js index 4aa2090ac..d9da9053c 100644 --- a/platform/viewer/cypress/integration/common/OHIFStudyViewer.spec.js +++ b/platform/viewer/cypress/integration/common/OHIFStudyViewer.spec.js @@ -1,8 +1,9 @@ describe('OHIF Study Viewer Page', function() { - before(function() { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); - cy.expectMinimumThumbnails(6); + before(() => { + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); + cy.expectMinimumThumbnails(5); }); beforeEach(function() { @@ -11,8 +12,6 @@ describe('OHIF Study Viewer Page', function() { }); it('checks if series thumbnails are being displayed', function() { - cy.screenshot('Series Thumbnails - Should Display Thumbnails'); - cy.get('[data-cy="thumbnail-list"]') .its('length') .should('be.gt', 1); @@ -291,9 +290,6 @@ describe('OHIF Study Viewer Page', function() { }); }); - // Visual comparison - cy.screenshot('About modal - Should display modal'); - //close modal cy.get('[data-cy="close-button"]').click(); cy.get('@aboutOverlay').should('not.be.enabled'); diff --git a/platform/viewer/cypress/integration/common/OHIFUserPreferences.spec.js b/platform/viewer/cypress/integration/common/OHIFUserPreferences.spec.js index 4803aa6a4..4fbd24e09 100644 --- a/platform/viewer/cypress/integration/common/OHIFUserPreferences.spec.js +++ b/platform/viewer/cypress/integration/common/OHIFUserPreferences.spec.js @@ -22,10 +22,6 @@ describe('OHIF User Preferences', () => { cy.get('@cancelBtn').should('have.text', 'Cancel'); cy.get('@saveBtn').should('have.text', 'Save'); - // Visual comparison - cy.screenshot( - 'User Preferences Modal - Hotkeys tab initial state in Study List page' - ); cy.get('[data-cy="close-button"]').click(); }); @@ -36,10 +32,6 @@ describe('OHIF User Preferences', () => { // Language dropdown should be displayed cy.get('#language-select').should('be.visible'); - // Visual comparison - cy.screenshot( - 'User Preferences Modal - General tab initial state in Study List page' - ); // Set language to Spanish and save cy.setLanguage('Spanish'); @@ -211,10 +203,6 @@ describe('OHIF User Preferences', () => { cy.get('@cancelBtn').should('have.text', 'Cancel'); cy.get('@saveBtn').should('have.text', 'Save'); - // Visual comparison - cy.screenshot( - 'User Preferences Modal - Hotkeys tab initial state in Study Viewer page' - ); cy.get('[data-cy="close-button"]').click(); //close User Preferences modal }); @@ -225,10 +213,6 @@ describe('OHIF User Preferences', () => { // Language dropdown should be displayed cy.get('#language-select').should('be.visible'); - // Visual comparison - cy.screenshot( - 'User Preferences Modal - General tab initial state in Study Viewer page' - ); // Set language to Spanish cy.setLanguage('Spanish'); @@ -401,9 +385,6 @@ describe('OHIF User Preferences', () => { cy.get('body').type(' '); cy.get('@viewportInfoMidTop').should('contains.text', 'A'); - // Visual comparison - cy.screenshot('Viewport Navigation - 2nd viewport inverted and rotated'); - // Set 1 viewport layout cy.setLayout(1, 1); }); diff --git a/platform/viewer/cypress/integration/pwa/OHIFExtensionHTML.spec.js b/platform/viewer/cypress/integration/pwa/OHIFExtensionHTMLPDF.spec.js similarity index 58% rename from platform/viewer/cypress/integration/pwa/OHIFExtensionHTML.spec.js rename to platform/viewer/cypress/integration/pwa/OHIFExtensionHTMLPDF.spec.js index 624939251..af4d43f05 100644 --- a/platform/viewer/cypress/integration/pwa/OHIFExtensionHTML.spec.js +++ b/platform/viewer/cypress/integration/pwa/OHIFExtensionHTMLPDF.spec.js @@ -1,6 +1,8 @@ describe('OHIF HTML Extension', () => { before(() => { - cy.openStudy('Dummy'); + cy.openStudyInViewer( + '1.2.826.0.13854362241694438965858641723883466450351448' + ); cy.expectMinimumThumbnails(5); }); @@ -40,5 +42,37 @@ describe('OHIF HTML Extension', () => { .scrollTo('bottom'); cy.wrap($viewport).should('have.class', 'active'); }); + + cy.setLayout('1', '1'); + }); +}); + +describe('OHIF PDF Extension', () => { + before(() => { + cy.checkStudyRouteInViewer( + '1.2.826.0.13854362241694438965858641723883466450351448' + ); + cy.expectMinimumThumbnails(5); + }); + + it('checks if series thumbnails are being displayed', () => { + cy.get('[data-cy="thumbnail-list"]') + .contains('DOC') + .its('length') + .should('to.be.at.least', 1); + }); + + it('drags and drop a PDF thumbnail into viewport', () => { + cy.get('[data-cy="thumbnail-list"]') + .contains('DOC') + .scrollIntoView() + .drag('.viewport-drop-target'); + + cy.get('.DicomPDFViewport') + .its('length') + .should('be.eq', 1); + + //Take Screenshot + cy.screenshot('PDF Extension - Should load PDF file'); }); }); diff --git a/platform/viewer/cypress/integration/pwa/OHIFExtensionPDF.spec.js b/platform/viewer/cypress/integration/pwa/OHIFExtensionPDF.spec.js deleted file mode 100644 index 9c4658a9c..000000000 --- a/platform/viewer/cypress/integration/pwa/OHIFExtensionPDF.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -describe('OHIF PDF Extension', () => { - before(() => { - cy.openStudy('Dummy'); - cy.expectMinimumThumbnails(6); - }); - - it('checks if series thumbnails are being displayed', () => { - cy.get('[data-cy="thumbnail-list"]') - .contains('DOC') - .its('length') - .should('to.be.at.least', 1); - }); - - it('drags and drop a PDF thumbnail into viewport', () => { - cy.get('[data-cy="thumbnail-list"]') - .contains('DOC') - .drag('.viewport-drop-target'); - - cy.get('.DicomPDFViewport') - .its('length') - .should('be.eq', 1); - - // This won't work unless we switch to an extension that renders using `canvas` - // Currently, we rely on the browser's built-in implementation - cy.screenshot('PDF Extension - Should load PDF file'); - }); -}); diff --git a/platform/viewer/cypress/integration/pwa/OHIFExtensionVTK.spec.js b/platform/viewer/cypress/integration/pwa/OHIFExtensionVTK.spec.js index bf50c8837..edf7b0283 100644 --- a/platform/viewer/cypress/integration/pwa/OHIFExtensionVTK.spec.js +++ b/platform/viewer/cypress/integration/pwa/OHIFExtensionVTK.spec.js @@ -1,16 +1,9 @@ describe('OHIF VTK Extension', () => { before(() => { - cy.openStudy('Juno'); - cy.waitDicomImage(); + cy.checkStudyRouteInViewer( + '1.3.6.1.4.1.25403.345050719074.3824.20170125113417.1' + ); cy.expectMinimumThumbnails(7); - }); - - beforeEach(() => { - //TODO: Due to percy snapshot, the images inside the viewports are being resized - //and once the browser continues the test execution, the images are not centered in the viewport. - //To fix that, we need to reload the page before each test. - //https://github.com/OHIF/Viewers/issues/1168 - cy.reload(); //Waiting for the desired thumbnail content to be displayed cy.get('[data-cy="thumbnail-list"]').should($list => { @@ -23,14 +16,16 @@ describe('OHIF VTK Extension', () => { // Drag and drop third thumbnail into first viewport cy.get('[data-cy="thumbnail-list"]') .contains('CT WB 5.0 B35f') - .drag('.viewport-drop-target') + .drag('.viewport-drop-target'); //Select 2D MPR button cy.get('[data-cy="2d mpr"]').click(); //Wait Reformatting Images cy.waitVTKReformatting(); + }); + beforeEach(() => { cy.initVTKToolsAliases(); }); @@ -54,9 +49,6 @@ describe('OHIF VTK Extension', () => { cy.get('@layoutBtn') .should('be.visible') .contains('Layout'); - - // Visual comparison - cy.screenshot('VTK initial state - Should display toolbar and 3 viewports'); }); it('checks Crosshairs tool', () => { @@ -64,20 +56,26 @@ describe('OHIF VTK Extension', () => { // 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'); - // Visual comparison + //Take Screenshot cy.screenshot( "VTK Crosshairs tool - Should display crosshairs' green lines" ); }); - /* TODO: Non-deterministic behavior (const expectedText = 'W: 350 L: -1044';) it('checks WWWC tool', () => { cy.get('@wwwcBtn').click(); + //Initial label in the viewport + const initialLabelText = 'W: 350 L: 40'; + // Click and Move the mouse inside the viewport cy.get('[data-cy="viewport-container-0"]') .trigger('mousedown', 'center', { which: 1 }) @@ -86,29 +84,29 @@ describe('OHIF VTK Extension', () => { .trigger('mousemove', 'top', { which: 1 }) .trigger('mouseup', { which: 1 }) .then(() => { - const expectedText = 'W: 350 L: 40'; cy.get('.ViewportOverlay > div.bottom-right.overlay-element').should( - 'contains.text', - expectedText + 'not.have.text', + initialLabelText ); }); - - // Visual comparison - cy.screenshot('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('mousedown', 'center', { + which: 1, + }) .trigger('mousemove', 'top', { which: 1 }) - .trigger('mousedown', 'center', { which: 1 }) + .trigger('mousedown', 'center', { + which: 1, + }) .trigger('mousemove', 'top', { which: 1 }) .trigger('mouseup', { which: 1 }); - // Visual comparison + //Take Screenshot cy.screenshot('VTK Rotate tool - Should rotate image'); }); }); diff --git a/platform/viewer/cypress/integration/pwa/OHIFSaveMeasurements.spec.js b/platform/viewer/cypress/integration/pwa/OHIFSaveMeasurements.spec.js index 761d409d3..687b5f624 100644 --- a/platform/viewer/cypress/integration/pwa/OHIFSaveMeasurements.spec.js +++ b/platform/viewer/cypress/integration/pwa/OHIFSaveMeasurements.spec.js @@ -1,7 +1,8 @@ describe('OHIF Save Measurements', function() { before(() => { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); cy.expectMinimumThumbnails(5); }); diff --git a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneHotkeys.spec.js b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneHotkeys.spec.js index 4e3c556ef..e9c108437 100644 --- a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneHotkeys.spec.js +++ b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneHotkeys.spec.js @@ -1,8 +1,9 @@ describe('Visual Regression - OHIF Cornerstone Hotkeys', () => { before(() => { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); - cy.expectMinimumThumbnails(3); + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); + cy.expectMinimumThumbnails(5); }); beforeEach(() => { diff --git a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneToolbar.spec.js b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneToolbar.spec.js index c5aa86699..f948b129c 100644 --- a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneToolbar.spec.js +++ b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFCornerstoneToolbar.spec.js @@ -1,7 +1,8 @@ describe('Visual Regression - OHIF Cornerstone Toolbar', () => { before(() => { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); cy.expectMinimumThumbnails(5); }); diff --git a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFDownloadSnapshotFile.spec.js b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFDownloadSnapshotFile.spec.js index 66f31cc64..623b5e85f 100644 --- a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFDownloadSnapshotFile.spec.js +++ b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFDownloadSnapshotFile.spec.js @@ -1,7 +1,8 @@ describe('Visual Regression - OHIF Download Snapshot File', () => { before(() => { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); cy.expectMinimumThumbnails(5); }); diff --git a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionPDF.spec.js b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionPDF.spec.js index 7dadf35d2..64079a706 100644 --- a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionPDF.spec.js +++ b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionPDF.spec.js @@ -1,8 +1,10 @@ describe('Visual Regression - OHIF PDF Extension', () => { before(() => { - cy.openStudy('Dummy'); - cy.expectMinimumThumbnails(6); - }); + cy.checkStudyRouteInViewer( + '1.2.826.0.13854362241694438965858641723883466450351448' + ); + cy.expectMinimumThumbnails(5); + });v it('drags and drop a PDF thumbnail into viewport', () => { cy.get('[data-cy="thumbnail-list"]') diff --git a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionVTK.spec.js b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionVTK.spec.js index efc163312..231e817e3 100644 --- a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionVTK.spec.js +++ b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFExtensionVTK.spec.js @@ -1,8 +1,9 @@ describe('Visual Regression - OHIF VTK Extension', () => { before(() => { - cy.openStudy('Bellona'); - cy.waitDicomImage(); - cy.expectMinimumThumbnails(5); + 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 => { diff --git a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFStudyViewer.spec.js b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFStudyViewer.spec.js index ef90cf7d0..6e3031cfe 100644 --- a/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFStudyViewer.spec.js +++ b/platform/viewer/cypress/integration/visual-regression/PercyCheckOHIFStudyViewer.spec.js @@ -1,8 +1,9 @@ describe('Visual Regression - OHIF Study Viewer Page', function() { - before(function() { - cy.openStudyInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78'); - cy.waitDicomImage(); - cy.expectMinimumThumbnails(6); + before(() => { + cy.checkStudyRouteInViewer( + '1.2.840.113619.2.5.1762583153.215519.978957063.78' + ); + cy.expectMinimumThumbnails(5); }); beforeEach(function() { diff --git a/platform/viewer/cypress/support/commands.js b/platform/viewer/cypress/support/commands.js index 102221f8a..4640587d2 100644 --- a/platform/viewer/cypress/support/commands.js +++ b/platform/viewer/cypress/support/commands.js @@ -53,6 +53,16 @@ Cypress.Commands.add('openStudy', PatientName => { .click({ force: true }); }); +Cypress.Commands.add('checkStudyRouteInViewer', StudyInstanceUID => { + cy.location('pathname').then($url => { + cy.log($url); + if ($url == 'blank' || !$url.includes(`/viewer/${StudyInstanceUID}`)) { + cy.openStudyInViewer(StudyInstanceUID); + cy.waitDicomImage(); + } + }); +}); + Cypress.Commands.add('openStudyInViewer', StudyInstanceUID => { cy.visit(`/viewer/${StudyInstanceUID}`); }); diff --git a/platform/viewer/package.json b/platform/viewer/package.json index 7c6c49ce2..4d130c3b6 100644 --- a/platform/viewer/package.json +++ b/platform/viewer/package.json @@ -30,6 +30,7 @@ "start": "yarn run dev", "test:e2e": "cypress open", "test:e2e:ci": "percy exec -- cypress run --config video=false --record --browser chrome --spec 'cypress/integration/visual-regression/**/*'", + "test:e2e:local": "cypress run --config video=false --browser chrome --spec 'cypress/integration/common/**/*,cypress/integration/pwa/**/*'", "test:e2e:dist": "start-server-and-test test:e2e:serve http://localhost:3000 test:e2e:ci", "test:e2e:serve": "serve -n -l 3000 -s dist", "test:unit": "jest --watchAll",