Phase 2 integration tests validate that both agents correctly read from and write to Zendesk, Slack, HubSpot, and Gmail APIs in the staging environment. Each test creates a real ticket in Zendesk staging, runs the automation, and confirms that tags, assignments, Slack messages, and HubSpot logs are created as expected.
Test ID
Scenario
Input
Expected Output
Pass Criteria
T17
Create billing ticket, read from Zendesk API, write tags and assignment back
POST /tickets with { subject: 'Refund request', description: 'Charged twice', customer_email: 'test@example.com' } to Zendesk staging
Zendesk API returns ticket ID; Ticket Analyzer reads ticket via GET /tickets/{id}; Smart Router returns { tags: [billing, high], assignment: billing-urgent }; automation POSTs update with tags and custom fields
Ticket created in Zendesk staging; tags and assignment written without error; ticket status changed to assigned
T18
Send Slack notification to billing-urgent queue channel
After routing, automation calls Slack Webhook with { channel: #billing-urgent, text: 'High-priority billing ticket: Refund request (ID: 1234)', urgency: high }
Slack receives POST request; message appears in #billing-urgent within 5 seconds; message includes ticket link and priority emoji
Slack message posted to correct channel; formatted correctly; contains ticket link and priority indicator
T19
Log triage decision to HubSpot contact record
After routing, automation POSTs to HubSpot API with { contact_email: 'test@example.com', ticket_category: billing, priority: high, assigned_queue: billing-urgent, triage_timestamp: <ISO8601> }
HubSpot API returns 200 OK; custom properties on contact record updated: ticket_category_last = 'billing', triage_priority = 'high', triage_queue = 'billing-urgent'
HubSpot contact record updated; all fields populated; timestamp is current
T20
Read email forwarded from Gmail and create Zendesk ticket
Gmail forwards support email to automation via webhook; automation extracts sender, subject, and body; creates ticket in Zendesk
Zendesk ticket created with { requester_email: <from Gmail>, subject: <Gmail subject>, description: <Gmail body>, source: email }; ticket categorized and routed
Email parsed correctly; Zendesk ticket created with source=email; triage runs without error
T21
Handle Zendesk API rate limit (429 response)
Automation receives 429 Too Many Requests while writing tags; automatic retry with exponential backoff
After 3 retries with 1-2-4 second delays, request succeeds; tag is written; no ticket is lost
Retry logic executes; request succeeds on retry; no data is dropped
T22
Handle missing HubSpot contact (email not in CRM)
Ticket arrives from email not found in HubSpot; automation attempts to log triage to non-existent contact
HubSpot API returns 404; automation creates new contact record with email and ticket metadata; triage data is still logged
New contact created in HubSpot; triage metadata attached; no error in automation flow
T23
Handle Slack channel does not exist or is archived
Smart Router assigns ticket to queue with channel #archived-queue; automation tries to post Slack message
Slack API returns 404 (channel not found); automation logs error, sends fallback notification to #general, and creates ticket in Zendesk with escalation flag
Fallback notification sent to #general; ticket escalation flag set; automation continues
T24
Zendesk custom field does not exist in target organization
Automation tries to write custom field 'sla_target_minutes' that does not exist in staging Zendesk
Zendesk API returns 422 Unprocessable Entity; automation logs field mismatch, writes available standard fields instead, and creates alert in FullSpec dashboard
Error is logged; standard fields are written; alert is visible in dashboard
Edge Case Tests: These scenarios represent unusual or potentially problematic tickets that require special handling, fallback logic, or human review flags.
Test ID
Scenario
Input
Expected Output
Pass Criteria
E01
Abusive language or threat detected
Ticket body contains profanity, threats, or harassment language; sentiment score is < -0.9
category: complaint, priority: escalation, safety_flag: true, target_agent: 'Support Lead', requires_review: true
Safety flag is set; ticket is escalated to Support Lead; marked for manual review before assignment
E02
Ticket references product not in company portfolio
Ticket mentions 'Product X' which customer does not have license for; or mentions a competitor product name
category: unknown, priority: high, escalation_flag: true, target_agent: 'Support Lead', note: 'Customer may be requesting help with wrong product'
Agent flags for manual review; ticket is escalated; note is added to ticket
E03
Customer mentions legal action or lawsuit threat
Ticket body contains phrases like 'lawyer', 'lawsuit', 'legal action', or 'class action'
category: legal, priority: escalation, escalation_flag: true, target_agent: 'Support Lead', requires_legal_review: true
Category is legal; legal review flag is set; escalation is automatic; no standard agent assignment
E04
Ticket is a duplicate of recently resolved ticket
New ticket arrives with same customer email and very similar content to ticket closed 2 days ago
category: duplicate, priority: normal, escalation_flag: false, linked_ticket_id: <previous ticket ID>, target_agent: 'Support Agent', note: 'See linked ticket for context'
Duplicate is detected and linked; agent is assigned to reference previous solution
E05
Ticket contains PII (password, credit card, SSN) in body
Ticket body includes patterns matching credit card numbers, social security numbers, or customer explicitly states 'my password is X'
priority: escalation, pii_flag: true, requires_manual_review: true, sanitize_before_logging: true, target_agent: 'Support Lead'
PII flag is set; ticket is flagged for manual review; PII is redacted before any logging
E06
Very long ticket with multiple issues
Ticket body is > 5000 characters and mentions 5 or more distinct problems
category: multi-issue, priority: high, escalation_flag: true, target_agent: 'Support Lead', note: 'Ticket contains multiple issues. Recommend splitting into sub-tickets.',
Multi-issue flag is set; escalation to Support Lead; note recommends decomposition
E07
Ticket from VIP or high-value customer
Customer email domain matches known enterprise account in HubSpot with ARR > $100k
priority: raised to high if normal, priority: escalation if already high, sla_minutes: reduced by 50%, target_agent: assigned to senior agent if available
Priority is elevated; SLA is reduced; assignment goes to senior team member
E08
Ticket in language other than English
Ticket body detected as Spanish, French, German, or Japanese (supported languages)
language: detected language, translation_provided: true, category: extracted from translated body, priority: assigned based on translated content, note: 'Ticket auto-translated from <language>'
Language is detected; content is translated; triage proceeds on translated text; note is added