import { HOMEPAGE } from './selectors' ; declare global { namespace Cypress { interface Chainable < Subject > { checkMenuLink ( { menuSelector , menu , testId , href , } ) : void ; checkNavigationBlock ( navigationBlock , link ) : void ; checkTheme ( theme , link ) : void ; } } } /**
 * Makes sure that a specific menu section is present and opens it so that its
 * child elements can be accessed
 */ Cypress . Commands . add ( 'checkMenuLink' , ( { menuSelector , menu , testId , href , } ) => { if ( menuSelector === HOMEPAGE . menuMobile ) { cy . get ( menuSelector ) . click ( ) . contains ( menu ) . click ( ) ; } else { cy . get ( menuSelector ) . contains ( menu ) . trigger ( 'mouseover' ) ; } cy . get ( menuSelector ) . find ( `[data-testid="${ testId }"]` ) . click ( ) ; cy . url ( ) . should ( 'include' , href ) ; cy . go ( 'back' ) ; } ) ; Cypress . Commands . add ( 'checkNavigationBlock' , ( navigationBlock , link ) => { cy . get ( navigationBlock ) . scrollIntoView ( ) . should ( 'be.visible' ) . click ( ) ; cy . url ( ) . should ( 'include' , link ) ; cy . go ( 'back' ) ; } ) ; Cypress . Commands . add ( 'checkTheme' , ( theme , link ) => { cy . get ( HOMEPAGE . themeLink ) . contains ( theme ) . should ( 'be.visible' ) . click ( ) ; cy . url ( ) . should ( 'include' , link ) ; cy . go ( 'back' ) ; } ) ;