Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky distribution filtering by prior year spec #4823

Closed

Conversation

coalest
Copy link
Collaborator

@coalest coalest commented Dec 2, 2024

Description

Apparently some of the specs I added were flaky in two different ways 🙃

Example of it failing in CI

Error message:

  1) Distributions by County handles time ranges properly works for prior year
     Failure/Error: expect(page).to have_css("table tbody tr td", text: "25", exact_text: true, count: 4)
       expected to find visible css "table tbody tr td" with exact text "25" 4 times but there were no matches. Also found "County 14", "50", "$525.00", "County 13", "50", "$525.00", "County 16", "50", "$525.00", "County 15", "50", "$525.00", "Unspecified", "0", "$0.00", which matched the selector but not all filters. 

     [Screenshot Image]: /home/runner/work/human-essentials/human-essentials/tmp/capybara/failures_r_spec_example_groups_distributions_by_county_handles_time_ranges_properly_works_for_prior_year_55.png


     # ./spec/system/distributions_by_county_system_spec.rb:58:in `block (3 levels) in <top (required)>'

In this case. what I think was happening is...
We want to test filtering by prior year. So we create a distribution on before last calendar year (ex: 12/31/2022), sometime last year (ex in year 2023), and on the first of the current year (1/1/2024).
For some year the test is matching two of those distributions instead of three.
Looking into how we determine the prior year in javascript, we are grabbing the time with local time zone (west coast for test suite), but UTC time in Ruby in the test suite so I think it could be a time zone issue.

Ruby example:

Screenshot from 2024-12-02 21-53-25

Javascript example (with change to DateTime.utc() shown)

Screenshot from 2024-12-02 21-37-44

Type of change

  • Fix flaky spec

How Has This Been Tested?

Locally

Screenshots

@coalest coalest force-pushed the fix-flaky-prior-year-date-picker-spec branch from a23982c to 40f5a9e Compare December 3, 2024 12:07
@coalest coalest closed this Dec 3, 2024
@coalest coalest force-pushed the fix-flaky-prior-year-date-picker-spec branch from 40f5a9e to a93fd40 Compare December 3, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant