test: update snackbar with variant and data-test attributes
This commit is contained in:
@@ -6,13 +6,13 @@ import Paper from '@mui/material/Paper';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import LoadingButton from '@mui/lab/LoadingButton';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import { useSnackbar } from 'notistack';
|
||||
|
||||
import { CREATE_APP_CONFIG } from 'graphql/mutations/create-app-config';
|
||||
import { UPDATE_APP_CONFIG } from 'graphql/mutations/update-app-config';
|
||||
|
||||
import Form from 'components/Form';
|
||||
import { Switch } from './style';
|
||||
import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar';
|
||||
|
||||
type AdminApplicationSettingsProps = {
|
||||
appKey: string;
|
||||
@@ -36,7 +36,7 @@ function AdminApplicationSettings(
|
||||
);
|
||||
|
||||
const formatMessage = useFormatMessage();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const enqueueSnackbar = useEnqueueSnackbar();
|
||||
|
||||
const handleSubmit = async (values: any) => {
|
||||
try {
|
||||
@@ -55,6 +55,9 @@ function AdminApplicationSettings(
|
||||
}
|
||||
enqueueSnackbar(formatMessage('adminAppsSettings.successfullySaved'), {
|
||||
variant: 'success',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-save-admin-apps-settings-success'
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error('Failed while saving!');
|
||||
|
@@ -15,7 +15,12 @@ const ApolloProvider = (props: ApolloProviderProps): React.ReactElement => {
|
||||
|
||||
const onError = React.useCallback(
|
||||
(message) => {
|
||||
enqueueSnackbar(message, { variant: 'error' });
|
||||
enqueueSnackbar(message, {
|
||||
variant: 'error',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-error'
|
||||
}
|
||||
});
|
||||
},
|
||||
[enqueueSnackbar]
|
||||
);
|
||||
|
@@ -82,6 +82,9 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
|
||||
|
||||
enqueueSnackbar(formatMessage('connection.deletedMessage'), {
|
||||
variant: 'success',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-delete-connection-success'
|
||||
}
|
||||
});
|
||||
} else if (action.type === 'test') {
|
||||
setVerificationVisible(true);
|
||||
|
@@ -31,6 +31,9 @@ export default function DeleteRoleButton(props: DeleteRoleButtonProps) {
|
||||
setShowConfirmation(false);
|
||||
enqueueSnackbar(formatMessage('deleteRoleButton.successfullyDeleted'), {
|
||||
variant: 'success',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-delete-role-success'
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error('Failed while deleting!');
|
||||
|
@@ -29,6 +29,9 @@ export default function DeleteUserButton(props: DeleteUserButtonProps) {
|
||||
setShowConfirmation(false);
|
||||
enqueueSnackbar(formatMessage('deleteUserButton.successfullyDeleted'), {
|
||||
variant: 'success',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-delete-user-success'
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error('Failed while deleting!');
|
||||
|
@@ -36,6 +36,9 @@ export default function ContextMenu(
|
||||
|
||||
enqueueSnackbar(formatMessage('flow.successfullyDuplicated'), {
|
||||
variant: 'success',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-duplicate-flow-success'
|
||||
}
|
||||
});
|
||||
|
||||
onClose();
|
||||
|
@@ -43,6 +43,9 @@ export default function ResetPasswordForm() {
|
||||
|
||||
enqueueSnackbar(formatMessage('resetPasswordForm.passwordUpdated'), {
|
||||
variant: 'success',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-reset-password-success'
|
||||
}
|
||||
});
|
||||
|
||||
navigate(URLS.LOGIN);
|
||||
|
Reference in New Issue
Block a user