All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 18m39s
6.6 KiB
6.6 KiB
Research: Separating E2E Tests from Integration Tests
Date: 2026-01-19 Status: In Progress Context: E2E tests exist with their own config but are not being run separately
Current State
Test Structure
- Unit tests:
src/tests/unit/(but most are co-located with source files) - Integration tests:
src/tests/integration/(28 test files) - E2E tests:
src/tests/e2e/(11 test files) ← NOT CURRENTLY RUNNING
Configurations
| Config File | Project Name | Environment | Port | Include Pattern |
|---|---|---|---|---|
vite.config.ts |
unit |
jsdom | N/A | Component/hook tests |
vitest.config.integration.ts |
integration |
node | 3099 | src/tests/integration/**/*.test.{ts,tsx} |
vitest.config.e2e.ts |
e2e |
node | 3098 | src/tests/e2e/**/*.e2e.test.ts |
Workspace Configuration
vitest.workspace.ts currently includes:
export default [
'vite.config.ts', // Unit tests
'vitest.config.integration.ts', // Integration tests
// ❌ vitest.config.e2e.ts is NOT included!
];
NPM Scripts
{
"test": "node scripts/check-linux.js && cross-env NODE_ENV=test tsx ./node_modules/vitest/vitest.mjs run",
"test:unit": "... --project unit ...",
"test:integration": "... --project integration ..."
// ❌ NO test:e2e script exists!
}
CI/CD Status
.gitea/workflows/deploy-to-test.yml runs:
- ✅
npm run test:unit -- --coverage - ✅
npm run test:integration -- --coverage - ❌ E2E tests are NOT run in CI
Key Findings
1. E2E Tests Are Orphaned
- 11 E2E test files exist but are never executed
- E2E config file exists (
vitest.config.e2e.ts) but is not referenced anywhere - No npm script to run E2E tests
- Not included in vitest workspace
- Not run in CI/CD pipeline
2. When Were E2E Tests Created?
Git history shows E2E config was added in commit e66027d ("fix e2e and deploy to prod"), but:
- It was never added to the workspace
- It was never added to CI
- No test:e2e script was created
This suggests the E2E separation was started but never completed.
3. How Are Tests Currently Run?
Locally:
npm test→ runs workspace (unit + integration only)npm run test:unit→ runs only unit testsnpm run test:integration→ runs only integration tests- E2E tests: Not accessible via any command
In CI:
- Only
test:unitandtest:integrationare run - E2E tests are never executed
4. Port Allocation
- Integration tests: Port 3099
- E2E tests: Port 3098 (configured but never used)
- No conflicts if both run sequentially
E2E Test Files (11 total)
admin-authorization.e2e.test.tsadmin-dashboard.e2e.test.tsauth.e2e.test.tsbudget-journey.e2e.test.tsdeals-journey.e2e.test.ts← Just fixed URL constraint issueerror-reporting.e2e.test.tsflyer-upload.e2e.test.tsinventory-journey.e2e.test.tsreceipt-journey.e2e.test.tsupc-journey.e2e.test.tsuser-journey.e2e.test.ts
Problems to Solve
Immediate Issues
- E2E tests are not running - Code exists but is never executed
- No way to run E2E tests - No npm script or CI job
- Coverage gaps - E2E scenarios are untested in practice
- False sense of security - Team may think E2E tests are running
Implementation Challenges
1. Adding E2E to Workspace
Option A: Add to workspace
// vitest.workspace.ts
export default [
'vite.config.ts',
'vitest.config.integration.ts',
'vitest.config.e2e.ts', // ← Add this
];
Impact: E2E tests would run with npm test, increasing test time significantly
Option B: Keep separate
- E2E remains outside workspace
- Requires explicit
npm run test:e2ecommand - CI would need separate step for E2E tests
2. Adding NPM Script
{
"test:e2e": "node scripts/check-linux.js && cross-env NODE_ENV=test tsx --max-old-space-size=8192 ./node_modules/vitest/vitest.mjs run --project e2e -c vitest.config.e2e.ts"
}
Dependencies:
- Uses same global setup pattern as integration tests
- Requires server to be stopped first (like integration tests)
- Port 3098 must be available
3. CI/CD Integration
Add to .gitea/workflows/deploy-to-test.yml:
- name: Run E2E Tests
run: |
npm run test:e2e -- --coverage \
--reporter=verbose \
--includeTaskLocation \
--testTimeout=120000 \
--silent=passed-only
Questions:
- Should E2E run before or after integration tests?
- Should E2E failures block deployment?
- Should E2E have separate coverage reports?
4. Test Organization Questions
- Are current "integration" tests actually E2E tests?
- Should some E2E tests be moved to integration?
- What's the distinction between integration and E2E in this project?
5. Coverage Implications
- E2E tests have separate coverage directory:
.coverage/e2e - Integration tests:
.coverage/integration - How to merge coverage from all test types?
- Do we need combined coverage reports?
Recommended Approach
Phase 1: Quick Fix (Enable E2E Tests)
- ✅ Fix any failing E2E tests (like URL constraints)
- Add
test:e2enpm script - Document how to run E2E tests manually
- Do NOT add to workspace yet (keep separate)
Phase 2: CI Integration
- Add E2E test step to
.gitea/workflows/deploy-to-test.yml - Run after integration tests pass
- Allow failures initially (monitor results)
- Make blocking once stable
Phase 3: Optimize
- Review test categorization (integration vs E2E)
- Consider adding to workspace if test time is acceptable
- Merge coverage reports if needed
- Document test strategy in testing docs
Next Steps
- Create
test:e2escript in package.json - Run E2E tests manually to verify they work
- Fix any failing E2E tests
- Document E2E testing in TESTING.md
- Add to CI once stable
- Consider workspace integration after CI is stable
Questions for Team
- Why were E2E tests never fully integrated?
- Should E2E tests run on every commit or separately?
- What's the acceptable test time for local development?
- Should we run E2E tests in parallel or sequentially with integration?
Related Files
vitest.workspace.ts- Workspace configurationvitest.config.e2e.ts- E2E test configurationsrc/tests/setup/e2e-global-setup.ts- E2E global setup.gitea/workflows/deploy-to-test.yml- CI pipelinepackage.json- NPM scripts