Skip to content
Snippets Groups Projects
Unverified Commit 2b5fd3de authored by github-automation-metabase's avatar github-automation-metabase Committed by GitHub
Browse files

:robot: backported "Ensure that correct error messages show up in the Edit user modal" (#49709)


* Ensure that correct error messages show up in the Edit user modal (#48966)

* kick ci

---------

Co-authored-by: default avatarRaphael Krut-Landau <raphael.kl@gmail.com>
parent bd29f819
Branches
Tags
No related merge requests found
......@@ -255,9 +255,17 @@ describe("scenarios > admin > people", () => {
showUserOptions(normalUserName);
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Edit user").click();
cy.findByDisplayValue(normal.first_name).click().clear().type(NEW_NAME);
clickButton("Update");
modal().within(() => {
cy.log("Should display error messages (metabase#46449)");
cy.findByLabelText("First name").click().clear().type(" ");
clickButton("Update");
cy.findByText(/non-blank string./).should("exist");
cy.findByLabelText("First name").click().clear().type(NEW_NAME);
clickButton("Update", { timeout: 4000 });
});
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(NEW_FULL_NAME);
cy.location().should(loc => expect(loc.pathname).to.eq("/admin/people"));
......@@ -871,8 +879,8 @@ function showUserOptions(full_name) {
});
}
function clickButton(button_name) {
cy.button(button_name).should("not.be.disabled").click();
function clickButton(button_name, opts = {}) {
cy.button(button_name, opts).should("not.be.disabled").click();
}
function assertTableRowsCount(length) {
......
......@@ -43,7 +43,8 @@ export const currentUser = createReducer<User | null>(null, builder => {
return state;
})
.addCase(Users.actionTypes.UPDATE, (state, { payload }) => {
const isCurrentUserUpdated = state?.id === payload.user.id;
const isCurrentUserUpdated =
payload.user && state?.id === payload.user.id;
if (isCurrentUserUpdated) {
return {
...state,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment