aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
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/test
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/test')
-rw-r--r--actionpack/test/dispatch/system_testing/browser_test.rb10
-rw-r--r--actionpack/test/dispatch/system_testing/driver_test.rb9
-rw-r--r--actionpack/test/dispatch/system_testing/screenshot_helper_test.rb10
-rw-r--r--actionpack/test/dispatch/system_testing/server_test.rb10
-rw-r--r--actionpack/test/dispatch/system_testing/system_test_case_test.rb21
5 files changed, 60 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/system_testing/browser_test.rb b/actionpack/test/dispatch/system_testing/browser_test.rb
new file mode 100644
index 0000000000..b0ad309492
--- /dev/null
+++ b/actionpack/test/dispatch/system_testing/browser_test.rb
@@ -0,0 +1,10 @@
+require "abstract_unit"
+require "action_dispatch/system_testing/browser"
+
+class BrowserTest < ActiveSupport::TestCase
+ test "initializing the browser" do
+ browser = ActionDispatch::SystemTesting::Browser.new(:chrome, [ 1400, 1400 ])
+ assert_equal :chrome, browser.instance_variable_get(:@name)
+ assert_equal [ 1400, 1400 ], browser.instance_variable_get(:@screen_size)
+ end
+end
diff --git a/actionpack/test/dispatch/system_testing/driver_test.rb b/actionpack/test/dispatch/system_testing/driver_test.rb
new file mode 100644
index 0000000000..f0ebdb38db
--- /dev/null
+++ b/actionpack/test/dispatch/system_testing/driver_test.rb
@@ -0,0 +1,9 @@
+require "abstract_unit"
+require "action_dispatch/system_testing/driver"
+
+class DriverTest < ActiveSupport::TestCase
+ test "initializing the driver" do
+ driver = ActionDispatch::SystemTesting::Driver.new(:selenium)
+ assert_equal :selenium, driver.instance_variable_get(:@name)
+ end
+end
diff --git a/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb b/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb
new file mode 100644
index 0000000000..3da89f4a10
--- /dev/null
+++ b/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb
@@ -0,0 +1,10 @@
+require "abstract_unit"
+require "action_dispatch/system_testing/test_helpers/screenshot_helper"
+
+class ScreenshotHelperTest < ActiveSupport::TestCase
+ test "image path is saved in tmp directory" do
+ new_test = ActionDispatch::SystemTestCase.new("x")
+
+ assert_equal "tmp/screenshots/failures_x.png", new_test.send(:image_path)
+ end
+end
diff --git a/actionpack/test/dispatch/system_testing/server_test.rb b/actionpack/test/dispatch/system_testing/server_test.rb
new file mode 100644
index 0000000000..66842f4ea9
--- /dev/null
+++ b/actionpack/test/dispatch/system_testing/server_test.rb
@@ -0,0 +1,10 @@
+require "abstract_unit"
+require "capybara/dsl"
+require "action_dispatch/system_testing/server"
+
+class ServerTest < ActiveSupport::TestCase
+ test "initializing the server port" do
+ server = ActionDispatch::SystemTesting::Server.new.run
+ assert_includes Capybara.servers, :rails_puma
+ end
+end
diff --git a/actionpack/test/dispatch/system_testing/system_test_case_test.rb b/actionpack/test/dispatch/system_testing/system_test_case_test.rb
new file mode 100644
index 0000000000..a384902a14
--- /dev/null
+++ b/actionpack/test/dispatch/system_testing/system_test_case_test.rb
@@ -0,0 +1,21 @@
+require "abstract_unit"
+
+class SystemTestCaseTest < ActiveSupport::TestCase
+ test "driven_by sets Capybara's default driver to poltergeist" do
+ ActionDispatch::SystemTestCase.driven_by :poltergeist
+
+ assert_equal :poltergeist, Capybara.default_driver
+ end
+
+ test "driven_by sets Capybara's drivers respectively" do
+ ActionDispatch::SystemTestCase.driven_by :selenium, using: :chrome
+
+ assert_includes Capybara.drivers, :selenium
+ assert_includes Capybara.drivers, :chrome
+ assert_equal :chrome, Capybara.default_driver
+ end
+
+ test "selenium? returns false if driver is poltergeist" do
+ assert_not ActionDispatch::SystemTestCase.selenium?(:poltergeist)
+ end
+end