Multi-step Form With Validation

Forms & Validation Validation Intermediate Nice to Try

Hands-on

Interactive Sandbox

Static partial

Try this

  1. Open page
  2. Interact control
  3. Read result

Assert this

  • Visible elements
  • Text matches
  • Button state toggles

Forms & Validation / Multi-Step

Multi Step Form With Validation

Validate each step before continue.

Step 1 Step 2
Step 1/2

Learning & behavior

User flow

  1. Open page
  2. Interact control
  3. Read result

Learning objectives

  • Pick solid locators
  • Time waits
  • Assert state

Suggested assertions

  • Visible elements
  • Text matches
  • Button state toggles

Selector tips

Good

  • [data-test-id='multi-step-form-with-validation-primary']
  • [data-test-id='multi-step-form-with-validation-secondary']
  • [data-test-id='multi-step-form-with-validation-action']
  • [aria-label='Multi-step Form With Validation']
  • getByRole('button', { name: 'Validation' })

Fallback

  • section.multi-step-form-with-validation-container :nth-of-type(1)
  • .card.multi_step_form_with_validation button:nth-of-type(1)
  • form.multi-step-form-with-validation-form .field-group:nth-child(1)

Avoid

  • .mt-4.mb-2.flex.items-center > input:nth-child(1)
  • .css-1a2b3c4
  • div[class*='temp-'][class*='hover']

Notes

  • Some parts delay render
  • Icon buttons need aria-label
  • Layout classes may shift