StrikekitStrikekit

if / else if / else

Line-by-line conditional branches for optional UI

Line-by-line chains for optional UI (banners, cookies, dialogs). Contiguous if → zero or more else if → optional else. After then / else, run one existing command via the normal execute path — branching does not redefine click / fill / etc.

Syntax

When I if see "<text>" then <action>
And I else if see "<text>" then <action>
And I else <action>

When I if not see "<text>" then <action>
And I else <action>

<action> is any existing step command remainder (for example click on "Dismiss", fill "email" with "a@b.com").

Forms

FormMeaning
if see "…" then <action>Start chain — run action if text is visible
if not see "…" then <action>Start chain — run action if text is not visible
else if see "…" then <action>Middle branch — only if no earlier branch matched
else if not see "…" then <action>Middle branch with not-see condition
else <action>Fallback when no earlier branch matched

Qualifiers

QualifierRole
see / not seev1 conditions — one-shot page text presence (not should see assert polling)
thenSeparates condition from action on if / else if lines

Examples

Given I navigate to "https://example.com"
When I if see "Banner" then click on "Dismiss"
And I else if see "Cookie" then click on "Accept"
And I else click on "Continue"
Then I should see "Welcome"
When I if not see "Error" then click on "OK"
And I else click on "Retry"
# if alone is valid — false condition → step SKIPPED; scenario continues
When I if see "Welcome back" then click on "Continue"
When I fill "email" with "a@b.com"

Chain rules

RuleDetail
Contiguous chainNo other steps between chain lines; blank lines and # comments are OK; And I continues
First match winsFirst true branch runs its action; later branches in the chain are unused
One action per lineMulti-step indent / end blocks are not in v1
No nested ifAction must not be if / else if / else
Orphan / gapA non-branch step between chain lines closes the chain; a later else if / else without a new if is a parse error

Status and reports

OutcomeMeaning
PASSEDThis branch matched and its action succeeded
SKIPPEDCondition false, or another branch already matched — not a failure
FAILEDBrowser/session error, or the taken action failed (fail-fast unchanged)
  • Unused / false branches are recorded as step SKIPPED in engine results and NDJSON (debug).
  • Scenario / suite summary stays PASSED or FAILED only — PASSED + SKIPPEDPASSED.
  • Human CLI prints scenario-level PASSED/FAILED. Product UI should not list SKIPPED steps (hide them); NDJSON still emits them for debug.

Not in v1

  • Nested if / else if / else
  • Multi-step branch blocks (indent / end)
  • Conditions beyond see / not see (for example be on, visibility asserts)

On this page