From 66fc604be2baa5bb7c0e72fc7a7c6be17310ad0f Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:22:21 -0800 Subject: [PATCH 01/33] replaced use of Capybara.current_session.wait_until with Timeout::timeout in preparation for supporting Cpapybara 2.X --- lib/ae_page_objects/element_proxy.rb | 41 ++++++------ test/unit/element_proxy_test.rb | 99 ++++++++++++---------------- 2 files changed, 63 insertions(+), 77 deletions(-) diff --git a/lib/ae_page_objects/element_proxy.rb b/lib/ae_page_objects/element_proxy.rb index 48214e66..9f79491c 100644 --- a/lib/ae_page_objects/element_proxy.rb +++ b/lib/ae_page_objects/element_proxy.rb @@ -1,3 +1,5 @@ +require 'timeout' + module AePageObjects class ElementProxy @@ -17,25 +19,17 @@ def initialize(element_class, *args) # Provided so that visible? can be asked without # an explicit check for present? first. def visible? - Capybara.current_session.wait_until do - Capybara.using_wait_time(0) do - inst = presence - !! inst && inst.visible? - end + wait_for do + inst = presence + !! inst && inst.visible? end - rescue Capybara::TimeoutError - false end def not_visible? - Capybara.current_session.wait_until do - Capybara.using_wait_time(0) do - inst = presence - inst.nil? || ! inst.visible? - end + wait_for do + inst = presence + inst.nil? || ! inst.visible? end - rescue Capybara::TimeoutError - false end def present? @@ -43,13 +37,9 @@ def present? end def not_present? - Capybara.current_session.wait_until do - Capybara.using_wait_time(0) do - ! present? - end + wait_for do + ! present? end - rescue Capybara::TimeoutError - false end def presence @@ -79,7 +69,16 @@ def respond_to?(*args) end private - + + def wait_for(&block) + Timeout.timeout(Capybara.default_wait_time) do + sleep(0.05) until value = Capybara.using_wait_time(0, &block) + value + end + rescue Timeout::Error + false + end + def element @element ||= @element_class.new(*@args) end diff --git a/test/unit/element_proxy_test.rb b/test/unit/element_proxy_test.rb index a2404bf6..2d62ca0d 100644 --- a/test/unit/element_proxy_test.rb +++ b/test/unit/element_proxy_test.rb @@ -59,7 +59,7 @@ def test_present__element_not_found def test_not_present proxy = new_proxy - stub_capybara_session_wait_until + stub_wait_for(proxy) element_class.expect_initialize assert_false proxy.not_present? @@ -68,26 +68,16 @@ def test_not_present def test_not_present__element_not_found proxy = new_proxy - stub_capybara_session_wait_until + stub_wait_for(proxy) element_class.expects(:new).raises(Capybara::ElementNotFound) assert proxy.not_present? end - - def test_not_present__timeout - proxy = new_proxy - - fake_session = stub - fake_session.expects(:wait_until).raises(Capybara::TimeoutError) - Capybara.stubs(:current_session).returns(fake_session) - - assert !proxy.not_present? - end def test_visible proxy = new_proxy - stub_capybara_session_wait_until + stub_wait_for(proxy) element_class.expect_initialize element_class.any_instance.expects(:visible?).returns(true) @@ -97,7 +87,7 @@ def test_visible def test_visible__element_not_found proxy = new_proxy - stub_capybara_session_wait_until + stub_wait_for(proxy) element_class.expects(:new).raises(Capybara::ElementNotFound) assert_false proxy.visible? @@ -105,14 +95,14 @@ def test_visible__element_not_found def test_not_visible proxy = new_proxy - - stub_capybara_session_wait_until + + stub_wait_for(proxy) element_class.expect_initialize element_class.any_instance.expects(:visible?).returns(false) assert proxy.not_visible? - - stub_capybara_session_wait_until + + stub_wait_for(proxy) element_class.any_instance.expects(:visible?).returns(true) assert ! proxy.not_visible? @@ -120,61 +110,58 @@ def test_not_visible def test_not_visible__element_not_found proxy = new_proxy - - stub_capybara_session_wait_until + + stub_wait_for(proxy) element_class.expects(:new).raises(Capybara::ElementNotFound) assert proxy.not_visible? end - - def test_not_visible__timeout - proxy = new_proxy - - fake_session = stub - fake_session.expects(:wait_until).raises(Capybara::TimeoutError) - Capybara.stubs(:current_session).returns(fake_session) - assert !proxy.not_visible? - end - def test_visible__false proxy = new_proxy - stub_capybara_session_wait_until + stub_wait_for(proxy) element_class.expect_initialize element_class.any_instance.expects(:visible?).returns(false) assert_false proxy.visible? end - - private - - def stub_capybara_session_wait_until - fake_session_class = Class.new do - def wait_until - verified_called - yield - end + + def test_wait_for + proxy = new_proxy + + Capybara.expects(:default_wait_time).returns(:default_wait_time) + Timeout.expects(:timeout).with(:default_wait_time).yields + + block_calls = sequence('calls') + Capybara.expects(:using_wait_time).in_sequence(block_calls).with(0).yields.returns(false) + Capybara.expects(:using_wait_time).in_sequence(block_calls).with(0).yields.returns(true) + + block = mock + block.expects(:called).times(2) + proxy.send(:wait_for) do + block.called end - - fake_session = fake_session_class.new - fake_session.expects :verified_called - Capybara.expects(:current_session).returns(fake_session) end - - def stub_capybara_session_wait_until - fake_session_class = Class.new do - def wait_until - verified_called - yield - end + + def test_wait_for__timeout + proxy = new_proxy + + Timeout.expects(:timeout).raises(Timeout::Error) + + assert !proxy.send(:wait_for) + end + + private + + def stub_wait_for(proxy) + wait_for_mock = mock(:wait_for_called => true) + (class << proxy; self; end).send(:define_method, :wait_for) do |&block| + wait_for_mock.wait_for_called + block.call end - - fake_session = fake_session_class.new - fake_session.expects :verified_called - Capybara.stubs(:current_session).returns(fake_session) end - + def element_class @element_class ||= Element.new_subclass do def self.expect_initialize From 62c188d1789f78b45b98e3376eb8aa5441bde1c1 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:25:40 -0800 Subject: [PATCH 02/33] removing lock files --- .gitignore | 2 + Gemfile.lock | 52 -------------- Gemfile.ruby-1.9.3.lock | 52 -------------- Gemfile.ruby-2.0.0.lock | 52 -------------- test/test_apps/2.3/Gemfile.lock | 71 ------------------ test/test_apps/3.0/Gemfile.lock | 114 ----------------------------- test/test_apps/3.1/Gemfile.lock | 124 -------------------------------- test/test_apps/3.2/Gemfile.lock | 123 ------------------------------- 8 files changed, 2 insertions(+), 588 deletions(-) delete mode 100644 Gemfile.lock delete mode 100644 Gemfile.ruby-1.9.3.lock delete mode 100644 Gemfile.ruby-2.0.0.lock delete mode 100644 test/test_apps/2.3/Gemfile.lock delete mode 100644 test/test_apps/3.0/Gemfile.lock delete mode 100644 test/test_apps/3.1/Gemfile.lock delete mode 100644 test/test_apps/3.2/Gemfile.lock diff --git a/.gitignore b/.gitignore index f2538f27..84e143e1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ test/test_apps/**/db/*.sqlite3 test/test_apps/**/log/*.log test/test_apps/**/tmp/**/* +*.lock + *.sqlite3 pkg .idea diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index cb431489..00000000 --- a/Gemfile.lock +++ /dev/null @@ -1,52 +0,0 @@ -PATH - remote: . - specs: - ae_page_objects (0.5.2) - capybara (~> 1.1) - -GEM - remote: https://rubygems.org/ - specs: - appraisal (0.5.2) - bundler - rake - capybara (1.1.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - ffi (1.9.0) - metaclass (0.0.1) - mime-types (1.25) - mocha (0.13.3) - metaclass (~> 0.0.1) - multi_json (1.8.0) - nokogiri (1.5.10) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rake (10.1.0) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - websocket (1.0.7) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - ae_page_objects! - appraisal (~> 0.5.1) - mocha (= 0.13.3) - nokogiri (< 1.6.0) - rubyzip (< 1.0.0) - selenium-webdriver diff --git a/Gemfile.ruby-1.9.3.lock b/Gemfile.ruby-1.9.3.lock deleted file mode 100644 index da959369..00000000 --- a/Gemfile.ruby-1.9.3.lock +++ /dev/null @@ -1,52 +0,0 @@ -PATH - remote: . - specs: - ae_page_objects (0.4.1) - capybara (~> 1.1) - -GEM - remote: https://rubygems.org/ - specs: - appraisal (0.5.2) - bundler - rake - capybara (1.1.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - ffi (1.9.0) - metaclass (0.0.1) - mime-types (1.25) - mini_portile (0.5.1) - mocha (0.13.3) - metaclass (~> 0.0.1) - multi_json (1.8.0) - nokogiri (1.6.0) - mini_portile (~> 0.5.0) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rake (10.1.0) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - websocket (1.0.7) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - ae_page_objects! - appraisal (~> 0.5.1) - mocha (= 0.13.3) - selenium-webdriver diff --git a/Gemfile.ruby-2.0.0.lock b/Gemfile.ruby-2.0.0.lock deleted file mode 100644 index da959369..00000000 --- a/Gemfile.ruby-2.0.0.lock +++ /dev/null @@ -1,52 +0,0 @@ -PATH - remote: . - specs: - ae_page_objects (0.4.1) - capybara (~> 1.1) - -GEM - remote: https://rubygems.org/ - specs: - appraisal (0.5.2) - bundler - rake - capybara (1.1.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - ffi (1.9.0) - metaclass (0.0.1) - mime-types (1.25) - mini_portile (0.5.1) - mocha (0.13.3) - metaclass (~> 0.0.1) - multi_json (1.8.0) - nokogiri (1.6.0) - mini_portile (~> 0.5.0) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rake (10.1.0) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - websocket (1.0.7) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - ae_page_objects! - appraisal (~> 0.5.1) - mocha (= 0.13.3) - selenium-webdriver diff --git a/test/test_apps/2.3/Gemfile.lock b/test/test_apps/2.3/Gemfile.lock deleted file mode 100644 index 81dd977e..00000000 --- a/test/test_apps/2.3/Gemfile.lock +++ /dev/null @@ -1,71 +0,0 @@ -PATH - remote: ../../.. - specs: - ae_page_objects (0.5.2) - capybara (~> 1.1) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (2.3.18) - actionpack (= 2.3.18) - actionpack (2.3.18) - activesupport (= 2.3.18) - rack (~> 1.1.0) - activerecord (2.3.18) - activesupport (= 2.3.18) - activeresource (2.3.18) - activesupport (= 2.3.18) - activesupport (2.3.18) - capybara (1.1.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - ffi (1.9.0) - json (1.7.7) - mime-types (1.25) - mocha (0.9.7) - rake - multi_json (1.8.2) - nokogiri (1.5.10) - rack (1.1.3) - rack-test (0.6.2) - rack (>= 1.0) - rails (2.3.18) - actionmailer (= 2.3.18) - actionpack (= 2.3.18) - activerecord (= 2.3.18) - activeresource (= 2.3.18) - activesupport (= 2.3.18) - rake (>= 0.8.3) - rake (10.1.0) - rdoc (3.12.2) - json (~> 1.4) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - sqlite3 (1.3.7) - websocket (1.0.7) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - ae_page_objects! - mocha (= 0.9.7) - nokogiri (< 1.6.0) - rails (= 2.3.18) - rake - rdoc - rubyzip (< 1.0.0) - sqlite3 diff --git a/test/test_apps/3.0/Gemfile.lock b/test/test_apps/3.0/Gemfile.lock deleted file mode 100644 index 73783b56..00000000 --- a/test/test_apps/3.0/Gemfile.lock +++ /dev/null @@ -1,114 +0,0 @@ -PATH - remote: ../../.. - specs: - ae_page_objects (0.5.2) - capybara (~> 1.1) - -GEM - remote: https://rubygems.org/ - specs: - abstract (1.0.0) - actionmailer (3.0.20) - actionpack (= 3.0.20) - mail (~> 2.2.19) - actionpack (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - rack (~> 1.2.5) - rack-mount (~> 0.6.14) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.20) - activesupport (= 3.0.20) - builder (~> 2.1.2) - i18n (~> 0.5.0) - activerecord (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - arel (~> 2.0.10) - tzinfo (~> 0.3.23) - activeresource (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - activesupport (3.0.20) - arel (2.0.10) - builder (2.1.2) - capybara (1.1.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - erubis (2.6.6) - abstract (>= 1.0.0) - ffi (1.9.0) - i18n (0.5.0) - jquery-rails (2.2.1) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.7.7) - mail (2.2.19) - activesupport (>= 2.3.6) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - metaclass (0.0.1) - mime-types (1.22) - mocha (0.13.3) - metaclass (~> 0.0.1) - multi_json (1.8.2) - nokogiri (1.5.10) - polyglot (0.3.3) - rack (1.2.8) - rack-mount (0.6.14) - rack (>= 1.0.0) - rack-test (0.5.7) - rack (>= 1.0) - rails (3.0.20) - actionmailer (= 3.0.20) - actionpack (= 3.0.20) - activerecord (= 3.0.20) - activeresource (= 3.0.20) - activesupport (= 3.0.20) - bundler (~> 1.0) - railties (= 3.0.20) - railties (3.0.20) - actionpack (= 3.0.20) - activesupport (= 3.0.20) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.4) - rake (10.0.4) - rdoc (3.12.2) - json (~> 1.4) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - sqlite3 (1.3.7) - thor (0.14.6) - treetop (1.4.12) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.37) - websocket (1.0.7) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - ae_page_objects! - jquery-rails - mocha (= 0.13.3) - rails (= 3.0.20) - sqlite3 diff --git a/test/test_apps/3.1/Gemfile.lock b/test/test_apps/3.1/Gemfile.lock deleted file mode 100644 index da388e7e..00000000 --- a/test/test_apps/3.1/Gemfile.lock +++ /dev/null @@ -1,124 +0,0 @@ -PATH - remote: ../../.. - specs: - ae_page_objects (0.5.2) - capybara (~> 1.1) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.1.12) - actionpack (= 3.1.12) - mail (~> 2.4.4) - actionpack (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - builder (~> 3.0.0) - erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.6) - rack-cache (~> 1.2) - rack-mount (~> 0.8.2) - rack-test (~> 0.6.1) - sprockets (~> 2.0.4) - activemodel (3.1.12) - activesupport (= 3.1.12) - builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - arel (~> 2.2.3) - tzinfo (~> 0.3.29) - activeresource (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - activesupport (3.1.12) - multi_json (~> 1.0) - arel (2.2.3) - builder (3.0.4) - capybara (1.1.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - erubis (2.7.0) - ffi (1.9.0) - hike (1.2.2) - i18n (0.6.4) - jquery-rails (2.2.1) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.7.7) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - metaclass (0.0.1) - mime-types (1.22) - mocha (0.13.3) - metaclass (~> 0.0.1) - multi_json (1.7.2) - nokogiri (1.5.10) - polyglot (0.3.3) - rack (1.3.10) - rack-cache (1.2) - rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.1.12) - actionmailer (= 3.1.12) - actionpack (= 3.1.12) - activerecord (= 3.1.12) - activeresource (= 3.1.12) - activesupport (= 3.1.12) - bundler (~> 1.0) - railties (= 3.1.12) - railties (3.1.12) - actionpack (= 3.1.12) - activesupport (= 3.1.12) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (10.0.4) - rdoc (3.12.2) - json (~> 1.4) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - sprockets (2.0.4) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.7) - thor (0.14.6) - tilt (1.3.7) - treetop (1.4.12) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.37) - websocket (1.0.7) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - ae_page_objects! - jquery-rails - mocha (= 0.13.3) - rails (= 3.1.12) - sqlite3 diff --git a/test/test_apps/3.2/Gemfile.lock b/test/test_apps/3.2/Gemfile.lock deleted file mode 100644 index b065c864..00000000 --- a/test/test_apps/3.2/Gemfile.lock +++ /dev/null @@ -1,123 +0,0 @@ -PATH - remote: ../../.. - specs: - ae_page_objects (0.5.2) - capybara (~> 1.1) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - arel (3.0.2) - builder (3.0.4) - capybara (1.1.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - erubis (2.7.0) - ffi (1.9.0) - hike (1.2.2) - i18n (0.6.1) - journey (1.0.4) - jquery-rails (2.2.1) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.7.7) - mail (2.5.3) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - metaclass (0.0.1) - mime-types (1.22) - mocha (0.13.3) - metaclass (~> 0.0.1) - multi_json (1.7.2) - nokogiri (1.5.10) - polyglot (0.3.3) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.0.4) - rdoc (3.12.2) - json (~> 1.4) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.7) - thor (0.18.1) - tilt (1.3.7) - treetop (1.4.12) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.37) - websocket (1.0.7) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - ae_page_objects! - jquery-rails - mocha (= 0.13.3) - rails (= 3.2.13) - sqlite3 From 7885662bb79421ca25a2c72c29193c64bfff18ce Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:29:02 -0800 Subject: [PATCH 03/33] introduce Appraisals and redoing some rake tasks to support a wider test matrix --- .gitignore | 1 + .travis.yml | 21 +++------------------ Appraisals | 20 ++++++++++++++++++++ Gemfile | 4 ---- Gemfile.ruby-1.9.3 | 7 ------- Gemfile.ruby-2.0.0 | 8 -------- Rakefile | 7 +++++++ 7 files changed, 31 insertions(+), 37 deletions(-) create mode 100644 Appraisals delete mode 100644 Gemfile.ruby-1.9.3 delete mode 100644 Gemfile.ruby-2.0.0 diff --git a/.gitignore b/.gitignore index 84e143e1..1c68f78d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ test/test_apps/**/log/*.log test/test_apps/**/tmp/**/* *.lock +gemfiles *.sqlite3 pkg diff --git a/.travis.yml b/.travis.yml index 31efc6b1..77b29513 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ rvm: gemfile: - Gemfile - - Gemfile.ruby-1.9.3 - - Gemfile.ruby-2.0.0 bundler_args: '' @@ -19,21 +17,8 @@ before_install: before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start + - bundle exec rake appraisal:gemfiles + - bundle exec rake appraisal:install - bundle exec rake test:integration:selenium:install -script: "bundle exec rake" - -matrix: - exclude: - - rvm: 1.9.3 - gemfile: Gemfile - - rvm: 2.0.0 - gemfile: Gemfile - - rvm: 1.8.7 - gemfile: Gemfile.ruby-1.9.3 - - rvm: 2.0.0 - gemfile: Gemfile.ruby-1.9.3 - - rvm: 1.8.7 - gemfile: Gemfile.ruby-2.0.0 - - rvm: 1.9.3 - gemfile: Gemfile.ruby-2.0.0 +script: "bundle exec rake test:ci" diff --git a/Appraisals b/Appraisals new file mode 100644 index 00000000..19265adb --- /dev/null +++ b/Appraisals @@ -0,0 +1,20 @@ +if RUBY_VERSION == '1.8.7' + + appraise "capybara-1.1" do + gemfile.gemspec + + gem "nokogiri", "< 1.6.0" + gem 'rubyzip', '< 1.0.0' + gem 'capybara', '~> 1.1.4' + end + +else + + appraise "capybara-1.1" do + gemfile.gemspec + + gem 'capybara', '~> 1.1.4' + end + +end + diff --git a/Gemfile b/Gemfile index fa5b1e3f..d3faf42a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,5 @@ source "https://rubygems.org" -gemspec - -gem "nokogiri", "< 1.6.0" gem "appraisal", "~> 0.5.1" gem "mocha", "= 0.13.3" gem "selenium-webdriver", ">= 0" -gem 'rubyzip', '< 1.0.0' diff --git a/Gemfile.ruby-1.9.3 b/Gemfile.ruby-1.9.3 deleted file mode 100644 index e5beff15..00000000 --- a/Gemfile.ruby-1.9.3 +++ /dev/null @@ -1,7 +0,0 @@ -source "https://rubygems.org" - -gemspec - -gem "appraisal", "~> 0.5.1" -gem "mocha", "= 0.13.3" -gem "selenium-webdriver", ">= 0" diff --git a/Gemfile.ruby-2.0.0 b/Gemfile.ruby-2.0.0 deleted file mode 100644 index 8bb0590f..00000000 --- a/Gemfile.ruby-2.0.0 +++ /dev/null @@ -1,8 +0,0 @@ -source "https://rubygems.org" - -gemspec - -gem "appraisal", "~> 0.5.1" -gem "mocha", "= 0.13.3" -gem "selenium-webdriver", ">= 0" - diff --git a/Rakefile b/Rakefile index 352c3a2c..da4bf4b9 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,11 @@ namespace :test do end namespace :integration do + task :units do + system("bundle exec rake -s appraisal test:units") + raise unless $?.exitstatus == 0 + end + namespace :selenium do task :install do for_each_directory_of('test/test_apps/[0-9]*/**/Gemfile') do |directory| @@ -63,6 +68,8 @@ namespace :test do end end end + + task :ci => ['test:integration:units', 'test:integration:selenium'] end def run_test_in(directory, *tasks) From 7eeb5c1ddaada3b45071d081a17f92c3563f0b29 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:30:21 -0800 Subject: [PATCH 04/33] making use of Selenium::WebDriver optional, and thus only supporting Window when using it. --- lib/ae_page_objects/document.rb | 14 ++++++++++---- test/test_apps/2.3/Gemfile | 3 +++ test/test_apps/3.0/Gemfile | 3 +++ test/test_apps/3.1/Gemfile | 3 +++ test/test_apps/3.2/Gemfile | 3 +++ test/unit_helper.rb | 1 + 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/ae_page_objects/document.rb b/lib/ae_page_objects/document.rb index df623d1a..3d5d2f56 100644 --- a/lib/ae_page_objects/document.rb +++ b/lib/ae_page_objects/document.rb @@ -2,13 +2,19 @@ module AePageObjects class Document < Node include Concerns::Visitable - attr_reader :window - def initialize super(Capybara.current_session) + end - @window = Window.current - @window.current_document = self + if defined? Selenium::WebDriver + attr_reader :window + + def initialize + super(Capybara.current_session) + + @window = Window.current + @window.current_document = self + end end def document diff --git a/test/test_apps/2.3/Gemfile b/test/test_apps/2.3/Gemfile index 0f230cb6..c837734f 100644 --- a/test/test_apps/2.3/Gemfile +++ b/test/test_apps/2.3/Gemfile @@ -7,6 +7,9 @@ gem 'sqlite3' gem "nokogiri", "< 1.6.0" +gem "selenium-webdriver" +gem 'capybara', '~> 1.1.4' + group :development do gem 'rubyzip', '< 1.0.0' gem 'ae_page_objects', :path => '../../..' diff --git a/test/test_apps/3.0/Gemfile b/test/test_apps/3.0/Gemfile index 47453dc8..9fc151ab 100644 --- a/test/test_apps/3.0/Gemfile +++ b/test/test_apps/3.0/Gemfile @@ -4,6 +4,9 @@ gem 'rails', '3.0.20' gem 'sqlite3' gem 'jquery-rails' +gem "selenium-webdriver" +gem 'capybara', '~> 1.1.4' + group :development do gem 'ae_page_objects', :path => '../../..' gem "mocha", "0.13.3", :require => false diff --git a/test/test_apps/3.1/Gemfile b/test/test_apps/3.1/Gemfile index 3142b54e..17d978c7 100644 --- a/test/test_apps/3.1/Gemfile +++ b/test/test_apps/3.1/Gemfile @@ -4,6 +4,9 @@ gem "rails", "3.1.12" gem "sqlite3" gem 'jquery-rails' +gem "selenium-webdriver" +gem 'capybara', '~> 1.1.4' + group :development do gem 'ae_page_objects', :path => '../../..' gem "mocha", "0.13.3", :require => false diff --git a/test/test_apps/3.2/Gemfile b/test/test_apps/3.2/Gemfile index c5cc8710..de7eb4c1 100644 --- a/test/test_apps/3.2/Gemfile +++ b/test/test_apps/3.2/Gemfile @@ -4,6 +4,9 @@ gem "rails", '3.2.13' gem "sqlite3" gem 'jquery-rails' +gem "selenium-webdriver" +gem 'capybara', '~> 1.1.4' + group :development do gem 'ae_page_objects', :path => '../../..' gem "mocha", "0.13.3", :require => false diff --git a/test/unit_helper.rb b/test/unit_helper.rb index 29abafc8..a1adb58c 100644 --- a/test/unit_helper.rb +++ b/test/unit_helper.rb @@ -4,6 +4,7 @@ require 'rubygems' +require 'selenium-webdriver' require 'ae_page_objects' require 'test/unit' require "mocha/setup" From 80aff79b2c3cf180b5a07496f25cfb57a0ac05e5 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:30:57 -0800 Subject: [PATCH 05/33] updates to support Capybara <2.3 --- Appraisals | 12 ++++++++++ ae_page_objects.gemspec | 2 +- lib/ae_page_objects/elements/collection.rb | 10 +++++++- test/unit/collection_test.rb | 27 ++++++++++++++-------- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Appraisals b/Appraisals index 19265adb..7ffade9b 100644 --- a/Appraisals +++ b/Appraisals @@ -16,5 +16,17 @@ else gem 'capybara', '~> 1.1.4' end + appraise "capybara-2.1" do + gemfile.gemspec + + gem 'capybara', '~> 2.1.0' + end + + appraise "capybara-2.2" do + gemfile.gemspec + + gem 'capybara', '~> 2.2.0' + end + end diff --git a/ae_page_objects.gemspec b/ae_page_objects.gemspec index f785cac6..86451d3b 100644 --- a/ae_page_objects.gemspec +++ b/ae_page_objects.gemspec @@ -18,6 +18,6 @@ Gem::Specification.new do |s| s.files = `git ls-files -- lib`.split("\n") - s.add_dependency("capybara", ["~> 1.1"]) + s.add_dependency('capybara', ['>= 1.1', '< 2.3']) end diff --git a/lib/ae_page_objects/elements/collection.rb b/lib/ae_page_objects/elements/collection.rb index e344a3b5..1778bb2f 100644 --- a/lib/ae_page_objects/elements/collection.rb +++ b/lib/ae_page_objects/elements/collection.rb @@ -63,7 +63,15 @@ def item_class_at(index) end def item_xpath - @item_xpath ||= Capybara::Selector.normalize(*eval_locator(@item_locator)).xpaths.first + @item_xpath ||= begin + evaled_locator = eval_locator(@item_locator) + + if Capybara::VERSION =~ /\A1/ + Capybara::Selector.normalize(*evaled_locator).xpaths.first + else + Capybara::Query.new(*evaled_locator).xpath.to_s + end + end end def item_locator_at(index) diff --git a/test/unit/collection_test.rb b/test/unit/collection_test.rb index 76768d7a..7ed128e6 100644 --- a/test/unit/collection_test.rb +++ b/test/unit/collection_test.rb @@ -17,7 +17,14 @@ def test_css_item_locator parent_node.expects(:find).with("#18_holder").returns(magazine_node) magazine = clip.new(parent, :name => "18_holder", :item_locator => ".some_class") - assert_equal ".//*[contains(concat(' ', normalize-space(@class), ' '), ' some_class ')]", magazine.send(:item_xpath) + + if Capybara::VERSION =~ /\A1/ + Capybara::Selector.expects(:normalize).returns(stub(:xpaths => ['item_xpath'])) + else + Capybara::Query.any_instance.expects(:xpath).returns('item_xpath') + end + + assert_equal "item_xpath", magazine.send(:item_xpath) end def test_empty @@ -34,8 +41,9 @@ def test_empty parent_node.expects(:find).with("#18_holder").returns(magazine_node) magazine = clip.new(parent, :name => "18_holder") + magazine.stubs(:item_xpath).returns("item_xpath") - magazine_node.stubs(:all).with(:xpath, magazine.send(:item_xpath)).returns([]) + magazine_node.stubs(:all).with(:xpath, "item_xpath").returns([]) assert_equal 0, magazine.size @@ -64,15 +72,16 @@ def test_non_empty parent_node.expects(:find).with("#18_holder").returns(magazine_node) magazine = clip.new(parent, :name => "18_holder") + magazine.stubs(:item_xpath).returns("item_xpath") bullet1_stub = mock bullet2_stub = mock - magazine_node.stubs(:all).with(:xpath, magazine.send(:item_xpath)).returns([bullet1_stub, bullet2_stub]) + magazine_node.stubs(:all).with(:xpath, "item_xpath").returns([bullet1_stub, bullet2_stub]) assert_equal 2, magazine.size - magazine_node.expects(:find).with(:xpath, "#{magazine.send(:item_xpath)}[1]").returns(bullet1_stub) - magazine_node.expects(:find).with(:xpath, "#{magazine.send(:item_xpath)}[2]").returns(bullet2_stub) + magazine_node.expects(:find).with(:xpath, "item_xpath[1]").returns(bullet1_stub) + magazine_node.expects(:find).with(:xpath, "item_xpath[2]").returns(bullet2_stub) each_block_call_count = 0 magazine.each do |bullet| bullet.name @@ -80,16 +89,16 @@ def test_non_empty end assert_equal 2, each_block_call_count - magazine_node.expects(:find).with(:xpath, "#{magazine.send(:item_xpath)}[1]").times(2).returns(bullet1_stub) + magazine_node.expects(:find).with(:xpath, "item_xpath[1]").times(2).returns(bullet1_stub) assert_equal bullet1_stub, magazine.at(0).node assert_equal bullet1_stub, magazine.first.node - magazine_node.expects(:find).with(:xpath, "#{magazine.send(:item_xpath)}[2]").times(2).returns(bullet2_stub) + magazine_node.expects(:find).with(:xpath, "item_xpath[2]").times(2).returns(bullet2_stub) assert_equal bullet2_stub, magazine.at(1).node assert_equal bullet2_stub, magazine.last.node - magazine_node.expects(:find).with(:xpath, "#{magazine.send(:item_xpath)}[1]").returns(bullet1_stub) - magazine_node.expects(:find).with(:xpath, "#{magazine.send(:item_xpath)}[2]").returns(bullet2_stub) + magazine_node.expects(:find).with(:xpath, "item_xpath[1]").returns(bullet1_stub) + magazine_node.expects(:find).with(:xpath, "item_xpath[2]").returns(bullet2_stub) assert_equal [bullet1_stub, bullet2_stub], magazine.map(&:node) assert_equal nil, magazine.at(1000) From 3360e01778acc5d6026939c7c4811aa61147ea7f Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:44:43 -0800 Subject: [PATCH 06/33] Creating CI specific Gemfile. Using top-level Gemfile for running rake tasks for development --- .travis.yml | 3 ++- Appraisals | 12 ++++++++++++ Gemfile | 2 ++ Gemfile-ci | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Gemfile-ci diff --git a/.travis.yml b/.travis.yml index 77b29513..b6c9487f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ rvm: - 2.0.0 gemfile: - - Gemfile + - Gemfile-ci bundler_args: '' @@ -17,6 +17,7 @@ before_install: before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start + - bundle exec rake appraisal:cleanup - bundle exec rake appraisal:gemfiles - bundle exec rake appraisal:install - bundle exec rake test:integration:selenium:install diff --git a/Appraisals b/Appraisals index 7ffade9b..7c7d4eee 100644 --- a/Appraisals +++ b/Appraisals @@ -1,6 +1,9 @@ if RUBY_VERSION == '1.8.7' appraise "capybara-1.1" do + gem "mocha", "= 0.13.3" + gem "selenium-webdriver", ">= 0" + gemfile.gemspec gem "nokogiri", "< 1.6.0" @@ -11,18 +14,27 @@ if RUBY_VERSION == '1.8.7' else appraise "capybara-1.1" do + gem "mocha", "= 0.13.3" + gem "selenium-webdriver", ">= 0" + gemfile.gemspec gem 'capybara', '~> 1.1.4' end appraise "capybara-2.1" do + gem "mocha", "= 0.13.3" + gem "selenium-webdriver", ">= 0" + gemfile.gemspec gem 'capybara', '~> 2.1.0' end appraise "capybara-2.2" do + gem "mocha", "= 0.13.3" + gem "selenium-webdriver", ">= 0" + gemfile.gemspec gem 'capybara', '~> 2.2.0' diff --git a/Gemfile b/Gemfile index d3faf42a..eb2df7bd 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,5 @@ source "https://rubygems.org" gem "appraisal", "~> 0.5.1" gem "mocha", "= 0.13.3" gem "selenium-webdriver", ">= 0" + +gemspec \ No newline at end of file diff --git a/Gemfile-ci b/Gemfile-ci new file mode 100644 index 00000000..dea05bf4 --- /dev/null +++ b/Gemfile-ci @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" From 34a00e38dcbf7797ee86e196ad902f2eca557dbd Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:52:00 -0800 Subject: [PATCH 07/33] restricting mime-type on 1.8.7 --- Appraisals | 1 + 1 file changed, 1 insertion(+) diff --git a/Appraisals b/Appraisals index 7c7d4eee..aa00c7df 100644 --- a/Appraisals +++ b/Appraisals @@ -8,6 +8,7 @@ if RUBY_VERSION == '1.8.7' gem "nokogiri", "< 1.6.0" gem 'rubyzip', '< 1.0.0' + gem 'mime-types', '< 2' gem 'capybara', '~> 1.1.4' end From a4f9438178215a1795a1a82748b62deb8e2c7d9d Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 16:55:57 -0800 Subject: [PATCH 08/33] restricting mime-types in 2.3 test app --- test/test_apps/2.3/Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_apps/2.3/Gemfile b/test/test_apps/2.3/Gemfile index c837734f..17f72a56 100644 --- a/test/test_apps/2.3/Gemfile +++ b/test/test_apps/2.3/Gemfile @@ -10,6 +10,8 @@ gem "nokogiri", "< 1.6.0" gem "selenium-webdriver" gem 'capybara', '~> 1.1.4' +gem 'mime-types', '< 2' + group :development do gem 'rubyzip', '< 1.0.0' gem 'ae_page_objects', :path => '../../..' From 8d8c1251e60cca5afae9101352148287c513d1d2 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 17:06:01 -0800 Subject: [PATCH 09/33] include ruby version in appraisal name --- Appraisals | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Appraisals b/Appraisals index aa00c7df..409f81d9 100644 --- a/Appraisals +++ b/Appraisals @@ -1,6 +1,6 @@ if RUBY_VERSION == '1.8.7' - appraise "capybara-1.1" do + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do gem "mocha", "= 0.13.3" gem "selenium-webdriver", ">= 0" @@ -14,7 +14,7 @@ if RUBY_VERSION == '1.8.7' else - appraise "capybara-1.1" do + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do gem "mocha", "= 0.13.3" gem "selenium-webdriver", ">= 0" @@ -23,7 +23,7 @@ else gem 'capybara', '~> 1.1.4' end - appraise "capybara-2.1" do + appraise "capybara-2.1-ruby#{RUBY_VERSION}" do gem "mocha", "= 0.13.3" gem "selenium-webdriver", ">= 0" @@ -32,7 +32,7 @@ else gem 'capybara', '~> 2.1.0' end - appraise "capybara-2.2" do + appraise "capybara-2.2-ruby#{RUBY_VERSION}" do gem "mocha", "= 0.13.3" gem "selenium-webdriver", ">= 0" From ab3827262bd4a36696358a0ac18569117b3de5da Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 17:08:20 -0800 Subject: [PATCH 10/33] adding Appraisal gemfiles to git --- .gitignore | 2 +- .travis.yml | 1 - Appraisals | 1 - gemfiles/capybara_1.1_ruby1.8.7.gemfile | 13 +++++++++++++ gemfiles/capybara_1.1_ruby1.9.3.gemfile | 10 ++++++++++ gemfiles/capybara_1.1_ruby2.0.0.gemfile | 10 ++++++++++ gemfiles/capybara_2.1_ruby1.9.3.gemfile | 10 ++++++++++ gemfiles/capybara_2.1_ruby2.0.0.gemfile | 10 ++++++++++ gemfiles/capybara_2.2_ruby1.9.3.gemfile | 10 ++++++++++ gemfiles/capybara_2.2_ruby2.0.0.gemfile | 10 ++++++++++ 10 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 gemfiles/capybara_1.1_ruby1.8.7.gemfile create mode 100644 gemfiles/capybara_1.1_ruby1.9.3.gemfile create mode 100644 gemfiles/capybara_1.1_ruby2.0.0.gemfile create mode 100644 gemfiles/capybara_2.1_ruby1.9.3.gemfile create mode 100644 gemfiles/capybara_2.1_ruby2.0.0.gemfile create mode 100644 gemfiles/capybara_2.2_ruby1.9.3.gemfile create mode 100644 gemfiles/capybara_2.2_ruby2.0.0.gemfile diff --git a/.gitignore b/.gitignore index 1c68f78d..d5cb916b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ test/test_apps/**/log/*.log test/test_apps/**/tmp/**/* *.lock -gemfiles +gemfiles/*.lock *.sqlite3 pkg diff --git a/.travis.yml b/.travis.yml index b6c9487f..d4c27c4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ before_install: before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - - bundle exec rake appraisal:cleanup - bundle exec rake appraisal:gemfiles - bundle exec rake appraisal:install - bundle exec rake test:integration:selenium:install diff --git a/Appraisals b/Appraisals index 409f81d9..4029ab64 100644 --- a/Appraisals +++ b/Appraisals @@ -40,6 +40,5 @@ else gem 'capybara', '~> 2.2.0' end - end diff --git a/gemfiles/capybara_1.1_ruby1.8.7.gemfile b/gemfiles/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..945dfcc0 --- /dev/null +++ b/gemfiles/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" +gem "mocha", "= 0.13.3" +gem "selenium-webdriver", ">= 0" +gem "nokogiri", "< 1.6.0" +gem "rubyzip", "< 1.0.0" +gem "mime-types", "< 2" +gem "capybara", "~> 1.1.4" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/capybara_1.1_ruby1.9.3.gemfile b/gemfiles/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..65e4f227 --- /dev/null +++ b/gemfiles/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" +gem "mocha", "= 0.13.3" +gem "selenium-webdriver", ">= 0" +gem "capybara", "~> 1.1.4" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/capybara_1.1_ruby2.0.0.gemfile b/gemfiles/capybara_1.1_ruby2.0.0.gemfile new file mode 100644 index 00000000..65e4f227 --- /dev/null +++ b/gemfiles/capybara_1.1_ruby2.0.0.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" +gem "mocha", "= 0.13.3" +gem "selenium-webdriver", ">= 0" +gem "capybara", "~> 1.1.4" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/capybara_2.1_ruby1.9.3.gemfile b/gemfiles/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..a8965e28 --- /dev/null +++ b/gemfiles/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" +gem "mocha", "= 0.13.3" +gem "selenium-webdriver", ">= 0" +gem "capybara", "~> 2.1.0" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/capybara_2.1_ruby2.0.0.gemfile b/gemfiles/capybara_2.1_ruby2.0.0.gemfile new file mode 100644 index 00000000..a8965e28 --- /dev/null +++ b/gemfiles/capybara_2.1_ruby2.0.0.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" +gem "mocha", "= 0.13.3" +gem "selenium-webdriver", ">= 0" +gem "capybara", "~> 2.1.0" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/capybara_2.2_ruby1.9.3.gemfile b/gemfiles/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..51b6345d --- /dev/null +++ b/gemfiles/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" +gem "mocha", "= 0.13.3" +gem "selenium-webdriver", ">= 0" +gem "capybara", "~> 2.2.0" + +gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/capybara_2.2_ruby2.0.0.gemfile b/gemfiles/capybara_2.2_ruby2.0.0.gemfile new file mode 100644 index 00000000..51b6345d --- /dev/null +++ b/gemfiles/capybara_2.2_ruby2.0.0.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 0.5.1" +gem "mocha", "= 0.13.3" +gem "selenium-webdriver", ">= 0" +gem "capybara", "~> 2.2.0" + +gemspec :path=>"../" \ No newline at end of file From 7cd02740860366dc87863e47a79fb7d25b964b2f Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 18:26:15 -0800 Subject: [PATCH 11/33] adding in testing layout to test multiple capybara versions against rails apps --- selenium_gemfiles/rails2.3/Gemfile | 12 +++++++++++ .../rails2.3/capybara_1.1_ruby1.8.7.gemfile | 8 ++++++++ .../rails2.3/capybara_1.1_ruby1.9.3.gemfile | 4 ++++ selenium_gemfiles/rails3.0/Gemfile | 11 ++++++++++ .../rails3.0/capybara_1.1_ruby1.8.7.gemfile | 8 ++++++++ .../rails3.0/capybara_1.1_ruby1.9.3.gemfile | 4 ++++ selenium_gemfiles/rails3.1/Gemfile | 11 ++++++++++ .../rails3.1/capybara_1.1_ruby1.8.7.gemfile | 8 ++++++++ .../rails3.1/capybara_1.1_ruby1.9.3.gemfile | 4 ++++ selenium_gemfiles/rails3.2/Gemfile | 12 +++++++++++ .../rails3.2/capybara_1.1_ruby2.0.0.gemfile | 4 ++++ test/test_apps/2.3/Gemfile | 20 +++---------------- test/test_apps/3.0/Gemfile | 14 +++---------- test/test_apps/3.1/Gemfile | 14 +++---------- test/test_apps/3.2/Gemfile | 14 +++---------- 15 files changed, 98 insertions(+), 50 deletions(-) create mode 100644 selenium_gemfiles/rails2.3/Gemfile create mode 100644 selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile create mode 100644 selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.0/Gemfile create mode 100644 selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile create mode 100644 selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.1/Gemfile create mode 100644 selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile create mode 100644 selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.2/Gemfile create mode 100644 selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile diff --git a/selenium_gemfiles/rails2.3/Gemfile b/selenium_gemfiles/rails2.3/Gemfile new file mode 100644 index 00000000..e138bcba --- /dev/null +++ b/selenium_gemfiles/rails2.3/Gemfile @@ -0,0 +1,12 @@ +source "https://rubygems.org" + +gem 'rails', '2.3.18' +gem 'sqlite3' +gem 'rake' +gem 'rdoc' + +gem "selenium-webdriver" + +gem "mocha", "0.9.7" + +gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) diff --git a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..6a52c96c --- /dev/null +++ b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,8 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem "nokogiri", "< 1.6.0" +gem 'mime-types', '< 2' +gem 'rubyzip', '< 1.0.0' + +gem 'capybara', '~> 1.1.4' + diff --git a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..2653b62b --- /dev/null +++ b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 1.1.4' + diff --git a/selenium_gemfiles/rails3.0/Gemfile b/selenium_gemfiles/rails3.0/Gemfile new file mode 100644 index 00000000..e7ea49fd --- /dev/null +++ b/selenium_gemfiles/rails3.0/Gemfile @@ -0,0 +1,11 @@ +source "https://rubygems.org" + +gem 'rails', '3.0.20' +gem 'sqlite3' +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) diff --git a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..6a52c96c --- /dev/null +++ b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,8 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem "nokogiri", "< 1.6.0" +gem 'mime-types', '< 2' +gem 'rubyzip', '< 1.0.0' + +gem 'capybara', '~> 1.1.4' + diff --git a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..2653b62b --- /dev/null +++ b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 1.1.4' + diff --git a/selenium_gemfiles/rails3.1/Gemfile b/selenium_gemfiles/rails3.1/Gemfile new file mode 100644 index 00000000..50933c2e --- /dev/null +++ b/selenium_gemfiles/rails3.1/Gemfile @@ -0,0 +1,11 @@ +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) diff --git a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..6a52c96c --- /dev/null +++ b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,8 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem "nokogiri", "< 1.6.0" +gem 'mime-types', '< 2' +gem 'rubyzip', '< 1.0.0' + +gem 'capybara', '~> 1.1.4' + diff --git a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..2653b62b --- /dev/null +++ b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 1.1.4' + diff --git a/selenium_gemfiles/rails3.2/Gemfile b/selenium_gemfiles/rails3.2/Gemfile new file mode 100644 index 00000000..55a6a6c7 --- /dev/null +++ b/selenium_gemfiles/rails3.2/Gemfile @@ -0,0 +1,12 @@ +source "https://rubygems.org" + +gem "rails", '3.2.13' +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) + diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile new file mode 100644 index 00000000..2653b62b --- /dev/null +++ b/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 1.1.4' + diff --git a/test/test_apps/2.3/Gemfile b/test/test_apps/2.3/Gemfile index 17f72a56..1d198e21 100644 --- a/test/test_apps/2.3/Gemfile +++ b/test/test_apps/2.3/Gemfile @@ -1,19 +1,5 @@ -source "https://rubygems.org" +file = Dir.glob("../../../selenium_gemfiles/rails2.3/*ruby#{RUBY_VERSION}*").sort.reverse.first +puts "Using Gemfile: #{file}" -gem 'rails', '2.3.18' -gem 'rake' -gem 'rdoc' -gem 'sqlite3' +eval_gemfile file -gem "nokogiri", "< 1.6.0" - -gem "selenium-webdriver" -gem 'capybara', '~> 1.1.4' - -gem 'mime-types', '< 2' - -group :development do - gem 'rubyzip', '< 1.0.0' - gem 'ae_page_objects', :path => '../../..' - gem "mocha", "0.9.7" -end diff --git a/test/test_apps/3.0/Gemfile b/test/test_apps/3.0/Gemfile index 9fc151ab..db45d2d3 100644 --- a/test/test_apps/3.0/Gemfile +++ b/test/test_apps/3.0/Gemfile @@ -1,13 +1,5 @@ -source "https://rubygems.org" +file = Dir.glob("../../../selenium_gemfiles/rails3.0/*ruby#{RUBY_VERSION}*").sort.reverse.first +puts "Using Gemfile: #{file}" -gem 'rails', '3.0.20' -gem 'sqlite3' -gem 'jquery-rails' +eval_gemfile file -gem "selenium-webdriver" -gem 'capybara', '~> 1.1.4' - -group :development do - gem 'ae_page_objects', :path => '../../..' - gem "mocha", "0.13.3", :require => false -end diff --git a/test/test_apps/3.1/Gemfile b/test/test_apps/3.1/Gemfile index 17d978c7..38f02d1f 100644 --- a/test/test_apps/3.1/Gemfile +++ b/test/test_apps/3.1/Gemfile @@ -1,13 +1,5 @@ -source "https://rubygems.org" +file = Dir.glob("../../../selenium_gemfiles/rails3.1/*ruby#{RUBY_VERSION}*").sort.reverse.first +puts "Using Gemfile: #{file}" -gem "rails", "3.1.12" -gem "sqlite3" -gem 'jquery-rails' +eval_gemfile file -gem "selenium-webdriver" -gem 'capybara', '~> 1.1.4' - -group :development do - gem 'ae_page_objects', :path => '../../..' - gem "mocha", "0.13.3", :require => false -end diff --git a/test/test_apps/3.2/Gemfile b/test/test_apps/3.2/Gemfile index de7eb4c1..f6072158 100644 --- a/test/test_apps/3.2/Gemfile +++ b/test/test_apps/3.2/Gemfile @@ -1,13 +1,5 @@ -source "https://rubygems.org" +file = Dir.glob("../../../selenium_gemfiles/rails3.2/*ruby#{RUBY_VERSION}*").sort.reverse.first +puts "Using Gemfile: #{file}" -gem "rails", '3.2.13' -gem "sqlite3" -gem 'jquery-rails' +eval_gemfile file -gem "selenium-webdriver" -gem 'capybara', '~> 1.1.4' - -group :development do - gem 'ae_page_objects', :path => '../../..' - gem "mocha", "0.13.3", :require => false -end From d7e24736cda0ba3689983cbf78cf4d093b5168e7 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 18:31:30 -0800 Subject: [PATCH 12/33] filling out capy1.1 for rails 3.2 --- selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile | 8 ++++++++ selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile create mode 100644 selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..6a52c96c --- /dev/null +++ b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,8 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem "nokogiri", "< 1.6.0" +gem 'mime-types', '< 2' +gem 'rubyzip', '< 1.0.0' + +gem 'capybara', '~> 1.1.4' + diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..2653b62b --- /dev/null +++ b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 1.1.4' + From 2f330ad24dc3698465a3d5a2c041ad5762ee3752 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 18:45:43 -0800 Subject: [PATCH 13/33] handle nonexistant gemfiles in test apps --- test/test_apps/2.3/Gemfile | 6 +----- test/test_apps/3.0/Gemfile | 6 +----- test/test_apps/3.1/Gemfile | 6 +----- test/test_apps/3.2/Gemfile | 6 +----- test/test_apps/shared/Gemfile | 21 +++++++++++++++++++++ 5 files changed, 25 insertions(+), 20 deletions(-) mode change 100644 => 120000 test/test_apps/2.3/Gemfile mode change 100644 => 120000 test/test_apps/3.0/Gemfile mode change 100644 => 120000 test/test_apps/3.1/Gemfile mode change 100644 => 120000 test/test_apps/3.2/Gemfile create mode 100644 test/test_apps/shared/Gemfile diff --git a/test/test_apps/2.3/Gemfile b/test/test_apps/2.3/Gemfile deleted file mode 100644 index 1d198e21..00000000 --- a/test/test_apps/2.3/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -file = Dir.glob("../../../selenium_gemfiles/rails2.3/*ruby#{RUBY_VERSION}*").sort.reverse.first -puts "Using Gemfile: #{file}" - -eval_gemfile file - diff --git a/test/test_apps/2.3/Gemfile b/test/test_apps/2.3/Gemfile new file mode 120000 index 00000000..6914d903 --- /dev/null +++ b/test/test_apps/2.3/Gemfile @@ -0,0 +1 @@ +../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/3.0/Gemfile b/test/test_apps/3.0/Gemfile deleted file mode 100644 index db45d2d3..00000000 --- a/test/test_apps/3.0/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -file = Dir.glob("../../../selenium_gemfiles/rails3.0/*ruby#{RUBY_VERSION}*").sort.reverse.first -puts "Using Gemfile: #{file}" - -eval_gemfile file - diff --git a/test/test_apps/3.0/Gemfile b/test/test_apps/3.0/Gemfile new file mode 120000 index 00000000..6914d903 --- /dev/null +++ b/test/test_apps/3.0/Gemfile @@ -0,0 +1 @@ +../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/3.1/Gemfile b/test/test_apps/3.1/Gemfile deleted file mode 100644 index 38f02d1f..00000000 --- a/test/test_apps/3.1/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -file = Dir.glob("../../../selenium_gemfiles/rails3.1/*ruby#{RUBY_VERSION}*").sort.reverse.first -puts "Using Gemfile: #{file}" - -eval_gemfile file - diff --git a/test/test_apps/3.1/Gemfile b/test/test_apps/3.1/Gemfile new file mode 120000 index 00000000..6914d903 --- /dev/null +++ b/test/test_apps/3.1/Gemfile @@ -0,0 +1 @@ +../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/3.2/Gemfile b/test/test_apps/3.2/Gemfile deleted file mode 100644 index f6072158..00000000 --- a/test/test_apps/3.2/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -file = Dir.glob("../../../selenium_gemfiles/rails3.2/*ruby#{RUBY_VERSION}*").sort.reverse.first -puts "Using Gemfile: #{file}" - -eval_gemfile file - diff --git a/test/test_apps/3.2/Gemfile b/test/test_apps/3.2/Gemfile new file mode 120000 index 00000000..6914d903 --- /dev/null +++ b/test/test_apps/3.2/Gemfile @@ -0,0 +1 @@ +../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/shared/Gemfile b/test/test_apps/shared/Gemfile new file mode 100644 index 00000000..70b54111 --- /dev/null +++ b/test/test_apps/shared/Gemfile @@ -0,0 +1,21 @@ +rails_version = File.dirname(__FILE__).split('/').last + +directory = "../../../selenium_gemfiles/rails#{rails_version}" + +file_pattern = "#{directory}/*ruby#{RUBY_VERSION}*" +file = Dir.glob(file_pattern).sort.reverse.first + +if !file || file.empty? + raise <<-ERROR + ------------- + Couldn't find Gemfile using pattern #{file_pattern} for Ruby#{RUBY_VERSION}. + Contents: + #{Dir.glob("#{directory}/*").join("\n ")}" + ------------- + ERROR +end + +puts "Using Gemfile: #{file}" + +eval_gemfile file + From dc0acfe7deef91a972438aa5e95534b5dd96a8ab Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 18:52:42 -0800 Subject: [PATCH 14/33] using full file path of gemfile --- test/test_apps/shared/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_apps/shared/Gemfile b/test/test_apps/shared/Gemfile index 70b54111..acfd6b12 100644 --- a/test/test_apps/shared/Gemfile +++ b/test/test_apps/shared/Gemfile @@ -1,6 +1,6 @@ rails_version = File.dirname(__FILE__).split('/').last -directory = "../../../selenium_gemfiles/rails#{rails_version}" +directory = File.expand_path("../../../../selenium_gemfiles/rails#{rails_version}", __FILE__) file_pattern = "#{directory}/*ruby#{RUBY_VERSION}*" file = Dir.glob(file_pattern).sort.reverse.first From 665e70c2a55ea6f16240e18b1a051bae0edd96cb Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Fri, 17 Jan 2014 19:31:56 -0800 Subject: [PATCH 15/33] dont generate gemfiles --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d4c27c4c..44f4824c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ before_install: before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - - bundle exec rake appraisal:gemfiles - bundle exec rake appraisal:install - bundle exec rake test:integration:selenium:install From 951b5991fd20ef6c0c735e312efced146d6ecac8 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 11:20:41 -0800 Subject: [PATCH 16/33] updating rake tasks to run across all gemfiles --- Rakefile | 177 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 117 insertions(+), 60 deletions(-) diff --git a/Rakefile b/Rakefile index da4bf4b9..95cb8ec1 100644 --- a/Rakefile +++ b/Rakefile @@ -2,19 +2,121 @@ require 'rubygems' require 'bundler' +require 'fileutils' require 'rake' require 'appraisal' require 'rake/testtask' +require 'pp' + + Bundler::GemHelper.install_tasks -selenium_matrix = { - '1.8.7' => ['2.3', '3.0', '3.1', '3.2'], - '1.9.3' => ['2.3', '3.0', '3.1', '3.2'], - '2.0.0' => ['3.2'] -} +class SeleniumRunner + + TestConfig = Struct.new(:rails_version, :gemfile) + + SELENIUM_GEMFILES_PATH = File.expand_path("../selenium_gemfiles", __FILE__) + + def initialize(options = {}) + @options = options + @gemfiles_path = SELENIUM_GEMFILES_PATH + @matrix = read_matrix + + puts "Test Matrix:" + pp @matrix + end + + def cleanup + FileUtils.rm_f Dir["#{@gemfiles_path}/**/*.lock"] + end + + def install_all + @matrix.each do |rails_version, test_configs| + test_configs.each do |test_config| + appraisal = Appraisal::Appraisal.new("name", test_config.gemfile) + + def appraisal.gemfile_path + @gemfile_path + end + + appraisal.instance_variable_set(:@gemfile_path, test_config.gemfile) + + if @options[:dry] + puts "Installing: #{test_config.gemfile}" + else + appraisal.install + end + end + end + end + + def run_all_tests + @matrix.keys.each do |rails_version| + run_all_tests_for(rails_version) + end + end + + def run_all_tests_for(rails_version) + rails_versions = @matrix[rails_version] + if !rails_versions || rails_versions.empty? + puts "Tests for #{rails_version} can't run on #{RUBY_VERSION}" + return + end + + rails_versions.each do |test_config| + run_test_in test_config.gemfile, "test/test_apps/#{rails_version}" + end + end + +private + + def run_test_in(gemfile, directory) + env = ["BUNDLE_GEMFILE=#{gemfile}"] + env << "TEST=../../#{ENV['TEST']} " if ENV['TEST'] + run_in(directory, "#{env.join(" ")} bundle exec rake test:selenium") + end + + def run_in(directory, command) + puts '', directory, ' ', command + with_pruned_env('BUNDLE_GEMFILE') do + return if @options[:dry] + system("cd #{directory} && #{command}") + raise unless $?.exitstatus == 0 + end + end + + def with_pruned_env(key_to_withhold, &block) + withholding = ENV.delete(key_to_withhold) + tap{ |r| r = yield; ENV[key_to_withhold] = withholding } + end + + def read_matrix + file_pattern = "#{@gemfiles_path}/**/*ruby#{RUBY_VERSION}*.gemfile" + + matrix = {} + + Dir.glob(file_pattern).each do |file| + matches = file.match(/#{@gemfiles_path}\/rails(\d\.\d)\/(.*ruby(\d\.\d\.\d)\.gemfile)/) + + gemfile_path = matches[0] + rails_version = matches[1] + gemfile = matches[2] + ruby_version = matches[3] + + matrix[rails_version] ||= [] + matrix[rails_version] << TestConfig.new(rails_version, gemfile_path) + end + + matrix + end +end + +def selenium_runner + SeleniumRunner.new(:dry => ENV['DRY']) +end namespace :test do Rake::TestTask.new(:units) do |test| @@ -22,7 +124,7 @@ namespace :test do test.pattern = 'test/unit/**/*_test.rb' test.verbose = true end - + namespace :integration do task :units do system("bundle exec rake -s appraisal test:units") @@ -31,40 +133,21 @@ namespace :test do namespace :selenium do task :install do - for_each_directory_of('test/test_apps/[0-9]*/**/Gemfile') do |directory| - app_version = File.basename(directory) - if selenium_matrix[RUBY_VERSION].include?(app_version) - gemfile_path = File.join(directory, 'Gemfile') - appraisal = Appraisal::Appraisal.new("name", File.join(directory, 'Gemfile')) - - def appraisal.gemfile_path - @gemfile_path - end - - appraisal.instance_variable_set(:@gemfile_path, gemfile_path) + selenium_runner.install_all + end - appraisal.install - end - end + task :cleanup do + selenium_runner.cleanup end end desc "Run selenium tests on all apps." - task :selenium do - app_version = ENV['APP_VERSION'] - if app_version - if selenium_matrix[RUBY_VERSION].include?(app_version) - run_test_in "test/test_apps/#{app_version}", 'test:selenium' - else - puts "Tests for #{app_version} can't run on #{RUBY_VERSION}" - end + task :selenium do + rails_version = ENV['APP_VERSION'] + if rails_version + selenium_runner.run_all_tests_for(rails_version) else - for_each_directory_of('test/test_apps/[0-9]*/**/Rakefile') do |directory| - app_version = File.basename(directory) - if selenium_matrix[RUBY_VERSION].include?(app_version) - run_test_in directory, 'test:selenium' - end - end + selenium_runner.run_all_tests end end end @@ -72,31 +155,5 @@ namespace :test do task :ci => ['test:integration:units', 'test:integration:selenium'] end -def run_test_in(directory, *tasks) - env = "TEST=../../#{ENV['TEST']} " if ENV['TEST'] - run_in(directory, "#{env} bundle exec rake #{tasks.join(' ')}") -end - -def run_in(directory, command) - puts '', directory, '' - with_pruned_env('BUNDLE_GEMFILE') do - system("cd #{directory} && #{command}") - raise unless $?.exitstatus == 0 - end -end - -def for_each_directory_of(path, &block) - Dir[path].sort.each do |rakefile| - directory = File.dirname(rakefile) - block.call(directory) - end -end - -def with_pruned_env(key_to_withhold, &block) - withholding = ENV.delete(key_to_withhold) - tap{ |r| r = yield; ENV[key_to_withhold] = withholding } -end - - desc 'Default: run the unit and integration tests.' task :default => ['test:units', 'test:integration:selenium'] From 7c6347b6aec705b7dc86b17a1fc248bbade4038f Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 11:35:02 -0800 Subject: [PATCH 17/33] some more fixes --- Rakefile | 2 +- test/test_apps/shared/Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 95cb8ec1..b031c41d 100644 --- a/Rakefile +++ b/Rakefile @@ -152,7 +152,7 @@ namespace :test do end end - task :ci => ['test:integration:units', 'test:integration:selenium'] + task :ci => ['test:integration:selenium:cleanup', 'test:integration:units', 'test:integration:selenium'] end desc 'Default: run the unit and integration tests.' diff --git a/test/test_apps/shared/Gemfile b/test/test_apps/shared/Gemfile index acfd6b12..dde83902 100644 --- a/test/test_apps/shared/Gemfile +++ b/test/test_apps/shared/Gemfile @@ -2,7 +2,7 @@ rails_version = File.dirname(__FILE__).split('/').last directory = File.expand_path("../../../../selenium_gemfiles/rails#{rails_version}", __FILE__) -file_pattern = "#{directory}/*ruby#{RUBY_VERSION}*" +file_pattern = "#{directory}/*ruby#{RUBY_VERSION}*.gemfile" file = Dir.glob(file_pattern).sort.reverse.first if !file || file.empty? From 25cd68e4093d3bad424569f3a450b3c2d0da9d8a Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 16:42:10 -0800 Subject: [PATCH 18/33] adding capybara2.1/2.2 test gemfiles and fixing Collection with support --- lib/ae_page_objects/elements/collection.rb | 13 ++++++++++++- .../rails2.3/capybara_2.1_ruby1.9.3.gemfile | 4 ++++ .../rails2.3/capybara_2.2_ruby1.9.3.gemfile | 4 ++++ .../rails3.0/capybara_2.1_ruby1.9.3.gemfile | 4 ++++ .../rails3.0/capybara_2.2_ruby1.9.3.gemfile | 4 ++++ .../rails3.1/capybara_2.1_ruby1.9.3.gemfile | 4 ++++ .../rails3.1/capybara_2.2_ruby1.9.3.gemfile | 4 ++++ .../rails3.2/capybara_2.1_ruby2.0.0.gemfile | 4 ++++ .../rails3.2/capybara_2.2_ruby2.0.0.gemfile | 4 ++++ test/test_apps/shared/test/selenium_helper.rb | 1 + test/unit/collection_test.rb | 8 +------- 11 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile create mode 100644 selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile create mode 100644 selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile diff --git a/lib/ae_page_objects/elements/collection.rb b/lib/ae_page_objects/elements/collection.rb index 1778bb2f..022afc01 100644 --- a/lib/ae_page_objects/elements/collection.rb +++ b/lib/ae_page_objects/elements/collection.rb @@ -69,7 +69,18 @@ def item_xpath if Capybara::VERSION =~ /\A1/ Capybara::Selector.normalize(*evaled_locator).xpaths.first else - Capybara::Query.new(*evaled_locator).xpath.to_s + query_args = evaled_locator + [{:exact => true}] + query = Capybara::Query.new(*query_args) + + result = query.xpath + + # if it's CSS, we need to run it through XPath as Capybara::Query#xpath only + # works when the selector is xpath. Lame. + if query.selector.format == :css + result = XPath.css(query.xpath).to_xpath + end + + result end end end diff --git a/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..331fa9f4 --- /dev/null +++ b/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.1' + diff --git a/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..41cb38cf --- /dev/null +++ b/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.2' + diff --git a/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..331fa9f4 --- /dev/null +++ b/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.1' + diff --git a/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..41cb38cf --- /dev/null +++ b/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.2' + diff --git a/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..331fa9f4 --- /dev/null +++ b/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.1' + diff --git a/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..41cb38cf --- /dev/null +++ b/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.2' + diff --git a/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile new file mode 100644 index 00000000..331fa9f4 --- /dev/null +++ b/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.1' + diff --git a/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile new file mode 100644 index 00000000..41cb38cf --- /dev/null +++ b/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile @@ -0,0 +1,4 @@ +eval_gemfile File.expand_path("../Gemfile", __FILE__) + +gem 'capybara', '~> 2.2' + diff --git a/test/test_apps/shared/test/selenium_helper.rb b/test/test_apps/shared/test/selenium_helper.rb index fb576f83..eee94f3f 100644 --- a/test/test_apps/shared/test/selenium_helper.rb +++ b/test/test_apps/shared/test/selenium_helper.rb @@ -42,6 +42,7 @@ def initialize(app, options = {}) Capybara.configure do |config| config.default_driver = :ae_page_objects_test_driver + config.ignore_hidden_elements = false config.default_wait_time = 5 end diff --git a/test/unit/collection_test.rb b/test/unit/collection_test.rb index 7ed128e6..82184972 100644 --- a/test/unit/collection_test.rb +++ b/test/unit/collection_test.rb @@ -18,13 +18,7 @@ def test_css_item_locator magazine = clip.new(parent, :name => "18_holder", :item_locator => ".some_class") - if Capybara::VERSION =~ /\A1/ - Capybara::Selector.expects(:normalize).returns(stub(:xpaths => ['item_xpath'])) - else - Capybara::Query.any_instance.expects(:xpath).returns('item_xpath') - end - - assert_equal "item_xpath", magazine.send(:item_xpath) + assert_equal ".//*[contains(concat(' ', normalize-space(@class), ' '), ' some_class ')]", magazine.send(:item_xpath) end def test_empty From 3a492aa0a976c8b6f4ba693df69747e8da83b345 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 17:14:19 -0800 Subject: [PATCH 19/33] moving version fixing for 1.8.7 to Gemfile --- Appraisals | 38 ++++---------------------------------- Gemfile | 9 ++++++++- 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/Appraisals b/Appraisals index 4029ab64..64797dc6 100644 --- a/Appraisals +++ b/Appraisals @@ -1,43 +1,13 @@ -if RUBY_VERSION == '1.8.7' - - appraise "capybara-1.1-ruby#{RUBY_VERSION}" do - gem "mocha", "= 0.13.3" - gem "selenium-webdriver", ">= 0" - - gemfile.gemspec - - gem "nokogiri", "< 1.6.0" - gem 'rubyzip', '< 1.0.0' - gem 'mime-types', '< 2' - gem 'capybara', '~> 1.1.4' - end - -else - - appraise "capybara-1.1-ruby#{RUBY_VERSION}" do - gem "mocha", "= 0.13.3" - gem "selenium-webdriver", ">= 0" - - gemfile.gemspec - - gem 'capybara', '~> 1.1.4' - end +appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' +end +if RUBY_VERSION != '1.8.7' appraise "capybara-2.1-ruby#{RUBY_VERSION}" do - gem "mocha", "= 0.13.3" - gem "selenium-webdriver", ">= 0" - - gemfile.gemspec - gem 'capybara', '~> 2.1.0' end appraise "capybara-2.2-ruby#{RUBY_VERSION}" do - gem "mocha", "= 0.13.3" - gem "selenium-webdriver", ">= 0" - - gemfile.gemspec - gem 'capybara', '~> 2.2.0' end end diff --git a/Gemfile b/Gemfile index eb2df7bd..c719b974 100644 --- a/Gemfile +++ b/Gemfile @@ -4,4 +4,11 @@ gem "appraisal", "~> 0.5.1" gem "mocha", "= 0.13.3" gem "selenium-webdriver", ">= 0" -gemspec \ No newline at end of file +gemspec + +if RUBY_VERSION =~ /\A1\.8/ + gem 'capybara', '~> 1.1.4' + gem "nokogiri", "< 1.6.0" + gem 'rubyzip', '< 1.0.0' + gem 'mime-types', '< 2' +end \ No newline at end of file From 2ec1a97146962ff3775f208976bf0733b30b165d Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 17:16:03 -0800 Subject: [PATCH 20/33] use standard Gemfile for CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 44f4824c..f1e65552 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ rvm: - 2.0.0 gemfile: - - Gemfile-ci + - Gemfile bundler_args: '' From 75b03d42a6ec74eab99faa23f0196c91e82633c3 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 18:36:17 -0800 Subject: [PATCH 21/33] removing unused Gemfile-ci --- Gemfile-ci | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Gemfile-ci diff --git a/Gemfile-ci b/Gemfile-ci deleted file mode 100644 index dea05bf4..00000000 --- a/Gemfile-ci +++ /dev/null @@ -1,3 +0,0 @@ -source "https://rubygems.org" - -gem "appraisal", "~> 0.5.1" From 622c2d4b4c2b45bdf75c4501308643f7d9114973 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 22:22:05 -0800 Subject: [PATCH 22/33] Redoing gemfile madness so that the Rails tests actually use the right Gemfile. --- Rakefile | 68 +++++++++++++------ selenium_gemfiles/rails2.3/Gemfile | 12 ---- .../rails2.3/capybara_1.1_ruby1.8.7.gemfile | 13 +++- .../rails2.3/capybara_1.1_ruby1.9.3.gemfile | 13 +++- .../rails2.3/capybara_2.1_ruby1.9.3.gemfile | 13 +++- .../rails2.3/capybara_2.2_ruby1.9.3.gemfile | 13 +++- selenium_gemfiles/rails3.0/Gemfile | 11 --- .../rails3.0/capybara_1.1_ruby1.8.7.gemfile | 12 +++- .../rails3.0/capybara_1.1_ruby1.9.3.gemfile | 12 +++- .../rails3.0/capybara_2.1_ruby1.9.3.gemfile | 12 +++- .../rails3.0/capybara_2.2_ruby1.9.3.gemfile | 12 +++- selenium_gemfiles/rails3.1/Gemfile | 11 --- .../rails3.1/capybara_1.1_ruby1.8.7.gemfile | 12 +++- .../rails3.1/capybara_1.1_ruby1.9.3.gemfile | 12 +++- .../rails3.1/capybara_2.1_ruby1.9.3.gemfile | 12 +++- .../rails3.1/capybara_2.2_ruby1.9.3.gemfile | 12 +++- selenium_gemfiles/rails3.2/Gemfile | 12 ---- .../rails3.2/capybara_1.1_ruby1.8.7.gemfile | 12 +++- .../rails3.2/capybara_1.1_ruby1.9.3.gemfile | 12 +++- .../rails3.2/capybara_1.1_ruby2.0.0.gemfile | 12 +++- .../rails3.2/capybara_2.1_ruby2.0.0.gemfile | 12 +++- .../rails3.2/capybara_2.2_ruby2.0.0.gemfile | 12 +++- 22 files changed, 237 insertions(+), 85 deletions(-) delete mode 100644 selenium_gemfiles/rails2.3/Gemfile delete mode 100644 selenium_gemfiles/rails3.0/Gemfile delete mode 100644 selenium_gemfiles/rails3.1/Gemfile delete mode 100644 selenium_gemfiles/rails3.2/Gemfile diff --git a/Rakefile b/Rakefile index b031c41d..2555d869 100644 --- a/Rakefile +++ b/Rakefile @@ -24,17 +24,17 @@ class SeleniumRunner @options = options @gemfiles_path = SELENIUM_GEMFILES_PATH @matrix = read_matrix - - puts "Test Matrix:" - pp @matrix end def cleanup - FileUtils.rm_f Dir["#{@gemfiles_path}/**/*.lock"] + glob_pattern = "#{@gemfiles_path}/**/*.lock" + puts "Removing '#{glob_pattern}'" + + FileUtils.rm_f Dir[glob_pattern] end def install_all - @matrix.each do |rails_version, test_configs| + @matrix.values.each do |test_configs| test_configs.each do |test_config| appraisal = Appraisal::Appraisal.new("name", test_config.gemfile) @@ -54,7 +54,7 @@ class SeleniumRunner end def run_all_tests - @matrix.keys.each do |rails_version| + @matrix.keys.sort.each do |rails_version| run_all_tests_for(rails_version) end end @@ -67,30 +67,47 @@ class SeleniumRunner end rails_versions.each do |test_config| - run_test_in test_config.gemfile, "test/test_apps/#{rails_version}" + run_test(test_config.gemfile, "test/test_apps/#{rails_version}", "bundle exec rake test:selenium") end end private - def run_test_in(gemfile, directory) - env = ["BUNDLE_GEMFILE=#{gemfile}"] - env << "TEST=../../#{ENV['TEST']} " if ENV['TEST'] - run_in(directory, "#{env.join(" ")} bundle exec rake test:selenium") + # Appraisal::Command almost has what I need: a way to run things without Bundler/Ruby + # Env variables. The subclassing is to override the initializer to not modify the command. + class Command < Appraisal::Command + def initialize(command, gemfile = nil) + @original_env = {} + @gemfile = gemfile + @command = command + end end - def run_in(directory, command) - puts '', directory, ' ', command - with_pruned_env('BUNDLE_GEMFILE') do - return if @options[:dry] - system("cd #{directory} && #{command}") - raise unless $?.exitstatus == 0 + def run_test(gemfile, directory, command) + puts 'Test Config', + "---------------------", + "Gemfile: #{gemfile}", + "Command: '#{command}'", + "---------------------" + + + if !@options[:dry] + with_gemfile_symlink(directory, gemfile, "Gemfile") do + Command.new("cd #{directory} && #{command}", gemfile).run + end end end - def with_pruned_env(key_to_withhold, &block) - withholding = ENV.delete(key_to_withhold) - tap{ |r| r = yield; ENV[key_to_withhold] = withholding } + def with_gemfile_symlink(directory, use_gemfile, app_gemfile) + current_link = run_command("readlink #{directory}/#{app_gemfile}").strip + + run_command("cd #{directory} && ln -sf #{use_gemfile} #{app_gemfile}") + run_command("cd #{directory} && ln -sf #{use_gemfile}.lock #{app_gemfile}.lock") + + yield + + run_command("cd #{directory} && ln -sf #{current_link} #{app_gemfile}") + run_command("rm -f #{directory}/#{app_gemfile}.lock") end def read_matrix @@ -112,6 +129,13 @@ private matrix end + + def run_command(command) + puts "Running '#{command}'" + output = `#{command}` + raise unless $?.exitstatus == 0 + output + end end def selenium_runner @@ -143,7 +167,7 @@ namespace :test do desc "Run selenium tests on all apps." task :selenium do - rails_version = ENV['APP_VERSION'] + rails_version = ENV['RAILS_VERSION'] if rails_version selenium_runner.run_all_tests_for(rails_version) else @@ -152,7 +176,7 @@ namespace :test do end end - task :ci => ['test:integration:selenium:cleanup', 'test:integration:units', 'test:integration:selenium'] + task :ci => ['test:integration:units', 'test:integration:selenium'] end desc 'Default: run the unit and integration tests.' diff --git a/selenium_gemfiles/rails2.3/Gemfile b/selenium_gemfiles/rails2.3/Gemfile deleted file mode 100644 index e138bcba..00000000 --- a/selenium_gemfiles/rails2.3/Gemfile +++ /dev/null @@ -1,12 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '2.3.18' -gem 'sqlite3' -gem 'rake' -gem 'rdoc' - -gem "selenium-webdriver" - -gem "mocha", "0.9.7" - -gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) diff --git a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile index 6a52c96c..bd288337 100644 --- a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile +++ b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile @@ -1,4 +1,15 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '2.3.18' +gem 'sqlite3' +gem 'rake' +gem 'rdoc' + +gem "selenium-webdriver" + +gem "mocha", "0.9.7" + +gem 'ae_page_objects', :path => "../../.." gem "nokogiri", "< 1.6.0" gem 'mime-types', '< 2' diff --git a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile index 2653b62b..72827835 100644 --- a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile @@ -1,4 +1,15 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '2.3.18' +gem 'sqlite3' +gem 'rake' +gem 'rdoc' + +gem "selenium-webdriver" + +gem "mocha", "0.9.7" + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 1.1.4' diff --git a/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile index 331fa9f4..3b66df47 100644 --- a/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile @@ -1,4 +1,15 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '2.3.18' +gem 'sqlite3' +gem 'rake' +gem 'rdoc' + +gem "selenium-webdriver" + +gem "mocha", "0.9.7" + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.1' diff --git a/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile index 41cb38cf..2bd1908c 100644 --- a/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile @@ -1,4 +1,15 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '2.3.18' +gem 'sqlite3' +gem 'rake' +gem 'rdoc' + +gem "selenium-webdriver" + +gem "mocha", "0.9.7" + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.2' diff --git a/selenium_gemfiles/rails3.0/Gemfile b/selenium_gemfiles/rails3.0/Gemfile deleted file mode 100644 index e7ea49fd..00000000 --- a/selenium_gemfiles/rails3.0/Gemfile +++ /dev/null @@ -1,11 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '3.0.20' -gem 'sqlite3' -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) diff --git a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile index 6a52c96c..88416e53 100644 --- a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile +++ b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '3.0.20' +gem 'sqlite3' +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem "nokogiri", "< 1.6.0" gem 'mime-types', '< 2' diff --git a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile index 2653b62b..36b85c39 100644 --- a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '3.0.20' +gem 'sqlite3' +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 1.1.4' diff --git a/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile index 331fa9f4..eef9227a 100644 --- a/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '3.0.20' +gem 'sqlite3' +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.1' diff --git a/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile index 41cb38cf..249dbd1f 100644 --- a/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem 'rails', '3.0.20' +gem 'sqlite3' +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.2' diff --git a/selenium_gemfiles/rails3.1/Gemfile b/selenium_gemfiles/rails3.1/Gemfile deleted file mode 100644 index 50933c2e..00000000 --- a/selenium_gemfiles/rails3.1/Gemfile +++ /dev/null @@ -1,11 +0,0 @@ -source "https://rubygems.org" - -gem "rails", "3.1.12" -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) diff --git a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile index 6a52c96c..32704818 100644 --- a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile +++ b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem "nokogiri", "< 1.6.0" gem 'mime-types', '< 2' diff --git a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile index 2653b62b..e60a47d6 100644 --- a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 1.1.4' diff --git a/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile index 331fa9f4..b3c884f9 100644 --- a/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.1' diff --git a/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile index 41cb38cf..2c68a4a6 100644 --- a/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.2' diff --git a/selenium_gemfiles/rails3.2/Gemfile b/selenium_gemfiles/rails3.2/Gemfile deleted file mode 100644 index 55a6a6c7..00000000 --- a/selenium_gemfiles/rails3.2/Gemfile +++ /dev/null @@ -1,12 +0,0 @@ -source "https://rubygems.org" - -gem "rails", '3.2.13' -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => File.expand_path("../../..", __FILE__) - diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile index 6a52c96c..576aef02 100644 --- a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile +++ b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", '3.2.13' +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem "nokogiri", "< 1.6.0" gem 'mime-types', '< 2' diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile index 2653b62b..d3e5edcb 100644 --- a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile +++ b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", '3.2.13' +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 1.1.4' diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile index 2653b62b..d3e5edcb 100644 --- a/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile +++ b/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", '3.2.13' +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 1.1.4' diff --git a/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile index 331fa9f4..8d4ad0b5 100644 --- a/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile +++ b/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", '3.2.13' +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.1' diff --git a/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile index 41cb38cf..f64da01b 100644 --- a/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile +++ b/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile @@ -1,4 +1,14 @@ -eval_gemfile File.expand_path("../Gemfile", __FILE__) +source "https://rubygems.org" + +gem "rails", '3.2.13' +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" + +gem "mocha", "0.13.3", :require => false + +gem 'ae_page_objects', :path => "../../.." gem 'capybara', '~> 2.2' From aee354712b47cb9e5b8704d708516168dddad4b6 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 20 Jan 2014 22:42:02 -0800 Subject: [PATCH 23/33] fixing rails 2.3 helper for capy2.X support --- test/test_apps/2.3/test/selenium_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_apps/2.3/test/selenium_helper.rb b/test/test_apps/2.3/test/selenium_helper.rb index eb5b5a1a..8ca489c0 100644 --- a/test/test_apps/2.3/test/selenium_helper.rb +++ b/test/test_apps/2.3/test/selenium_helper.rb @@ -31,6 +31,7 @@ class TestCase < ActiveSupport::TestCase Capybara.configure do |config| config.default_driver = :selenium + config.ignore_hidden_elements = false config.default_wait_time = 5 end From c42a8f1dc396ad42cc570b10ce5dc1f063aecbc9 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 00:07:03 -0800 Subject: [PATCH 24/33] moving integration test gemfiles into test apps and using Appraisals to manage them. Removed test/test_app/shared/Gemfile redirection trick --- .gitignore | 1 + Rakefile | 32 ++++++++----------- .../rails2.3/capybara_1.1_ruby1.8.7.gemfile | 19 ----------- .../rails2.3/capybara_1.1_ruby1.9.3.gemfile | 15 --------- .../rails2.3/capybara_2.1_ruby1.9.3.gemfile | 15 --------- .../rails2.3/capybara_2.2_ruby1.9.3.gemfile | 15 --------- .../rails3.0/capybara_1.1_ruby1.8.7.gemfile | 18 ----------- .../rails3.0/capybara_1.1_ruby1.9.3.gemfile | 14 -------- .../rails3.0/capybara_2.1_ruby1.9.3.gemfile | 14 -------- .../rails3.0/capybara_2.2_ruby1.9.3.gemfile | 14 -------- .../rails3.1/capybara_1.1_ruby1.8.7.gemfile | 18 ----------- .../rails3.1/capybara_1.1_ruby1.9.3.gemfile | 14 -------- .../rails3.1/capybara_2.1_ruby1.9.3.gemfile | 14 -------- .../rails3.1/capybara_2.2_ruby1.9.3.gemfile | 14 -------- .../rails3.2/capybara_1.1_ruby1.8.7.gemfile | 18 ----------- .../rails3.2/capybara_1.1_ruby1.9.3.gemfile | 14 -------- .../rails3.2/capybara_1.1_ruby2.0.0.gemfile | 14 -------- .../rails3.2/capybara_2.1_ruby2.0.0.gemfile | 14 -------- .../rails3.2/capybara_2.2_ruby2.0.0.gemfile | 14 -------- test/test_apps/2.3/Appraisals | 22 +++++++++++++ test/test_apps/2.3/Gemfile | 21 +++++++++++- test/test_apps/2.3/Rakefile | 2 ++ .../gemfiles/capybara_1.1_ruby1.8.7.gemfile | 17 ++++++++++ .../gemfiles/capybara_1.1_ruby1.9.3.gemfile | 14 ++++++++ .../gemfiles/capybara_2.1_ruby1.9.3.gemfile | 14 ++++++++ .../gemfiles/capybara_2.2_ruby1.9.3.gemfile | 14 ++++++++ test/test_apps/3.0/Appraisals | 22 +++++++++++++ test/test_apps/3.0/Gemfile | 22 ++++++++++++- test/test_apps/3.0/Rakefile | 1 + .../gemfiles/capybara_1.1_ruby1.8.7.gemfile | 16 ++++++++++ .../gemfiles/capybara_1.1_ruby1.9.3.gemfile | 13 ++++++++ .../gemfiles/capybara_2.1_ruby1.9.3.gemfile | 13 ++++++++ .../gemfiles/capybara_2.2_ruby1.9.3.gemfile | 13 ++++++++ test/test_apps/3.1/Appraisals | 22 +++++++++++++ test/test_apps/3.1/Gemfile | 20 +++++++++++- .../gemfiles/capybara_1.1_ruby1.8.7.gemfile | 16 ++++++++++ .../gemfiles/capybara_1.1_ruby1.9.3.gemfile | 13 ++++++++ .../gemfiles/capybara_2.1_ruby1.9.3.gemfile | 13 ++++++++ .../gemfiles/capybara_2.2_ruby1.9.3.gemfile | 13 ++++++++ test/test_apps/3.2/Appraisals | 32 +++++++++++++++++++ test/test_apps/3.2/Gemfile | 20 +++++++++++- .../gemfiles/capybara_1.1_ruby1.8.7.gemfile | 16 ++++++++++ .../gemfiles/capybara_1.1_ruby1.9.3.gemfile | 13 ++++++++ .../gemfiles/capybara_2.1_ruby1.9.3.gemfile | 13 ++++++++ .../gemfiles/capybara_2.1_ruby2.0.0.gemfile | 13 ++++++++ .../gemfiles/capybara_2.2_ruby1.9.3.gemfile | 13 ++++++++ .../gemfiles/capybara_2.2_ruby2.0.0.gemfile | 13 ++++++++ test/test_apps/shared/Gemfile | 21 ------------ 48 files changed, 445 insertions(+), 301 deletions(-) delete mode 100644 selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile delete mode 100644 selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile delete mode 100644 selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile delete mode 100644 selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile delete mode 100644 selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile delete mode 100644 selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile delete mode 100644 selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile delete mode 100644 selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile create mode 100644 test/test_apps/2.3/Appraisals mode change 120000 => 100644 test/test_apps/2.3/Gemfile create mode 100644 test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.8.7.gemfile create mode 100644 test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/2.3/gemfiles/capybara_2.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/2.3/gemfiles/capybara_2.2_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.0/Appraisals mode change 120000 => 100644 test/test_apps/3.0/Gemfile create mode 100644 test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.8.7.gemfile create mode 100644 test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.0/gemfiles/capybara_2.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.0/gemfiles/capybara_2.2_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.1/Appraisals mode change 120000 => 100644 test/test_apps/3.1/Gemfile create mode 100644 test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.8.7.gemfile create mode 100644 test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.1/gemfiles/capybara_2.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.1/gemfiles/capybara_2.2_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.2/Appraisals mode change 120000 => 100644 test/test_apps/3.2/Gemfile create mode 100644 test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.8.7.gemfile create mode 100644 test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.2/gemfiles/capybara_2.1_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.2/gemfiles/capybara_2.1_ruby2.0.0.gemfile create mode 100644 test/test_apps/3.2/gemfiles/capybara_2.2_ruby1.9.3.gemfile create mode 100644 test/test_apps/3.2/gemfiles/capybara_2.2_ruby2.0.0.gemfile delete mode 100644 test/test_apps/shared/Gemfile diff --git a/.gitignore b/.gitignore index d5cb916b..1d270f4d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ test/test_apps/**/.bundle test/test_apps/**/db/*.sqlite3 test/test_apps/**/log/*.log test/test_apps/**/tmp/**/* +test/test_apps/**/gemfiles/*.lock *.lock gemfiles/*.lock diff --git a/Rakefile b/Rakefile index 2555d869..b92c2723 100644 --- a/Rakefile +++ b/Rakefile @@ -18,16 +18,13 @@ class SeleniumRunner TestConfig = Struct.new(:rails_version, :gemfile) - SELENIUM_GEMFILES_PATH = File.expand_path("../selenium_gemfiles", __FILE__) - def initialize(options = {}) @options = options - @gemfiles_path = SELENIUM_GEMFILES_PATH @matrix = read_matrix end def cleanup - glob_pattern = "#{@gemfiles_path}/**/*.lock" + glob_pattern = "test/test_apps/**/gemfiles/*.lock" puts "Removing '#{glob_pattern}'" FileUtils.rm_f Dir[glob_pattern] @@ -84,39 +81,36 @@ private end def run_test(gemfile, directory, command) - puts 'Test Config', - "---------------------", + puts "---------------------", + 'Test Config', "Gemfile: #{gemfile}", "Command: '#{command}'", "---------------------" - - if !@options[:dry] - with_gemfile_symlink(directory, gemfile, "Gemfile") do + with_gemfile_symlink(directory, gemfile, "Gemfile") do + if !@options[:dry] Command.new("cd #{directory} && #{command}", gemfile).run end end end def with_gemfile_symlink(directory, use_gemfile, app_gemfile) - current_link = run_command("readlink #{directory}/#{app_gemfile}").strip - run_command("cd #{directory} && ln -sf #{use_gemfile} #{app_gemfile}") run_command("cd #{directory} && ln -sf #{use_gemfile}.lock #{app_gemfile}.lock") yield - run_command("cd #{directory} && ln -sf #{current_link} #{app_gemfile}") + run_command("cd #{directory} && git checkout -- #{app_gemfile}") run_command("rm -f #{directory}/#{app_gemfile}.lock") end def read_matrix - file_pattern = "#{@gemfiles_path}/**/*ruby#{RUBY_VERSION}*.gemfile" + file_pattern = "test/test_apps/**/gemfiles/*ruby#{RUBY_VERSION}*.gemfile" matrix = {} Dir.glob(file_pattern).each do |file| - matches = file.match(/#{@gemfiles_path}\/rails(\d\.\d)\/(.*ruby(\d\.\d\.\d)\.gemfile)/) + matches = file.match(%r{test/test_apps/(\d\.\d)/gemfiles/(.*ruby(\d\.\d\.\d)\.gemfile)}) gemfile_path = matches[0] rails_version = matches[1] @@ -124,7 +118,7 @@ private ruby_version = matches[3] matrix[rails_version] ||= [] - matrix[rails_version] << TestConfig.new(rails_version, gemfile_path) + matrix[rails_version] << TestConfig.new(rails_version, File.expand_path("../#{gemfile_path}", __FILE__)) end matrix @@ -132,9 +126,11 @@ private def run_command(command) puts "Running '#{command}'" - output = `#{command}` - raise unless $?.exitstatus == 0 - output + + if ! @options[:dry] + `#{command}` + raise unless $?.exitstatus == 0 + end end end diff --git a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile deleted file mode 100644 index bd288337..00000000 --- a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.8.7.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '2.3.18' -gem 'sqlite3' -gem 'rake' -gem 'rdoc' - -gem "selenium-webdriver" - -gem "mocha", "0.9.7" - -gem 'ae_page_objects', :path => "../../.." - -gem "nokogiri", "< 1.6.0" -gem 'mime-types', '< 2' -gem 'rubyzip', '< 1.0.0' - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile deleted file mode 100644 index 72827835..00000000 --- a/selenium_gemfiles/rails2.3/capybara_1.1_ruby1.9.3.gemfile +++ /dev/null @@ -1,15 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '2.3.18' -gem 'sqlite3' -gem 'rake' -gem 'rdoc' - -gem "selenium-webdriver" - -gem "mocha", "0.9.7" - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile deleted file mode 100644 index 3b66df47..00000000 --- a/selenium_gemfiles/rails2.3/capybara_2.1_ruby1.9.3.gemfile +++ /dev/null @@ -1,15 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '2.3.18' -gem 'sqlite3' -gem 'rake' -gem 'rdoc' - -gem "selenium-webdriver" - -gem "mocha", "0.9.7" - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.1' - diff --git a/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile deleted file mode 100644 index 2bd1908c..00000000 --- a/selenium_gemfiles/rails2.3/capybara_2.2_ruby1.9.3.gemfile +++ /dev/null @@ -1,15 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '2.3.18' -gem 'sqlite3' -gem 'rake' -gem 'rdoc' - -gem "selenium-webdriver" - -gem "mocha", "0.9.7" - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.2' - diff --git a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile deleted file mode 100644 index 88416e53..00000000 --- a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.8.7.gemfile +++ /dev/null @@ -1,18 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '3.0.20' -gem 'sqlite3' -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem "nokogiri", "< 1.6.0" -gem 'mime-types', '< 2' -gem 'rubyzip', '< 1.0.0' - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile deleted file mode 100644 index 36b85c39..00000000 --- a/selenium_gemfiles/rails3.0/capybara_1.1_ruby1.9.3.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '3.0.20' -gem 'sqlite3' -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile deleted file mode 100644 index eef9227a..00000000 --- a/selenium_gemfiles/rails3.0/capybara_2.1_ruby1.9.3.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '3.0.20' -gem 'sqlite3' -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.1' - diff --git a/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile deleted file mode 100644 index 249dbd1f..00000000 --- a/selenium_gemfiles/rails3.0/capybara_2.2_ruby1.9.3.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem 'rails', '3.0.20' -gem 'sqlite3' -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.2' - diff --git a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile deleted file mode 100644 index 32704818..00000000 --- a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.8.7.gemfile +++ /dev/null @@ -1,18 +0,0 @@ -source "https://rubygems.org" - -gem "rails", "3.1.12" -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem "nokogiri", "< 1.6.0" -gem 'mime-types', '< 2' -gem 'rubyzip', '< 1.0.0' - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile deleted file mode 100644 index e60a47d6..00000000 --- a/selenium_gemfiles/rails3.1/capybara_1.1_ruby1.9.3.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem "rails", "3.1.12" -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile deleted file mode 100644 index b3c884f9..00000000 --- a/selenium_gemfiles/rails3.1/capybara_2.1_ruby1.9.3.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem "rails", "3.1.12" -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.1' - diff --git a/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile deleted file mode 100644 index 2c68a4a6..00000000 --- a/selenium_gemfiles/rails3.1/capybara_2.2_ruby1.9.3.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem "rails", "3.1.12" -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.2' - diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile deleted file mode 100644 index 576aef02..00000000 --- a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.8.7.gemfile +++ /dev/null @@ -1,18 +0,0 @@ -source "https://rubygems.org" - -gem "rails", '3.2.13' -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem "nokogiri", "< 1.6.0" -gem 'mime-types', '< 2' -gem 'rubyzip', '< 1.0.0' - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile deleted file mode 100644 index d3e5edcb..00000000 --- a/selenium_gemfiles/rails3.2/capybara_1.1_ruby1.9.3.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem "rails", '3.2.13' -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile deleted file mode 100644 index d3e5edcb..00000000 --- a/selenium_gemfiles/rails3.2/capybara_1.1_ruby2.0.0.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem "rails", '3.2.13' -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 1.1.4' - diff --git a/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile deleted file mode 100644 index 8d4ad0b5..00000000 --- a/selenium_gemfiles/rails3.2/capybara_2.1_ruby2.0.0.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem "rails", '3.2.13' -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.1' - diff --git a/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile b/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile deleted file mode 100644 index f64da01b..00000000 --- a/selenium_gemfiles/rails3.2/capybara_2.2_ruby2.0.0.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gem "rails", '3.2.13' -gem "sqlite3" -gem 'jquery-rails' - -gem "selenium-webdriver" - -gem "mocha", "0.13.3", :require => false - -gem 'ae_page_objects', :path => "../../.." - -gem 'capybara', '~> 2.2' - diff --git a/test/test_apps/2.3/Appraisals b/test/test_apps/2.3/Appraisals new file mode 100644 index 00000000..6e6b24d7 --- /dev/null +++ b/test/test_apps/2.3/Appraisals @@ -0,0 +1,22 @@ +case(RUBY_VERSION) +when '1.8.7' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + +when '1.9.3' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + + appraise "capybara-2.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.1.0' + end + + appraise "capybara-2.2-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.2.0' + end + +end diff --git a/test/test_apps/2.3/Gemfile b/test/test_apps/2.3/Gemfile deleted file mode 120000 index 6914d903..00000000 --- a/test/test_apps/2.3/Gemfile +++ /dev/null @@ -1 +0,0 @@ -../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/2.3/Gemfile b/test/test_apps/2.3/Gemfile new file mode 100644 index 00000000..70499e15 --- /dev/null +++ b/test/test_apps/2.3/Gemfile @@ -0,0 +1,20 @@ +source "https://rubygems.org" + +gem 'rails', '2.3.18' +gem 'sqlite3' +gem 'rake' +gem 'rdoc' + +gem "selenium-webdriver" +gem "mocha", "0.9.7" +gem "appraisal", "~> 0.5.1" + +gem 'ae_page_objects', :path => "../../../.." + +if RUBY_VERSION =~ /\A1\.8/ + gem 'capybara', '~> 1.1.4' + gem "nokogiri", "< 1.6.0" + gem 'rubyzip', '< 1.0.0' + gem 'mime-types', '< 2' +end + diff --git a/test/test_apps/2.3/Rakefile b/test/test_apps/2.3/Rakefile index 2877e0de..8afc57aa 100644 --- a/test/test_apps/2.3/Rakefile +++ b/test/test_apps/2.3/Rakefile @@ -9,6 +9,8 @@ require 'rdoc/task' require 'tasks/rails' +require 'appraisal' + namespace :test do Rake::TestTask.new(:selenium) do |t| t.libs << "test" diff --git a/test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.8.7.gemfile b/test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..9ffcfa2e --- /dev/null +++ b/test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,17 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "2.3.18" +gem "sqlite3" +gem "rake" +gem "rdoc" +gem "selenium-webdriver" +gem "mocha", "0.9.7" +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "nokogiri", "< 1.6.0" +gem "rubyzip", "< 1.0.0" +gem "mime-types", "< 2" +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.9.3.gemfile b/test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..1b8caa72 --- /dev/null +++ b/test/test_apps/2.3/gemfiles/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "2.3.18" +gem "sqlite3" +gem "rake" +gem "rdoc" +gem "selenium-webdriver" +gem "mocha", "0.9.7" +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/2.3/gemfiles/capybara_2.1_ruby1.9.3.gemfile b/test/test_apps/2.3/gemfiles/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..4eea1d9e --- /dev/null +++ b/test/test_apps/2.3/gemfiles/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "2.3.18" +gem "sqlite3" +gem "rake" +gem "rdoc" +gem "selenium-webdriver" +gem "mocha", "0.9.7" +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.1.0" + diff --git a/test/test_apps/2.3/gemfiles/capybara_2.2_ruby1.9.3.gemfile b/test/test_apps/2.3/gemfiles/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..63539d42 --- /dev/null +++ b/test/test_apps/2.3/gemfiles/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "2.3.18" +gem "sqlite3" +gem "rake" +gem "rdoc" +gem "selenium-webdriver" +gem "mocha", "0.9.7" +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.2.0" + diff --git a/test/test_apps/3.0/Appraisals b/test/test_apps/3.0/Appraisals new file mode 100644 index 00000000..6e6b24d7 --- /dev/null +++ b/test/test_apps/3.0/Appraisals @@ -0,0 +1,22 @@ +case(RUBY_VERSION) +when '1.8.7' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + +when '1.9.3' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + + appraise "capybara-2.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.1.0' + end + + appraise "capybara-2.2-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.2.0' + end + +end diff --git a/test/test_apps/3.0/Gemfile b/test/test_apps/3.0/Gemfile deleted file mode 120000 index 6914d903..00000000 --- a/test/test_apps/3.0/Gemfile +++ /dev/null @@ -1 +0,0 @@ -../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/3.0/Gemfile b/test/test_apps/3.0/Gemfile new file mode 100644 index 00000000..fc1ed887 --- /dev/null +++ b/test/test_apps/3.0/Gemfile @@ -0,0 +1,21 @@ +source "https://rubygems.org" + +gem 'rails', '3.0.20' +gem 'sqlite3' +gem 'jquery-rails' + +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require => false +gem "appraisal", "~> 0.5.1" + +gem 'ae_page_objects', :path => "../../../.." + +if RUBY_VERSION =~ /\A1\.8/ + gem 'capybara', '~> 1.1.4' + gem "nokogiri", "< 1.6.0" + gem 'rubyzip', '< 1.0.0' + gem 'mime-types', '< 2' +end + + + diff --git a/test/test_apps/3.0/Rakefile b/test/test_apps/3.0/Rakefile index d3f1b585..04125a24 100644 --- a/test/test_apps/3.0/Rakefile +++ b/test/test_apps/3.0/Rakefile @@ -3,6 +3,7 @@ require File.expand_path('../config/application', __FILE__) require 'rake' +require 'appraisal' TestApp::Application.load_tasks diff --git a/test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.8.7.gemfile b/test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..de2f2b55 --- /dev/null +++ b/test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,16 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.0.20" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "nokogiri", "< 1.6.0" +gem "rubyzip", "< 1.0.0" +gem "mime-types", "< 2" +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.9.3.gemfile b/test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..d48ddf52 --- /dev/null +++ b/test/test_apps/3.0/gemfiles/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.0.20" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/3.0/gemfiles/capybara_2.1_ruby1.9.3.gemfile b/test/test_apps/3.0/gemfiles/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..e4ae1614 --- /dev/null +++ b/test/test_apps/3.0/gemfiles/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.0.20" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.1.0" + diff --git a/test/test_apps/3.0/gemfiles/capybara_2.2_ruby1.9.3.gemfile b/test/test_apps/3.0/gemfiles/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..44f2108d --- /dev/null +++ b/test/test_apps/3.0/gemfiles/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.0.20" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.2.0" + diff --git a/test/test_apps/3.1/Appraisals b/test/test_apps/3.1/Appraisals new file mode 100644 index 00000000..6e6b24d7 --- /dev/null +++ b/test/test_apps/3.1/Appraisals @@ -0,0 +1,22 @@ +case(RUBY_VERSION) +when '1.8.7' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + +when '1.9.3' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + + appraise "capybara-2.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.1.0' + end + + appraise "capybara-2.2-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.2.0' + end + +end diff --git a/test/test_apps/3.1/Gemfile b/test/test_apps/3.1/Gemfile deleted file mode 120000 index 6914d903..00000000 --- a/test/test_apps/3.1/Gemfile +++ /dev/null @@ -1 +0,0 @@ -../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/3.1/Gemfile b/test/test_apps/3.1/Gemfile new file mode 100644 index 00000000..6663b83b --- /dev/null +++ b/test/test_apps/3.1/Gemfile @@ -0,0 +1,19 @@ +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require => false +gem "appraisal", "~> 0.5.1" + +gem 'ae_page_objects', :path => "../../../.." + +if RUBY_VERSION =~ /\A1\.8/ + gem 'capybara', '~> 1.1.4' + gem "nokogiri", "< 1.6.0" + gem 'rubyzip', '< 1.0.0' + gem 'mime-types', '< 2' +end + diff --git a/test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.8.7.gemfile b/test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..e1da4ea3 --- /dev/null +++ b/test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,16 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "nokogiri", "< 1.6.0" +gem "rubyzip", "< 1.0.0" +gem "mime-types", "< 2" +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.9.3.gemfile b/test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..808cfa95 --- /dev/null +++ b/test/test_apps/3.1/gemfiles/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/3.1/gemfiles/capybara_2.1_ruby1.9.3.gemfile b/test/test_apps/3.1/gemfiles/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..81c2b5b3 --- /dev/null +++ b/test/test_apps/3.1/gemfiles/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.1.0" + diff --git a/test/test_apps/3.1/gemfiles/capybara_2.2_ruby1.9.3.gemfile b/test/test_apps/3.1/gemfiles/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..ffbc8cb6 --- /dev/null +++ b/test/test_apps/3.1/gemfiles/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.1.12" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.2.0" + diff --git a/test/test_apps/3.2/Appraisals b/test/test_apps/3.2/Appraisals new file mode 100644 index 00000000..de2f37c6 --- /dev/null +++ b/test/test_apps/3.2/Appraisals @@ -0,0 +1,32 @@ +case(RUBY_VERSION) +when '1.8.7' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + +when '1.9.3' then + + appraise "capybara-1.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 1.1.4' + end + + appraise "capybara-2.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.1.0' + end + + appraise "capybara-2.2-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.2.0' + end + +when '2.0.0' then + + appraise "capybara-2.1-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.1.0' + end + + appraise "capybara-2.2-ruby#{RUBY_VERSION}" do + gem 'capybara', '~> 2.2.0' + end + +end diff --git a/test/test_apps/3.2/Gemfile b/test/test_apps/3.2/Gemfile deleted file mode 120000 index 6914d903..00000000 --- a/test/test_apps/3.2/Gemfile +++ /dev/null @@ -1 +0,0 @@ -../shared/Gemfile \ No newline at end of file diff --git a/test/test_apps/3.2/Gemfile b/test/test_apps/3.2/Gemfile new file mode 100644 index 00000000..54445bff --- /dev/null +++ b/test/test_apps/3.2/Gemfile @@ -0,0 +1,19 @@ +source "https://rubygems.org" + +gem "rails", '3.2.13' +gem "sqlite3" +gem 'jquery-rails' + +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require => false +gem "appraisal", "~> 0.5.1" + +gem 'ae_page_objects', :path => "../../../.." + +if RUBY_VERSION =~ /\A1\.8/ + gem 'capybara', '~> 1.1.4' + gem "nokogiri", "< 1.6.0" + gem 'rubyzip', '< 1.0.0' + gem 'mime-types', '< 2' +end + diff --git a/test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.8.7.gemfile b/test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.8.7.gemfile new file mode 100644 index 00000000..0375237d --- /dev/null +++ b/test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.8.7.gemfile @@ -0,0 +1,16 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.2.13" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "nokogiri", "< 1.6.0" +gem "rubyzip", "< 1.0.0" +gem "mime-types", "< 2" +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.9.3.gemfile b/test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..aa58f952 --- /dev/null +++ b/test/test_apps/3.2/gemfiles/capybara_1.1_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.2.13" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 1.1.4" + diff --git a/test/test_apps/3.2/gemfiles/capybara_2.1_ruby1.9.3.gemfile b/test/test_apps/3.2/gemfiles/capybara_2.1_ruby1.9.3.gemfile new file mode 100644 index 00000000..e5624583 --- /dev/null +++ b/test/test_apps/3.2/gemfiles/capybara_2.1_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.2.13" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.1.0" + diff --git a/test/test_apps/3.2/gemfiles/capybara_2.1_ruby2.0.0.gemfile b/test/test_apps/3.2/gemfiles/capybara_2.1_ruby2.0.0.gemfile new file mode 100644 index 00000000..e5624583 --- /dev/null +++ b/test/test_apps/3.2/gemfiles/capybara_2.1_ruby2.0.0.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.2.13" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.1.0" + diff --git a/test/test_apps/3.2/gemfiles/capybara_2.2_ruby1.9.3.gemfile b/test/test_apps/3.2/gemfiles/capybara_2.2_ruby1.9.3.gemfile new file mode 100644 index 00000000..be822b7b --- /dev/null +++ b/test/test_apps/3.2/gemfiles/capybara_2.2_ruby1.9.3.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.2.13" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.2.0" + diff --git a/test/test_apps/3.2/gemfiles/capybara_2.2_ruby2.0.0.gemfile b/test/test_apps/3.2/gemfiles/capybara_2.2_ruby2.0.0.gemfile new file mode 100644 index 00000000..be822b7b --- /dev/null +++ b/test/test_apps/3.2/gemfiles/capybara_2.2_ruby2.0.0.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "3.2.13" +gem "sqlite3" +gem "jquery-rails" +gem "selenium-webdriver" +gem "mocha", "0.13.3", :require=>false +gem "appraisal", "~> 0.5.1" +gem "ae_page_objects", :path=>"../../../.." +gem "capybara", "~> 2.2.0" + diff --git a/test/test_apps/shared/Gemfile b/test/test_apps/shared/Gemfile deleted file mode 100644 index dde83902..00000000 --- a/test/test_apps/shared/Gemfile +++ /dev/null @@ -1,21 +0,0 @@ -rails_version = File.dirname(__FILE__).split('/').last - -directory = File.expand_path("../../../../selenium_gemfiles/rails#{rails_version}", __FILE__) - -file_pattern = "#{directory}/*ruby#{RUBY_VERSION}*.gemfile" -file = Dir.glob(file_pattern).sort.reverse.first - -if !file || file.empty? - raise <<-ERROR - ------------- - Couldn't find Gemfile using pattern #{file_pattern} for Ruby#{RUBY_VERSION}. - Contents: - #{Dir.glob("#{directory}/*").join("\n ")}" - ------------- - ERROR -end - -puts "Using Gemfile: #{file}" - -eval_gemfile file - From d3b3a8d62cec3c27e38d1c0ee1a814d5a914140c Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 00:21:32 -0800 Subject: [PATCH 25/33] parallelize travis tasks --- .travis.yml | 22 ++++++++++++++++++++++ Rakefile | 6 +++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f1e65552..93bde018 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,3 +21,25 @@ before_script: - bundle exec rake test:integration:selenium:install script: "bundle exec rake test:ci" + +# For all the integration tests +env: + - RAILS_VERSION=2.3 + - RAILS_VERSION=3.0 + - RAILS_VERSION=3.1 + - RAILS_VERSION=3.2 + +# For all the unit tests (via absence of RAILS_VERSION) +include: + - rvm: 1.8.7 + - rvm: 1.9.3 + - rvm: 2.0.0 + +exclude: + - rvm: 2.0.0 + env: RAILS_VERSION=2.3 + - rvm: 2.0.0 + env: RAILS_VERSION=3.0 + - rvm: 2.0.0 + env: RAILS_VERSION=3.1 + diff --git a/Rakefile b/Rakefile index b92c2723..d5c52d85 100644 --- a/Rakefile +++ b/Rakefile @@ -172,7 +172,11 @@ namespace :test do end end - task :ci => ['test:integration:units', 'test:integration:selenium'] + if ENV['RAILS_VERSION'] + task :ci => ['test:integration:selenium'] + else + task :ci => ['test:integration:units'] + end end desc 'Default: run the unit and integration tests.' From 8954f1c46bfb087a54848ed5fd77edbfae03e682 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 00:26:28 -0800 Subject: [PATCH 26/33] more travising --- .travis.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93bde018..87d0a8f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,27 +19,28 @@ before_script: - sh -e /etc/init.d/xvfb start - bundle exec rake appraisal:install - bundle exec rake test:integration:selenium:install - + script: "bundle exec rake test:ci" # For all the integration tests env: - - RAILS_VERSION=2.3 - - RAILS_VERSION=3.0 - - RAILS_VERSION=3.1 - - RAILS_VERSION=3.2 + - RAILS_VERSION=2.3 + - RAILS_VERSION=3.0 + - RAILS_VERSION=3.1 + - RAILS_VERSION=3.2 # For all the unit tests (via absence of RAILS_VERSION) -include: - - rvm: 1.8.7 - - rvm: 1.9.3 - - rvm: 2.0.0 - -exclude: - - rvm: 2.0.0 - env: RAILS_VERSION=2.3 - - rvm: 2.0.0 - env: RAILS_VERSION=3.0 - - rvm: 2.0.0 - env: RAILS_VERSION=3.1 +matrix: + include: + - rvm: 1.8.7 + - rvm: 1.9.3 + - rvm: 2.0.0 + + exclude: + - rvm: 2.0.0 + env: RAILS_VERSION=2.3 + - rvm: 2.0.0 + env: RAILS_VERSION=3.0 + - rvm: 2.0.0 + env: RAILS_VERSION=3.1 From 216b30c54f66847eac1b1dcc27020e46dce213a9 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 00:29:11 -0800 Subject: [PATCH 27/33] more travising --- .travis.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87d0a8f4..cfb7fd5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,18 +24,20 @@ script: "bundle exec rake test:ci" # For all the integration tests env: - - RAILS_VERSION=2.3 - - RAILS_VERSION=3.0 - - RAILS_VERSION=3.1 - - RAILS_VERSION=3.2 + matrix: + - RAILS_VERSION=2.3 + - RAILS_VERSION=3.0 + - RAILS_VERSION=3.1 + - RAILS_VERSION=3.2 + - UNITS_ONLY=true # For all the unit tests (via absence of RAILS_VERSION) matrix: - include: - - rvm: 1.8.7 - - rvm: 1.9.3 - - rvm: 2.0.0 - +# include: +# - rvm: 1.8.7 +# - rvm: 1.9.3 +# - rvm: 2.0.0 +# exclude: - rvm: 2.0.0 env: RAILS_VERSION=2.3 From 09d6866890ac9c6f3e8fa07cebed460388c1fd01 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 00:32:00 -0800 Subject: [PATCH 28/33] more travising --- .travis.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index cfb7fd5c..919a1909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,18 +31,14 @@ env: - RAILS_VERSION=3.2 - UNITS_ONLY=true -# For all the unit tests (via absence of RAILS_VERSION) matrix: -# include: -# - rvm: 1.8.7 -# - rvm: 1.9.3 -# - rvm: 2.0.0 -# exclude: - rvm: 2.0.0 + gemfile: Gemfile env: RAILS_VERSION=2.3 - rvm: 2.0.0 + gemfile: Gemfile env: RAILS_VERSION=3.0 - rvm: 2.0.0 + gemfile: Gemfile env: RAILS_VERSION=3.1 - From be6f6e3c1d1eb6c9795bb19c16812da751ebd9ff Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 00:52:15 -0800 Subject: [PATCH 29/33] optimizing travis --- .travis.yml | 3 +-- Rakefile | 50 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 919a1909..0e76f176 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,7 @@ before_install: before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - - bundle exec rake appraisal:install - - bundle exec rake test:integration:selenium:install + - bundle exec rake test:ci:install script: "bundle exec rake test:ci" diff --git a/Rakefile b/Rakefile index d5c52d85..802785e4 100644 --- a/Rakefile +++ b/Rakefile @@ -33,23 +33,17 @@ class SeleniumRunner def install_all @matrix.values.each do |test_configs| test_configs.each do |test_config| - appraisal = Appraisal::Appraisal.new("name", test_config.gemfile) - - def appraisal.gemfile_path - @gemfile_path - end - - appraisal.instance_variable_set(:@gemfile_path, test_config.gemfile) - - if @options[:dry] - puts "Installing: #{test_config.gemfile}" - else - appraisal.install - end + install_config(test_config) end end end + def install_all_for(rails_version) + @matrix[rails_version].each do |test_config| + install_config(test_config) + end + end + def run_all_tests @matrix.keys.sort.each do |rails_version| run_all_tests_for(rails_version) @@ -70,6 +64,22 @@ class SeleniumRunner private + def install_config(test_config) + appraisal = Appraisal::Appraisal.new("name", test_config.gemfile) + + def appraisal.gemfile_path + @gemfile_path + end + + appraisal.instance_variable_set(:@gemfile_path, test_config.gemfile) + + if @options[:dry] + puts "Installing: #{test_config.gemfile}" + else + appraisal.install + end + end + # Appraisal::Command almost has what I need: a way to run things without Bundler/Ruby # Env variables. The subclassing is to override the initializer to not modify the command. class Command < Appraisal::Command @@ -153,7 +163,13 @@ namespace :test do namespace :selenium do task :install do - selenium_runner.install_all + rails_version = ENV['RAILS_VERSION'] + if rails_version + selenium_runner.install_all_for(rails_version) + else + selenium_runner.install_all + end + end task :cleanup do @@ -173,8 +189,14 @@ namespace :test do end if ENV['RAILS_VERSION'] + namespace :ci do + task :install => ["test:integration:selenium:install"] + end task :ci => ['test:integration:selenium'] else + namespace :ci do + task :install => ["appraisal:install"] + end task :ci => ['test:integration:units'] end end From 977d4ab1929230034ab9be40e98078df7977f004 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 01:07:35 -0800 Subject: [PATCH 30/33] better local test:ci support --- .travis.yml | 2 +- Rakefile | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e76f176..f70f20ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ env: - RAILS_VERSION=3.0 - RAILS_VERSION=3.1 - RAILS_VERSION=3.2 - - UNITS_ONLY=true + - UNITS=true matrix: exclude: diff --git a/Rakefile b/Rakefile index 802785e4..9216cc25 100644 --- a/Rakefile +++ b/Rakefile @@ -188,17 +188,25 @@ namespace :test do end end - if ENV['RAILS_VERSION'] - namespace :ci do - task :install => ["test:integration:selenium:install"] - end - task :ci => ['test:integration:selenium'] - else - namespace :ci do - task :install => ["appraisal:install"] - end - task :ci => ['test:integration:units'] + ci_install = nil + ci_task = nil + + if ! (ENV['RAILS_VERSION'].nil? ^ ENV['UNITS'].nil?) + ci_install = ["appraisal:install", "test:integration:selenium:install"] + ci_task = ['test:integration:units', 'test:integration:selenium'] + elsif ENV['RAILS_VERSION'] + ci_install = "test:integration:selenium:install" + ci_task = 'test:integration:selenium' + elsif ENV['UNITS'] + ci_install = "appraisal:install" + ci_task = 'test:integration:units' end + + namespace :ci do + task :install => ci_install + end + + task :ci => ci_task end desc 'Default: run the unit and integration tests.' From 3d5548c355630e0c777ef2d34a6642f9997eb7f4 Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 01:22:42 -0800 Subject: [PATCH 31/33] try consolidated build --- .travis.yml | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index f70f20ba..c6ca75d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,23 +21,25 @@ before_script: script: "bundle exec rake test:ci" -# For all the integration tests -env: - matrix: - - RAILS_VERSION=2.3 - - RAILS_VERSION=3.0 - - RAILS_VERSION=3.1 - - RAILS_VERSION=3.2 - - UNITS=true - -matrix: - exclude: - - rvm: 2.0.0 - gemfile: Gemfile - env: RAILS_VERSION=2.3 - - rvm: 2.0.0 - gemfile: Gemfile - env: RAILS_VERSION=3.0 - - rvm: 2.0.0 - gemfile: Gemfile - env: RAILS_VERSION=3.1 +# With the below you get a build that takes about 15 mins elapsed time and 46.5 mins worker time: +#https://travis-ci.org/appfolio/ae_page_objects/builds/17328226 +## For all the integration tests +#env: +# matrix: +# - RAILS_VERSION=2.3 +# - RAILS_VERSION=3.0 +# - RAILS_VERSION=3.1 +# - RAILS_VERSION=3.2 +# - UNITS=true +# +#matrix: +# exclude: +# - rvm: 2.0.0 +# gemfile: Gemfile +# env: RAILS_VERSION=2.3 +# - rvm: 2.0.0 +# gemfile: Gemfile +# env: RAILS_VERSION=3.0 +# - rvm: 2.0.0 +# gemfile: Gemfile +# env: RAILS_VERSION=3.1 From 1601507bba519d16b699ed82904b57d600b4603b Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 01:38:22 -0800 Subject: [PATCH 32/33] adding notes --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index c6ca75d7..ebad92f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,16 @@ before_script: script: "bundle exec rake test:ci" +# Without the below, Travis runs 3 builds, that take about 14 mins elapsed time and 22 mins worker time: +#https://travis-ci.org/appfolio/ae_page_objects/builds/17328803 +# # With the below you get a build that takes about 15 mins elapsed time and 46.5 mins worker time: #https://travis-ci.org/appfolio/ae_page_objects/builds/17328226 +# +# It might be worth trying targetting the Appraisal gemfiles directly... +# +# - "The Below" - +# ## For all the integration tests #env: # matrix: From 4165cd383bc5eed2b8728952021579ad8b0f651a Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Tue, 21 Jan 2014 11:11:39 -0800 Subject: [PATCH 33/33] update changelog [ci skip] --- CHANGELOG.rdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index c4611e26..005c80e6 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,7 @@ +== X.X.X + +* Support Capybara 2 + == 0.5.2 * A few Collection improvements