Objective: Read a real form test completely — and internalize the rule that governs all form automation on live sites.
⏱ ≈4 min full lesson · Converted from the B-09 module deck · English edition — Español · العربية · বাংলা in translation
In ~4 minutes: read a real form test completely — and internalize the rule that governs all form automation on live sites.
The one rule: Forms are where sites make money — and where automation can do real damage. So: ON A LIVE SITE, FILL IT, CHECK IT, NEVER SUBMIT IT. Full submission runs on staging, where the data is fake. TestGen's form tests literally carry this in their titles.
TC-007: the fill pattern: Find the field → only proceed if it's actually there and visible → fill with obviously-fake data → assert the value stuck. That pattern repeats per field: name, business, email (qa@example.com), phone (5551234567). Code: const fld = po.field("#g-name"); | if ((await fld.count()) && (await fld.isVisible())) { | await fld.fill("QA Tester"); | await expect(fld).toHaveValue("QA Tester"); | }
Why the guards exist: Real forms reveal fields in steps — multi-step wizards, chat widgets, conditionals. A test that DEMANDS every field be visible immediately would false-alarm on healthy pages. Guards are B-06's triage lesson, applied in advance.
Its sibling: presence + toggle: TC-008 completes the honest checklist: every field EXISTS in the DOM, and the consent checkbox genuinely TOGGLES — clicked via the input itself, its state read before and after. Presence, input, toggle: everything verifiable without pressing send.
Plug & chug: your safety map: List your site's forms. For each, write what SUBMIT would create in the real world (a lead? an order? an email to a real person?). That last column tells you exactly what must never be automated against the live site.
Forms mastered, safely. Next: data-driven testing — one template, many rows.