Skip to content

Commit 32cb786

Browse files
committed
fix(cypress): Login validation for all session flows
The no-session login did not run the validation code, which lead to not closing the openshift guide. This commit wraps the validation login into a cypress command and runs it also with the no-session login.
1 parent 8f0ed86 commit 32cb786

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

web/cypress/support/commands/auth-commands.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { guidedTour } from '../../views/tour';
21
import { nav } from '../../views/nav';
2+
import { guidedTour } from '../../views/tour';
33

44

55

@@ -16,6 +16,7 @@ declare global {
1616
loginNoSession(provider: string, username: string, password: string, oauthurl: string): Chainable<Element>;
1717
adminCLI(command: string, options?);
1818
executeAndDelete(command: string);
19+
validateLogin(): Chainable<Element>;
1920
}
2021
}
2122
}
@@ -79,6 +80,12 @@ declare global {
7980
);
8081
}
8182

83+
Cypress.Commands.add('validateLogin', () => {
84+
cy.visit('/');
85+
cy.byTestID("username", {timeout: 120000}).should('be.visible');
86+
guidedTour.close();
87+
});
88+
8289
// Session-wrapped login
8390
Cypress.Commands.add(
8491
'login',
@@ -96,9 +103,7 @@ declare global {
96103
{
97104
cacheAcrossSpecs: true,
98105
validate() {
99-
cy.visit('/');
100-
cy.byTestID("username", {timeout: 120000}).should('be.visible');
101-
guidedTour.close();
106+
cy.validateLogin();
102107
},
103108
},
104109
);
@@ -108,6 +113,7 @@ declare global {
108113
// Non-session login (for use within sessions)
109114
Cypress.Commands.add('loginNoSession', (provider: string, username: string, password: string, oauthurl: string) => {
110115
performLogin(provider, username, password, oauthurl);
116+
cy.validateLogin();
111117
});
112118

113119
Cypress.Commands.add('switchPerspective', (perspective: string) => {

0 commit comments

Comments
 (0)