Update ferrum double_click helper to use their API#5588
Open
stefannibrasil wants to merge 1 commit into
Open
Conversation
Closes rubyforgood#5573 This spec was flaky and can be reproduced with the 61044 seed: ``` Failures: 1) Distributions Double clicking distribution complete does not result in the distribution attemping to be completed twice Failure/Error: expect(page).not_to have_content("Sorry, we encountered an error when trying to mark this distribution as being completed") expected not to find text "Sorry, we encountered an error when trying to mark this distribution as being completed" in "User Guide\nDiaper McDiaperface\n \nDashboard\n \nDonations\n \nPurchases\n \nRequests\n \nDistributions\n \nPick Ups & Deliveries\n \nPartner Agencies\n \nInventory\n \nCommunity\n \nReports\nSorry, we encountered an error when trying to mark this distribution as being completed\nDistribution from Test Storage Location to Test Partner\n Home\nDistributions\nTest Partner (05/22/2026)\nID\tSource location:\tAgency representative:\tDelivery method:\tShipping cost:\tComments:\tStatus:\n5\tTest Storage Location\t\tDelivery\t\t\tComplete\nItem\tValue per item\tTotal value\tQuantity\tPackage count\n23Dont test this\t\t\t15\t\nTotal:\t\t\t15\t\n Make a Correction Print\nHuman Essentials was built with by Ruby for Good.\nVersion:" [Screenshot Image]: /home/runner/work/human-essentials/human-essentials/tmp/capybara/failures_r_spec_example_groups_distributions_2_double_clicking_distribution_complete_does_not_result_in_the_distribution_attemping_to_be_completed_twice_712.png # ./spec/system/distribution_system_spec.rb:932:in 'block (2 levels) in <top (required)>' ``` Using ferrum's double click with the `double: mode` makes the test more consistent: https://github.com/rubycdp/ferrum/blob/main/spec/node_spec.rb#L115 The previous code was a solution shared in this issue: rubycdp/ferrum#529 but the maintainer of the gem commented that this wans't accurate. With rubycdp/ferrum#533, the `double_click` helper was fixed. This commit updates the custom helper to use the official ferrum API to simulate double clicks, and hopefully it will prevent more flaky specs from happening. I also reordered the assertions to check for the content in the page before asserting against what's not present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5573
This spec was flaky and can be reproduced with the 61044 seed:
Using ferrum's double click with the
double: modemakes thetest more consistent: https://github.com/rubycdp/ferrum/blob/main/spec/node_spec.rb#L115
The previous code was a solution shared in this issue: rubycdp/ferrum#529 but the maintainer of the gem commented that this wans't accurate. With rubycdp/ferrum#533, the
double_clickhelper was fixed.This commit updates the custom helper to use the official ferrum API to simulate double clicks, and hopefully it will prevent more flaky specs from happening.
I also reordered the assertions to check for the content in the page before asserting against what's not present.
How Has This Been Tested?
I ran the test several times with a seed from a previous flaky spec run and did not get another flaky spec with this change.