Skip to content

Add option to rspec:install generator to configure for Selenium in Docker #2878

@unikitty37

Description

@unikitty37

Is your feature request related to a problem? Please describe.
When I run rails new and don't skip tests, system tests, or Docker, it creates a Docker container for Selenium and installs this in test/application_system_test_case.rb:

require "test_helper"

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  if ENV["CAPYBARA_SERVER_PORT"]
    served_by host: "rails-app", port: ENV["CAPYBARA_SERVER_PORT"]

    driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ], options: {
      browser: :remote,
      url: "http://#{ENV["SELENIUM_HOST"]}:4444"
    }
  else
    driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
  end
end

rails g rspec:install doesn't do anything to set Selenium up, and getting system tests working is a nightmare as a result.

Describe the solution you'd like
It should be possible to pass the container name to the install generator, using syntax along the lines of rails g rspec:install --selenium-container=selenium and the generator should then provide a basic setup similar to the one rails new does for minitest.

Describe alternatives you've considered
Right now I'm considering just using Playwright for system tests, because I know I can get that working.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions