CDCgov / prime-simplereport

SimpleReport is a fast, free, and easy way for COVID-19 testing facilities to report results to public health departments.
https://simplereport.gov
Creative Commons Zero v1.0 Universal
55 stars 58 forks source link

fix flaky test card tests #7792

Closed fzhao99 closed 3 weeks ago

fzhao99 commented 3 weeks ago

FRONTEND PULL REQUEST

Noticed there was a flaky test that we added after some of the recent test card additions, so putting up a PR to fix.

Took the opportunity to do some fixture refactoring as well since adding in the mock was way more of a pain in the neck due to the needed constants being split between files.

Think the core issue here is that our current setup requiring interaction-to-interaction testing mocks seems to work sometimes with Apollo mocking provider when missing, but then fails other times. The larger fix is to use a system that can just reuse mocks rather than having to manually specify it every time, which we might be able to do with our work with msw.

Changes Proposed

PR is mainly moving a bunch of test constants around so the diff is bigger than it looks. Should be a no-op that can be tested by re-running the testing job

Testing

Rerun the frontend testing process a few times and verify they pass determinantly. Got a string of successful runs in a row working here (red X failure is from Sonar duplication issues, even though the actual frontend test job is working fine)

fzhao99 commented 3 weeks ago

Bobby found some other flaking tests due to a similar issue so trying to fix them. If anyone finds any other ones please let me know!

fzhao99 commented 3 weeks ago

@bobbywells52 I've gotten these to pass pretty consistently locally / got a string of successful runs in CI. Guessing even if we didn't get to the root cause of the flakiness that this will help, so going to propose merging it.

Happy to pair further on whether there might be another cause / config misalignment locally

bobbywells52 commented 3 weeks ago

@bobbywells52 I've gotten these to pass pretty consistently locally / got a string of successful runs in CI. Guessing even if we didn't get to the root cause of the flakiness that this will help, so going to propose merging it.

Happy to pair further on whether there might be another cause / config misalignment locally

Taking a look rn -- if I get a good string of runs I'll approve. Def down to pair and get to the root!

sonarcloud[bot] commented 3 weeks ago

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
15.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud