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

Reliable way to check a path with Capybara #2696

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

pablobm
Copy link
Collaborator

@pablobm pablobm commented Oct 26, 2024

I just saw a random failure at ./spec/features/products_index_spec.rb:22. It's a JS-enabled example with an expectation on current_path. This is one of those cases where the previous action (in this case clicking on a link) does not necessarily happen immediately, requiring a slight wait, and therefore failing randomly.

I have changed all instances of this type of expectation to use have_current_path, which is provided by Capybara and applies its waiting behaviour where appropriate.

Note that not all cases actually need it, as this is only a problem in JS-enabled examples, but it's good to be consistent so I changed all.

@pablobm pablobm merged commit 4b1f3cf into thoughtbot:main Oct 26, 2024
10 checks passed
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