forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial ui for organizations (keycloak#29643)
* initial screen Signed-off-by: Erik Jan de Wit <[email protected]> * more screens Signed-off-by: Erik Jan de Wit <[email protected]> * added members tab Signed-off-by: Erik Jan de Wit <[email protected]> * added the backend Signed-off-by: Erik Jan de Wit <[email protected]> * added member add / invite models Signed-off-by: Erik Jan de Wit <[email protected]> * initial version of the identity provider section Signed-off-by: Erik Jan de Wit <[email protected]> * add link and unlink providers Signed-off-by: Erik Jan de Wit <[email protected]> * small fix Signed-off-by: Erik Jan de Wit <[email protected]> * PR comments Signed-off-by: Erik Jan de Wit <[email protected]> * Do not validate broker domain when the domain is an empty string Closes keycloak#29759 Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * added filter and value Signed-off-by: Erik Jan de Wit <[email protected]> * added test Signed-off-by: Erik Jan de Wit <[email protected]> * added first name last name Signed-off-by: Erik Jan de Wit <[email protected]> * refresh menu when realm organization is changed Signed-off-by: Erik Jan de Wit <[email protected]> * changed to record Signed-off-by: Erik Jan de Wit <[email protected]> * changed to form data Signed-off-by: Erik Jan de Wit <[email protected]> * fixed lint error Signed-off-by: Erik Jan de Wit <[email protected]> * Changing name of invitation parameters Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Chancing name of parameters on the client Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Enable organization at the realm before running tests Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Domain help message Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Handling model validation errors when creating organizations Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Message key for organizationDetails Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Do not change kc.org attribute on group Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * add realm into the context Signed-off-by: Erik Jan de Wit <[email protected]> * tests Signed-off-by: Erik Jan de Wit <[email protected]> * Changing button in invitation model to use Send instead of Save Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Better message when validating the organization domain Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * Fixing compilation error after rebase Signed-off-by: Pedro Igor <[email protected]> Signed-off-by: Erik Jan de Wit <[email protected]> * fixed test Signed-off-by: Erik Jan de Wit <[email protected]> * removed wait as it no longer required and skip flacky test Signed-off-by: Erik Jan de Wit <[email protected]> * skip tests that are flaky Signed-off-by: Erik Jan de Wit <[email protected]> * stabilize user create test Signed-off-by: Erik Jan de Wit <[email protected]> --------- Signed-off-by: Erik Jan de Wit <[email protected]> Signed-off-by: Pedro Igor <[email protected]> Co-authored-by: Pedro Igor <[email protected]>
- Loading branch information
Showing
69 changed files
with
2,160 additions
and
452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
import Form from "../support/forms/Form"; | ||
import LoginPage from "../support/pages/LoginPage"; | ||
import ListingPage from "../support/pages/admin-ui/ListingPage"; | ||
import IdentityProviderTab from "../support/pages/admin-ui/manage/organization/IdentityProviderTab"; | ||
import MembersTab from "../support/pages/admin-ui/manage/organization/MemberTab"; | ||
import OrganizationPage from "../support/pages/admin-ui/manage/organization/OrganizationPage"; | ||
import adminClient from "../support/util/AdminClient"; | ||
import { keycloakBefore } from "../support/util/keycloak_hooks"; | ||
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage"; | ||
import SidebarPage from "../support/pages/admin-ui/SidebarPage"; | ||
|
||
const loginPage = new LoginPage(); | ||
const listingPage = new ListingPage(); | ||
const page = new OrganizationPage(); | ||
const realmSettingsPage = new RealmSettingsPage(); | ||
const sidebarPage = new SidebarPage(); | ||
|
||
describe.skip("Organization CRUD", () => { | ||
beforeEach(() => { | ||
loginPage.logIn(); | ||
keycloakBefore(); | ||
sidebarPage.goToRealmSettings(); | ||
realmSettingsPage.setSwitch("organizationsEnabled", true); | ||
realmSettingsPage.saveGeneral(); | ||
}); | ||
|
||
it("should create new organization", () => { | ||
page.goToTab(); | ||
page.goToCreate(); | ||
Form.assertSaveButtonDisabled(); | ||
page.fillCreatePage({ name: "orgName" }); | ||
Form.assertSaveButtonEnabled(); | ||
page.fillCreatePage({ | ||
name: "orgName", | ||
domain: ["ame.org", "test.nl"], | ||
description: "some description", | ||
}); | ||
Form.clickSaveButton(); | ||
page.assertSaveSuccess(); | ||
}); | ||
|
||
it("should modify existing organization", () => { | ||
cy.wrap(null).then(() => | ||
adminClient.createOrganization({ | ||
name: "editName", | ||
domains: [{ name: "go.org", verified: false }], | ||
}), | ||
); | ||
page.goToTab(); | ||
|
||
listingPage.goToItemDetails("editName"); | ||
const newValue = "newName"; | ||
page.fillNameField(newValue).should("have.value", newValue); | ||
Form.clickSaveButton(); | ||
page.assertSaveSuccess(); | ||
page.goToTab(); | ||
listingPage.itemExist(newValue); | ||
}); | ||
|
||
it("should delete from list", () => { | ||
page.goToTab(); | ||
listingPage.deleteItem("orgName"); | ||
page.modalUtils().confirmModal(); | ||
page.assertDeleteSuccess(); | ||
}); | ||
|
||
it.skip("should delete from details page", () => { | ||
page.goToTab(); | ||
listingPage.goToItemDetails("newName"); | ||
|
||
page | ||
.actionToolbarUtils() | ||
.clickActionToggleButton() | ||
.clickDropdownItem("Delete"); | ||
page.modalUtils().confirmModal(); | ||
|
||
page.assertDeleteSuccess(); | ||
}); | ||
}); | ||
|
||
describe.skip("Members", () => { | ||
const membersTab = new MembersTab(); | ||
|
||
before(() => { | ||
adminClient.createOrganization({ | ||
name: "member", | ||
domains: [{ name: "o.com", verified: false }], | ||
}); | ||
adminClient.createUser({ username: "realm-user", enabled: true }); | ||
}); | ||
|
||
after(() => { | ||
adminClient.deleteOrganization("member"); | ||
adminClient.deleteUser("realm-user"); | ||
}); | ||
|
||
beforeEach(() => { | ||
loginPage.logIn(); | ||
keycloakBefore(); | ||
page.goToTab(); | ||
}); | ||
|
||
it("should add member", () => { | ||
listingPage.goToItemDetails("member"); | ||
membersTab.goToTab(); | ||
membersTab.clickAddRealmUser(); | ||
membersTab.modalUtils().assertModalVisible(true); | ||
membersTab.modalUtils().table().selectRowItemCheckbox("realm-user"); | ||
membersTab.modalUtils().add(); | ||
membersTab.assertMemberAddedSuccess(); | ||
membersTab.tableUtils().checkRowItemExists("realm-user"); | ||
}); | ||
}); | ||
|
||
describe.skip("Identity providers", () => { | ||
const idpTab = new IdentityProviderTab(); | ||
before(() => { | ||
adminClient.createOrganization({ | ||
name: "idp", | ||
domains: [{ name: "o.com", verified: false }], | ||
}); | ||
adminClient.createIdentityProvider("BitBucket", "bitbucket"); | ||
}); | ||
after(() => { | ||
adminClient.deleteOrganization("idp"); | ||
adminClient.deleteIdentityProvider("bitbucket"); | ||
}); | ||
|
||
beforeEach(() => { | ||
loginPage.logIn(); | ||
keycloakBefore(); | ||
page.goToTab(); | ||
}); | ||
|
||
it("should add idp", () => { | ||
listingPage.goToItemDetails("idp"); | ||
idpTab.goToTab(); | ||
idpTab.emptyState().checkIfExists(true); | ||
idpTab.emptyState().clickPrimaryBtn(); | ||
|
||
idpTab.fillForm({ name: "bitbucket", domain: "o.com", public: true }); | ||
idpTab.modalUtils().confirmModal(); | ||
|
||
idpTab.assertAddedSuccess(); | ||
|
||
idpTab.tableUtils().checkRowItemExists("bitbucket"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
js/apps/admin-ui/cypress/support/pages/admin-ui/manage/organization/IdentityProviderTab.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Select from "../../../../forms/Select"; | ||
import CommonPage from "../../../CommonPage"; | ||
|
||
export default class IdentityProviderTab extends CommonPage { | ||
goToTab() { | ||
cy.findByTestId("identityProvidersTab").click(); | ||
} | ||
|
||
fillForm(data: { name: string; domain: string; public: boolean }) { | ||
Select.selectItem(cy.findByTestId("alias"), data.name); | ||
Select.selectItem(cy.get("#kc🍺org🍺domain"), data.domain); | ||
if (data.public) { | ||
cy.findByAltText("config.kc🍺org🍺broker🍺public").click(); | ||
} | ||
} | ||
|
||
assertAddedSuccess() { | ||
this.masthead().checkNotificationMessage( | ||
"Identity provider successfully linked to organization", | ||
); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
js/apps/admin-ui/cypress/support/pages/admin-ui/manage/organization/MemberTab.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import CommonPage from "../../../CommonPage"; | ||
|
||
export default class MembersTab extends CommonPage { | ||
goToTab() { | ||
cy.findByTestId("membersTab").click(); | ||
} | ||
|
||
clickAddRealmUser() { | ||
cy.findByTestId("add-realm-user-empty-action").click(); | ||
} | ||
|
||
assertMemberAddedSuccess() { | ||
this.masthead().checkNotificationMessage( | ||
"1 user added to the organization", | ||
); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
js/apps/admin-ui/cypress/support/pages/admin-ui/manage/organization/OrganizationPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import CommonPage from "../../../CommonPage"; | ||
|
||
export default class OrganizationPage extends CommonPage { | ||
#nameField = "[data-testid='name']"; | ||
|
||
goToTab() { | ||
cy.get("#nav-item-organizations").click(); | ||
} | ||
|
||
goToCreate(empty: boolean = true) { | ||
cy.findByTestId( | ||
empty ? "no-organizations-empty-action" : "addOrganization", | ||
).click(); | ||
} | ||
|
||
fillCreatePage(values: { | ||
name: string; | ||
domain?: string[]; | ||
description?: string; | ||
}) { | ||
this.fillNameField(values.name); | ||
values.domain?.forEach((d, index) => { | ||
cy.findByTestId(`domains${index}`).type(d); | ||
if (index !== (values.domain?.length || 0) - 1) | ||
cy.findByTestId("addValue").click(); | ||
}); | ||
if (values.description) | ||
cy.findByTestId("description").type(values.description); | ||
} | ||
|
||
getNameField() { | ||
return cy.get(this.#nameField); | ||
} | ||
|
||
fillNameField(name: string) { | ||
cy.get(this.#nameField).clear().type(name); | ||
return this.getNameField(); | ||
} | ||
|
||
assertSaveSuccess() { | ||
this.masthead().checkNotificationMessage( | ||
"Organization successfully saved.", | ||
); | ||
} | ||
|
||
assertDeleteSuccess() { | ||
this.masthead().checkNotificationMessage( | ||
"The organization has been deleted", | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.