Add default value true to closeNotification (#3333)

This commit is contained in:
Aboullos 2022-09-15 12:55:57 +02:00 committed by GitHub
parent 6fc4325871
commit bd9dbfb78b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 31 additions and 35 deletions

View file

@ -66,6 +66,9 @@ describe("Events tests", () => {
.enableSaveEventsSwitch() .enableSaveEventsSwitch()
.save() .save()
.clearUserEvents(); .clearUserEvents();
cy.wait(5000);
sidebarPage.goToEvents(); sidebarPage.goToEvents();
eventsPage.goToUserEventsTab(); eventsPage.goToUserEventsTab();
userEventsTab.assertNoSearchResultsExist(true); userEventsTab.assertNoSearchResultsExist(true);
@ -99,6 +102,8 @@ describe("Events tests", () => {
.disableSaveEventsSwitch() .disableSaveEventsSwitch()
.save(); .save();
cy.wait(5000);
masthead.signOut(); masthead.signOut();
loginPage.logIn(); loginPage.logIn();
@ -271,6 +276,9 @@ describe("Events tests", () => {
.disableSaveEvents() .disableSaveEvents()
.save() .save()
.clearAdminEvents(); .clearAdminEvents();
cy.wait(5000);
sidebarPage.goToEvents(); sidebarPage.goToEvents();
eventsPage.goToAdminEventsTab(); eventsPage.goToAdminEventsTab();
adminEventsTab.assertNoSearchResultsExist(true); adminEventsTab.assertNoSearchResultsExist(true);

View file

@ -61,8 +61,7 @@ describe("Realm tests", () => {
createRealmPage.fillRealmName(testRealmName).createRealm(); createRealmPage.fillRealmName(testRealmName).createRealm();
masthead.checkNotificationMessage("Realm created"); masthead.checkNotificationMessage("Realm created successfully");
masthead.closeAllAlertMessages();
}); });
it("should create Test Disabled realm", () => { it("should create Test Disabled realm", () => {
@ -71,11 +70,10 @@ describe("Realm tests", () => {
createRealmPage.fillRealmName("Test Disabled").createRealm(); createRealmPage.fillRealmName("Test Disabled").createRealm();
createRealmPage.disableRealm(); createRealmPage.disableRealm();
masthead.checkNotificationMessage("Realm created"); masthead.checkNotificationMessage("Realm created successfully");
}); });
it("Should cancel deleting Test Disabled realm", () => { it("Should cancel deleting Test Disabled realm", () => {
masthead.closeAllAlertMessages();
sidebarPage.goToRealm("Test Disabled").goToRealmSettings(); sidebarPage.goToRealm("Test Disabled").goToRealmSettings();
realmSettings.clickActionMenu(); realmSettings.clickActionMenu();
cy.findByText("Delete").click(); cy.findByText("Delete").click();
@ -100,14 +98,14 @@ describe("Realm tests", () => {
const fetchUrl = "/admin/realms?briefRepresentation=true"; const fetchUrl = "/admin/realms?briefRepresentation=true";
cy.intercept(fetchUrl).as("fetch"); cy.intercept(fetchUrl).as("fetch");
masthead.checkNotificationMessage("Realm created"); masthead.checkNotificationMessage("Realm created successfully");
cy.wait(["@fetch"]); cy.wait(["@fetch"]);
sidebarPage.goToCreateRealm(); sidebarPage.goToCreateRealm();
createRealmPage.fillRealmName(editedRealmName).createRealm(); createRealmPage.fillRealmName(editedRealmName).createRealm();
masthead.checkNotificationMessage("Realm created"); masthead.checkNotificationMessage("Realm created successfully");
cy.wait(["@fetch"]); cy.wait(["@fetch"]);

View file

@ -67,7 +67,11 @@ describe("Sessions test", () => {
it("Push when URI not configured", () => { it("Push when URI not configured", () => {
sessionsPage.pushRevocation(); sessionsPage.pushRevocation();
commonPage.masthead().checkNotificationMessage("No push sent"); commonPage
.masthead()
.checkNotificationMessage(
"No push sent. No admin URI configured or no registered cluster nodes available"
);
}); });
}); });

View file

@ -195,9 +195,7 @@ describe("User Fed Kerberos tests", () => {
masthead.checkNotificationMessage(savedSuccessMessage); masthead.checkNotificationMessage(savedSuccessMessage);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.checkNotificationMessage(savedSuccessMessage);
sidebarPage.goToUserFederation();
expect(cy.contains("Disabled").should("exist")); expect(cy.contains("Disabled").should("exist"));
}); });

View file

@ -87,7 +87,6 @@ const savedSuccessMessage = "User federation provider successfully saved";
const deletedSuccessMessage = "The user federation provider has been deleted."; const deletedSuccessMessage = "The user federation provider has been deleted.";
const deleteModalTitle = "Delete user federation provider?"; const deleteModalTitle = "Delete user federation provider?";
const disableModalTitle = "Disable user federation provider?"; const disableModalTitle = "Disable user federation provider?";
const nonWritableFailMessage = "User federation provider could not be saved:";
const validatePasswordPolicyFailMessage = const validatePasswordPolicyFailMessage =
"User federation provider could not be saved: Validate Password Policy is applicable only with WRITABLE edit mode"; "User federation provider could not be saved: Validate Password Policy is applicable only with WRITABLE edit mode";
const userImportingDisabledFailMessage = const userImportingDisabledFailMessage =
@ -141,7 +140,6 @@ describe("User Federation LDAP tests", () => {
providersPage.save(provider); providersPage.save(provider);
masthead.checkNotificationMessage(createdSuccessMessage); masthead.checkNotificationMessage(createdSuccessMessage);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should fail updating advanced settings", () => { it("Should fail updating advanced settings", () => {
@ -150,9 +148,8 @@ describe("User Federation LDAP tests", () => {
providersPage.toggleSwitch(providersPage.validatePwPolicySwitch); providersPage.toggleSwitch(providersPage.validatePwPolicySwitch);
providersPage.toggleSwitch(providersPage.trustEmailSwitch); providersPage.toggleSwitch(providersPage.trustEmailSwitch);
providersPage.save(provider); providersPage.save(provider);
masthead.checkNotificationMessage(nonWritableFailMessage); masthead.checkNotificationMessage(validatePasswordPolicyFailMessage);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should update advanced settings", () => { it("Should update advanced settings", () => {
@ -175,7 +172,6 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.ldapv3PwSwitch, "on"); providersPage.verifyToggle(providersPage.ldapv3PwSwitch, "on");
providersPage.verifyToggle(providersPage.validatePwPolicySwitch, "on"); providersPage.verifyToggle(providersPage.validatePwPolicySwitch, "on");
providersPage.verifyToggle(providersPage.trustEmailSwitch, "on"); providersPage.verifyToggle(providersPage.trustEmailSwitch, "on");
masthead.closeAllAlertMessages();
}); });
it("Should set cache policy to evict_daily", () => { it("Should set cache policy to evict_daily", () => {
@ -191,7 +187,6 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(dailyPolicy).should("exist")); expect(cy.contains(dailyPolicy).should("exist"));
expect(cy.contains(defaultPolicy).should("not.exist")); expect(cy.contains(defaultPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
}); });
it("Should set cache policy to default", () => { it("Should set cache policy to default", () => {
@ -205,7 +200,6 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(defaultPolicy).should("exist")); expect(cy.contains(defaultPolicy).should("exist"));
expect(cy.contains(dailyPolicy).should("not.exist")); expect(cy.contains(dailyPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
}); });
it("Should set cache policy to evict_weekly", () => { it("Should set cache policy to evict_weekly", () => {
@ -222,7 +216,6 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(weeklyPolicy).should("exist")); expect(cy.contains(weeklyPolicy).should("exist"));
expect(cy.contains(defaultPolicy).should("not.exist")); expect(cy.contains(defaultPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
}); });
it("Update connection and authentication settings and save", () => { it("Update connection and authentication settings and save", () => {
@ -259,7 +252,6 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.enableStartTls, "on"); providersPage.verifyToggle(providersPage.enableStartTls, "on");
providersPage.verifyToggle(providersPage.connectionPooling, "on"); providersPage.verifyToggle(providersPage.connectionPooling, "on");
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should fail connection and authentication tests", () => { it("Should fail connection and authentication tests", () => {
@ -272,7 +264,6 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(ldapTestFailMsg); masthead.checkNotificationMessage(ldapTestFailMsg);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should make changes and pass connection and authentication tests", () => { it("Should make changes and pass connection and authentication tests", () => {
@ -298,7 +289,6 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(ldapTestSuccessMsg); masthead.checkNotificationMessage(ldapTestSuccessMsg);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should update Kerberos integration settings and save", () => { it("Should update Kerberos integration settings and save", () => {
@ -338,7 +328,6 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.useKerberosForPwAuth, "on"); providersPage.verifyToggle(providersPage.useKerberosForPwAuth, "on");
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should update Synchronization settings and save", () => { it("Should update Synchronization settings and save", () => {
@ -377,7 +366,6 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.periodicUsersSync, "on"); providersPage.verifyToggle(providersPage.periodicUsersSync, "on");
providersPage.verifyToggle(providersPage.importUsers, "on"); providersPage.verifyToggle(providersPage.importUsers, "on");
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should update LDAP searching and updating settings and save", () => { it("Should update LDAP searching and updating settings and save", () => {
@ -470,7 +458,6 @@ describe("User Federation LDAP tests", () => {
providersPage.ldapEditModeInput, providersPage.ldapEditModeInput,
editModeUnsynced editModeUnsynced
); );
masthead.closeAllAlertMessages();
}); });
it("Should update display name", () => { it("Should update display name", () => {
@ -484,7 +471,6 @@ describe("User Federation LDAP tests", () => {
providersPage.clickExistingCard(updatedLdapName); providersPage.clickExistingCard(updatedLdapName);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should update existing LDAP provider and cancel", () => { it("Should update existing LDAP provider and cancel", () => {
@ -517,7 +503,6 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(lifespanPolicy).should("exist")); expect(cy.contains(lifespanPolicy).should("exist"));
expect(cy.contains(weeklyPolicy).should("not.exist")); expect(cy.contains(weeklyPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
}); });
it("Should set cache policy to no_cache", () => { it("Should set cache policy to no_cache", () => {
@ -541,7 +526,6 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(savedSuccessMessage); masthead.checkNotificationMessage(savedSuccessMessage);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
expect(cy.contains("Disabled").should("exist")); expect(cy.contains("Disabled").should("exist"));
masthead.closeAllAlertMessages();
}); });
it("Should enable a previously-disabled LDAP provider", () => { it("Should enable a previously-disabled LDAP provider", () => {
@ -551,7 +535,6 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(savedSuccessMessage); masthead.checkNotificationMessage(savedSuccessMessage);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
expect(cy.contains("Enabled").should("exist")); expect(cy.contains("Enabled").should("exist"));
masthead.closeAllAlertMessages();
}); });
it("Should create new LDAP provider using New Provider dropdown", () => { it("Should create new LDAP provider using New Provider dropdown", () => {
@ -576,7 +559,6 @@ describe("User Federation LDAP tests", () => {
providersPage.save(provider); providersPage.save(provider);
masthead.checkNotificationMessage(createdSuccessMessage); masthead.checkNotificationMessage(createdSuccessMessage);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
}); });
it("Should delete LDAP provider from card view using card menu", () => { it("Should delete LDAP provider from card view using card menu", () => {

View file

@ -275,7 +275,6 @@ describe("User creation", () => {
true true
); );
} }
masthead.closeAllAlertMessages();
}); });
}); });
@ -335,7 +334,6 @@ describe("User creation", () => {
true true
); );
} }
masthead.closeAllAlertMessages();
}); });
}); });
}); });

View file

@ -31,8 +31,8 @@ export default class CommonElements {
return this; return this;
} }
clickSecondaryBtn(buttonName: string) { clickSecondaryBtn(buttonName: string, force = false) {
cy.get(this.secondaryBtn).contains(buttonName).click(); cy.get(this.secondaryBtn).contains(buttonName).click({ force: force });
return this; return this;
} }

View file

@ -49,11 +49,13 @@ export default class Masthead extends CommonElements {
cy.get("#manage-account").click(); cy.get("#manage-account").click();
} }
checkNotificationMessage(message: string, closeNotification?: boolean) { checkNotificationMessage(message: string, closeNotification = true) {
cy.get(this.alertMessage).should("contain.text", message); cy.get(this.alertMessage).should("contain.text", message);
if (closeNotification) { if (closeNotification) {
cy.get(`button[title="${message}"]`).last().click({ force: true }); cy.get(`button[title="` + message.replaceAll('"', '\\"') + `"]`)
.last()
.click({ force: true });
} }
return this; return this;
} }

View file

@ -340,4 +340,9 @@ export default class PageObject {
cy.get(this.breadcrumbItem).contains(itemName).click(); cy.get(this.breadcrumbItem).contains(itemName).click();
return this; return this;
} }
protected waitForPageLoad() {
cy.get('[role="progressbar"]').should("not.exist");
return this;
}
} }

View file

@ -30,7 +30,7 @@ export default class DedicatedScopesMappersTab extends CommonPage {
addPredefinedMapper() { addPredefinedMapper() {
this.emptyState() this.emptyState()
.checkIfExists(true) .checkIfExists(true)
.clickSecondaryBtn(mapperTypeEmptyState.AddPredefinedMapper); .clickSecondaryBtn(mapperTypeEmptyState.AddPredefinedMapper, true);
return this; return this;
} }

View file

@ -21,6 +21,7 @@ export default class UserEventsSettingsTab extends PageObject {
disableSaveEventsSwitch() { disableSaveEventsSwitch() {
cy.get(this.saveEventsSwitch).parent().click(); cy.get(this.saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.saveEventsSwitch)); super.assertSwitchStateOn(cy.get(this.saveEventsSwitch));
this.waitForPageLoad();
modal.checkModalTitle("Unsave events?"); modal.checkModalTitle("Unsave events?");
modal.confirmModal(); modal.confirmModal();
super.assertSwitchStateOff(cy.get(this.saveEventsSwitch)); super.assertSwitchStateOff(cy.get(this.saveEventsSwitch));