Fix failing and flaky tests (#3091)

This commit is contained in:
ikhomyn 2022-08-12 12:52:41 +02:00 committed by GitHub
parent eddc097a56
commit 6a881d71b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 9 deletions

View file

@ -76,9 +76,16 @@ describe("Clients SAML tests", () => {
cy.findByTestId("keysTab").click();
});
it("doesn't disable when no", () => {
it("should doesn't disable signature when cancel", () => {
cy.findByTestId("clientSignature").click({ force: true });
cy.findByTestId("generate").click();
masthead.checkNotificationMessage(
"New key pair and certificate generated successfully"
);
modalUtils.confirmModal();
cy.findByTestId("clientSignature").click({ force: true });
modalUtils
.checkModalTitle('Disable "Client signature required"')
.cancelModal();
@ -86,7 +93,8 @@ describe("Clients SAML tests", () => {
cy.findAllByTestId("certificate").should("have.length", 1);
});
it("disable client signature", () => {
// https://github.com/keycloak/keycloak-admin-ui/issues/3092
it.skip("should disable client signature", () => {
cy.intercept(
"admin/realms/master/clients/*/certificates/saml.signing"
).as("load");

View file

@ -46,6 +46,8 @@ describe("Group test", () => {
);
});
after(() => adminClient.deleteGroups());
beforeEach(() => {
keycloakBefore();
loginPage.logIn();

View file

@ -62,6 +62,7 @@ describe("Realm tests", () => {
createRealmPage.fillRealmName(testRealmName).createRealm();
masthead.checkNotificationMessage("Realm created");
masthead.closeAllAlertMessages();
});
it("should create Test Disabled realm", () => {
@ -74,6 +75,7 @@ describe("Realm tests", () => {
});
it("Should cancel deleting Test Disabled realm", () => {
masthead.closeAllAlertMessages();
sidebarPage.goToRealm("Test Disabled").goToRealmSettings();
realmSettings.clickActionMenu();
cy.findByText("Delete").click();

View file

@ -123,14 +123,14 @@ describe("User Fed LDAP mapper tests", () => {
});
// create a new client and then new role for that client
it.skip("Create client and role", () => {
it("Create client and role", () => {
sidebarPage.goToClients();
listingPage.goToCreateItem();
createClientPage
.selectClientType("openid-connect")
.fillClientData(clientName)
.continue()
.continue();
.save();
masthead.checkNotificationMessage(clientCreatedSuccess);
@ -204,7 +204,7 @@ describe("User Fed LDAP mapper tests", () => {
listingPage.itemExist(hcLdapRoleMapper, true);
});
it.skip("Create role ldap mapper", () => {
it("Create role ldap mapper", () => {
providersPage.clickExistingCard(ldapName);
providersPage.goToMappers();
providersPage.createNewMapper(roleLdapMapper);
@ -227,7 +227,7 @@ describe("User Fed LDAP mapper tests", () => {
masthead.checkNotificationMessage(groupDeletedSuccess);
});
it.skip("Cleanup - delete client", () => {
it("Cleanup - delete client", () => {
sidebarPage.goToClients();
listingPage.deleteItem(clientName);
modalUtils.checkModalTitle(`Delete ${clientName} ?`).confirmModal();

View file

@ -141,6 +141,7 @@ describe("User Federation LDAP tests", () => {
providersPage.save(provider);
masthead.checkNotificationMessage(createdSuccessMessage);
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should fail updating advanced settings", () => {
@ -151,6 +152,7 @@ describe("User Federation LDAP tests", () => {
providersPage.save(provider);
masthead.checkNotificationMessage(nonWritableFailMessage);
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should update advanced settings", () => {
@ -173,6 +175,7 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.ldapv3PwSwitch, "on");
providersPage.verifyToggle(providersPage.validatePwPolicySwitch, "on");
providersPage.verifyToggle(providersPage.trustEmailSwitch, "on");
masthead.closeAllAlertMessages();
});
it("Should set cache policy to evict_daily", () => {
@ -188,6 +191,7 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(dailyPolicy).should("exist"));
expect(cy.contains(defaultPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
});
it("Should set cache policy to default", () => {
@ -201,6 +205,7 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(defaultPolicy).should("exist"));
expect(cy.contains(dailyPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
});
it("Should set cache policy to evict_weekly", () => {
@ -217,6 +222,7 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(weeklyPolicy).should("exist"));
expect(cy.contains(defaultPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
});
it("Update connection and authentication settings and save", () => {
@ -253,6 +259,7 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.enableStartTls, "on");
providersPage.verifyToggle(providersPage.connectionPooling, "on");
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should fail connection and authentication tests", () => {
@ -265,6 +272,7 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(ldapTestFailMsg);
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should make changes and pass connection and authentication tests", () => {
@ -290,6 +298,7 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(ldapTestSuccessMsg);
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should update Kerberos integration settings and save", () => {
@ -329,6 +338,7 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.useKerberosForPwAuth, "on");
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should update Synchronization settings and save", () => {
@ -367,6 +377,7 @@ describe("User Federation LDAP tests", () => {
providersPage.verifyToggle(providersPage.periodicUsersSync, "on");
providersPage.verifyToggle(providersPage.importUsers, "on");
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should update LDAP searching and updating settings and save", () => {
@ -459,6 +470,7 @@ describe("User Federation LDAP tests", () => {
providersPage.ldapEditModeInput,
editModeUnsynced
);
masthead.closeAllAlertMessages();
});
it("Should update display name", () => {
@ -472,6 +484,7 @@ describe("User Federation LDAP tests", () => {
providersPage.clickExistingCard(updatedLdapName);
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should update existing LDAP provider and cancel", () => {
@ -504,6 +517,7 @@ describe("User Federation LDAP tests", () => {
expect(cy.contains(lifespanPolicy).should("exist"));
expect(cy.contains(weeklyPolicy).should("not.exist"));
masthead.closeAllAlertMessages();
});
it("Should set cache policy to no_cache", () => {
@ -527,6 +541,7 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(savedSuccessMessage);
sidebarPage.goToUserFederation();
expect(cy.contains("Disabled").should("exist"));
masthead.closeAllAlertMessages();
});
it("Should enable a previously-disabled LDAP provider", () => {
@ -536,6 +551,7 @@ describe("User Federation LDAP tests", () => {
masthead.checkNotificationMessage(savedSuccessMessage);
sidebarPage.goToUserFederation();
expect(cy.contains("Enabled").should("exist"));
masthead.closeAllAlertMessages();
});
it("Should create new LDAP provider using New Provider dropdown", () => {
@ -560,6 +576,7 @@ describe("User Federation LDAP tests", () => {
providersPage.save(provider);
masthead.checkNotificationMessage(createdSuccessMessage);
sidebarPage.goToUserFederation();
masthead.closeAllAlertMessages();
});
it("Should delete LDAP provider from card view using card menu", () => {

View file

@ -171,6 +171,7 @@ describe("User creation", () => {
});
it("Add user to groups test", () => {
masthead.closeAllAlertMessages();
// Go to user groups
listingPage.searchItem(itemId).itemExist(itemId);
listingPage.goToItemDetails(itemId);
@ -250,10 +251,13 @@ describe("User creation", () => {
.clickCloseDataDialogBtn();
});
it.skip("Delete credential", () => {
it("Delete credential", () => {
listingPage.goToItemDetails(itemIdWithCred);
credentialsPage.goToCredentialsTab();
masthead.closeAllAlertMessages();
cy.wait(2000);
listingPage.deleteItem(itemCredential);
modalUtils.checkModalTitle("Delete credentials?").confirmModal();
masthead.checkNotificationMessage(

View file

@ -64,7 +64,9 @@ export default class Masthead extends CommonElements {
}
closeAllAlertMessages() {
cy.get(this.closeAlertMessageBtn).each(() => {
cy.get(this.closeAlertMessageBtn).click({ force: true, multiple: true });
});
return this;
}

View file

@ -361,7 +361,12 @@ export default class ProviderPage {
case this.roleLdapMapper:
cy.findByTestId(this.ldapRolesDnInput).clear().type(ldapDnValue);
cy.get(this.clientIdSelect).click();
cy.get(".pf-c-form__group")
.contains("Client ID")
.parent()
.parent()
.find("input")
.click();
cy.get("button").contains(this.clientName).click({ force: true });
break;