|
| 1 | +# E2E Tests for Apex Language Server Extension |
| 2 | + |
| 3 | +This package provides comprehensive end-to-end testing for the Apex Language Server Extension in VS Code Web environments. The test suite validates that the extension correctly integrates with VS Code's language server protocol and provides essential Apex language features. |
| 4 | + |
| 5 | +## Purpose |
| 6 | + |
| 7 | +The e2e test suite ensures the Apex Language Server Extension works correctly in real-world browser environments by testing: |
| 8 | + |
| 9 | +- **Extension Activation**: Verifies the extension properly activates when Apex files are opened |
| 10 | +- **Language Server Integration**: Confirms the LSP worker starts and initializes without errors |
| 11 | +- **Symbol Parsing**: Validates that Apex code is correctly parsed and symbols are identified |
| 12 | +- **Outline View**: Tests that the VS Code outline view displays Apex class structure |
| 13 | +- **Workspace Integration**: Ensures Apex files are recognized and handled in the workspace |
| 14 | +- **Stability**: Confirms the extension doesn't cause VS Code crashes or performance issues |
| 15 | + |
| 16 | +## Test Philosophy |
| 17 | + |
| 18 | +These tests focus on critical user-facing functionality rather than internal implementation details. They simulate real user interactions with the extension in a browser environment, providing confidence that the extension will work correctly when published. |
| 19 | + |
| 20 | +The test suite prioritizes: |
| 21 | + |
| 22 | +- **Reliability**: Tests are designed to be stable across different environments |
| 23 | +- **Performance**: Fast execution with parallel test runs where possible |
| 24 | +- **Maintainability**: Clean abstractions and reusable utilities |
| 25 | +- **Comprehensive Coverage**: Core functionality is thoroughly validated |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +- Node.js >= 20.0.0 |
| 30 | +- Extension must be built before running tests |
| 31 | +- VS Code Web test server capability |
| 32 | + |
| 33 | +## Running Tests |
| 34 | + |
| 35 | +```bash |
| 36 | +# Run all tests (recommended) |
| 37 | +npm run test:e2e |
| 38 | + |
| 39 | +# Debug mode with browser UI |
| 40 | +npm run test:e2e:debug |
| 41 | + |
| 42 | +# Visual mode for test development |
| 43 | +npm run test:e2e:visual |
| 44 | +``` |
| 45 | + |
| 46 | +## Test Environment |
| 47 | + |
| 48 | +The tests run against a real VS Code Web instance with the extension pre-loaded. This provides high confidence that the extension will work correctly in production browser environments. |
| 49 | + |
| 50 | +**Supported Browsers**: Chromium (primary testing target) |
| 51 | + |
| 52 | +**Environment Support**: |
| 53 | + |
| 54 | +- Local development with detailed debugging |
| 55 | +- CI/CD with stability optimizations |
| 56 | +- Debug modes for test development |
| 57 | + |
| 58 | +## Architecture |
| 59 | + |
| 60 | +The test suite uses Playwright for browser automation and is structured with: |
| 61 | + |
| 62 | +- **Utilities**: Reusable functions for common test operations |
| 63 | +- **Test Helpers**: Specialized functions for extension-specific testing |
| 64 | +- **Configuration**: Centralized settings and selectors |
| 65 | +- **Type Safety**: Full TypeScript support throughout |
| 66 | + |
| 67 | +## Debugging and Development |
| 68 | + |
| 69 | +The test suite includes comprehensive debugging capabilities: |
| 70 | + |
| 71 | +- Console error monitoring with intelligent filtering |
| 72 | +- Network failure tracking |
| 73 | +- Screenshot and video capture on failures |
| 74 | +- Detailed logging for test analysis |
| 75 | + |
| 76 | +For manual debugging, tests can be run against a standalone VS Code Web server with full developer tools access. |
| 77 | + |
| 78 | +## CI/CD Integration |
| 79 | + |
| 80 | +Tests are configured for continuous integration with: |
| 81 | + |
| 82 | +- Retry logic for flaky test handling |
| 83 | +- Environment-specific timeouts and worker configuration |
| 84 | +- Comprehensive reporting and artifact collection |
| 85 | +- Headless execution with debugging artifact generation |
| 86 | + |
| 87 | +## Contributing |
| 88 | + |
| 89 | +When adding new tests: |
| 90 | + |
| 91 | +1. Use existing test utilities and patterns |
| 92 | +2. Focus on user-facing functionality |
| 93 | +3. Ensure tests are reliable across environments |
| 94 | +4. Include proper error handling and logging |
| 95 | +5. Follow TypeScript best practices |
| 96 | + |
| 97 | +The test suite is designed to grow with the extension while maintaining reliability and performance. |
0 commit comments