test(support): improve Zammad user context tests with meaningful assertions

Enable Zammad settings via mock and verify user data appears in the
rendered HTML. Add tests for chat widget, email-only fallback, and
display_name fallback. Also improve JS variable naming in help.html.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-08 18:33:39 +00:00
parent 209e82f7e5
commit 8098856186
2 changed files with 75 additions and 16 deletions
+6 -3
View File
@@ -495,12 +495,14 @@ $(function() {
{% if user_name or user_email %}
{# Auto-fill Zammad form fields from the authenticated user context #}
$('#zammad-feedback-form').on('click', function() {
var maxAttempts = 30; /* ~3 s total wait for modal to appear */
var retryDelayMs = 100;
var attempts = 0;
var prefillForm = function() {
var $modal = $('.zammad-form-modal, .js-zammad-form-modal');
if ($modal.length === 0 && attempts < 30) {
if ($modal.length === 0 && attempts < maxAttempts) {
attempts++;
setTimeout(prefillForm, 100);
setTimeout(prefillForm, retryDelayMs);
return;
}
var $name = $modal.find('input[name="name"]');
@@ -512,7 +514,8 @@ $(function() {
if ($email.length && !$email.val()) $email.val({{ user_email | tojson }});
{% endif %}
};
setTimeout(prefillForm, 200);
var initialDelayMs = 200; /* wait for modal DOM to start rendering */
setTimeout(prefillForm, initialDelayMs);
});
{# Append user metadata to the ticket body before Zammad posts it #}