Testing strategy overview
Manual verification checklist
Before writing automated tests, verify the basics withdebug="true":
1
Component renders
Open your page and confirm the SofIA widget appears. Check the console for
[Sofia SDK] Configuration Error — if absent, props are valid.2
Template loads
Look for
[Sofia SDK] Settings - Template loaded: {n} fields in the console. If n matches your expected field count, the template parsed correctly.3
Generate button appears
If both
template and templateid are set, the generate button should be visible. If missing, check template validation logs.4
handleReport fires
Click Generate after a conversation and verify your
handleReport callback receives data. Log the output with JSON.stringify(report, null, 2).Unit testing callbacks
Test your callback functions independently from the SDK. These tests verify that your application correctly processes the data SofIA delivers.Testing handleReport
Testing template validation
Integration testing
Testing component mounting (Vanilla JS)
Testing with React
Testing with Angular
Mocking the SDK for CI/CD
In CI environments where the SDK cannot connect to real servers, mock the web component to test your integration logic:Testing report delivery
SofIA delivers data through callback properties, not DOM events. Reports arrive by the SDK calling the
handleReport property you assign (sofia.handleReport = fn) — the SDK does not emit handle-report/set-is-open/set-get-last-report DOM events. Test the callback path, not addEventListener.Test environment configuration
Vitest configuration
Setup file
Next steps
- Troubleshooting — solutions for common issues
- Error Reference — complete catalog of SDK error messages
- Migration Guide — upgrade from v0.x to v1.0