better waits for realm role tests (#897)

* better waits for realm role tests

* possible fix for delete
This commit is contained in:
Erik Jan de Wit 2021-07-23 12:58:39 +02:00 committed by GitHub
parent d1d99f7ee0
commit 5dde8ee523
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 21 deletions

View file

@ -37,7 +37,7 @@ describe("Realm roles test", function () {
); );
}); });
/*it("Realm role CRUD test", function () { it("Realm role CRUD test", function () {
itemId += "_" + (Math.random() + 1).toString(36).substring(7); itemId += "_" + (Math.random() + 1).toString(36).substring(7);
// Create // Create
@ -51,19 +51,17 @@ describe("Realm roles test", function () {
listingPage.searchItem(itemId).itemExist(itemId); listingPage.searchItem(itemId).itemExist(itemId);
cy.wait(100); const fetchUrl = "/auth/admin/realms/master/roles?first=0&max=11";
cy.intercept(fetchUrl).as("fetch");
// Delete
listingPage.deleteItem(itemId); listingPage.deleteItem(itemId);
cy.wait(500); cy.wait(["@fetch"]);
modalUtils.checkModalTitle("Delete role?").confirmModal(); modalUtils.checkModalTitle("Delete role?").confirmModal();
masthead.checkNotificationMessage("The role has been deleted"); masthead.checkNotificationMessage("The role has been deleted");
listingPage.itemExist(itemId, false); listingPage.itemExist(itemId, false);
});*/ });
it("Associated roles test", function () { it("Associated roles test", function () {
itemId += "_" + (Math.random() + 1).toString(36).substring(7); itemId += "_" + (Math.random() + 1).toString(36).substring(7);

View file

@ -72,9 +72,6 @@ describe("Realm settings", () => {
}; };
const deleteProvider = (providerName: string) => { const deleteProvider = (providerName: string) => {
const keysUrl = `/auth/admin/realms/${realmName}/keys`;
cy.intercept(keysUrl).as("keysFetch");
cy.getId("provider-name-link") cy.getId("provider-name-link")
.contains(providerName) .contains(providerName)
.parent() .parent()
@ -82,12 +79,12 @@ describe("Realm settings", () => {
.click() .click()
.getId(realmSettingsPage.deleteAction) .getId(realmSettingsPage.deleteAction)
.click(); .click();
cy.wait(500).getId(realmSettingsPage.modalConfirm).click(); cy.getId(realmSettingsPage.modalConfirm).click();
return this; return this;
}; };
const addBundle = () => { /*const addBundle = () => {
const localizationUrl = `/auth/admin/realms/${realmName}/localization/en`; const localizationUrl = `/auth/admin/realms/${realmName}/localization/en`;
cy.intercept(localizationUrl).as("localizationFetch"); cy.intercept(localizationUrl).as("localizationFetch");
@ -99,7 +96,7 @@ describe("Realm settings", () => {
cy.wait(["@localizationFetch"]); cy.wait(["@localizationFetch"]);
return this; return this;
}; };*/
it("Go to general tab", function () { it("Go to general tab", function () {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
@ -245,9 +242,10 @@ describe("Realm settings", () => {
it("delete providers", () => { it("delete providers", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-keys-tab").click(); cy.getId("rs-keys-tab").click();
cy.getId("rs-providers-tab").click(); cy.getId("rs-providers-tab").click();
cy.get(".pf-c-spinner__tail-ball").should("not.exist");
deleteProvider("test_aes-generated"); deleteProvider("test_aes-generated");
deleteProvider("test_ecdsa-generated"); deleteProvider("test_ecdsa-generated");
deleteProvider("test_hmac-generated"); deleteProvider("test_hmac-generated");

View file

@ -25,10 +25,12 @@ export default class AssociatedRolesPage {
addAssociatedRealmRole() { addAssociatedRealmRole() {
cy.get(this.actionDropdown).last().click(); cy.get(this.actionDropdown).last().click();
const load = "/auth/admin/realms/master/clients";
cy.intercept(load).as("load");
cy.get(this.addRolesDropdownItem).click(); cy.get(this.addRolesDropdownItem).click();
cy.wait(100); cy.wait(["@load"]);
cy.get(this.checkbox).eq(2).check(); cy.get(this.checkbox).eq(2).check();
cy.get(this.addAssociatedRolesModalButton).contains("Add").click(); cy.get(this.addAssociatedRolesModalButton).contains("Add").click();
@ -37,7 +39,7 @@ export default class AssociatedRolesPage {
cy.get(this.compositeRoleBadge).should("contain.text", "Composite"); cy.get(this.compositeRoleBadge).should("contain.text", "Composite");
cy.wait(2500); cy.wait(["@load"]);
return this; return this;
} }
@ -45,19 +47,17 @@ export default class AssociatedRolesPage {
addAssociatedClientRole() { addAssociatedClientRole() {
cy.get(this.addRoleToolbarButton).click(); cy.get(this.addRoleToolbarButton).click();
cy.wait(100);
cy.get(this.filterTypeDropdown).click(); cy.get(this.filterTypeDropdown).click();
cy.get(this.filterTypeDropdownItem).click(); cy.get(this.filterTypeDropdownItem).click();
cy.wait(2500); cy.get(".pf-c-spinner__tail-ball").should("not.exist");
cy.get(this.checkbox).eq(12).check({ force: true }); cy.get(this.checkbox).eq(12).check({ force: true });
cy.get(this.addAssociatedRolesModalButton).contains("Add").click(); cy.get(this.addAssociatedRolesModalButton).contains("Add").click();
cy.wait(5000); cy.get(".pf-c-spinner__tail-ball").should("not.exist");
cy.contains("Users in role").click().get(this.usersPage).should("exist"); cy.contains("Users in role").click().get(this.usersPage).should("exist");
} }