fix: Add commands for tab interception and visiting (no-changelog) (#15866)

This commit is contained in:
shortstacked
2025-05-30 14:01:12 +01:00
committed by GitHub
parent b8ab4b6a5e
commit 90aac9691d
3 changed files with 22 additions and 6 deletions

View File

@@ -240,3 +240,18 @@ Cypress.Commands.add('resetDatabase', () => {
admin: INSTANCE_ADMIN,
});
});
Cypress.Commands.add('interceptNewTab', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});
});
Cypress.Commands.add('visitInterceptedTab', () => {
cy.get('@windowOpen')
.should('have.been.called')
.then((stub: any) => {
const url = stub.firstCall.args[0];
cy.visit(url);
});
});

View File

@@ -86,6 +86,8 @@ declare global {
>;
resetDatabase(): void;
setAppDate(targetDate: number | Date): void;
interceptNewTab(): Chainable<void>;
visitInterceptedTab(): Chainable<void>;
}
}
}