department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
282 stars 203 forks source link

Support alert assertions in VAOS unit tests #82624

Open JunTaoLuo opened 5 months ago

JunTaoLuo commented 5 months ago

Summary

Currently alerts from validation is difficult to write assertions for in certain unit tests since the DOM does not update after user action (e.g. clicking a button or choosing an option) is made. Ideally we should be able to assert alerts are displayed correctly to ensure the desired component behaviors.

Steps to Reproduce

Actual Result

Currently these assertions are disabled so no errors are observed but enabling the assertions will result in the following stack traces:

Expand stack trace ``` 1) VAOS Page: ClosestCityStatePage should not submit without choosing a site: Unable to find role="alert"
We'll send your request to the VA medical center nearest to the city you select. The medical center staff will help schedule your community care appointment.