This example demonstrates the @wdio/nightwatch-devtools plugin in action.
Make sure you have Chrome/Chromium installed on your system. The example uses Nightwatch's built-in chromedriver manager.
- Build the plugin:
cd packages/nightwatch-devtools
pnpm build- Install dependencies:
pnpm installRun the example tests with DevTools UI:
pnpm exampleIf you encounter chromedriver issues, you can:
- Install chromedriver globally:
npm install -g chromedriver-
Or download Chrome for Testing: Visit: https://googlechromelabs.github.io/chrome-for-testing/
-
Update nightwatch.conf.cjs with your chromedriver path:
webdriver: {
start_process: true,
server_path: '/path/to/chromedriver',
port: 9515
}When you run the example, the plugin will:
- ✅ Start the DevTools backend server on port 3000
- ✅ Open the DevTools UI in a new browser window
- ✅ Run your Nightwatch tests
- ✅ Stream all commands, logs, and results to the UI in real-time
- ✅ Keep the UI open until you close the browser window
- Commands Tab: Every Nightwatch command executed (url, click, assert, etc.)
- Console Tab: Browser console logs
- Network Tab: All HTTP requests made during tests
- Tests Tab: Test suite structure and results (pass/fail)
- Metadata Tab: Session information and test timing
- Sources Tab: Test file sources
- Logs Tab: Framework logs and debugging information
Notice the test files in example/tests/ have zero DevTools-specific code. They're pure Nightwatch tests. The plugin automatically:
- Hooks into Nightwatch's lifecycle
- Captures all test data
- Sends it to the DevTools backend
- Updates the UI in real-time
// nightwatch.conf.cjs
module.exports = {
plugins: ['@wdio/nightwatch-devtools']
}module.exports = {
plugins: [
['@wdio/nightwatch-devtools', {
port: 4000,
hostname: 'localhost'
}]
]
}Make sure chromedriver is installed:
pnpm install chromedriver
# Then rebuild it
pnpm rebuild chromedriverOr install globally:
npm install -g chromedriverMake sure you've built the plugin:
pnpm buildChange the port in your config:
plugins: [
['@wdio/nightwatch-devtools', { port: 4000 }]
]