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

Attempt to fix flaky specs where the toast might disappear before the page finishes loading #15410

Merged
merged 4 commits into from May 3, 2024

Conversation

dombesz
Copy link
Contributor

@dombesz dombesz commented Apr 29, 2024

Let's consider the following scenario:

We are saving a form by clicking the submit button. The page redirects, the toast message is shown, but the page still loads some requests in the background. Capybara will not consider the page submission with the "click_on" command done, unless the page is loaded. Hence it will not go to the next expectation unless the page is loaded. If the page takes too long to load, the toast message might already disappear by the time capybara runs the next expectation for the toast's presence. This will make the expectation fail.

Attempt to fix flaky spec on ./modules/budgets/spec/features/budgets/add_budget_spec.rb:59

Some specs got broken alongside while applying the fix. Those cases were prone to toast timing and fixed those too.

@dombesz dombesz force-pushed the fix-flaky-spec branch 5 times, most recently from 5a840b3 to 760798b Compare April 29, 2024 17:11
… page finished loading

Let's consider the folliwng scenario: We are saving a form by clicking
the submit button. The page redirects, the toast message is shown, but
the page still loads some requests in the background. Capybara will not
consider the page submission with the "click_on" command done, unless
the page is loaded. Hence it will not go to the next expectation unless
the page is loaded. If the page takes too long to load, the toast
message might already disappear by the time capybara runs the next
expectation for the toast's presence. This will make the expectation
fail.
@dombesz dombesz marked this pull request as ready for review April 29, 2024 18:57
Copy link
Contributor

@ulferts ulferts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only time will tell in the end but the reasoning sound compelling, @dombesz. Once again thanks for digging into this.

@ulferts ulferts merged commit 5cf73ae into dev May 3, 2024
11 checks passed
@ulferts ulferts deleted the fix-flaky-spec branch May 3, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants