GitHub Actions
Basic Example Setup
Create.github/workflows/e2e-tests.yml
:
Optimization Tips
Use headless mode in CI
Use headless mode in CI
Always run headless in CI for better performance:
Implement retry logic
Implement retry logic
Add smart retry logic for flaky tests:
Troubleshooting
Error: connect ECONNREFUSED ::1:{SOME_PORT}
Error: connect ECONNREFUSED ::1:{SOME_PORT}
This error occurs when Node.js resolves “localhost” to ::1 (IPv6) but Anvil only listens on IPv4 addresses.Solution: Force Node.js to prefer IPv4 addresses by setting the This ensures:
NODE_OPTIONS
environment variable:localhost
resolves to127.0.0.1
(IPv4) instead of::1
(IPv6)- Anvil can properly listen on the resolved address
- Tests can successfully connect to the local blockchain
Flaky tests with high parallelism only in CI/CD workflows
Flaky tests with high parallelism only in CI/CD workflows
E2E tests may become less reliable with increased parallelism, especially when multiple wallet interactions occur simultaneously. This is
not an issue locally though.Solutions:
- Reduce test parallelism in CI environments:
- Add longer timeouts for wallet operations:
- Use test isolation to prevent state conflicts: