Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IbrahimCSAE committed Apr 25, 2024
1 parent 9b0370b commit fda8f29
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,17 @@ describe('OHIF Percy Layout Advanced Presets', () => {

it('should display each layout preset correctly', () => {
cy.get('[data-cy="study-browser-thumbnail"]').eq(2).dblclick();
cy.wait(200);
cy.get('[data-cy="Layout"]').click();
cy.wait(200);
cy.percySnapshot('Layout tool opened');
cy.get('div').contains('MPR').click();
cy.wait(2000);
cy.selectLayoutPreset('MPR', true);
cy.percySnapshot('MPR Preset');
cy.get('[data-cy="Layout"]').click();
cy.wait(200);
cy.get('div').contains('3D four up').click();
cy.wait(2000);
cy.selectLayoutPreset('3D four up');
cy.percySnapshot('3D four up Preset');
cy.get('[data-cy="Layout"]').click();
cy.wait(200);
cy.get('div').contains('3D main').click();
cy.wait(2000);
cy.selectLayoutPreset('3D main');
cy.percySnapshot('3D main Preset');
cy.get('[data-cy="Layout"]').click();
cy.wait(200);
cy.get('div').contains('Axial Primary').click();
cy.wait(2000);
cy.selectLayoutPreset('Axial Primary');
cy.percySnapshot('Axial Primary Preset');
cy.get('[data-cy="Layout"]').click();
cy.wait(200);
cy.get('div').contains('3D only').click();
cy.wait(2000);
cy.selectLayoutPreset('3D only');
cy.percySnapshot('3D only Preset');
cy.get('[data-cy="Layout"]').click();
cy.wait(200);
cy.get('div').contains('3D primary').click();
cy.wait(2000);
cy.selectLayoutPreset('3D primary');
cy.percySnapshot('3D primary Preset');
});
});

This file was deleted.

42 changes: 16 additions & 26 deletions platform/app/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,26 @@ import {
initCommonElementsAliases,
initRouteAliases,
initStudyListAliasesOnDesktop,
initStudyListAliasesOnTablet,
initPreferencesModalAliases,
initPreferencesModalFooterBtnAliases,
} from './aliases.js';

// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
/**
* Command to select a layout preset.
* The layout preset is selected by clicking on the Layout button and then clicking on the desired preset.
* The preset name is the text that is displayed on the button.
* @param {string} presetName - The name of the layout preset that we would like to select
* @param {boolean} screenshot - If true, a screenshot will be taken when the layout tool is opened
*/
Cypress.Commands.add('selectLayoutPreset', (presetName, screenshot) => {
cy.get('[data-cy="Layout"]').click();
if (screenshot) {
cy.percySnapshot('Layout tool opened');
}
cy.get('div').contains(presetName).should('be.visible').click();
// fixed wait time for layout changes and rendering
cy.wait(2000);
});

/**
* Command to search for a patient name and open his/her study.
Expand Down

0 comments on commit fda8f29

Please sign in to comment.