|
| 1 | +--- |
| 2 | +description: 'E2E testing patterns and best practices for Calva extension development.' |
| 3 | +applyTo: '**/src/extension-test/e2e,package.json' |
| 4 | +--- |
| 5 | + |
| 6 | +# E2E Testing Memory |
| 7 | + |
| 8 | +Patterns for reliable end-to-end testing and debugging workflows. |
| 9 | + |
| 10 | +## Use Containerized Test Runner |
| 11 | +Always use the containerized test runner to reproduce CI conditions exactly: |
| 12 | + |
| 13 | +```bash |
| 14 | +npm run e2e-test-containerized |
| 15 | +``` |
| 16 | + |
| 17 | +**Why:** The containerized runner can use Insiders even if it is being used on the host machine. |
| 18 | + |
| 19 | +## Test Both Development and Production Scenarios |
| 20 | +E2E tests should cover both: |
| 21 | +- **Development mode**: `extensionDevelopmentPath` for source code testing |
| 22 | +- **Production mode**: VSIX package testing (what users actually install) |
| 23 | + |
| 24 | +## Use npm Scripts for Containerized Testing |
| 25 | +Always use npm scripts rather than running Docker commands directly: |
| 26 | +- `npm run e2e-test-containerized` - for containerized testing |
| 27 | + |
| 28 | +This ensures proper environment setup and dependency management. |
| 29 | + |
| 30 | +## Environment Variable Debugging |
| 31 | +When debugging CI failures related to environment variables: |
| 32 | +- Use exact CI argument reproduction: `npm run e2e-test-containerized -- --ci` |
| 33 | +- Check JavaScript variable access syntax: `process.env.VARIABLE_NAME` not `process.env[VARIABLE_NAME]` |
| 34 | +- Verify variable scoping in launch scripts |
| 35 | + |
| 36 | +## Data-Oriented E2E Debugging |
| 37 | +Follow the general debugging workflow for E2E issues: |
| 38 | +1. **Gather context** - understand CI vs local environment differences |
| 39 | +2. **Reproduce precisely** - use containerized runner with exact CI conditions |
| 40 | +3. **Analyze data flow** - trace through launch.js and test setup |
| 41 | +4. **Apply targeted fix** - address root cause in environment/configuration |
| 42 | +5. **Validate thoroughly** - test with both development and CI scenarios |
0 commit comments