aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/system_testing/browser.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2017-02-19 11:50:42 -0500
committereileencodes <eileencodes@gmail.com>2017-02-20 15:07:35 -0500
commit1a0ca84a064b07ecab798793a3d7ebe89bb6367c (patch)
treeb4eccc275e62040d0a3ffdcc19103e54ab0289b6 /actionpack/lib/action_dispatch/system_testing/browser.rb
parent0a683085b1db435b7371350b2799a0f248cd717a (diff)
downloadrails-1a0ca84a064b07ecab798793a3d7ebe89bb6367c.tar.gz
rails-1a0ca84a064b07ecab798793a3d7ebe89bb6367c.tar.bz2
rails-1a0ca84a064b07ecab798793a3d7ebe89bb6367c.zip
Move and rename system tests
* Move system tests back into Action Pack * Rename `ActionSystemTest` to `ActionDispatch::SystemTestCase` * Remove private base module and only make file for public `SystemTestCase` class, name private module `SystemTesting` * Rename `ActionSystemTestCase` to `ApplicationSystemTestCase` * Update corresponding documentation and guides * Delete old `ActionSystemTest` files
Diffstat (limited to 'actionpack/lib/action_dispatch/system_testing/browser.rb')
-rw-r--r--actionpack/lib/action_dispatch/system_testing/browser.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/browser.rb b/actionpack/lib/action_dispatch/system_testing/browser.rb
new file mode 100644
index 0000000000..c9a6628516
--- /dev/null
+++ b/actionpack/lib/action_dispatch/system_testing/browser.rb
@@ -0,0 +1,28 @@
+module ActionDispatch
+ module SystemTesting
+ class Browser # :nodoc:
+ def initialize(name, screen_size)
+ @name = name
+ @screen_size = screen_size
+ end
+
+ def run
+ register
+ setup
+ end
+
+ private
+ def register
+ Capybara.register_driver @name do |app|
+ Capybara::Selenium::Driver.new(app, browser: @name).tap do |driver|
+ driver.browser.manage.window.size = Selenium::WebDriver::Dimension.new(*@screen_size)
+ end
+ end
+ end
+
+ def setup
+ Capybara.default_driver = @name.to_sym
+ end
+ end
+ end
+end