Testing overview
TryDevUtils uses Playwright for end-to-end testing of the web application. The test suite verifies that all developer utilities work without console errors.Running tests
Run the complete test suite:Test commands explained
- npm run test
- npm run test:ci
- Starts preview server in background
- Waits 5 seconds for server to be ready
- Runs Playwright tests with HTML reporter
- Opens interactive report on failure
Test structure
Tests are located in thetests/ directory:
Console errors test
This test verifies that every utility loads without JavaScript errors:What this test covers
Playwright configuration
The Playwright config is located inplaywright.config.ts:
Key configuration options
- fullyParallel: Disabled for CI stability (single worker)
- retries: 2 retries in CI, 0 locally
- timeout: 2 minutes per test (covers all utilities)
- trace: Captured only on failure to save disk space
- baseURL:
http://localhost:3000(preview server) - projects: Only Chromium (primary browser target)
Viewing test results
Local development
After runningnpm run test, open the HTML report:
- Passed/failed tests
- Test duration
- Screenshots on failure
- Trace viewer for debugging
CI/CD
In GitHub Actions, test results appear in the workflow logs:Debugging test failures
Run tests in headed mode
See the browser while tests run:Debug a specific test
Use Playwright’s debug mode:- Browser window (paused)
- Playwright Inspector (step through test)
- Browser DevTools (inspect page)
View test traces
If a test fails, view the trace:- Screenshots at each step
- Network requests
- Console logs
- DOM snapshots
Code quality checks
Beyond Playwright tests, ensure code quality with these tools:Type checking
Run TypeScript compiler to catch type errors:Linting
Run ESLint to enforce code standards:- TypeScript ESLint rules
- React Hooks rules
- React Refresh rules
Writing new tests
When adding new features, consider adding tests:Test best practices
- Use descriptive test names
- Wait for elements before interacting
- Use
waitForLoadState('networkidle')after navigation - Capture screenshots on failure
- Keep tests independent (no shared state)
- Clean up after tests (return to home page)
CI/CD integration
Tests run automatically on GitHub Actions:Test failure handling
- Retries: Tests retry up to 2 times in CI
- Artifacts: Failed test traces are uploaded
- Notifications: Failed builds trigger GitHub notifications
Performance testing
While not automated, you can manually test performance:Lighthouse
Run Lighthouse on the production build:Bundle size analysis
Check bundle sizes after building:Testing checklist
Before committing code:- Run
npm run testlocally - Run
npm run lintto check code style - Run
npm run checkto verify types - Test manually in browser (dev mode)
- Test production build (
npm run preview) - Verify no console errors or warnings
- Check network tab for failed requests
- Test on different screen sizes
Next steps
- Learn about deployment pipelines
- Review the building guide
- Return to development setup