test: search for proper snackbar on user create error
This commit is contained in:
@@ -156,15 +156,8 @@ test.describe('User management page', () => {
|
|||||||
'option', { name: 'Admin' }
|
'option', { name: 'Admin' }
|
||||||
).click();
|
).click();
|
||||||
await adminCreateUserPage.createButton.click();
|
await adminCreateUserPage.createButton.click();
|
||||||
await adminUsersPage.snackbar.waitFor({
|
const snackbar = await adminUsersPage.getSnackbarData('snackbar-error');
|
||||||
state: 'attached'
|
await expect(snackbar.variant).toBe('error');
|
||||||
});
|
|
||||||
/*
|
|
||||||
TODO: assert snackbar behavior after deciding what should
|
|
||||||
happen here, i.e. if this should create a new user, stay the
|
|
||||||
same, un-delete the user, or something else
|
|
||||||
*/
|
|
||||||
// await adminUsersPage.getSnackbarData('snackbar-error');
|
|
||||||
await adminUsersPage.closeSnackbar();
|
await adminUsersPage.closeSnackbar();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -223,6 +223,7 @@
|
|||||||
"createUser.submit": "Create",
|
"createUser.submit": "Create",
|
||||||
"createUser.successfullyCreated": "The user has been created.",
|
"createUser.successfullyCreated": "The user has been created.",
|
||||||
"createUser.invitationEmailInfo": "Invitation email will be sent if SMTP credentials are valid. Otherwise, you can share the invitation link manually: <link></link>",
|
"createUser.invitationEmailInfo": "Invitation email will be sent if SMTP credentials are valid. Otherwise, you can share the invitation link manually: <link></link>",
|
||||||
|
"createUser.error": "Error while creating the user",
|
||||||
"editUserPage.title": "Edit user",
|
"editUserPage.title": "Edit user",
|
||||||
"editUser.status": "Status",
|
"editUser.status": "Status",
|
||||||
"editUser.submit": "Update",
|
"editUser.submit": "Update",
|
||||||
|
@@ -51,6 +51,14 @@ export default function CreateUser() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
enqueueSnackbar(formatMessage('createUser.error'), {
|
||||||
|
variant: 'error',
|
||||||
|
persist: true,
|
||||||
|
SnackbarProps: {
|
||||||
|
'data-test': 'snackbar-error',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
throw new Error('Failed while creating!');
|
throw new Error('Failed while creating!');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user