aboutsummaryrefslogtreecommitdiffstats
path: root/actionsystemtest/lib/action_system_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 /actionsystemtest/lib/action_system_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 'actionsystemtest/lib/action_system_test')
-rw-r--r--actionsystemtest/lib/action_system_test/browser.rb26
-rw-r--r--actionsystemtest/lib/action_system_test/driver.rb16
-rw-r--r--actionsystemtest/lib/action_system_test/gem_version.rb15
-rw-r--r--actionsystemtest/lib/action_system_test/server.rb21
-rw-r--r--actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb51
-rw-r--r--actionsystemtest/lib/action_system_test/version.rb8
6 files changed, 0 insertions, 137 deletions
diff --git a/actionsystemtest/lib/action_system_test/browser.rb b/actionsystemtest/lib/action_system_test/browser.rb
deleted file mode 100644
index 220d8b6807..0000000000
--- a/actionsystemtest/lib/action_system_test/browser.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-module ActionSystemTest
- 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
diff --git a/actionsystemtest/lib/action_system_test/driver.rb b/actionsystemtest/lib/action_system_test/driver.rb
deleted file mode 100644
index 7d499ba772..0000000000
--- a/actionsystemtest/lib/action_system_test/driver.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module ActionSystemTest
- class Driver # :nodoc:
- def initialize(name)
- @name = name
- end
-
- def run
- register
- end
-
- private
- def register
- Capybara.default_driver = @name
- end
- end
-end
diff --git a/actionsystemtest/lib/action_system_test/gem_version.rb b/actionsystemtest/lib/action_system_test/gem_version.rb
deleted file mode 100644
index c10fce2da0..0000000000
--- a/actionsystemtest/lib/action_system_test/gem_version.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module ActionSystemTest
- # Returns the version of the currently loaded Action System Test as a <tt>Gem::Version</tt>.
- def self.gem_version
- Gem::Version.new VERSION::STRING
- end
-
- module VERSION
- MAJOR = 5
- MINOR = 1
- TINY = 0
- PRE = "alpha"
-
- STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
- end
-end
diff --git a/actionsystemtest/lib/action_system_test/server.rb b/actionsystemtest/lib/action_system_test/server.rb
deleted file mode 100644
index 76ae30f753..0000000000
--- a/actionsystemtest/lib/action_system_test/server.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require "rack/handler/puma"
-
-module ActionSystemTest
- class Server # :nodoc:
- def run
- register
- setup
- end
-
- private
- def register
- Capybara.register_server :rails_puma do |app, port, host|
- Rack::Handler::Puma.run(app, Port: port, Threads: "0:1")
- end
- end
-
- def setup
- Capybara.server = :rails_puma
- end
- end
-end
diff --git a/actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb b/actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb
deleted file mode 100644
index af83ca3ec8..0000000000
--- a/actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-module ActionSystemTest
- module TestHelpers
- # Screenshot helper for system testing
- module ScreenshotHelper
- # Takes a screenshot of the current page in the browser.
- #
- # +take_screenshot+ can be used at any point in your system tests to take
- # a screenshot of the current state. This can be useful for debugging or
- # automating visual testing.
- def take_screenshot
- save_image
- puts "[Screenshot]: #{image_path}"
- puts display_image
- end
-
- # Takes a screenshot of the current page in the browser if the test
- # failed.
- #
- # +take_screenshot+ is included in <tt>system_test_helper.rb</tt> that is
- # generated with the application. To take screenshots when a test fails
- # add +take_failed_screenshot+ to the teardown block before clearing
- # sessions.
- def take_failed_screenshot
- take_screenshot unless passed?
- end
-
- private
- def image_path
- "tmp/screenshots/failures_#{method_name}.png"
- end
-
- def save_image
- page.save_screenshot(Rails.root.join(image_path))
- end
-
- def display_image
- if ENV["CAPYBARA_INLINE_SCREENSHOT"] == "artifact"
- "\e]1338;url=artifact://#{image_path}\a"
- else
- name = inline_base64(File.basename(image_path))
- image = inline_base64(File.read(image_path))
- "\e]1337;File=name=#{name};height=400px;inline=1:#{image}\a"
- end
- end
-
- def inline_base64(path)
- Base64.encode64(path).gsub("\n", "")
- end
- end
- end
-end
diff --git a/actionsystemtest/lib/action_system_test/version.rb b/actionsystemtest/lib/action_system_test/version.rb
deleted file mode 100644
index a0fda7d9da..0000000000
--- a/actionsystemtest/lib/action_system_test/version.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require_relative "gem_version"
-
-module ActionSystemTest
- # Returns the version of the currently loaded Action System Test as a <tt>Gem::Version</tt>
- def self.version
- gem_version
- end
-end