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

Spreewald should never check the current driver name, but its class #74

Closed
codener opened this issue May 23, 2017 · 9 comments
Closed

Comments

@codener
Copy link
Member

codener commented May 23, 2017

In multiple places in web_steps.rb, spreewald distinguishes Capybara drivers by their name. However, since the driver name is variable (i.e. it is chosen by project developers), this is a weak means for differentiation.

Spreewald should check the driver's class instead, e.g. check if it is Capybara::Selenium::Driver or the like.

@triskweline
Copy link
Member

Note that there are many JavaScript capable drivers that are not using Selenium. E.g. capybara-webkit, poltergeist, headless chrome in the near future.

@foobear
Copy link
Member

foobear commented Aug 31, 2018

@codener I'm not sure I understand how checking against Capybara::Selenium::Driver is better than checking against :selenium. Class names are more subject to change than an identifier like :selenium, IMHO.

@triskweline
Copy link
Member

Neither solution has ever broke down in us in 10 years or so? Maybe just decide on one and expose with via Spreewald.javascript_scenario? so people can override it if needed.

@foobear
Copy link
Member

foobear commented Sep 6, 2018

Today I worked with multiple Chrome sessions because of device emulation. Capybara.current_driver == :selenium will only work for exactly one driver that is named like that.

I vote for using Capybara.current_session.driver.is_a?(Capybara::Selenium::Driver) instead.
We should still place it inside a method that can be overwritten if needed.

@triskweline
Copy link
Member

Is this always right?

Before '@javascript' do
  @javascript_scenario = true
end

@foobear
Copy link
Member

foobear commented Nov 7, 2018

Not really. For example, we used @mobile in a project recently which implied using Selenium because of mobile emulation, not because it supports JavaScript.

Would still favor checking inheritance.

@codener
Copy link
Member Author

codener commented Nov 16, 2018

Today, I could not use the I switch to the new tab step, because it requires the current driver to be called :selenium. However, my project features multiple Javascript-capable drivers, and the driver for that very test was not named :selenium.

Would be awesome if we could fix Spreewald any time soon.

@triskweline
Copy link
Member

Maybe just decide on one and expose with via Spreewald.javascript_scenario? so people can override it if needed.

This is the one solution we all agreed on.

@judithroth
Copy link
Contributor

Done with 1.12.2 / 196b016

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

4 participants