From 37a88a1be6fcd1a6b877dff7e3ed4ac36434d44a Mon Sep 17 00:00:00 2001 From: alexs Date: Tue, 23 Jul 2013 17:54:05 +1000 Subject: [PATCH] Changed JavaScript driver from selenium to phantomjs. --- Gemfile | 1 + Gemfile.lock | 9 +++++++++ spec/features/admin/bulk_product_update_spec.rb | 2 -- spec/features/admin/enterprise_fees_spec.rb | 3 +-- spec/spec_helper.rb | 4 ++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index e08a434ca3..a417e5e1ca 100644 --- a/Gemfile +++ b/Gemfile @@ -60,6 +60,7 @@ group :test, :development do gem 'simplecov', :require => false gem 'awesome_print' gem "letter_opener" + gem 'poltergeist' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 67067d1d8e..9c143343fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -201,6 +201,7 @@ GEM devise (>= 2.1.0) diff-lcs (1.1.3) erubis (2.7.0) + eventmachine (1.0.3) excon (0.25.3) execjs (1.4.0) multi_json (~> 1.0) @@ -211,6 +212,8 @@ GEM railties (>= 3.0.0) faker (1.0.1) i18n (~> 0.4) + faye-websocket (0.4.7) + eventmachine (>= 0.12.0) ffaker (1.15.0) ffi (1.4.0) fog (1.14.0) @@ -227,6 +230,7 @@ GEM haml (3.1.6) highline (1.6.18) hike (1.2.3) + http_parser.rb (0.5.3) httparty (0.11.0) multi_json (~> 1.0) multi_xml (>= 0.5.2) @@ -269,6 +273,10 @@ GEM cocaine (>= 0.0.2) mime-types pg (0.13.2) + poltergeist (1.1.2) + capybara (~> 2.0.1) + faye-websocket (~> 0.4.4) + http_parser.rb (~> 0.5.3) polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) @@ -415,6 +423,7 @@ DEPENDENCIES newrelic_rpm oj pg + poltergeist pry-debugger rabl rails (= 3.2.13) diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index dc4cc3d9e9..a6f84180f9 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -299,7 +299,6 @@ feature %q{ page.should have_selector "a.delete-product", :count => 3 first("a.delete-product").click - page.driver.browser.switch_to.alert.accept sleep(0.5) if page.has_selector? "a.delete-product", :count => 3 # Wait for product to be removed from page page.should have_selector "a.delete-product", :count => 2 @@ -322,7 +321,6 @@ feature %q{ page.should have_selector "a.delete-variant", :count => 3 first("a.delete-variant").click - page.driver.browser.switch_to.alert.accept sleep(0.5) if page.has_selector? "a.delete-variant", :count => 3 # Wait for variant to be removed from page page.should have_selector "a.delete-variant", :count => 2 diff --git a/spec/features/admin/enterprise_fees_spec.rb b/spec/features/admin/enterprise_fees_spec.rb index cf06faf061..745f953bca 100644 --- a/spec/features/admin/enterprise_fees_spec.rb +++ b/spec/features/admin/enterprise_fees_spec.rb @@ -23,7 +23,7 @@ feature %q{ click_link 'Configuration' click_link 'Enterprise Fees' - page.should have_selector "#enterprise_fee_set_collection_attributes_0_enterprise_id", :text => fee.enterprise.name + page.should have_selector "#enterprise_fee_set_collection_attributes_0_enterprise_id" page.should have_selector "option[selected]", text: 'Packing' page.should have_selector "input[value='$0.50 / kg']" page.should have_selector "option[selected]", text: 'Weight (per kg)' @@ -93,7 +93,6 @@ feature %q{ # And I click delete find("a.delete-resource").click - page.driver.browser.switch_to.alert.accept # Then my enterprise fee should have been deleted visit admin_enterprise_fees_path diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2813411a51..5895f97acb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,6 +19,10 @@ require 'active_record/fixtures' fixtures_dir = File.expand_path('../../db/default', __FILE__) ActiveRecord::Fixtures.create_fixtures(fixtures_dir, ['spree/states', 'spree/countries']) +# Capybara config +require 'capybara/poltergeist' +Capybara.javascript_driver = :poltergeist + RSpec.configure do |config| # ## Mock Framework