Skip to content

Commit 349aad9

Browse files
Revert logic for dismissing notification alerts on cypress login flow
1 parent 8acbd65 commit 349aad9

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

cypress/e2e/ui/Settings/Application-Settings/schedule.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function verifyTimerDropdownExists() {
158158

159159
describe('Automate Schedule form operations: Settings > Application Settings > Settings > Schedules > Configuration > Add a new schedule', () => {
160160
beforeEach(() => {
161-
cy.login('admin', 'smartvm', { disableNotifications: true });
161+
cy.login();
162162
cy.menu(settingsMenuOption, appSettingsMenuOption);
163163
cy.intercept('POST', '/ops/tree_select?id=xx-msc&text=Schedules').as(
164164
'getSchedules'

cypress/support/commands/login.js

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,12 @@
11
/* eslint-disable no-undef */
22

3-
Cypress.Commands.add('disableAlertsIfVisible', () => {
4-
// Look for notification popups and disable them if present
5-
return cy.get('body').then(($body) => {
6-
const $link = $body.find(
7-
'.miq-toast-wrapper .row .alert a:contains("Disable notifications")'
8-
);
9-
if ($link.length && $link.is(':visible')) {
10-
cy.wrap($link).click({ force: true });
11-
}
12-
return cy.wrap(null);
13-
});
14-
});
15-
163
// user: String of username to log in with, default is admin.
174
// password: String of password to log in with, default is smartvm.
18-
Cypress.Commands.add(
19-
'login',
20-
(user = 'admin', password = 'smartvm', options = {}) => {
21-
const { disableNotifications = false } = options;
22-
if (disableNotifications) {
23-
cy.intercept('GET', '/api/notifications').as('getNotifications');
24-
}
25-
cy.visit('/');
5+
Cypress.Commands.add('login', (user = 'admin', password = 'smartvm') => {
6+
cy.visit('/');
267

27-
cy.get('#user_name').type(user);
28-
cy.get('#user_password').type(password);
29-
const triggerLogin = () => cy.get('#login').click();
8+
cy.get('#user_name').type(user);
9+
cy.get('#user_password').type(password);
10+
return cy.get('#login').click();
11+
});
3012

31-
if (disableNotifications) {
32-
return triggerLogin()
33-
.then(() => cy.wait('@getNotifications'))
34-
.then(() => cy.disableAlertsIfVisible());
35-
}
36-
return triggerLogin();
37-
}
38-
);

0 commit comments

Comments
 (0)