SoftTelRG

Web Automation: Make Tests Stable (Waits, Retries, CI Headless)

Tags: web, best-practices, ci, headless, stability

Enterprise reality: the difference between a demo tool and a production tool is flakiness control.

1) Prefer explicit waiting behavior
- If your app supports “clickable/visible” waits, use those instead of fixed sleeps.
- If your target page is slow, increase timeouts before you increase retries.

2) Use a retry loop for DOM churn
- React/Angular apps often detach and reattach nodes.
- A short retry loop (ex: 2–3 attempts) on click/typing actions prevents random failures.

3) Run headless in CI
- Use environment variables / system properties to toggle headless.
- Keep your CI screenshots/logs on failure (diagnostics win arguments).

4) Keep selectors maintainable
- Prefer: data-testid, id, name
- Avoid: deep CSS chains, “nth-child” unless no choice

5) Isolation
- Don’t share state across tests unless you have to.
- Reset test data or use dedicated test accounts.

6) Practical checklist
- Are your locators stable?
- Do you wait for the page state you actually need?
- Are timeouts realistic for your slowest environment?
- Do you have logs/screenshots when it fails?
Need help?

Use the Intelligent Assistant for guided troubleshooting and next actions.

Open Assistant