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

Capybara screenshot feature in tests is broken #5653

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

Capybara screenshot feature in tests is broken #5653

ragesoss opened this issue Feb 13, 2024 · 0 comments

Comments

@ragesoss
Copy link
Member

What is happening?

When a feature test fails, the configuration in rails_helper.rb is used to attempt to make a screenshot (which can be helpful for diagnosing a failing browser-based feature spec). The Capybara screenshot interface seems to have changed, so the call for creating a screenshot throws a NoMethodError. For example, the second part of this failure output:

  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)>'

Fix this so that screenshots are properly generated when a feature spec fails.

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

1 participant