mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Remove need for Selenium driver in cucumber tests
This commit is contained in:
parent
1cbfcf13f2
commit
9e352cd13d
4 changed files with 27 additions and 12 deletions
|
@ -8,19 +8,19 @@ Feature: Capybara's cucumber integration
|
|||
Then I should see "Hello world!"
|
||||
|
||||
@javascript
|
||||
Scenario: javascript tag
|
||||
Scenario: javascript tag should use Capybara.javascript_driver
|
||||
When I visit the root page
|
||||
Then Capybara should use the "selenium" driver
|
||||
Then Capybara should use the "javascript_test" driver
|
||||
|
||||
@selenium
|
||||
Scenario: selenium tag
|
||||
@named_test
|
||||
Scenario: named driver tag
|
||||
When I visit the root page
|
||||
Then Capybara should use the "selenium" driver
|
||||
Then Capybara should use the "named_test" driver
|
||||
|
||||
@selenium
|
||||
@named_test
|
||||
Scenario Outline: selenium tag with scenario outline
|
||||
When I visit the <Page> page
|
||||
Then Capybara should use the "selenium" driver
|
||||
Then Capybara should use the "named_test" driver
|
||||
|
||||
Examples:
|
||||
| Page |
|
||||
|
|
5
features/named_driver_feature.feature
Normal file
5
features/named_driver_feature.feature
Normal file
|
@ -0,0 +1,5 @@
|
|||
@named_test
|
||||
Feature: an entire feature that uses a driver by tag
|
||||
|
||||
Scenario: should use the named driver without being explicitly told
|
||||
Then Capybara should use the "named_test" driver
|
|
@ -1,5 +0,0 @@
|
|||
@selenium
|
||||
Feature: an entire feature that uses selenium
|
||||
|
||||
Scenario: should use selenium without being explicitly told
|
||||
Then Capybara should use the "selenium" driver
|
|
@ -3,6 +3,21 @@ require 'rubygems'
|
|||
require 'bundler/setup'
|
||||
|
||||
require 'capybara/cucumber'
|
||||
require 'selenium-webdriver'
|
||||
require 'capybara/spec/test_app'
|
||||
|
||||
Capybara.app = TestApp
|
||||
|
||||
# These drivers are only used for testing driver switching.
|
||||
# They don't actually need to process javascript so use RackTest
|
||||
|
||||
Capybara.register_driver :javascript_test do |app|
|
||||
Capybara::RackTest::Driver.new(app)
|
||||
end
|
||||
|
||||
Capybara.javascript_driver = :javascript_test
|
||||
|
||||
Capybara.register_driver :named_test do |app|
|
||||
Capybara::RackTest::Driver.new(app)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue