|
1 | | -# devtools |
2 | | -Browser devtools extension for debugging WebdriverIO tests |
| 1 | +# WebdriverIO DevTools |
| 2 | + |
| 3 | +A powerful browser devtools extension for debugging, visualizing, and controlling WebdriverIO test executions in real-time. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### 🎯 Interactive Test Execution |
| 8 | +- **Selective Test Rerun**: Click play buttons on individual test cases, test suites, or Cucumber scenario examples to re-execute them instantly |
| 9 | +- **Smart Browser Reuse**: Tests rerun in the same browser window without opening new tabs, improving performance and user experience |
| 10 | +- **Stop Test Execution**: Terminate running tests with proper process cleanup using the stop button |
| 11 | +- **Test List Preservation**: All tests remain visible in the sidebar during reruns, maintaining full context |
| 12 | + |
| 13 | +### 🎭 Multi-Framework Support |
| 14 | +- **Mocha**: Full support with grep-based filtering for test/suite execution |
| 15 | +- **Jasmine**: Complete integration with grep-based filtering |
| 16 | +- **Cucumber**: Scenario-level and example-specific execution with feature:line targeting |
| 17 | + |
| 18 | +### 📊 Real-Time Visualization |
| 19 | +- **Live Browser Preview**: View the application under test in a scaled iframe with automatic screenshot updates |
| 20 | +- **Actions Timeline**: Command-by-command execution log with timestamps and parameters |
| 21 | +- **Test Hierarchy**: Nested test suite and test case tree view with status indicators |
| 22 | +- **Live Status Updates**: Immediate spinner icons and visual feedback when tests start/stop |
| 23 | + |
| 24 | +### 🧐 Debugging Capabilities |
| 25 | +- **Command Logging**: Detailed capture of all WebDriver commands with arguments and results |
| 26 | +- **Screenshot Capture**: Automatic screenshots after each command for visual debugging |
| 27 | +- **Source Code Mapping**: View the exact line of code that triggered each command |
| 28 | +- **Console Logs**: Capture and display application console output with timestamps and log levels |
| 29 | +- **Network Logs**: Monitor and inspect HTTP requests/responses including headers, payloads, timing, and status codes |
| 30 | +- **Error Tracking**: Full error messages and stack traces for failed tests |
| 31 | + |
| 32 | +### 🎮 Execution Controls |
| 33 | +- **Global Test Running State**: All play buttons automatically disable during test execution to prevent conflicts |
| 34 | +- **Immediate Feedback**: Spinner icons update instantly when tests start |
| 35 | +- **Actions Tab Auto-Clear**: Execution data automatically clears and refreshes on reruns |
| 36 | +- **Metadata Tracking**: Test duration, status, and execution timestamps |
| 37 | + |
| 38 | +### 🔍︎ TestLens |
| 39 | +- **Code Intelligence**: View test definitions directly in your editor |
| 40 | +- **Run/Debug Actions**: Execute individual tests or suites with inline CodeLens actions |
| 41 | +- **Quick Navigation**: Jump between test code and execution results seamlessly |
| 42 | +- **Status Indicators**: Visual feedback for test pass/fail states in the editor |
| 43 | + |
| 44 | +### 🏗️ Architecture |
| 45 | +- **Frontend**: Lit web components with reactive state management (@lit/context) |
| 46 | +- **Backend**: Fastify server with WebSocket streaming for real-time updates |
| 47 | +- **Service**: WebdriverIO reporter integration with stable UID generation |
| 48 | +- **Process Management**: Tree-kill for proper cleanup of spawned processes |
| 49 | + |
| 50 | +## Demo |
| 51 | + |
| 52 | +### 🛠️ Test Rerunner & Snapshot |
| 53 | +<img src="https://github.com/user-attachments/assets/c3804559-c0ec-441a-80dc-e4048385f3b2" alt="Test Rerunner & Snapshot Demo" width="400" /> |
| 54 | + |
| 55 | +### 🛑 Stop Test Runner |
| 56 | +<img src="https://github.com/user-attachments/assets/f42e43ed-bfac-4280-be5f-87895fb232d3" alt="Stop Test Runner Demo" width="400" /> |
| 57 | + |
| 58 | +### 🔍︎ TestLens |
| 59 | +<img src="https://github.com/user-attachments/assets/72c576a1-330a-49c4-affe-df260e7c70df" alt="TestLens Demo" width="400" /> |
| 60 | + |
| 61 | +### >_ Console Logs |
| 62 | +<img src="https://github.com/user-attachments/assets/aff14f15-a298-4a12-bc3d-8e4deefddae6" alt="Console Logs" width="400" /> |
| 63 | + |
| 64 | +### 🌐 Network Logs |
| 65 | +<img src="https://github.com/user-attachments/assets/2cca4885-f989-4d07-b7ce-a4fa476c3c1c" alt="Network Logs 1" width="400" /> |
| 66 | + |
| 67 | +<img src="https://github.com/user-attachments/assets/0f81e0af-75b5-454f-bffb-e40654c89908" alt="Network Logs 2" width="400" /> |
| 68 | + |
| 69 | +## Installation |
| 70 | + |
| 71 | +```bash |
| 72 | +npm install @wdio/devtools-service |
| 73 | +``` |
| 74 | + |
| 75 | +## Configuration |
| 76 | + |
| 77 | +Add the service to your `wdio.conf.js`: |
| 78 | + |
| 79 | +```javascript |
| 80 | +export const config = { |
| 81 | + // ... |
| 82 | + services: ['devtools'] |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +## Usage |
| 87 | + |
| 88 | +1. Run your WebdriverIO tests |
| 89 | +2. The devtools UI automatically opens in an external browser window at `http://localhost:3000` |
| 90 | +3. Tests begin executing immediately with real-time visualization |
| 91 | +4. View live browser preview, test progress, and command execution |
| 92 | +5. After initial run completes, use play buttons to rerun individual tests or suites |
| 93 | +6. Click stop button anytime to terminate running tests |
| 94 | +7. Explore actions, metadata, console logs, and source code in the workbench tabs |
| 95 | + |
| 96 | +## Development |
| 97 | + |
| 98 | +```bash |
| 99 | +# Install dependencies |
| 100 | +pnpm install |
| 101 | + |
| 102 | +# Build all packages |
| 103 | +pnpm build |
| 104 | + |
| 105 | +# Run demo |
| 106 | +pnpm demo |
| 107 | +``` |
| 108 | + |
| 109 | +## Project Structure |
| 110 | + |
| 111 | +``` |
| 112 | +packages/ |
| 113 | +├── app/ # Frontend Lit-based UI application |
| 114 | +├── backend/ # Fastify server with test runner management |
| 115 | +├── service/ # WebdriverIO service and reporter |
| 116 | +└── script/ # Browser-injected trace collection script |
| 117 | +``` |
| 118 | + |
| 119 | +## Contributing |
| 120 | + |
| 121 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 122 | + |
| 123 | +## :page_facing_up: License |
| 124 | + |
| 125 | +[MIT](/LICENSE) |
0 commit comments