keycloak-scim/js/apps/admin-ui/cypress/e2e/organization.spec.ts

149 lines
4.3 KiB
TypeScript
Raw Normal View History

initial ui for organizations (#29643) * initial screen Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * more screens Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * added members tab Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * added the backend Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * added member add / invite models Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * initial version of the identity provider section Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * add link and unlink providers Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * small fix Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * PR comments Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Do not validate broker domain when the domain is an empty string Closes #29759 Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * added filter and value Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * added test Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * added first name last name Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * refresh menu when realm organization is changed Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * changed to record Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * changed to form data Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * fixed lint error Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Changing name of invitation parameters Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Chancing name of parameters on the client Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Enable organization at the realm before running tests Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Domain help message Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Handling model validation errors when creating organizations Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Message key for organizationDetails Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Do not change kc.org attribute on group Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * add realm into the context Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * tests Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Changing button in invitation model to use Send instead of Save Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Better message when validating the organization domain Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Fixing compilation error after rebase Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * fixed test Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * removed wait as it no longer required and skip flacky test Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * skip tests that are flaky Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * stabilize user create test Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> --------- Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com>
2024-05-29 12:34:02 +00:00
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");
});
});