A ticket-ordering frontend app in React that:
Each step of the form should also contain the "Submit" and "Back" buttons.
data-testid
attributes are used to identify those elements.
The inputs on the form steps have the following data-testid
attributes:
<form ...>
<input data-testid="firstName" ... />
<input data-testid="lastName" ... />
<input data-testid="age" ... />
<button data-testid="submit" />
</form>
<form ...>
<input data-testid="phone" ... />
<input data-testid="email" ... />
<button data-testid="submit" />
<button data-testid="back" />
</form>
<form ...>
<input data-testid="seat" ... />
<input data-testid="food" ... />
<input data-testid="allergies" ... />
<button data-testid="submit" />
<button data-testid="back" />
</form>
On the results page we see the values collected by the form.
Each element containing the value has a data-testid
field with the corresponding field name
:
<div data-testid="<field name>">value</div>
<button data-testid="back" />
Form steps have the following validations:
firstName
is a required field.First name is a required field
firstName
should not contain numbers.First name should not contain numbers
lastName
is a required field.Last name is a required field
lastName
should not contain numbers.Last name should not contain numbers
age
is a required field.Age must be a number
age
should be a positive number.Age should be positive
email
is a required field.Email is a required field
email
should have correct email format.Email should have correct format
phone
is a required field.Phone number is a required field
seat
is a required field.Seat is a required field
food
is a required field.Food is a required field
allergies
is a required field.Allergies is a required field
npm install
# Run your app here
npm run test