Integration tests validate the data handoffs between agents and across the full tool chain. All tests continue the sequential ID numbering from Phase 1.
ID
Scenario
Agents or tools involved
Expected behaviour
Pass criteria
T15
Timesheet Collection Agent output triggers Reconciliation Agent correctly
Timesheet Collection Agent → Reconciliation and Calculation Agent
On all timesheets confirmed approved, Reconciliation Agent receives the structured hours payload and begins schedule comparison without manual intervention
Execution log shows handoff event; Reconciliation Agent starts within 30 seconds; no data loss between agents (record count matches)
T16
Reconciliation Agent output triggers Approval Agent correctly
Reconciliation and Calculation Agent → Approval and Submission Agent
On payroll summary marked complete in Google Sheets, Approval Agent reads the summary tab and sends the approval email without manual trigger
Approval Agent execution starts within 60 seconds of Sheets write; email sent to correct address; Sheets summary linked in email body matches the written tab
T17
End-to-end data integrity across Deputy, Google Sheets, and Gusto
Deputy API → Reconciliation Agent → Google Sheets → Gusto sandbox
Gross pay figure in Gusto sandbox payload matches the figure written to Google Sheets for each employee to within $0.01
Automated reconciliation check script confirms field-level match for all 8 test employee records between Sheets and Gusto sandbox payload
T18
Slack exception alert contains sufficient detail for Finance Manager to act
Reconciliation Agent → Slack
Exception Slack message lists employee name, exception type (missing hours, unapproved overtime, leave conflict), and the expected vs actual value
Slack message in test channel contains all three data fields; no generic or empty exception descriptions
T19
QuickBooks journal staging is called after Google Sheets write completes
Reconciliation Agent → QuickBooks
After Sheets payroll summary is written, agent calls QuickBooks API to stage journal entries for gross pay and deductions
QuickBooks sandbox shows staged journal entries; total of journal debit entries equals total gross pay figure in Google Sheets
T20
Finance Manager resolves exception and workflow resumes
Slack alert → manual resolution → Reconciliation Agent resumes
After the Finance Manager updates the flagged employee record and signals resolution (via configured input mechanism), the Reconciliation Agent reprocesses that record and completes the summary
Updated record appears correctly in Google Sheets; no other records changed; Reconciliation Agent marks summary complete; Approval Agent triggers
T21
Approval email approve link is idempotent on double-click
Gmail approve link → Approval and Submission Agent → Gusto sandbox
If the approve link is clicked twice within a short window, only one Gusto API write is made; the second click returns an already-processed response
Gusto sandbox shows exactly one payroll write record for the period; execution log records two approval signal events but one Gusto call
T22
Slack confirmation message is posted after Gusto write succeeds
Approval and Submission Agent → Slack
After Gusto sandbox write returns a 200 response, Slack confirmation is posted within 60 seconds containing the period label, total gross payroll value, and submission timestamp
Slack message delivered; period label correct; gross total matches Sheets summary; timestamp within 2 minutes of Gusto write
T23
QuickBooks API rate limit encountered mid-run; agent backs off and retries
Reconciliation Agent → QuickBooks
Sandbox QuickBooks endpoint configured to return 429 on first call; agent waits 15 seconds and retries; second call succeeds
Execution log shows 429 received; 15-second backoff recorded; retry call succeeds; journal entries staged correctly; no data loss
Edge-case tests below use the E01 sequence. These cover boundary conditions that fall outside normal happy-path or single-agent failure scenarios.
ID
Edge-case scenario
Condition
Expected handling
Pass criteria
E01
Duplicate timesheet entry for the same employee and period
Deputy sandbox returns two shift records for employee 3 covering the same date range
Reconciliation Agent detects the duplicate, flags it as an exception, and does not double-count hours; Finance Manager alerted via Slack
Only one record for employee 3 in Sheets summary; duplicate flag in exception log; Slack alert names employee 3 and describes the duplicate
E02
Employee record missing an hourly rate in the HR data source
Deputy returns approved hours for employee 7; hourly rate field is blank
Reconciliation Agent cannot calculate gross pay; flags the record as incomplete; skips to next employee; Finance Manager alerted
Employee 7 row in Sheets has no gross pay value; exception log entry references missing rate field; no calculation attempted
E03
Deputy API unavailable for more than 10 minutes after trigger
Sandbox Deputy API configured to return 503 for 12 minutes from trigger time
Agent retries at 2-minute intervals up to 5 attempts; after fifth failure, posts critical alert to Slack and halts; Finance Manager notified to trigger manually
Five retry attempts logged at correct intervals; critical Slack alert delivered after fifth failure; workflow halted with clear error state
E04
Payroll summary contains a gross pay figure more than 30% above the prior period average for one employee
Employee 2 gross pay in Sheets is 38% higher than the prior period baseline loaded in the comparison config
Agent flags the anomaly as a high-value exception in the exception list; does not block the run but requires Finance Manager acknowledgement before approval email is sent
Anomaly flag present in Sheets exception tab for employee 2; approval email is withheld until Finance Manager sends the acknowledgement signal; log records the hold
E05
Business owner approval email link expires before the owner clicks it
Approve link configured with a 48-hour expiry; sandbox time advanced 49 hours without approval action
Agent detects link expiry; generates a fresh approval email with a new link; logs the re-send; does not submit to Gusto on the expired link
Second approval email delivered with valid new link; execution log records expiry detection and re-send; no Gusto write on expired link attempt
E06
Finance Manager takes no action on a Slack exception alert for more than 4 hours
Slack exception message posted; no resolution signal received within 4 hours in sandbox time simulation
Agent sends a follow-up Slack message in the same thread and a Gmail reminder to the Finance Manager; logs the escalation; does not proceed to payroll summary without resolution
Follow-up Slack message and Gmail reminder both delivered at the 4-hour mark; execution log records escalation event; workflow remains in exception-pending state