proper fix for create user and re-enable tests (#29995)

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-05-30 13:47:34 +02:00 committed by GitHub
parent 1135f4f05f
commit 1e4ccf24bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 8 deletions

View file

@ -136,8 +136,8 @@ describe("User profile tabs", () => {
});
});
describe.skip("Check attributes are displayed and editable on user create/edit", () => {
it.skip("Checks that not required attribute is not present when user is created with email as username and edit username set to disabled", () => {
describe("Check attributes are displayed and editable on user create/edit", () => {
it("Checks that not required attribute is not present when user is created with email as username and edit username set to disabled", () => {
const attrName = "newAttribute1";
getUserProfileTab();
@ -171,7 +171,7 @@ describe("User profile tabs", () => {
masthead.checkNotificationMessage("Attribute deleted");
});
it.skip("Checks that not required attribute is not present when user is created/edited with email as username enabled", () => {
it("Checks that not required attribute is not present when user is created/edited with email as username enabled", () => {
const attrName = "newAttribute2";
getUserProfileTab();

View file

@ -31,7 +31,6 @@ export default class CreateUserPage {
}
goToCreateUser() {
cy.intercept("/admin/realms/master/users/profile/metadata").as("meta");
cy.get("body").then((body) => {
if (body.find(`[data-testid=${this.addUserBtn}]`).length > 0) {
cy.findByTestId(this.addUserBtn).click({ force: true });
@ -39,7 +38,6 @@ export default class CreateUserPage {
cy.findByTestId(this.emptyStateCreateUserBtn).click({ force: true });
}
});
cy.wait(["@meta"]);
return this;
}

View file

@ -37,11 +37,11 @@ export default function CreateUser() {
useFetch(
() => adminClient.users.getProfileMetadata({ realm: realmName }),
(userProfileMetadata) => {
if (!realm) {
if (!userProfileMetadata) {
throw new Error(t("notFound"));
}
form.setValue("attributes.locale", realm.defaultLocale || "");
form.setValue("attributes.locale", realm?.defaultLocale || "");
setUserProfileMetadata(userProfileMetadata);
},
[],
@ -69,7 +69,7 @@ export default function CreateUser() {
}
};
if (!realm) {
if (!realm || !userProfileMetadata) {
return <KeycloakSpinner />;
}