Fix several flaky tests (#3488)
This commit is contained in:
parent
c37e8714ce
commit
aa3346c369
12 changed files with 48 additions and 41 deletions
|
@ -27,7 +27,7 @@ describe("Authentication test", () => {
|
|||
cy.wrap(adminClient.createRealm("test"));
|
||||
keycloakBefore();
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToRealm("Test");
|
||||
sidebarPage.goToRealm("test");
|
||||
});
|
||||
|
||||
after(() => adminClient.deleteRealm("test"));
|
||||
|
@ -191,10 +191,10 @@ describe("Required actions", () => {
|
|||
const requiredActionsPage = new RequiredActions();
|
||||
|
||||
before(() => {
|
||||
cy.wrap(adminClient.createRealm("Test"));
|
||||
cy.wrap(adminClient.createRealm("test"));
|
||||
keycloakBefore();
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToRealm("Test");
|
||||
sidebarPage.goToRealm("test");
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -202,7 +202,7 @@ describe("Required actions", () => {
|
|||
requiredActionsPage.goToTab();
|
||||
});
|
||||
|
||||
after(() => adminClient.deleteRealm("Test"));
|
||||
after(() => adminClient.deleteRealm("test"));
|
||||
|
||||
it("should enable delete account", () => {
|
||||
const action = "Delete Account";
|
||||
|
|
|
@ -18,6 +18,7 @@ import ClientDetailsPage, {
|
|||
import CommonPage from "../support/pages/CommonPage";
|
||||
import ListingPage from "../support/pages/admin_console/ListingPage";
|
||||
import AttributesTab from "../support/pages/admin_console/manage/AttributesTab";
|
||||
import DedicatedScopesMappersTab from "../support/pages/admin_console/manage/clients/client_details/DedicatedScopesMappersTab";
|
||||
|
||||
let itemId = "client_crud";
|
||||
const loginPage = new LoginPage();
|
||||
|
@ -27,6 +28,7 @@ const clientDetailsPage = new ClientDetailsPage();
|
|||
const commonPage = new CommonPage();
|
||||
const listingPage = new ListingPage();
|
||||
const attributesTab = new AttributesTab();
|
||||
const dedicatedScopesMappersTab = new DedicatedScopesMappersTab();
|
||||
|
||||
describe("Clients test", () => {
|
||||
describe("Client details - Client scopes subtab", () => {
|
||||
|
@ -71,8 +73,8 @@ describe("Clients test", () => {
|
|||
keycloakBefore();
|
||||
loginPage.logIn();
|
||||
commonPage.sidebar().goToClients();
|
||||
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
|
||||
commonPage.tableToolbarUtils().searchItem(clientId);
|
||||
cy.intercept("/admin/realms/master/clients/*").as("fetchClient");
|
||||
commonPage.tableUtils().clickRowItemLink(clientId);
|
||||
cy.wait("@fetchClient");
|
||||
clientDetailsPage.goToClientScopesTab();
|
||||
|
@ -536,8 +538,8 @@ describe("Clients test", () => {
|
|||
it("Should add attribute to client role", () => {
|
||||
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
||||
commonPage.tableUtils().clickRowItemLink(itemId);
|
||||
cy.wait("@load");
|
||||
rolesTab.goToAttributesTab();
|
||||
cy.wait(["@load", "@load"]);
|
||||
attributesTab
|
||||
.addAttribute("crud_attribute_key", "crud_attribute_value")
|
||||
.save();
|
||||
|
@ -550,8 +552,8 @@ describe("Clients test", () => {
|
|||
it("Should delete attribute from client role", () => {
|
||||
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
||||
commonPage.tableUtils().clickRowItemLink(itemId);
|
||||
cy.wait("@load");
|
||||
rolesTab.goToAttributesTab();
|
||||
cy.wait(["@load", "@load"]);
|
||||
attributesTab.deleteAttribute(1);
|
||||
commonPage
|
||||
.masthead()
|
||||
|
@ -896,9 +898,8 @@ describe("Clients test", () => {
|
|||
it("Add mapping to openid client", () => {
|
||||
clientDetailsPage
|
||||
.goToClientScopesTab()
|
||||
.clickDedicatedScope(mappingClient)
|
||||
.goToMappersTab()
|
||||
.addPredefinedMapper();
|
||||
.clickDedicatedScope(mappingClient);
|
||||
dedicatedScopesMappersTab.addPredefinedMapper();
|
||||
clientDetailsPage.modalUtils().table().clickHeaderItem(1, "input");
|
||||
clientDetailsPage.modalUtils().confirmModal();
|
||||
clientDetailsPage
|
||||
|
@ -967,6 +968,7 @@ describe("Clients test", () => {
|
|||
.checkTabExists(ClientsDetailsTab.Settings, true)
|
||||
.checkTabExists(ClientsDetailsTab.Roles, true)
|
||||
.checkTabExists(ClientsDetailsTab.Sessions, true)
|
||||
.checkTabExists(ClientsDetailsTab.Authorization, true)
|
||||
.checkTabExists(ClientsDetailsTab.Permissions, true)
|
||||
.checkTabExists(ClientsDetailsTab.Advanced, true)
|
||||
.checkNumberOfTabsIsEqual(5);
|
||||
|
|
|
@ -20,12 +20,9 @@ const associatedRolesPage = new AssociatedRolesPage();
|
|||
const rolesTab = new ClientRolesTab();
|
||||
|
||||
describe("Realm roles test", () => {
|
||||
before(() => {
|
||||
beforeEach(() => {
|
||||
keycloakBefore();
|
||||
loginPage.logIn();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
sidebarPage.goToRealmRoles();
|
||||
});
|
||||
|
||||
|
@ -254,7 +251,7 @@ describe("Realm roles test", () => {
|
|||
});
|
||||
|
||||
const keyValue = new KeyValueInput("attributes");
|
||||
it.skip("should add attribute", () => {
|
||||
it("should add attribute", () => {
|
||||
listingPage.itemExist(editRoleName).goToItemDetails(editRoleName);
|
||||
|
||||
createRealmRolePage.goToAttributesTab();
|
||||
|
@ -264,7 +261,7 @@ describe("Realm roles test", () => {
|
|||
keyValue.validateRows(1);
|
||||
});
|
||||
|
||||
it.skip("should add attribute multiple", () => {
|
||||
it("should add attribute multiple", () => {
|
||||
listingPage.itemExist(editRoleName).goToItemDetails(editRoleName);
|
||||
|
||||
createRealmRolePage.goToAttributesTab();
|
||||
|
@ -275,7 +272,7 @@ describe("Realm roles test", () => {
|
|||
.validateRows(3);
|
||||
});
|
||||
|
||||
it.skip("should delete attribute", () => {
|
||||
it("should delete attribute", () => {
|
||||
listingPage.itemExist(editRoleName).goToItemDetails(editRoleName);
|
||||
createRealmRolePage.goToAttributesTab();
|
||||
|
||||
|
|
|
@ -458,6 +458,8 @@ describe("User Federation LDAP tests", () => {
|
|||
providersPage.ldapEditModeInput,
|
||||
editModeUnsynced
|
||||
);
|
||||
|
||||
masthead.closeAllAlertMessages();
|
||||
});
|
||||
|
||||
it("Should update display name", () => {
|
||||
|
|
|
@ -161,20 +161,18 @@ describe("User creation", () => {
|
|||
.addAttribute(attributeKey, "other value")
|
||||
.save();
|
||||
|
||||
masthead.checkNotificationMessage("The user has been saved");
|
||||
|
||||
cy.wait("@save-user").should(({ request, response }) => {
|
||||
expect(response?.statusCode).to.equal(204);
|
||||
|
||||
expect(request.body.attributes, "response body").deep.equal({
|
||||
key: ["value"],
|
||||
"key-multiple": ["other value"],
|
||||
});
|
||||
});
|
||||
|
||||
masthead.checkNotificationMessage("The user has been saved");
|
||||
});
|
||||
|
||||
it("Add user to groups test", () => {
|
||||
masthead.closeAllAlertMessages();
|
||||
// Go to user groups
|
||||
listingPage.searchItem(itemId).itemExist(itemId);
|
||||
listingPage.goToItemDetails(itemId);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import CommonElements from "../CommonElements";
|
||||
export default class Masthead extends CommonElements {
|
||||
private logoBtn = "#masthead-logo";
|
||||
private logoBtn = ".pf-c-page__header-brand-link img";
|
||||
private helpBtn = "#help";
|
||||
private closeAlertMessageBtn = ".pf-c-alert__action button";
|
||||
private closeLastAlertMessageBtn =
|
||||
|
|
|
@ -2,7 +2,7 @@ export default class AttributesTab {
|
|||
private saveAttributeBtn = "save-attributes";
|
||||
private addAttributeBtn = "attributes-add-row";
|
||||
private attributesTab = "attributes";
|
||||
private attributeRow = "[data-testid=row]";
|
||||
private attributeRow = "row";
|
||||
private keyInput = (index: number) => `attributes[${index}].key`;
|
||||
private valueInput = (index: number) => `attributes[${index}].value`;
|
||||
|
||||
|
@ -13,11 +13,13 @@ export default class AttributesTab {
|
|||
}
|
||||
|
||||
public addAttribute(key: string, value: string) {
|
||||
cy.get(this.attributeRow)
|
||||
cy.findAllByTestId(this.attributeRow)
|
||||
.its("length")
|
||||
.then((index) => {
|
||||
cy.findByTestId(this.keyInput(index - 1)).type(key);
|
||||
cy.findByTestId(this.valueInput(index - 1)).type(value);
|
||||
cy.findByTestId(this.keyInput(index - 1)).type(key, { force: true });
|
||||
cy.findByTestId(this.valueInput(index - 1)).type(value, {
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
@ -33,7 +35,7 @@ export default class AttributesTab {
|
|||
}
|
||||
|
||||
public deleteAttributeButton(row: number) {
|
||||
cy.findByTestId(`attributes[${row - 1}].remove`).click();
|
||||
cy.findByTestId(`attributes[${row - 1}].remove`).click({ force: true });
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@ export default class ClientRolesTab extends CommonPage {
|
|||
}
|
||||
|
||||
goToAttributesTab() {
|
||||
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
||||
this.tabUtils().clickTab(ClientRolesTabItems.Attributes);
|
||||
cy.wait("@load");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -34,7 +36,9 @@ export default class ClientRolesTab extends CommonPage {
|
|||
}
|
||||
|
||||
goToAssociatedRolesTab() {
|
||||
cy.intercept("/admin/realms/master/roles-by-id/*").as("load");
|
||||
cy.get(this.associatedRolesTab).click();
|
||||
cy.wait("@load");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ enum mapperType {
|
|||
ByConfiguration = "By configuration",
|
||||
}
|
||||
|
||||
enum mapperTypeEmptyState {
|
||||
AddPredefinedMapper = "Add predefined mapper",
|
||||
ConfigureaNewMapper = "Configure a new mapper",
|
||||
}
|
||||
|
||||
export default class DedicatedScopesMappersTab extends CommonPage {
|
||||
private addPredefinedMapperEmptyStateBtn =
|
||||
"add-predefined-mapper-empty-action";
|
||||
private configureNewMapperEmptyStateBtn =
|
||||
"configure-a-new-mapper-empty-action";
|
||||
|
||||
addMapperFromPredefinedMappers() {
|
||||
this.emptyState().checkIfExists(false);
|
||||
this.tableToolbarUtils()
|
||||
|
@ -29,17 +29,17 @@ export default class DedicatedScopesMappersTab extends CommonPage {
|
|||
|
||||
addPredefinedMapper() {
|
||||
this.emptyState().checkIfExists(true);
|
||||
this.emptyState().clickSecondaryBtn(
|
||||
mapperTypeEmptyState.AddPredefinedMapper,
|
||||
true
|
||||
);
|
||||
cy.findByTestId(this.addPredefinedMapperEmptyStateBtn).click({
|
||||
force: true,
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
configureNewMapper() {
|
||||
this.emptyState()
|
||||
.checkIfExists(true)
|
||||
.clickSecondaryBtn(mapperTypeEmptyState.ConfigureaNewMapper);
|
||||
this.emptyState().checkIfExists(true);
|
||||
cy.findByTestId(this.configureNewMapperEmptyStateBtn).click({
|
||||
force: true,
|
||||
});
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ export default class ClientScopesTab extends CommonPage {
|
|||
}
|
||||
|
||||
clickDedicatedScope(clientId: string) {
|
||||
cy.intercept("/admin/realms/master/clients/*").as("get");
|
||||
cy.findByText(`${clientId}-dedicated`).click();
|
||||
cy.wait("@get");
|
||||
return this.dedicatedScopesPage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ export default class AssociatedRolesPage {
|
|||
}
|
||||
|
||||
addAssociatedRoleFromSearchBar(roleName: string, isClientRole?: boolean) {
|
||||
cy.findByTestId(this.addRoleToolbarButton).click();
|
||||
cy.findByTestId(this.addRoleToolbarButton).click({ force: true });
|
||||
|
||||
if (isClientRole) {
|
||||
cy.findByTestId(this.filterTypeDropdown).click();
|
||||
|
|
|
@ -116,7 +116,7 @@ export default class CredentialsPage {
|
|||
}
|
||||
|
||||
clickCloseDataDialogBtn() {
|
||||
cy.get(this.closeDataDialogBtn).eq(1).click({ force: true });
|
||||
cy.get(this.closeDataDialogBtn).click({ force: true });
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue