Recommendation

Writing stable autotests

Writing stable autotests

Recommendation for ComplexQA autotest authors: how to reduce brittle Playwright steps on a verified team domain.

Why

An unstable locator, a new-tab click, and a long pause instead of waiting for an element cause false failures in an autotest run. A stable scenario uses precise Targets, explicit waits, and status READY only on finished CASE items.

How to work

  1. Prefer ROLE, LABEL, and TESTID over CSS with substring *=.
  2. Wait for the element before an action: waitForSelector or toBeVisible, not a long waitForTimeout.
  3. Do not click links with target=_blank. Open the address with goto and a full https URL on a verified host.
  4. Move repeated locators into the object repository.
  5. Set status READY on a CASE only after the scenario and syntax are checked.
  6. Take login and password via TEST_ACCOUNT, not INLINE.

Full step flow: Autotest step authoring. Typical false failures in the report: How to author autotest steps without false failures.

What to avoid

BadGood
CSS with *= «just in case»Exact TESTID or ROLE plus name
waitForTimeout of 10000 ms before every clickwaitForSelector / toBeVisible on Target
Click a new-tab linkgoto with a full URL
The same locator copied into ten autotestsOne element in the object repository
CASE at READY with draft stepsPENDING until the scenario is ready

Example: brittle pause

json
{
  "action_name": "waitForTimeout",
  "value_text": "10000",
  "value_source_type": "INLINE"
}

Example: wait for an element

json
{
  "action_name": "waitForSelector",
  "target": { "kind": "TESTID", "value": "results-table" },
  "timeout_ms": 15000
}

Version 1.1.0 · Last updated 2026-09-14

Did this page help?