-
Notifications
You must be signed in to change notification settings - Fork 633
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
Fixed Rspec Checks Failure of assigned_articles_spec.rb
#5654
Fixed Rspec Checks Failure of assigned_articles_spec.rb
#5654
Conversation
@ragesoss After.mp4 |
@@ -21,9 +21,9 @@ | |||
# we need to use VCR to avoid getting stopped by WebMock | |||
VCR.use_cassette('assigned_articles_view') do | |||
visit "/courses/#{course.slug}/articles/assigned" | |||
expect(page).to have_content('Nancy Tuana') | |||
page.has_content?('Nancy Tuana') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it simply removes the check for the expected article, so that if .has_content?
returns false
it doesn't matter and the test continues... whereas the expect
line also relies on Capybara to wait a certain amount of time and continue checking for the content, so it ensure that the assigned articles list has rendered before moving on. I don't think will make it more reliable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I thought that the has_content waits till it is fully rendered.
The test usually passes, so if you weren't able to replicate the failure locally, I suspect that this won't improve the test. |
@@ -21,7 +21,7 @@ | |||
# we need to use VCR to avoid getting stopped by WebMock | |||
VCR.use_cassette('assigned_articles_view') do | |||
visit "/courses/#{course.slug}/articles/assigned" | |||
page.has_content?('Nancy Tuana') | |||
expect(page).to have_content('Nancy Tuana', wait:20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not certain about how page.has_content?
works, but have_content
automatically waits and continues checking the page (up to a certain amount of time) until the expected content is found, so there's no need for the wait
argument here.
Note that this spec still failed on CI for this PR. |
@ragesoss The |
Hmm... the default wait time is pretty long; what makes you think that waiting even longer is the solution? Why does it sometimes take that long to load? My guess was that when it fails, it's not because of being slow to render, but that something else went wrong such as a request that failed or didn't return the expected data. But I guess that |
That 'manual_update' speculation is relevant for another flaky spec, but not this one. But it still seems related to too-slow network requests that rely on external services. I think the right fix is probably to identify the slow request, and then stub it (with a new method in |
What this PR does
This PR fixes Rspec checks failure which were failing due to
assigned_articles_spec.rb
file.Addresses Issue #5652
Screenshots
Before:
After: