chore(prettier): full repo linting and code reformatting once and for all (#3627)
This commit is contained in:
1 parent
01500a2d4c
commit
9045ddaedc
656 files changed
+21737
-20628
No files matched your search
@@ -2,4 +2,4 @@
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,11 @@ describe('OHIF Multi Study', () => {
|
||||
it('Should display 2 comparison up', () => {
|
||||
beforeSetup();
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 4);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 4);
|
||||
cy.get('[data-cy="studyDate"]').should(studyDate => {
|
||||
expect(studyDate.length).to.be.eq(4);
|
||||
expect(studyDate.text())
|
||||
.to.contain('2014')
|
||||
.contain('2001');
|
||||
expect(studyDate.text().indexOf('2014')).to.be.lessThan(
|
||||
studyDate.text().indexOf('2001')
|
||||
);
|
||||
expect(studyDate.text()).to.contain('2014').contain('2001');
|
||||
expect(studyDate.text().indexOf('2014')).to.be.lessThan(studyDate.text().indexOf('2001'));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,11 @@
|
||||
describe('OHIF PDF Display', function() {
|
||||
beforeEach(function() {
|
||||
describe('OHIF PDF Display', function () {
|
||||
beforeEach(function () {
|
||||
cy.openStudyInViewer('2.25.317377619501274872606137091638706705333');
|
||||
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks if series thumbnails are being displayed', function() {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]')
|
||||
.its('length')
|
||||
.should('be.gt', 0);
|
||||
it('checks if series thumbnails are being displayed', function () {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]').its('length').should('be.gt', 0);
|
||||
});
|
||||
});
|
||||
@@ -1,19 +1,15 @@
|
||||
describe('OHIF Video Display', function() {
|
||||
beforeEach(function() {
|
||||
describe('OHIF Video Display', function () {
|
||||
beforeEach(function () {
|
||||
cy.openStudyInViewer('2.25.96975534054447904995905761963464388233');
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks if series thumbnails are being displayed', function() {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]')
|
||||
.its('length')
|
||||
.should('be.gt', 1);
|
||||
it('checks if series thumbnails are being displayed', function () {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]').its('length').should('be.gt', 1);
|
||||
});
|
||||
|
||||
it('performs double-click to load thumbnail in active viewport', () => {
|
||||
cy.get(
|
||||
'[data-cy="study-browser-thumbnail-no-image"]:nth-child(2)'
|
||||
).dblclick();
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]:nth-child(2)').dblclick();
|
||||
|
||||
//const expectedText = 'Ser: 3';
|
||||
//cy.get('@viewportInfoBottomLeft').should('contains.text', expectedText);
|
||||
|
||||
@@ -12,9 +12,7 @@ describe('OHIF HP', () => {
|
||||
it('Should display 3 up', () => {
|
||||
beforeSetup();
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 3);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 3);
|
||||
});
|
||||
|
||||
it('Should navigate next/previous stage', () => {
|
||||
@@ -22,15 +20,11 @@ describe('OHIF HP', () => {
|
||||
|
||||
cy.get('body').type(',');
|
||||
cy.wait(250);
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 4);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 4);
|
||||
|
||||
cy.get('body').type('..');
|
||||
cy.wait(250);
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 2);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 2);
|
||||
});
|
||||
|
||||
it('Should navigate to display set specified', () => {
|
||||
|
||||
@@ -11,9 +11,7 @@ describe('OHIF Double Click', () => {
|
||||
|
||||
it('Should double click each viewport to one up and back', () => {
|
||||
const numExpectedViewports = 3;
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', numExpectedViewports);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', numExpectedViewports);
|
||||
|
||||
for (let i = 0; i < numExpectedViewports; i += 1) {
|
||||
cy.wait(2000);
|
||||
@@ -38,13 +36,9 @@ describe('OHIF Double Click', () => {
|
||||
.not('.pointer-events-none');
|
||||
|
||||
// The actual double click.
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.eq(i)
|
||||
.trigger('dblclick', 'center');
|
||||
cy.get('[data-cy="viewport-pane"]').eq(i).trigger('dblclick', 'center');
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 1);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 1);
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.trigger('mousedown', 'center', {
|
||||
@@ -54,9 +48,7 @@ describe('OHIF Double Click', () => {
|
||||
force: true,
|
||||
});
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.eq(0)
|
||||
.trigger('dblclick', 'center');
|
||||
cy.get('[data-cy="viewport-pane"]').eq(0).trigger('dblclick', 'center');
|
||||
}
|
||||
});
|
||||
});
|
||||
+6
-12
@@ -1,8 +1,6 @@
|
||||
describe('OHIF Context Menu', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Context Menu', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -10,7 +8,7 @@ describe('OHIF Context Menu', function() {
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks context menu customization', function() {
|
||||
it('checks context menu customization', function () {
|
||||
// Add length measurement
|
||||
cy.addLengthMeasurement();
|
||||
cy.get('[data-cy="prompt-begin-tracking-yes-btn"]').click();
|
||||
@@ -29,14 +27,10 @@ describe('OHIF Context Menu', function() {
|
||||
cy.get('[data-cy="context-menu"]').should('be.visible');
|
||||
|
||||
// Click "Finding" subMenu
|
||||
cy.get('[data-cy="context-menu-item"]')
|
||||
.contains('Finding')
|
||||
.click();
|
||||
cy.get('[data-cy="context-menu-item"]').contains('Finding').click();
|
||||
|
||||
// Click "Finding" subMenu
|
||||
cy.get('[data-cy="context-menu-item"]')
|
||||
.contains('Aortic insufficiency')
|
||||
.click();
|
||||
cy.get('[data-cy="context-menu-item"]').contains('Aortic insufficiency').click();
|
||||
cy.get('[data-cy="measurement-item"]').contains('Aortic insufficiency');
|
||||
});
|
||||
});
|
||||
+2
-6
@@ -1,17 +1,13 @@
|
||||
describe('OHIF Cornerstone Hotkeys', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.window()
|
||||
.its('cornerstone')
|
||||
.then(cornerstone => {
|
||||
// For debugging issues where tests pass locally but fail on CI
|
||||
// - Sometimes Cypress orb seems to use CPU rendering pathway
|
||||
cy.log(
|
||||
`Cornerstone using CPU Rendering?: ${cornerstone.getShouldUseCPURendering()}`
|
||||
);
|
||||
cy.log(`Cornerstone using CPU Rendering?: ${cornerstone.getShouldUseCPURendering()}`);
|
||||
});
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
|
||||
+4
-12
@@ -1,15 +1,11 @@
|
||||
describe('OHIF Cornerstone Toolbar', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCornerstoneToolsAliases();
|
||||
cy.initCommonElementsAliases();
|
||||
|
||||
cy.get('[data-cy="study-browser-thumbnail"]')
|
||||
.eq(1)
|
||||
.click();
|
||||
cy.get('[data-cy="study-browser-thumbnail"]').eq(1).click();
|
||||
|
||||
//const expectedText = 'Ser: 1';
|
||||
//cy.get('@viewportInfoBottomLeft').should('contains.text', expectedText);
|
||||
@@ -89,9 +85,7 @@ describe('OHIF Cornerstone Toolbar', () => {
|
||||
// The exact text is slightly dependent on the viewport resolution, so leave a range
|
||||
cy.get('@viewportInfoTopLeft').should($txt => {
|
||||
const text = $txt.text();
|
||||
expect(text)
|
||||
.to.include('W:193')
|
||||
.include('L:479');
|
||||
expect(text).to.include('W:193').include('L:479');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -119,9 +113,7 @@ describe('OHIF Cornerstone Toolbar', () => {
|
||||
//Verify the measurement exists in the table
|
||||
cy.get('@measurementsPanel').should('be.visible');
|
||||
|
||||
cy.get('[data-cy="measurement-item"]')
|
||||
.its('length')
|
||||
.should('be.at.least', 1);
|
||||
cy.get('[data-cy="measurement-item"]').its('length').should('be.at.least', 1);
|
||||
});
|
||||
|
||||
/*it('checks if angle annotation can be added on viewport without causing any errors', () => {
|
||||
|
||||
+4
-10
@@ -1,13 +1,11 @@
|
||||
describe('OHIF Download Snapshot File', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.openDownloadImageModal();
|
||||
});
|
||||
|
||||
it('checks displayed information for Desktop experience', function() {
|
||||
it('checks displayed information for Desktop experience', function () {
|
||||
// Set Desktop resolution
|
||||
// cy.viewport(1750, 720);
|
||||
// Visual comparison
|
||||
@@ -36,12 +34,8 @@ describe('OHIF Download Snapshot File', () => {
|
||||
// .and('include', 'data:image');
|
||||
|
||||
// Check buttons
|
||||
cy.get('[data-cy="cancel-btn"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
cy.get('[data-cy="download-btn"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
cy.get('[data-cy="cancel-btn"]').scrollIntoView().should('be.visible');
|
||||
cy.get('[data-cy="download-btn"]').scrollIntoView().should('be.visible');
|
||||
});
|
||||
|
||||
/*it('cancel changes on download modal', function() {
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
describe('OHIF Study Viewer Page', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Study Viewer Page', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
cy.initCornerstoneToolsAliases();
|
||||
});
|
||||
|
||||
it('scrolls series stack using scrollbar', function() {
|
||||
it('scrolls series stack using scrollbar', function () {
|
||||
cy.scrollToIndex(13);
|
||||
|
||||
cy.get('@viewportInfoTopRight').should('contains.text', '14');
|
||||
});
|
||||
|
||||
it('performs right click to zoom', function() {
|
||||
it('performs right click to zoom', function () {
|
||||
// This is not used to activate the tool, it is used to ensure the
|
||||
// top left viewport info shows the zoom values (it only shows up
|
||||
// when the zoom tool is active)
|
||||
@@ -25,11 +23,9 @@ describe('OHIF Study Viewer Page', function() {
|
||||
cy.wrap($zoomBtn).should('have.class', 'active');
|
||||
});
|
||||
|
||||
const zoomLevelInitial = cy
|
||||
.get('@viewportInfoTopLeft')
|
||||
.then($viewportInfo => {
|
||||
return $viewportInfo.text().substring(6, 9);
|
||||
});
|
||||
const zoomLevelInitial = cy.get('@viewportInfoTopLeft').then($viewportInfo => {
|
||||
return $viewportInfo.text().substring(6, 9);
|
||||
});
|
||||
|
||||
//Right click on viewport
|
||||
cy.get('@viewport')
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
describe('OHIF Measurement Panel', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Measurement Panel', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -11,7 +9,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.waitDicomImage();
|
||||
});
|
||||
|
||||
it('checks if Measurements right panel can be hidden/displayed', function() {
|
||||
it('checks if Measurements right panel can be hidden/displayed', function () {
|
||||
cy.get('@measurementsPanel').should('exist');
|
||||
cy.get('@measurementsPanel').should('be.visible');
|
||||
|
||||
@@ -23,7 +21,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('@measurementsPanel').should('be.visible');
|
||||
});
|
||||
|
||||
it('checks if measurement item can be Relabeled under Measurements panel', function() {
|
||||
it('checks if measurement item can be Relabeled under Measurements panel', function () {
|
||||
// Add length measurement
|
||||
cy.addLengthMeasurement();
|
||||
cy.get('[data-cy="viewport-notification"]').should('exist');
|
||||
@@ -31,9 +29,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('[data-cy="prompt-begin-tracking-yes-btn"]').click();
|
||||
cy.get('[data-cy="measurement-item"]').click();
|
||||
|
||||
cy.get('[data-cy="measurement-item"]')
|
||||
.find('svg')
|
||||
.click();
|
||||
cy.get('[data-cy="measurement-item"]').find('svg').click();
|
||||
|
||||
// enter Bone label
|
||||
cy.get('[data-cy="input-annotation"]').should('exist');
|
||||
@@ -44,7 +40,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('[data-cy="measurement-item"]').should('contain.text', 'Bone');
|
||||
});
|
||||
|
||||
it('checks if image would jump when clicked on a measurement item', function() {
|
||||
it('checks if image would jump when clicked on a measurement item', function () {
|
||||
// Add length measurement
|
||||
cy.addLengthMeasurement();
|
||||
cy.get('[data-cy="prompt-begin-tracking-yes-btn"]').click();
|
||||
@@ -56,9 +52,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('@viewportInfoTopRight').should('contains.text', '(14/');
|
||||
|
||||
// Click on first measurement item
|
||||
cy.get('[data-cy="measurement-item"]')
|
||||
.eq(0)
|
||||
.click();
|
||||
cy.get('[data-cy="measurement-item"]').eq(0).click();
|
||||
|
||||
cy.get('@viewportInfoTopRight').should('contains.text', '(1/');
|
||||
cy.get('@viewportInfoTopRight').should('not.contains.text', '(14/');
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
describe('OHIF Study Viewer Page', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Study Viewer Page', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -10,13 +8,11 @@ describe('OHIF Study Viewer Page', function() {
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks if series thumbnails are being displayed', function() {
|
||||
cy.get('[data-cy="study-browser-thumbnail"]')
|
||||
.its('length')
|
||||
.should('be.gt', 1);
|
||||
it('checks if series thumbnails are being displayed', function () {
|
||||
cy.get('[data-cy="study-browser-thumbnail"]').its('length').should('be.gt', 1);
|
||||
});
|
||||
|
||||
it('drags and drop a series thumbnail into viewport', function() {
|
||||
it('drags and drop a series thumbnail into viewport', function () {
|
||||
// Can't use the native drag version as the element should be rerendered
|
||||
// cy.get('[data-cy="study-browser-thumbnail"]:nth-child(2)') //element to be dragged
|
||||
// .drag('.cornerstone-canvas'); //dropzone element
|
||||
@@ -38,7 +34,7 @@ describe('OHIF Study Viewer Page', function() {
|
||||
//cy.get('@viewportInfoBottomLeft').should('contain.text', expectedText);
|
||||
});
|
||||
|
||||
it('checks if Series left panel can be hidden/displayed', function() {
|
||||
it('checks if Series left panel can be hidden/displayed', function () {
|
||||
cy.get('@seriesPanel').should('exist');
|
||||
cy.get('@seriesPanel').should('be.visible');
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//We are keeping the hardcoded results values for the study list tests
|
||||
//this is intended to be running in a controled docker environment with test data.
|
||||
describe('OHIF Study List', function() {
|
||||
context('Desktop resolution', function() {
|
||||
beforeEach(function() {
|
||||
describe('OHIF Study List', function () {
|
||||
context('Desktop resolution', function () {
|
||||
beforeEach(function () {
|
||||
cy.openStudyList();
|
||||
|
||||
cy.viewport(1750, 720);
|
||||
@@ -14,7 +14,7 @@ describe('OHIF Study List', function() {
|
||||
cy.get('@StudyDescription').clear();
|
||||
});
|
||||
|
||||
it('Displays several studies initially', function() {
|
||||
it('Displays several studies initially', function () {
|
||||
cy.waitStudyList();
|
||||
cy.get('@searchResult2').should($list => {
|
||||
expect($list.length).to.be.greaterThan(1);
|
||||
@@ -23,7 +23,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches Patient Name with exact string', function() {
|
||||
it('searches Patient Name with exact string', function () {
|
||||
cy.get('@PatientName').type('Juno');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
@@ -33,7 +33,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches MRN with exact string', function() {
|
||||
it('searches MRN with exact string', function () {
|
||||
cy.get('@MRN').type('0000003');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
@@ -43,7 +43,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches Accession with exact string', function() {
|
||||
it('searches Accession with exact string', function () {
|
||||
cy.get('@AccessionNumber').type('321');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
@@ -53,7 +53,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches Description with exact string', function() {
|
||||
it('searches Description with exact string', function () {
|
||||
cy.get('@StudyDescription').type('PETCT');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
describe('OHIF MPR', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.3.6.1.4.1.25403.345050719074.3824.20170125113417.1'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.3.6.1.4.1.25403.345050719074.3824.20170125113417.1');
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCornerstoneToolsAliases();
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -76,10 +74,7 @@ describe('OHIF MPR', () => {
|
||||
cy.wrap(imageData2).should('not.be', undefined);
|
||||
cy.wrap(imageData3).should('not.be', undefined);
|
||||
|
||||
cy.wrap(imageData1.dimensions).should(
|
||||
'deep.equal',
|
||||
imageData2.dimensions
|
||||
);
|
||||
cy.wrap(imageData1.dimensions).should('deep.equal', imageData2.dimensions);
|
||||
|
||||
cy.wrap(imageData1.origin).should('deep.equal', imageData2.origin);
|
||||
});
|
||||
@@ -89,10 +84,7 @@ describe('OHIF MPR', () => {
|
||||
cy.get('.cornerstone-canvas').should('have.length', 1);
|
||||
|
||||
// should not have any div under it
|
||||
cy.get('[data-cy="thumbnail-viewport-labels"]')
|
||||
.eq(2)
|
||||
.find('div')
|
||||
.should('have.length', 0);
|
||||
cy.get('[data-cy="thumbnail-viewport-labels"]').eq(2).find('div').should('have.length', 0);
|
||||
});
|
||||
|
||||
it('should correctly render Crosshairs for MPR', () => {
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
};
|
||||
@@ -6,18 +6,12 @@ export const DragSimulator = {
|
||||
counter: 0,
|
||||
rectsEqual(r1, r2) {
|
||||
return (
|
||||
r1.top === r2.top &&
|
||||
r1.right === r2.right &&
|
||||
r1.bottom === r2.bottom &&
|
||||
r1.left === r2.left
|
||||
r1.top === r2.top && r1.right === r2.right && r1.bottom === r2.bottom && r1.left === r2.left
|
||||
);
|
||||
},
|
||||
get dropped() {
|
||||
const currentSourcePosition = this.source.getBoundingClientRect();
|
||||
return !this.rectsEqual(
|
||||
this.initialSourcePosition,
|
||||
currentSourcePosition
|
||||
);
|
||||
return !this.rectsEqual(this.initialSourcePosition, currentSourcePosition);
|
||||
},
|
||||
get hasTriesLeft() {
|
||||
return this.counter < this.MAX_TRIES;
|
||||
@@ -71,8 +65,6 @@ export const DragSimulator = {
|
||||
simulate(sourceWrapper, targetSelector, position = 'center') {
|
||||
return cy
|
||||
.get(targetSelector)
|
||||
.then(targetWrapper =>
|
||||
this.init(sourceWrapper.get(0), targetWrapper.get(0), position)
|
||||
);
|
||||
.then(targetWrapper => this.init(sourceWrapper.get(0), targetWrapper.get(0), position));
|
||||
},
|
||||
};
|
||||
@@ -3,16 +3,10 @@ export function initCornerstoneToolsAliases() {
|
||||
cy.get('[data-cy="StackScroll"]').as('stackScrollBtn');
|
||||
cy.get('[data-cy="Zoom"]').as('zoomBtn');
|
||||
cy.get('[data-cy="WindowLevel-split-button-primary"]').as('wwwcBtnPrimary');
|
||||
cy.get('[data-cy="WindowLevel-split-button-secondary"]').as(
|
||||
'wwwcBtnSecondary'
|
||||
);
|
||||
cy.get('[data-cy="WindowLevel-split-button-secondary"]').as('wwwcBtnSecondary');
|
||||
cy.get('[data-cy="Pan"]').as('panBtn');
|
||||
cy.get('[data-cy="MeasurementTools-split-button-primary"]').as(
|
||||
'measurementToolsBtnPrimary'
|
||||
);
|
||||
cy.get('[data-cy="MeasurementTools-split-button-secondary"]').as(
|
||||
'measurementToolsBtnSecondary'
|
||||
);
|
||||
cy.get('[data-cy="MeasurementTools-split-button-primary"]').as('measurementToolsBtnPrimary');
|
||||
cy.get('[data-cy="MeasurementTools-split-button-secondary"]').as('measurementToolsBtnSecondary');
|
||||
// cy.get('[data-cy="Angle"]').as('angleBtn');
|
||||
cy.get('[data-cy="MoreTools-split-button-primary"]').as('moreBtnPrimary');
|
||||
cy.get('[data-cy="MoreTools-split-button-secondary"]').as('moreBtnSecondary');
|
||||
@@ -37,12 +31,8 @@ export function initCommonElementsAliases() {
|
||||
cy.get('[data-cy="studyBrowser-panel"]').as('seriesPanel');
|
||||
cy.get('[data-cy="viewport-overlay-top-right"]').as('viewportInfoTopRight');
|
||||
cy.get('[data-cy="viewport-overlay-top-left"]').as('viewportInfoTopLeft');
|
||||
cy.get('[data-cy="viewport-overlay-bottom-right"]').as(
|
||||
'viewportInfoBottomRight'
|
||||
);
|
||||
cy.get('[data-cy="viewport-overlay-bottom-left"]').as(
|
||||
'viewportInfoBottomLeft'
|
||||
);
|
||||
cy.get('[data-cy="viewport-overlay-bottom-right"]').as('viewportInfoBottomRight');
|
||||
cy.get('[data-cy="viewport-overlay-bottom-left"]').as('viewportInfoBottomLeft');
|
||||
|
||||
cy.get('.left-mid.orientation-marker').as('viewportInfoMidLeft');
|
||||
cy.get('.top-mid.orientation-marker').as('viewportInfoMidTop');
|
||||
@@ -50,9 +40,7 @@ export function initCommonElementsAliases() {
|
||||
|
||||
//Creating aliases for Routes
|
||||
export function initRouteAliases() {
|
||||
cy.intercept('GET', '**/series**', { statusCode: 200, body: [] }).as(
|
||||
'getStudySeries'
|
||||
);
|
||||
cy.intercept('GET', '**/series**', { statusCode: 200, body: [] }).as('getStudySeries');
|
||||
|
||||
// Todo: for some reason cypress does not redirect to the correct url
|
||||
// so we intercept the request and redirect it to the correct url
|
||||
|
||||
@@ -59,10 +59,7 @@ Cypress.Commands.add(
|
||||
(StudyInstanceUID, otherParams = '', mode = '/basic-test') => {
|
||||
cy.location('pathname').then($url => {
|
||||
cy.log($url);
|
||||
if (
|
||||
$url === 'blank' ||
|
||||
!$url.includes(`${mode}/${StudyInstanceUID}${otherParams}`)
|
||||
) {
|
||||
if ($url === 'blank' || !$url.includes(`${mode}/${StudyInstanceUID}${otherParams}`)) {
|
||||
cy.openStudyInViewer(StudyInstanceUID, otherParams, mode);
|
||||
cy.waitDicomImage();
|
||||
// Very short wait to ensure pending updates are handled
|
||||
@@ -91,14 +88,9 @@ Cypress.Commands.add('openStudyModality', Modality => {
|
||||
cy.initRouteAliases();
|
||||
cy.visit('/');
|
||||
|
||||
cy.get('#filter-accessionOrModalityOrDescription')
|
||||
.type(Modality)
|
||||
.waitQueryList();
|
||||
cy.get('#filter-accessionOrModalityOrDescription').type(Modality).waitQueryList();
|
||||
|
||||
cy.get('[data-cy="study-list-results"]')
|
||||
.contains(Modality)
|
||||
.first()
|
||||
.click();
|
||||
cy.get('[data-cy="study-list-results"]').contains(Modality).first().click();
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -175,60 +167,47 @@ Cypress.Commands.add('addLine', (viewport, firstClick, secondClick) => {
|
||||
* @param {number[]} secondClick - Click position [x, y]
|
||||
* @param {number[]} thirdClick - Click position [x, y]
|
||||
*/
|
||||
Cypress.Commands.add(
|
||||
'addAngle',
|
||||
(viewport, firstClick, secondClick, thirdClick) => {
|
||||
cy.get(viewport).then($viewport => {
|
||||
const [x1, y1] = firstClick;
|
||||
const [x2, y2] = secondClick;
|
||||
const [x3, y3] = thirdClick;
|
||||
Cypress.Commands.add('addAngle', (viewport, firstClick, secondClick, thirdClick) => {
|
||||
cy.get(viewport).then($viewport => {
|
||||
const [x1, y1] = firstClick;
|
||||
const [x2, y2] = secondClick;
|
||||
const [x3, y3] = thirdClick;
|
||||
|
||||
cy.wrap($viewport)
|
||||
.click(x1, y1, { force: true })
|
||||
.trigger('mousemove', { clientX: x2, clientY: y2 })
|
||||
.click(x2, y2, { force: true })
|
||||
.trigger('mousemove', { clientX: x3, clientY: y3 })
|
||||
.click(x3, y3, { force: true });
|
||||
});
|
||||
}
|
||||
);
|
||||
cy.wrap($viewport)
|
||||
.click(x1, y1, { force: true })
|
||||
.trigger('mousemove', { clientX: x2, clientY: y2 })
|
||||
.click(x2, y2, { force: true })
|
||||
.trigger('mousemove', { clientX: x3, clientY: y3 })
|
||||
.click(x3, y3, { force: true });
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('expectMinimumThumbnails', (seriesToWait = 1) => {
|
||||
cy.get('[data-cy="study-browser-thumbnail"]', { timeout: 50000 }).should(
|
||||
$itemList => {
|
||||
expect($itemList.length >= seriesToWait).to.be.true;
|
||||
}
|
||||
);
|
||||
cy.get('[data-cy="study-browser-thumbnail"]', { timeout: 50000 }).should($itemList => {
|
||||
expect($itemList.length >= seriesToWait).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
//Command to wait DICOM image to load into the viewport
|
||||
Cypress.Commands.add(
|
||||
'waitDicomImage',
|
||||
(mode = '/basic-test', timeout = 50000) => {
|
||||
cy.window()
|
||||
.its('cornerstone')
|
||||
.should($cornerstone => {
|
||||
const enabled = $cornerstone.getEnabledElements();
|
||||
if (enabled?.length) {
|
||||
enabled.forEach((item, i) => {
|
||||
if (
|
||||
item.viewport.viewportStatus !==
|
||||
$cornerstone.Enums.ViewportStatus.RENDERED
|
||||
) {
|
||||
throw new Error(
|
||||
`Viewport ${i} in state ${item.viewport.viewportStatus}`
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error('No enabled elements');
|
||||
}
|
||||
});
|
||||
// This shouldn't be necessary, but seems to be.
|
||||
cy.wait(250);
|
||||
cy.log('DICOM image loaded');
|
||||
}
|
||||
);
|
||||
Cypress.Commands.add('waitDicomImage', (mode = '/basic-test', timeout = 50000) => {
|
||||
cy.window()
|
||||
.its('cornerstone')
|
||||
.should($cornerstone => {
|
||||
const enabled = $cornerstone.getEnabledElements();
|
||||
if (enabled?.length) {
|
||||
enabled.forEach((item, i) => {
|
||||
if (item.viewport.viewportStatus !== $cornerstone.Enums.ViewportStatus.RENDERED) {
|
||||
throw new Error(`Viewport ${i} in state ${item.viewport.viewportStatus}`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error('No enabled elements');
|
||||
}
|
||||
});
|
||||
// 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
|
||||
Cypress.Commands.add('resetViewport', () => {
|
||||
@@ -392,18 +371,14 @@ Cypress.Commands.add('setLayout', (columns = 1, rows = 1) => {
|
||||
});
|
||||
|
||||
function convertCanvas(documentClone) {
|
||||
documentClone
|
||||
.querySelectorAll('canvas')
|
||||
.forEach(selector => canvasToImage(selector));
|
||||
documentClone.querySelectorAll('canvas').forEach(selector => canvasToImage(selector));
|
||||
|
||||
return documentClone;
|
||||
}
|
||||
|
||||
function unconvertCanvas(documentClone) {
|
||||
// Remove previously generated images
|
||||
documentClone
|
||||
.querySelectorAll('[data-percy-image]')
|
||||
.forEach(selector => selector.remove());
|
||||
documentClone.querySelectorAll('[data-percy-image]').forEach(selector => selector.remove());
|
||||
// Restore canvas visibility
|
||||
documentClone.querySelectorAll('[data-percy-canvas]').forEach(selector => {
|
||||
selector.removeAttribute('data-percy-canvas');
|
||||
@@ -413,9 +388,7 @@ function unconvertCanvas(documentClone) {
|
||||
|
||||
function canvasToImage(selectorOrEl) {
|
||||
let canvas =
|
||||
typeof selectorOrEl === 'object'
|
||||
? selectorOrEl
|
||||
: document.querySelector(selectorOrEl);
|
||||
typeof selectorOrEl === 'object' ? selectorOrEl : document.querySelector(selectorOrEl);
|
||||
let image = document.createElement('img');
|
||||
let canvasImageBase64 = canvas.toDataURL('image/png');
|
||||
|
||||
@@ -443,10 +416,7 @@ Cypress.Commands.add('openPreferences', () => {
|
||||
.scrollIntoView()
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('[data-cy="options-dropdown"]')
|
||||
.last()
|
||||
.click()
|
||||
.wait(200);
|
||||
cy.get('[data-cy="options-dropdown"]').last().click().wait(200);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -481,9 +451,7 @@ Cypress.Commands.add('closePreferences', () => {
|
||||
cy.get('body').then(body => {
|
||||
// Close notification if displayed
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
|
||||
// Close User Preferences Modal (if displayed)
|
||||
@@ -495,9 +463,7 @@ Cypress.Commands.add('closePreferences', () => {
|
||||
|
||||
Cypress.Commands.add('selectPreferencesTab', tabAlias => {
|
||||
cy.initPreferencesModalAliases();
|
||||
cy.get(tabAlias)
|
||||
.click()
|
||||
.should('have.class', 'active');
|
||||
cy.get(tabAlias).click().should('have.class', 'active');
|
||||
initPreferencesModalFooterBtnAliases();
|
||||
});
|
||||
|
||||
@@ -513,9 +479,7 @@ Cypress.Commands.add('resetUserHotkeyPreferences', () => {
|
||||
// Close Success Message overlay (if displayed)
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
// Click on Save Button
|
||||
cy.get('@saveBtn').click();
|
||||
@@ -534,28 +498,23 @@ Cypress.Commands.add('resetUserGeneralPreferences', () => {
|
||||
// Close Success Message overlay (if displayed)
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
// Click on Save Button
|
||||
cy.get('@saveBtn').click();
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
'setNewHotkeyShortcutOnUserPreferencesModal',
|
||||
(function_label, shortcut) => {
|
||||
// Within scopes all `.get` and `.contains` to within the matched elements
|
||||
// dom instead of checking from document
|
||||
cy.get('.HotkeysPreferences').within(() => {
|
||||
cy.contains(function_label) // label we're looking for
|
||||
.parent()
|
||||
.find('input') // closest input to that label
|
||||
.type(shortcut, { force: true }); // Set new shortcut for that function
|
||||
});
|
||||
}
|
||||
);
|
||||
Cypress.Commands.add('setNewHotkeyShortcutOnUserPreferencesModal', (function_label, shortcut) => {
|
||||
// Within scopes all `.get` and `.contains` to within the matched elements
|
||||
// dom instead of checking from document
|
||||
cy.get('.HotkeysPreferences').within(() => {
|
||||
cy.contains(function_label) // label we're looking for
|
||||
.parent()
|
||||
.find('input') // closest input to that label
|
||||
.type(shortcut, { force: true }); // Set new shortcut for that function
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
'setWindowLevelPreset',
|
||||
@@ -590,9 +549,7 @@ Cypress.Commands.add(
|
||||
|
||||
Cypress.Commands.add('openDownloadImageModal', () => {
|
||||
// Click on More button
|
||||
cy.get('[data-cy="Capture"]')
|
||||
.as('captureBtn')
|
||||
.click();
|
||||
cy.get('[data-cy="Capture"]').as('captureBtn').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('setLanguage', (language, save = true) => {
|
||||
@@ -609,16 +566,12 @@ Cypress.Commands.add('setLanguage', (language, save = true) => {
|
||||
// Close Success Message overlay (if displayed)
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
|
||||
//Click on Save/Cancel button
|
||||
const toClick = save ? '@saveBtn' : '@cancelBtn';
|
||||
cy.get(toClick)
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
cy.get(toClick).scrollIntoView().click();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -626,7 +579,7 @@ Cypress.Commands.add('setLanguage', (language, save = true) => {
|
||||
// https://github.com/cypress-io/cypress/issues/7362
|
||||
// uncomment this if you really need the network logs
|
||||
const origLog = Cypress.log;
|
||||
Cypress.log = function(opts, ...other) {
|
||||
Cypress.log = function (opts, ...other) {
|
||||
if (opts.displayName === 'script' || opts.name === 'request') {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user