88// commands please read more here:
99// https://on.cypress.io/custom-commands
1010// ***********************************************
11- //
12- //
13- // -- This is a parent command --
14- // Cypress.Commands.add('login', (email, password) => { ... })
15- //
16- //
17- // -- This is a child command --
18- // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19- //
20- //
21- // -- This is a dual command --
22- // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23- //
24- //
25- // -- This will overwrite an existing command --
26- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27- //
28- // declare global {
29- // namespace Cypress {
30- // interface Chainable {
31- // login(email: string, password: string): Chainable<void>
32- // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33- // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34- // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35- // }
36- // }
37- // }
11+
12+ // Required for TypeScript to treat this as a module and allow `declare global`
13+ export { } ;
14+
15+ declare global {
16+ namespace Cypress {
17+ interface Chainable {
18+ dismissReleaseCatalogusModal ( ) : Chainable < void > ;
19+ }
20+ }
21+ }
22+
23+ /**
24+ * Dismiss the release catalogus modal if it appears.
25+ * The modal opens automatically on fresh sessions.
26+ */
27+ Cypress . Commands . add ( 'dismissReleaseCatalogusModal' , ( ) => {
28+ cy . get ( 'app-root' , { timeout : 10000 } ) . should ( 'exist' ) ;
29+ cy . wait ( 500 ) ;
30+ cy . get ( 'body' ) . then ( ( $body ) => {
31+ if ( $body . find ( 'app-modal' ) . length > 0 ) {
32+ cy . get ( 'app-modal button.close-btn' ) . click ( ) ;
33+ cy . get ( 'app-modal' ) . should ( 'not.exist' ) ;
34+ }
35+ } ) ;
36+ } ) ;
0 commit comments