human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

[BUG] Flaky test in donations system spec

Open edwinthinks opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

Running the specs in CI sometimes yield this failures:

Failures:
  1) Donations When signed in as a normal user When creating a new donation Via manual entry Allows User to create a Product Drive from donation
     Failure/Error: expect(page).to have_content("New Product Drive")
       expected to find text "New Product Drive" in "Need Help?\nDEFAULT USER\nDashboard\nProduct Drives\nDonations\nAll Donations\nNew Donation\nPurchases\nRequests\nDistributions\nPick Ups & Deliveries\nPartner Agencies\nInventory\nCommunity\nForecasting\nStart a new donation for DEFAULT\nHome\nDonations\nNew Donation\nSource *\nProduct Drive\nManufacturer\nDonation Site\nMisc. Donation\nProduct Drive\nTest Drive\n---Create new Product Drive---\nProduct Drive Participant\nAwesome Business\n---Create new Participant---\nStorage Location *\nSmithsonian Conservation Center\nMoney raised in dollars\nComment\nIssued on\nItems in this donation\nOR\nChoose an item\n57T Diapers\nAdult Briefs (Large/X-Large)\nAdult Briefs (Medium/Large)\nAdult Briefs (Small/Medium)\nAdult Briefs (XS/Small)\nAdult Briefs (XXL)\nAdult Briefs (XXS)\nAdult Briefs (XXXL)\nAdult Cloth Diapers (Large/XL/XXL)\nAdult Cloth Diapers (Small/Medium)\nAdult Incontinence Pads\nAdult Liners\nBed Pads (Cloth)\nBed Pads (Disposable)\nBibs (Adult & Child)\nCloth Diapers (AIO's/Pocket)\nCloth Diapers (Covers)\nCloth Diapers (Plastic Cover Pants)\nCloth Diapers (Prefolds & Fitted)\nCloth Inserts (For Cloth Diapers)\nCloth Potty Training Pants/Underwear\nCloth Swimmers (Kids)\nDiaper Rash Cream/Powder\nDisposable Inserts\nKids L/XL (60-125 lbs)\nKids (Newborn)\nKids (Preemie)\nKids Pull-Ups (2T-3T)\nKids Pull-Ups (3T-4T)\nKids Pull-Ups (4T-5T)\nKids (Size 1)\nKids (Size 2)\nKids (Size 3)\nKids (Size 4)\nKids (Size 5)\nKids (Size 6)\nKids (Size 7)\nKids S/M (38-65 lbs)\nOther\nPads\nSwimmers\nTampons\nUnderpads (Pack)\nWipes (Adult)\nWipes (Baby)\nRemove\nAdd another item\nSave". (However, it was found 1 time using a case insensitive search and it was found 2 times including non-visible text.)
     [Screenshot Image]: /home/runner/work/human-essentials/human-essentials/tmp/screenshots/failures_r_spec_example_groups_donations_when_signed_in_as_a_normal_user_when_creating_a_new_donation_via_manual_entry_allows_user_to_create_a_product_drive_from_donation_442.png
     # ./spec/system/donation_system_spec.rb:240:in `block (5 levels) in <top (required)>'
     # ./spec/spec_helper.rb:97:in `block (2 levels) in <top (required)>'
Finished in 4 minutes 13.5 seconds (files took 9.38 seconds to load)
198 examples, 1 failure, 2 pending
Failed examples:
rspec ./spec/system/donation_system_spec.rb:237 # Donations When signed in as a normal user When creating a new donation Via manual entry Allows User to create a Product Drive from donation

Expected Behavior

This spec is either always fail or never fail. It shouldn't fail sometimes and not.

Steps To Reproduce

This is a bit challenging to specify how it happens due to its "flakiness". However:

  1. You run the CI
  2. Re-run multiple times until it fails (however might not work, if it is time dependent)

A part of the problem and solution, is figuring how to reproduce it.

Environment

- OS: MacOSX
- Node: N/A
- npm: N/A

Anything else?

No response

edwinthinks avatar Jun 15 '22 10:06 edwinthinks

This is linked to https://github.com/rubyforgood/human-essentials/issues/2711 but is more specific to this spec failure.

edwinthinks avatar Jun 15 '22 10:06 edwinthinks

Hi @edwinthinks, do you have the build failure's rspec seed number? The seed number should allow anyone to reproduce the failure locally rather than running the CI mutiple times 🤞

shen-sat avatar Sep 18 '22 23:09 shen-sat

Hey, @shen-sat sorry for the late reply. I don't have the seed number on hand but the good news is I believe it was fixed in https://github.com/rubyforgood/human-essentials/pull/3128 :). It hasn't appeared again since.

PS - Sorry going back into old issues to check on them :)

edwinthinks avatar Sep 27 '22 14:09 edwinthinks