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 200 forks source link

"How to debug flaky unit tests" Section could use instructions on waitFor #64097

Closed radavis closed 1 year ago

radavis commented 1 year ago

Description

Ran into an issue where my test was not waiting for state and UI changes. Tests would pass locally in isolation, but fail when run as part of a larger test suite.

After getting assistance from a number of helpful devs, Adrian Rollett suggested that other developers could benefit from our learning and suggested an update to this section of the docs.

https://dsva.slack.com/archives/C02V265VCGH/p1692733516168829?thread_ts=1692386204.624589&cid=C02V265VCGH

Relevant URLs

https://depo-platform-documentation.scrollhelp.site/developer-docs/debugging-unit-tests#Debuggingunittests-Howtoavoidwritingflakyunittests

Which type of team are you on? (Platform team, VFS team, or Leadership)

VFS, MHV on VA.gov Cartographers

vbellissimo commented 1 year ago

Hi @radavis , thank you for flagging this. Can one of our content writers work with you directly to figure out the details of what you're suggesting would be helpful to add to the page?

radavis commented 1 year ago

Hey @vbellissimo, I'd be happy to collaborate with someone on your team on this issue.

taylojill commented 1 year ago

Hi @radavis I'll be working with you to update this page on the Platform web site. It looks like we need to add a statement that explains when waitFor should be used when the item being tested depends on a state update. If you have the statement ready to go, let me know where it should live on the page and I will make the update and get it published. Questions, please let me know. Thanks @radavis

radavis commented 1 year ago

Hi @taylojill! I'll write something up and have it to you before the end of the week.

radavis commented 1 year ago

Hey, @taylojill. Here's that writeup I promised: https://github.com/department-of-veterans-affairs/va.gov-team/blob/master/products/health-care/digital-health-modernization/engineering/testing-library-wait-for.md

taylojill commented 1 year ago

Thank you @radavis!

taylojill commented 1 year ago

Here's what I did:

  1. Added the waitFor content to the "How to debug flaky unit tests" section of the page.
  2. Checked page for launch-blocking issues. No issues found!
  3. Updated page has been deployed!