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

Deprecation Warnings in System Tests #2604

Closed
pgwillia opened this issue Oct 28, 2021 · 2 comments · Fixed by #2609
Closed

Deprecation Warnings in System Tests #2604

pgwillia opened this issue Oct 28, 2021 · 2 comments · Fixed by #2609

Comments

@pgwillia
Copy link
Member

pgwillia commented Oct 28, 2021

Describe the bug

DEPRECATION WARNING: ActionDispatch::SystemTestCase#host! is deprecated with no replacement. Set Capybara.app_host directly or rely on Capybara's default host. (called from block in <class:ApplicationSystemTestCase> at /mnt/c/Users/pgwillia/Code/ualbertalib/jupiter/test/application_system_test_case.rb:9)
2021-10-28 11:14:16 WARN Selenium [DEPRECATION] [:browser_options] :options as a parameter for driver initialization is deprecated. Use :capabilities with an Array of value capabilities/options if necessary instead.

To Reproduce
Steps to reproduce the behavior:

  1. rails test:system
  2. See warnings

Expected behavior
Our codebase is free of warnings and errors.

Related
#2600
#2552

@pgwillia
Copy link
Member Author

pgwillia commented Nov 1, 2021

https://github.com/rails/rails/blob/f95c0b7e96eb36bc3efc0c5beffbb9e84ea664e4/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb#L7-L13

def host!(host)
  ActiveSupport::Deprecation.warn \
    "ActionDispatch::SystemTestCase#host! is deprecated with no replacement. " \
    "Set Capybara.app_host directly or rely on Capybara's default host."

  Capybara.app_host = host
end

@pgwillia
Copy link
Member Author

pgwillia commented Nov 1, 2021

I think that Rails might be causing the second one.

https://github.com/rails/rails/blob/37c46e859bc53175dba913e61b60042aee216ab1/actionpack/lib/action_dispatch/system_test_case.rb#L138-L160

    # System Test configuration options
    #
    # The default settings are Selenium, using Chrome, with a screen size
    # of 1400x1400.
    #
    # Examples:
    #
    #   driven_by :cuprite
    #
    #   driven_by :selenium, screen_size: [800, 800]
    #
    #   driven_by :selenium, using: :chrome
    #
    #   driven_by :selenium, using: :headless_chrome
    #
    #   driven_by :selenium, using: :firefox
    #
    #   driven_by :selenium, using: :headless_firefox
    def self.driven_by(driver, using: :chrome, screen_size: [1400, 1400], options: {}, &capabilities)
      driver_options = { using: using, screen_size: screen_size, options: options }

      self.driver = SystemTesting::Driver.new(driver, **driver_options, &capabilities)
    end

https://github.com/rails/rails/blob/37c46e859bc53175dba913e61b60042aee216ab1/actionpack/lib/action_dispatch/system_testing/driver.rb#L62-L66

       def register_selenium(app)
          Capybara::Selenium::Driver.new(app, browser: @browser.type, **browser_options).tap do |driver|
            driver.browser.manage.window.size = Selenium::WebDriver::Dimension.new(*@screen_size)
          end
        end

https://github.com/SeleniumHQ/selenium/blob/677b1ecd0596068bdba8cdac0a248c4077eacc6d/rb/lib/selenium/webdriver/common/driver.rb#L325-L331

        options = opts.delete(:options)
        if options
          WebDriver.logger.deprecate(':options as a parameter for driver initialization',
                                     ':capabilities with an Array of value capabilities/options if necessary',
                                     id: :browser_options)
          cap_array << options
        end

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

Successfully merging a pull request may close this issue.

1 participant