<script type="text/javascript">
    require(['orosync/js/sync', 'oroui/js/messenger', 'orotranslation/js/translator'],
        function (sync, messenger, __) {
            sync.subscribe('oro/imap_sync_fail_u_{{ app.user.id }}', function (response) {
                messenger.notificationMessage(
                    'error',
                    __('oro.imap.sync.flash_message.user_box_failed', {username: response.username, host: response.host})
                );
            });
            {% if is_granted('oro_imap_sync_origin_credential_notifications') %}
            sync.subscribe('oro/imap_sync_fail_system', function (response) {
                messenger.notificationMessage(
                    'error',
                    __('oro.imap.sync.flash_message.system_box_failed', {username: response.username, host: response.host})
                );
            });
            {% endif %}
        });
</script>

{% if app.user %}
<script type="text/javascript">
    require(['orosync/js/sync', 'oroui/js/messenger', 'orotranslation/js/translator'],
        function (sync, messenger, __) {
            sync.subscribe('oro/imap_sync_fail_u_{{ app.user.id }}', function (response) {
                messenger.notificationMessage(
                    'error',
                    __('oro.imap.sync.flash_message.user_box_failed', {username: response.username, host: response.host})
                );
            });
            {% if is_granted('oro_imap_sync_origin_credential_notifications') %}
            sync.subscribe('oro/imap_sync_fail_system', function (response) {
                messenger.notificationMessage(
                    'error',
                    __('oro.imap.sync.flash_message.system_box_failed', {username: response.username, host: response.host})
                );
            });
            {% endif %}
        });
</script>
{% endif %}

Add notification on email synchronization failed when credentials are not correct - fix tests
BAP-16295: Add notification on email synchronization failed when credentials are not correct
 - fix tests
