cal-itp / benefits

Transit benefits enrollment, minus the paperwork.
https://docs.calitp.org/benefits
GNU Affero General Public License v3.0
26 stars 9 forks source link

Feat(eligibility/form): custom validation message for index and confirm fields #2045

Closed angela-tran closed 4 months ago

angela-tran commented 4 months ago

Closes #2012

Reviewing

Eligibility Index form

  1. Don't select any transit benefit
  2. Click "Choose this benefit"
  3. You should get a browser validation message that says "Please choose a transit benefit."

Eligibility Confirm form

Cases to try with sub field (card number field):

In all those cases, you should get a browser validation message that says "Please enter a X-digit number." where X is the number specific for the transit benefit (5 for MST Courtesy Card, 4 for SBMTD Reduced Fare Mobility ID). See https://github.com/cal-itp/benefits/issues/2012#issuecomment-2071090041 for more context.

Cases to try with name field (last name field):

In all those cases, you should get a browser validation message that says "Please enter your last name."

Screenshots

Expand ![image](https://github.com/cal-itp/benefits/assets/25497886/9156860f-0cb1-41b4-a548-51d7f9874c22) ![image](https://github.com/cal-itp/benefits/assets/25497886/ca6baabb-868d-48b8-ba2c-8bfd718f8675)
github-actions[bot] commented 4 months ago

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/eligibility
  forms.py
Project Total  

This report was generated by python-coverage-comment-action

angela-tran commented 4 months ago

Side note: our Cypress tests were actually really helpful for this PR. They fail tests that encounter syntax errors, which caught regressions on pages that contain forms but don't need custom validation messages. 🎉

See GitHub Action runs: https://github.com/cal-itp/benefits/actions/runs/8760017173/job/24044225079 https://github.com/cal-itp/benefits/actions/runs/8790692524/job/24123260719 https://github.com/cal-itp/benefits/actions/runs/8791452896/job/24125714216

angela-tran commented 4 months ago

Need to resolve conflicts

angela-tran commented 4 months ago

Rebased on top of #2042 and waiting for it to be merged to minimize merge conflicts