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