[Feature request] System Tests with multiple browsers

44 weergaven
Naar het eerste ongelezen bericht

Pierre Hedkvist

ongelezen,
14 dec 2017, 07:23:1914-12-2017
aan Ruby on Rails: Core
Hi,

I think it could be useful to run System Test with multiple browsers when using Selenium, in order to get better testing coverage for different browsers.

For instance if you could put an array of browsers inside the using variable:

require "test_helper"


class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  driven_by
:selenium, using: [:chrome, :firefox], screen_size: [1000, 1000]
end


I know its possible to run capybara with multiple browser using RSpec, like this: https://stackoverflow.com/questions/39955782/capybara-rspec-how-to-set-up-multi-browser-tc-running

What are your thoughts?

eileencodes

ongelezen,
15 dec 2017, 08:12:5215-12-2017
aan Ruby on Rails: Core
Hi Pierre,

That does sound like a useful feature. That would require your test suite to run twice though, is that desirable? If you'd like to implement this feature cc me when you open the PR.

-Eileen (eileencodes)

Pierre Hedkvist

ongelezen,
15 dec 2017, 16:17:3915-12-2017
aan Ruby on Rails: Core
Thanks for the reply,

I have tried to find a solution, I think running the test suite twice is possible, could this be good solution though? Downside is that it might be slow to start selenium multiple times? 
I cant find where you instantiate system test from when starting it. I am familiar with your code from this PR inside of ActionDispatch. But when rails test:system is entered in the terminal,
from where does rails start the test?

eileencodes

ongelezen,
28 dec 2017, 11:56:0228-12-2017
aan Ruby on Rails: Core
> I think running the test suite twice is possible, could this be good solution though

What I mean is I don't see a way to implement this that wouldn't start 2 servers and run the tests twice, once in Chrome and once in FF for example.

> I cant find where you instantiate system test from when starting it.

When you run `rails test:system` https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/system_test_case.rb#L145 starts the server and boots the Rails application. `driven_by` is initialized when the test starts which is why you if you want multiple drivers you need to have multiple classes that call `driven_by` and inherit from that class (https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/system_test_case.rb#L136-L138). That calls `setup` which initializes Capybara and then Capybara takes over from there. https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/system_testing/driver.rb#L78

-Eileen
Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten