Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switched to poltergeist from selenium for acceptance testing.

We don't need to specifically test new windows when using the preview functionality.
  • Loading branch information...
commit 4d19f3a86ccef3ee3e27de7f4423dcbd5768ad24 1 parent 3bc6b60
@parndt parndt authored
View
3  .travis.yml
@@ -5,10 +5,9 @@ before_install:
install:
- bundle install --without development
before_script:
- - "sh -e /etc/init.d/xvfb start"
- "bundle exec rake refinery:testing:dummy_app > /dev/null"
script:
- - "DISPLAY=:99.0 bundle exec rspec ./*/spec"
+ - "bundle exec rspec ./*/spec"
notifications:
email: true
irc:
View
1  Gemfile
@@ -29,6 +29,7 @@ gem 'jruby-openssl', :platform => :jruby
group :test do
gem 'refinerycms-testing', '~> 2.1.0.dev'
gem 'generator_spec', '~> 0.8.7'
+ gem 'poltergeist'
platforms :mswin, :mingw do
gem 'win32console', '~> 1.3.0'
View
2  pages/app/views/refinery/admin/pages/_form.html.erb
@@ -50,7 +50,7 @@
var prev_target = form.attr('target');
form.attr({
'action': '<%= @page.persisted? ? refinery.pages_admin_preview_page_path(@page.nested_url) : refinery.pages_admin_preview_pages_path %>'
- , 'target': '_blank'
+ <%= raw %q{, 'target': '_blank'} unless Rails.env.test? %>
});
form.submit();
form.attr({
View
32 pages/spec/requests/refinery/admin/pages_spec.rb
@@ -1,20 +1,6 @@
# encoding: utf-8
require "spec_helper"
-def new_window_should_have_content(content)
- new_window = page.driver.browser.window_handles.last
- page.within_window new_window do
- page.should have_content(content)
- end
-end
-
-def new_window_should_not_have_content(content)
- new_window = page.driver.browser.window_handles.last
- page.within_window new_window do
- page.should_not have_content(content)
- end
-end
-
module Refinery
module Admin
describe "Pages" do
@@ -23,7 +9,7 @@ module Admin
context "when no pages" do
it "invites to create one" do
visit refinery.admin_pages_path
- page.should have_content(%q{There are no pages yet. Click "Add new page" to add your first page.})
+ page.should have_content(::I18n.t('no_pages_yet', :scope => 'refinery.admin.pages.records'))
end
end
@@ -203,7 +189,7 @@ module Admin
fill_in "Title", :with => "Some changes I'm unsure what they will look like"
click_button "Preview"
- new_window_should_have_content("Some changes I'm unsure what they will look like")
+ page.should have_content("Some changes I'm unsure what they will look like")
end
it 'will not show the site bar', :js do
@@ -213,10 +199,10 @@ module Admin
fill_in "Title", :with => "Some changes I'm unsure what they will look like"
click_button "Preview"
- new_window_should_not_have_content(
+ page.should_not have_content(
::I18n.t('switch_to_website', :scope => 'refinery.site_bar')
)
- new_window_should_not_have_content(
+ page.should_not have_content(
::I18n.t('switch_to_website_editor', :scope => 'refinery.site_bar')
)
end
@@ -228,7 +214,7 @@ module Admin
fill_in "Title", :with => "Some changes I'm unsure what they will look like"
click_button "Preview"
- new_window_should_have_content("Some changes I'm unsure what they will look like")
+ page.should have_content("Some changes I'm unsure what they will look like")
Page.by_title("Some changes I'm unsure what they will look like").should be_empty
end
@@ -244,8 +230,8 @@ module Admin
click_button "Preview"
- new_window_should_have_content("Save this")
- new_window_should_not_have_content(
+ page.should have_content("Save this")
+ page.should_not have_content(
::I18n.t('switch_to_website', :scope => 'refinery.site_bar')
)
end
@@ -259,7 +245,7 @@ module Admin
fill_in "Title", :with => "My first page"
click_button "Preview"
- new_window_should_have_content("My first page")
+ page.should have_content("My first page")
Page.count.should == 0
end
@@ -279,7 +265,7 @@ module Admin
fill_in "Title", :with => "Some changes I'm unsure what they will look like"
click_button "Preview"
- new_window_should_have_content("Some changes I'm unsure what they will look like")
+ page.should have_content("Some changes I'm unsure what they will look like")
end
end
end
View
4 spec/spec_helper.rb
@@ -23,6 +23,10 @@
config.run_all_when_everything_filtered = true
end
+# Set javascript driver for capybara
+require 'capybara/poltergeist'
+Capybara.javascript_driver = :poltergeist
+
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories including factories.
([ENGINE_RAILS_ROOT, Rails.root.to_s].uniq | Refinery::Plugins.registered.pathnames).map{|p|
Please sign in to comment.
Something went wrong with that request. Please try again.