Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/integration/test_methods_system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ module Capybara
module Screenshot
module Diff
class TestMethodsSystemTest < ActionDispatch::SystemTestCase
self.test_order = :random

include CapybaraScreenshotDiff::DSL
include CapybaraScreenshotDiff::DSLStub

Expand Down
4 changes: 1 addition & 3 deletions test/support/setup_rails_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

# NOTE: Simulate Rails Environment
module Rails
def self.root
Pathname("../../tmp").expand_path(__dir__)
end
mattr_accessor(:root) { Pathname("../../tmp").expand_path(__dir__) }

def self.application
Rack::Builder.new {
Expand Down
4 changes: 4 additions & 0 deletions test/system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
require "support/setup_capybara_drivers"

class SystemTestCase < ActiveSupport::TestCase
self.test_order = :random
# TODO: Handle race conditions in system tests by introducing git steps
parallelize(workers: 0) # Disable parallelization for system tests to prevent race conditions

setup do
Capybara.current_driver = Capybara.javascript_driver
Capybara.page.current_window.resize_to(*SCREEN_SIZE)
Expand Down
8 changes: 8 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ class ActiveSupport::TestCase
# Set up fixtures and test helpers
self.file_fixture_path = Pathname.new(File.expand_path("fixtures", __dir__))

parallelize

parallelize_setup do |i|
Rails.root = Pathname.new(File.expand_path("../tmp", __dir__)) / i.to_s
Capybara::Screenshot.root = Rails.root
FileUtils.mkdir_p(Capybara::Screenshot.root)
end

teardown do
CapybaraScreenshotDiff::SnapManager.cleanup! unless persist_comparisons?
end
Expand Down