Integration tests validate the handoff from the Complaint Triage Agent to the Escalation and Routing Agent, ensuring the enriched triage payload is correctly consumed and that all downstream tool writes succeed in the correct sequence.
ID
Scenario
Input
Expected Output
Pass Criteria
T11
Full handoff: low severity end to end in sandbox
New sandbox Zendesk ticket from a low-frustration email. Full HubSpot sandbox record exists.
Triage agent scores low, enriches ticket. Routing agent assigns ticket, sends Slack agent notification, sends Gmail acknowledgement. All within 90 seconds.
All four tool writes confirmed in sandbox logs: Zendesk update, HubSpot read, Slack message, Gmail send. Total elapsed time under 90 seconds.
T12
Full handoff: high severity end to end in sandbox
Sandbox ticket with legal threat keywords and high-LTV HubSpot record.
Triage scores high. Routing agent assigns to senior queue, sends two Slack messages (agent and manager), sends high-priority acknowledgement email.
Zendesk sandbox ticket shows priority=urgent; two Slack messages in test workspace; Gmail acknowledgement subject line contains High Priority indicator.
T13
Triage output schema mismatch
Manually post a malformed triage payload (missing category field) to the routing agent input.
Routing agent detects missing field, defaults category to unclassified, logs a schema_warning, and completes routing.
No workflow crash; schema_warning entry in execution log; ticket routed and notifications sent with category=unclassified.
T14
Overdue escalation alert fires correctly
Sandbox ticket created and intentionally left unresolved. Overdue threshold set to 2 minutes for testing purposes.
After 2 minutes, routing agent fires a Slack escalation alert to the manager and updates ticket priority in Zendesk sandbox.
Slack escalation alert received in test workspace within 10 seconds of threshold breach; Zendesk sandbox ticket priority incremented.
T15
Gmail acknowledgement personalisation by severity tier
Three sandbox tickets submitted simultaneously: one low, one medium, one high.
Three distinct acknowledgement emails sent from test Gmail, each with the correct expected response time: 24 hours (low), 4 hours (medium), 1 hour (high).
Three emails received in test inbox; subject and body response-time values match severity tier mapping defined in the build spec.
T16
Gmail send failure: SMTP error
Simulate Gmail sandbox returning a 500 error on acknowledgement send.
Agent logs a gmail_send_failed error, retries once after 30 seconds, tags the Zendesk ticket with ack_email_failed if retry also fails.
Retry attempt present in execution log; ack_email_failed tag on ticket; routing and Slack steps still complete successfully.
T17
Concurrent complaint volume: 10 tickets simultaneously
Submit 10 sandbox Zendesk tickets in rapid succession to simulate a complaint burst.
All 10 tickets processed independently with no queue starvation. All receive a triage score, routing assignment, and acknowledgement email within 3 minutes.
Execution log shows 10 independent workflow runs with no overlapping state contamination; all 10 Gmail test-inbox messages received within 3 minutes.
Edge case tests cover conditions that fall outside the normal complaint flow but are realistic given the process volume of approximately 90 complaints per month.
ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate complaint submission
The same customer submits the identical complaint twice within 5 minutes (e.g. double form submission).
Second ticket is detected as a duplicate via email address and subject match. Duplicate tagged in Zendesk and merged with the original. Only one acknowledgement sent.
Zendesk sandbox shows one active ticket with duplicate tag on the second; only one Gmail acknowledgement delivered to test inbox.
E02
Missing customer email address
Complaint submitted via web form with no email field populated.
Ticket created in Zendesk. HubSpot lookup skipped. Severity scored from text. Ticket tagged with missing_contact_email. Acknowledgement not sent.
no_email tag present; HubSpot call not made (confirmed in API request log); acknowledgement step skipped; triage score still applied.
E03
Zendesk API unavailable
Simulate Zendesk sandbox returning 503 at ticket creation step.
Workflow retries ticket creation up to three times with exponential back-off (30s, 60s, 120s). After three failures, an alert is sent to the internal Slack ops channel and the raw complaint is stored in the error queue.
Three retry attempts logged with correct back-off intervals; Slack ops channel receives failure alert; error queue contains the raw payload for manual recovery.
E04
Complaint contains only an attachment, no text body
Email complaint submitted with a PDF attachment and a blank body.
Ticket created. Text body set to attachment_only. Severity defaulted to medium. Ticket tagged with manual_review_required.
manual_review_required tag on ticket; severity=medium; no exception from the sentiment analysis step when passed an empty string.
E05
Agent assigned in Zendesk is no longer active
Routing agent attempts to assign a ticket to a Zendesk sandbox user whose account has been deactivated.
Routing falls back to the default support queue. Ticket tagged with routing_fallback. Slack notification sent to the queue channel rather than a named agent.
routing_fallback tag present; ticket sits in default queue; Slack notification delivered to queue channel in test workspace.
E06
Human agent does not acknowledge ticket within SLA window
Ticket assigned in Zendesk sandbox. Agent takes no action. Overdue threshold set to 3 minutes for test.
Escalation alert fires to manager Slack channel. Ticket priority upgraded in Zendesk. A second alert fires at 6 minutes if still unresolved.
First escalation Slack message received at 3-minute mark; priority incremented in Zendesk; second message at 6-minute mark if ticket open status unchanged.
E07
HubSpot returns a contact with no complaint history but very high LTV
Sandbox ticket from a new customer email matched to a HubSpot sandbox contact with LTV of $12,000 and zero prior support tickets.
Triage agent upgrades severity from its text-based score (medium) to high due to LTV rule. Routing agent triggers manager alert.
Severity in triage output=high with reason=ltv_override; manager Slack alert received in test workspace despite no negative text signals.