4.2 How to Conditionally Skip Test Steps (`IF` Conditions & Toggles)
How to conditionally skip steps based on runtime variables, environment flags, or active/inactive toggles.
Same Suite, Different Rules Per Environment
Section titled “Same Suite, Different Rules Per Environment”Dev might skip Two-Factor Authentication entirely; Staging enforces it; Production requires it plus an extra fraud check that doesn’t exist anywhere else. Cloning the whole case per environment just to add or remove one step multiplies maintenance debt at exactly the rate CertiBlocks solve for shared logic (see 4.1) – so instead, any individual step can carry its own condition, evaluated fresh against that run’s live variables and DOM the moment the step is reached. When the condition doesn’t hold, the step is skipped – not failed – and the case simply moves on to the next one.
The Real Condition Catalog
Section titled “The Real Condition Catalog”Conditions aren’t limited to the three textbook examples – the Condition Modal groups a dozen concrete rule types into four families, so a step can branch on the DOM, on a variable, on the current URL, or on an arbitrary JavaScript expression when nothing built-in covers the case.
| Family | Rule Types | Typical Use |
|---|---|---|
| Element | EXISTS / NOT_EXISTS, VISIBLE / NOT_VISIBLE, TEXT_EQUALS, TEXT_CONTAINS, VALUE_EQUALS, ATTRIBUTE_EQUALS | Skip a step only if a cookie banner, feature-flagged widget, or modal is (or isn’t) actually on screen. |
| Variable | EQUALS, NOT_EQUALS, NOT_NULL | Branch on {{ ENV }}, a captured API response value, or whether an earlier step ever populated a variable at all. |
| URL | CONTAINS, EQUALS | Run a step only once navigation has actually landed on the page it expects, useful after a redirect that doesn’t always fire. |
| Escape hatch | JS_EXPRESSION | A JavaScript expression evaluating to true/false, for the rare check none of the built-in rules quite cover. |
A condition is evaluated fresh on every run, against whatever the live DOM or variable state actually is – which is a different tool from opening a step’s action menu and choosing “Skip Step” (or “Enable Step”). Skipping is a static, author-time switch with no logic behind it, useful for temporarily silencing a step while you debug a case without deleting it or wiring up a real condition you don’t actually need long-term.