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

assigned_articles_spec.rb is flaky #5652

Open
ragesoss opened this issue Feb 13, 2024 · 3 comments
Open

assigned_articles_spec.rb is flaky #5652

ragesoss opened this issue Feb 13, 2024 · 3 comments

Comments

@ragesoss
Copy link
Member

What is happening?

The 'Assigned Articles' feature spec fails intermittently on CI. For example: https://github.com/WikiEducationFoundation/WikiEduDashboard/actions/runs/7889907818/job/21530874633

  1) Assigned Articles view lets users submit feedback about articles
     Got 0 failures and 2 other errors:

     1.1) Failure/Error: find('textarea.feedback-form').fill_in with: 'This is a great article!'

          Capybara::ElementNotFound:
            Unable to find css "textarea.feedback-form"
          # ./spec/features/assigned_articles_spec.rb:26:in `block (3 levels) in <top (required)>'
          # ./spec/features/assigned_articles_spec.rb:22:in `block (2 levels) in <top (required)>'

     1.2) Failure/Error: Capybara::Screenshot.new.screenshot_and_save_page if example.exception

          NoMethodError:
            undefined method `new' for Capybara::Screenshot:Module

                Capybara::Screenshot.new.screenshot_and_save_page if example.exception
                                    ^^^^
          # ./spec/rails_helper.rb:101:in `block (2 levels) in <top (required)>'

Update the test to pass reliably, and describe what made the test unreliable if you can.

It may be useful to remove the --headless=new parameter from the Capybara config in rails_helper.rb so that you can watch the test run in the browser. (Be sure not to include that change to rails_helper in the PR.)

@PR4NJ41
Copy link
Contributor

PR4NJ41 commented Feb 13, 2024

@ragesoss
I have raised a PR to fix this. I fixed Error 1.1 & afterwards 1.2 stopped showing automatically. But i suppose error due to Capybara still persist

@ragesoss
Copy link
Member Author

Yes, I opened a separate issue for the Capybara screenshot error.

@ragesoss
Copy link
Member Author

This 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 request_helpers.rb) so that the test can run quickly without actually hitting the slow API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants