chore: Clean up unused files, imports, and work on getting end-to-end tests and unit tests running (#2272)
This commit is contained in:
1 parent
414ebc6850
commit
0db81b30f3
374 files changed
+14138
-21288
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import '@percy/cypress';
|
||||
import 'cypress-file-upload';
|
||||
import { DragSimulator } from '../helpers/DragSimulator.js';
|
||||
import { DragSimulator } from './DragSimulator.js';
|
||||
import {
|
||||
initCornerstoneToolsAliases,
|
||||
initCommonElementsAliases,
|
||||
@@ -64,7 +64,7 @@ Cypress.Commands.add('checkStudyRouteInViewer', StudyInstanceUID => {
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openStudyInViewer', StudyInstanceUID => {
|
||||
cy.visit(`/viewer/${StudyInstanceUID}`);
|
||||
cy.visit(`/viewer?StudyInstanceUIDs=${StudyInstanceUID}`);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ Cypress.Commands.add('openStudyModality', Modality => {
|
||||
*
|
||||
* @param {string} url - part of the expected url. Default value is /viewer/
|
||||
*/
|
||||
Cypress.Commands.add('isPageLoaded', (url = '/viewer/') => {
|
||||
Cypress.Commands.add('isPageLoaded', (url = '/viewer') => {
|
||||
return cy.location('pathname', { timeout: 60000 }).should('include', url);
|
||||
});
|
||||
|
||||
@@ -107,18 +107,6 @@ Cypress.Commands.add('waitStudyList', () => {
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitVTKLoading', () => {
|
||||
// Wait for start loading
|
||||
cy.get('[data-cy="viewprt-grid"]', { timeout: 10000 }).should($grid => {
|
||||
expect($grid).to.contain.text('Loading');
|
||||
});
|
||||
|
||||
// Wait for finish loading
|
||||
cy.get('[data-cy="viewprt-grid"]', { timeout: 30000 }).should($grid => {
|
||||
expect($grid).not.to.contain.text('Loading');
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitViewportImageLoading', () => {
|
||||
// Wait for finish loading
|
||||
cy.get('[data-cy="viewprt-grid"]', { timeout: 30000 }).should($grid => {
|
||||
@@ -149,10 +137,11 @@ Cypress.Commands.add('addLine', (viewport, firstClick, secondClick) => {
|
||||
const [x1, y1] = firstClick;
|
||||
const [x2, y2] = secondClick;
|
||||
|
||||
// TODO: Added a wait which appears necessary in Cornerstone Tools >4?
|
||||
cy.wrap($viewport)
|
||||
.click(x1, y1, { force: true })
|
||||
.click(x1, y1).wait(100)
|
||||
.trigger('mousemove', { clientX: x2, clientY: y2 })
|
||||
.click(x2, y2, { force: true });
|
||||
.click(x2, y2).wait(100);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -184,7 +173,7 @@ Cypress.Commands.add(
|
||||
);
|
||||
|
||||
Cypress.Commands.add('expectMinimumThumbnails', (seriesToWait = 1) => {
|
||||
cy.get('[data-cy=thumbnail-list]', { timeout: 50000 }).should($itemList => {
|
||||
cy.get('[data-cy="study-browser-thumbnail"]', { timeout: 50000 }).should($itemList => {
|
||||
expect($itemList.length >= seriesToWait).to.be.true;
|
||||
});
|
||||
});
|
||||
@@ -225,23 +214,11 @@ Cypress.Commands.add('waitDicomImage', (timeout = 50000) => {
|
||||
//Command to reset and clear all the changes made to the viewport
|
||||
Cypress.Commands.add('resetViewport', () => {
|
||||
//Click on More button
|
||||
cy.get('[data-cy="more"]')
|
||||
cy.get('[data-cy="MoreTools-split-button-primary"]')
|
||||
.should('have.attr', 'data-tool', 'Reset')
|
||||
.as('moreBtn')
|
||||
.click();
|
||||
//Verify if overlay is displayed
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.tooltip-toolbar-overlay').length == 0) {
|
||||
cy.get('@moreBtn').click();
|
||||
}
|
||||
});
|
||||
//Click on Clear button
|
||||
cy.get('[data-cy="clear"]')
|
||||
.as('clearBtn')
|
||||
.click();
|
||||
//Click on Reset button
|
||||
cy.get('[data-cy="reset"]')
|
||||
.as('resetBtn')
|
||||
.click();
|
||||
.click()
|
||||
;
|
||||
});
|
||||
|
||||
Cypress.Commands.add('imageZoomIn', () => {
|
||||
@@ -257,7 +234,7 @@ Cypress.Commands.add('imageZoomIn', () => {
|
||||
|
||||
Cypress.Commands.add('imageContrast', () => {
|
||||
cy.initCornerstoneToolsAliases();
|
||||
cy.get('@levelsBtn').click();
|
||||
cy.get('@wwwcBtnPrimary').click();
|
||||
|
||||
//drags the mouse inside the viewport to be able to interact with series
|
||||
cy.get('@viewport')
|
||||
@@ -281,36 +258,22 @@ Cypress.Commands.add('initRouteAliases', () => {
|
||||
initRouteAliases();
|
||||
});
|
||||
|
||||
//Initialize aliases for VTK tools
|
||||
Cypress.Commands.add('initVTKToolsAliases', () => {
|
||||
initVTKToolsAliases();
|
||||
});
|
||||
|
||||
//Initialize aliases for Study List page elements
|
||||
Cypress.Commands.add('initStudyListAliasesOnDesktop', () => {
|
||||
initStudyListAliasesOnDesktop();
|
||||
});
|
||||
|
||||
//Initialize aliases for Study List page elements
|
||||
Cypress.Commands.add('initStudyListAliasesOnTablet', () => {
|
||||
initStudyListAliasesOnTablet();
|
||||
});
|
||||
|
||||
//Initialize aliases for Study List page elements
|
||||
Cypress.Commands.add('initStudyListAliasesOnDesktop', () => {
|
||||
initStudyListAliasesOnDesktop();
|
||||
});
|
||||
|
||||
//Initialize aliases for Study List page elements
|
||||
Cypress.Commands.add('initStudyListAliasesOnTablet', () => {
|
||||
initStudyListAliasesOnTablet();
|
||||
});
|
||||
|
||||
//Add measurements in the viewport
|
||||
Cypress.Commands.add(
|
||||
'addLengthMeasurement',
|
||||
(firstClick = [150, 100], secondClick = [130, 170]) => {
|
||||
cy.get('[data-cy="length"]').click();
|
||||
cy.get('@measurementToolsBtnPrimary')
|
||||
.should('have.attr', 'data-tool', 'Length')
|
||||
.click()
|
||||
.then($lengthBtn => {
|
||||
cy.wrap($lengthBtn).should('have.class', 'active');
|
||||
});
|
||||
|
||||
cy.addLine('.viewport-element', firstClick, secondClick);
|
||||
}
|
||||
);
|
||||
@@ -319,7 +282,7 @@ Cypress.Commands.add(
|
||||
Cypress.Commands.add(
|
||||
'addAngleMeasurement',
|
||||
(initPos = [180, 390], midPos = [300, 410], finalPos = [180, 450]) => {
|
||||
cy.get('[data-cy="angle"]').click();
|
||||
cy.get('[data-cy="Angle"]').click();
|
||||
cy.addAngle('.viewport-element', initPos, midPos, finalPos);
|
||||
}
|
||||
);
|
||||
@@ -453,11 +416,11 @@ Cypress.Commands.add('openPreferences', () => {
|
||||
// Open User Preferences modal
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.OHIFModal').length === 0) {
|
||||
cy.get('[data-cy="options-menu"]')
|
||||
cy.get('[data-cy="options-chevron-down-icon"]')
|
||||
.scrollIntoView()
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('[data-cy="dd-item-menu"]')
|
||||
cy.get('[data-cy="options-dropdown"]')
|
||||
.last()
|
||||
.click()
|
||||
.wait(200);
|
||||
@@ -466,6 +429,24 @@ Cypress.Commands.add('openPreferences', () => {
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('closePreferences', () => {
|
||||
cy.log('Close User Preferences Modal');
|
||||
|
||||
cy.get('body').then(body => {
|
||||
// Close notification if displayed
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
}
|
||||
|
||||
// Close User Preferences Modal (if displayed)
|
||||
if (body.find('.OHIFModal__header').length > 0) {
|
||||
cy.get('[data-cy="close-button"]').click({ force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('selectPreferencesTab', tabAlias => {
|
||||
cy.initPreferencesModalAliases();
|
||||
cy.get(tabAlias)
|
||||
@@ -527,8 +508,7 @@ Cypress.Commands.add(
|
||||
.parent()
|
||||
.find('input') // closest input to that label
|
||||
.type(shortcut, { force: true }); // Set new shortcut for that function
|
||||
})
|
||||
.blur();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -565,13 +545,8 @@ Cypress.Commands.add(
|
||||
|
||||
Cypress.Commands.add('openDownloadImageModal', () => {
|
||||
// Click on More button
|
||||
cy.get('[data-cy="more"]')
|
||||
.as('moreBtn')
|
||||
.click();
|
||||
|
||||
// Click on Download button
|
||||
cy.get('[data-cy="download"]')
|
||||
.as('downloadBtn')
|
||||
cy.get('[data-cy="Capture"]')
|
||||
.as('captureBtn')
|
||||
.click();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user