declare namespace Cypress { interface Chainable < Subject > { login ( email , password ) : void ; verifyRendersDataTestId ( dataTestId ) : void ; verifyFormControlName ( formControlName , formControlNameValue , dataTestId ) : void ; verifyRequiredInputErrorDisplayed ( inputDataTestId , otherDataTestId , errorMessage ) : void ; verifySlugPatternErrorDisplayed ( otherDataTestId ) : void ; } } Cypress . Commands . add ( 'verifyRendersDataTestId' , ( dataTestId ) => { cy . get ( `[data-testid=${ dataTestId }` ) . should ( 'be.visible' ) ; } ) ; Cypress . Commands . add ( 'verifyFormControlName' , ( formControlName , formControlNameValue , dataTestId ) => { cy . changeArg ( formControlName , formControlNameValue ) ; cy . get ( `[data-testid=${ dataTestId }]` ) . should ( 'have.attr' , 'ng-reflect-name' , formControlNameValue ) ; } ) ; Cypress . Commands . add ( 'verifyRequiredInputErrorDisplayed' , ( inputDataTestId , otherDataTestId , errorMessage ) => { cy . get ( `[data-testid=${ inputDataTestId }]` ) . type ( 'A' ) . type ( '{backspace}' ) . get ( `[data-testid=${ otherDataTestId }]` ) . click ( ) . get ( 'mat-error[role=alert]' ) . contains ( errorMessage ) . should ( 'be.visible' ) ; } ) ; Cypress . Commands . add ( 'verifySlugPatternErrorDisplayed' , ( otherDataTestId ) => { cy . get ( '[data-testid=slug-input]' ) . type ( 'An Invalid Value' ) . get ( `[data-testid=${ otherDataTestId }]` ) . click ( ) . get ( 'mat-error[role=alert]' ) . contains ( 'Slug allows lowercase and dash (-) characters' ) . should ( 'be.visible' ) ; } ) ;