diff --git a/package.json b/package.json index e81a20713..48f1caf65 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "copy-webpack-plugin": "^5.0.3", "cross-env": "^5.2.0", "css-loader": "^3.2.0", + "cypress-file-upload": "^3.5.3", "dotenv": "^8.1.0", "eslint": "5.16.0", "eslint-config-prettier": "^6.4.0", diff --git a/platform/viewer/cypress/fixtures/PDFDICOMfile.pdf b/platform/viewer/cypress/fixtures/PDFDICOMfile.pdf new file mode 100644 index 000000000..bad5641ed --- /dev/null +++ b/platform/viewer/cypress/fixtures/PDFDICOMfile.pdf @@ -0,0 +1,16 @@ +Findings + +New T2w-hyperintense lesions +Optic nerve +Optic nerve (right): Unremarkable. +Optic nerve (left): Unremarkable. +PML-typical changes +No. +Additional findings +Ventricular system: Normal width, midline position andsymmetry of the ventricular system for age. +Cerebral atrophy (visual): No signs of cerebral atrophy. +Corticomedullary differentiation: Preserved corticomedullary differentiation. +Sella and mastoid: Unremarkable. +Orbits: No orbital symmetry. +Paranasal sinuses: Clear. + diff --git a/platform/viewer/cypress/integration/common/OHIFLoadLocalFile.spec.js b/platform/viewer/cypress/integration/common/OHIFLoadLocalFile.spec.js new file mode 100644 index 000000000..9fdfd3061 --- /dev/null +++ b/platform/viewer/cypress/integration/common/OHIFLoadLocalFile.spec.js @@ -0,0 +1,31 @@ +describe('OHIF Load Local File', () => { + beforeEach(() => { + cy.visit('/local'); + }); + + it('checks if user can navigate to /local', () => { + cy.get('.drag-drop-contents').should( + 'contain', + 'Drag and Drop DICOM files here to load them in the Viewer' + ); + }); + + it('loads an invalid file and verify if viewer is empty', () => { + const fileName = 'example.json'; + + cy.fixture(fileName).then(fileContent => { + cy.get('input[type=file]') + .first() + .upload({ + fileContent, + fileName, + mimeType: 'application/json', + }); + }); + + //Verify if there is no thumbnail visible + cy.expectMinimumThumbnails(0); + //Verify if DOC thumnails is displayed and load it on viewport + cy.get('[data-cy="thumbnail-list"]').should('not.exist'); + }); +}); diff --git a/platform/viewer/cypress/integration/pwa/OHIFLoadLocalPDFFile.spec.js b/platform/viewer/cypress/integration/pwa/OHIFLoadLocalPDFFile.spec.js new file mode 100644 index 000000000..641f8a46f --- /dev/null +++ b/platform/viewer/cypress/integration/pwa/OHIFLoadLocalPDFFile.spec.js @@ -0,0 +1,29 @@ +describe('OHIF Load Local PDF File', () => { + beforeEach(() => { + cy.visit('/local'); + }); + + it('loads a PDF DICOM file and visualize it', () => { + const fileName = 'PDFDICOMfile.pdf'; + + cy.fixture(fileName).then(fileContent => { + cy.get('input[type=file]') + .first() + .upload({ + fileContent, + fileName, + mimeType: 'application/pdf', + }); + }); + + //Verify if 1 thumbnail is visible + cy.expectMinimumThumbnails(1); + //Verify if DOC thumnails is displayed and load it on viewport + cy.get('[data-cy="thumbnail-list"]') + .contains('DOC') + .click({ force: true }); + + //Verify if PDF document is displayed on the viewport + cy.get('#pdf-canvas-container').should('be.visible'); + }); +}); diff --git a/platform/viewer/cypress/support/commands.js b/platform/viewer/cypress/support/commands.js index 5299fa964..6284740aa 100644 --- a/platform/viewer/cypress/support/commands.js +++ b/platform/viewer/cypress/support/commands.js @@ -1,4 +1,5 @@ import '@percy/cypress'; +import 'cypress-file-upload'; import { DragSimulator } from '../helpers/DragSimulator.js'; import { initCornerstoneToolsAliases, diff --git a/yarn.lock b/yarn.lock index 2f5e2e4ca..9d0e699ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1262,6 +1262,54 @@ unique-filename "^1.1.1" which "^1.3.1" +"@ffmpeg-installer/darwin-x64@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/darwin-x64/-/darwin-x64-4.1.0.tgz#48e1706c690e628148482bfb64acb67472089aaa" + integrity sha512-Z4EyG3cIFjdhlY8wI9aLUXuH8nVt7E9SlMVZtWvSPnm2sm37/yC2CwjUzyCQbJbySnef1tQwGG2Sx+uWhd9IAw== + +"@ffmpeg-installer/ffmpeg@1.0.20": + version "1.0.20" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/ffmpeg/-/ffmpeg-1.0.20.tgz#d3c9c2bbcd76149468fb0886c2b3fe9e4795490b" + integrity sha512-wbgd//6OdwbFXYgV68ZyKrIcozEQpUKlvV66XHaqO2h3sFbX0jYLzx62Q0v8UcFWN21LoxT98NU2P+K0OWsKNA== + optionalDependencies: + "@ffmpeg-installer/darwin-x64" "4.1.0" + "@ffmpeg-installer/linux-arm" "4.1.3" + "@ffmpeg-installer/linux-arm64" "4.1.4" + "@ffmpeg-installer/linux-ia32" "4.1.0" + "@ffmpeg-installer/linux-x64" "4.1.0" + "@ffmpeg-installer/win32-ia32" "4.1.0" + "@ffmpeg-installer/win32-x64" "4.1.0" + +"@ffmpeg-installer/linux-arm64@4.1.4": + version "4.1.4" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/linux-arm64/-/linux-arm64-4.1.4.tgz#7219f3f901bb67f7926cb060b56b6974a6cad29f" + integrity sha512-dljEqAOD0oIM6O6DxBW9US/FkvqvQwgJ2lGHOwHDDwu/pX8+V0YsDL1xqHbj1DMX/+nP9rxw7G7gcUvGspSoKg== + +"@ffmpeg-installer/linux-arm@4.1.3": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/linux-arm/-/linux-arm-4.1.3.tgz#c554f105ed5f10475ec25d7bec94926ce18db4c1" + integrity sha512-NDf5V6l8AfzZ8WzUGZ5mV8O/xMzRag2ETR6+TlGIsMHp81agx51cqpPItXPib/nAZYmo55Bl2L6/WOMI3A5YRg== + +"@ffmpeg-installer/linux-ia32@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/linux-ia32/-/linux-ia32-4.1.0.tgz#adad70b0d0d9d8d813983d6e683c5a338a75e442" + integrity sha512-0LWyFQnPf+Ij9GQGD034hS6A90URNu9HCtQ5cTqo5MxOEc7Rd8gLXrJvn++UmxhU0J5RyRE9KRYstdCVUjkNOQ== + +"@ffmpeg-installer/linux-x64@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/linux-x64/-/linux-x64-4.1.0.tgz#b4a5d89c4e12e6d9306dbcdc573df716ec1c4323" + integrity sha512-Y5BWhGLU/WpQjOArNIgXD3z5mxxdV8c41C+U15nsE5yF8tVcdCGet5zPs5Zy3Ta6bU7haGpIzryutqCGQA/W8A== + +"@ffmpeg-installer/win32-ia32@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/win32-ia32/-/win32-ia32-4.1.0.tgz#6eac4fb691b64c02e7a116c1e2d167f3e9b40638" + integrity sha512-FV2D7RlaZv/lrtdhaQ4oETwoFUsUjlUiasiZLDxhEUPdNDWcH1OU9K1xTvqz+OXLdsmYelUDuBS/zkMOTtlUAw== + +"@ffmpeg-installer/win32-x64@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@ffmpeg-installer/win32-x64/-/win32-x64-4.1.0.tgz#17e8699b5798d4c60e36e2d6326a8ebe5e95a2c5" + integrity sha512-Drt5u2vzDnIONf4ZEkKtFlbvwj6rI3kxw1Ck9fpudmtgaZIHD4ucsWB2lCZBXRxJgXR+2IMSti+4rtM4C4rXgg== + "@hapi/address@2.x.x": version "2.1.2" resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.2.tgz#1c794cd6dbf2354d1eb1ef10e0303f573e1c7222" @@ -6441,6 +6489,11 @@ cyclist@^1.0.1: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= +cypress-file-upload@^3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-3.5.3.tgz#cd706485de3fb2cbd4a8c2dd90fe96d537bb4311" + integrity sha512-S/czzqAj1BYz6Xxnfpx2aSc6hXsj76fd8/iuycJ2RxoxCcQMliw8eQV0ugzVlkzr1GD5dKGviNFGYqv3nRJ+Tg== + cypress@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.8.0.tgz#7d4cd08f81f9048ee36760cc9ee3b9014f9e84ab"