Get started testing the Forms system in 5 minutes
# Run everything
npm test && npm run e2e
# Just unit tests
npm test
# Just E2E tests
npm run e2e
# Forms tests specifically
npm test -- forms.test.ts
npx playwright test 50-forms.spec.ts
# With UI (interactive)
npx playwright test 50-forms.spec.ts --ui
# Debug mode
npx playwright test 50-forms.spec.ts --debugUnit Tests (forms.test.ts)
- Form creation & validation
- Schema validation
- Submission handling
- Wizard logic
E2E Tests (50-forms.spec.ts)
- Form CRUD operations
- Builder UI interactions
- Public form rendering
- Form submissions
- Headless API endpoints
See /docs/FORMS_TESTING_SCENARIOS.md for step-by-step testing guide.
-
Start dev server:
npm run dev
-
Setup database:
cd my-sonicjs-app npm run setup:db cd ..
-
Verify server is running:
curl http://localhost:8787/health
✓ Forms Service (45 tests)
✓ Form Creation (5)
✓ Form Schema Validation (5)
✓ Form Settings (3)
✓ Form Submission Data (5)
✓ Form Queries (4)
✓ Form Updates (3)
✓ JSON Serialization (4)
✓ Validation Rules (6)
✓ Wizard Form Logic (5)
✓ Component Configuration (5)
Test Files: 1 passed (1)
Tests: 45 passed (45)
✓ Forms Management (7 tests)
✓ Form Builder UI (8 tests)
✓ Public Form Rendering (4 tests)
✓ Form Submissions (5 tests)
✓ Headless API (6 tests)
✓ Multi-Page Wizards (5 tests)
35 passed (35)
Fix: Ensure database is set up with npm run setup:db
Fix: Increase timeout in test (Form.io takes 10-15 seconds to load)
Fix: Wait for Form.io to fully initialize before dragging
Fix: Check that dev server is running on port 8787
Before launch, verify:
-
npm test- All unit tests pass -
npm run e2e- All E2E tests pass - Manual testing complete (25/25 scenarios)
- Tested in Chrome, Firefox, Safari
- Tested on mobile
- No console errors
- Performance acceptable
- Testing Suite Overview:
/docs/FORMS_TESTING_SUITE.md - Manual Testing Scenarios:
/docs/FORMS_TESTING_SCENARIOS.md - E2E Test File:
/tests/e2e/50-forms.spec.ts - Unit Test File:
/packages/core/src/__tests__/services/forms.test.ts
Tests are passing when:
- ✅ 100% unit tests pass
- ✅ 100% E2E tests pass
- ✅ No flaky tests
- ✅ No console errors
- ✅ Performance targets met
Ready to test? Run npm test && npm run e2e now! 🚀