12 / 108 · 03 Agentic Testing Architectures · Mapping ReAct to CLI Browser Commands← prev⊞ allnext →☰ Read as one page
2.3A Complete ReAct Test Using the CLI
Here is how an agent thinks through a login test using the ReAct loop:
TEST OBJECTIVE: Verify that submitting the login form with empty fields
shows appropriate validation errors.
STEP 1 — OBSERVE:
$ playwright-cli open "https://app.example.com/login"
$ playwright-cli snapshot
→ reads snapshot: textbox "Email" [ref=e8], textbox "Password" [ref=e9],
button "Sign In" [ref=e11]
STEP 2 — THINK:
"I see a login form with email and password fields and a Sign In button.
My objective is to test empty field submission. I should click Sign In
without filling in any fields."
STEP 3 — ACT:
$ playwright-cli click e11
STEP 4 — OBSERVE:
$ playwright-cli snapshot
→ reads snapshot: alert "Email is required" [ref=e15],
alert "Password is required" [ref=e16], textbox "Email" [ref=e8] ...
STEP 5 — THINK:
"Two validation errors appeared: one for email and one for password.
Both say the field is required. This matches expected behavior.
Let me also verify we stayed on the login page (no navigation)."
STEP 6 — OBSERVE:
$ playwright-cli eval "location.href"
→ "https://app.example.com/login"
STEP 7 — THINK:
"URL has not changed. We are still on the login page. Both required
field errors are shown. Test objective is met."
STEP 8 — EVALUATE:
DONE pass "Empty form submission correctly shows validation errors
for both email ('Email is required') and password ('Password is required').
Page did not navigate away from /login."