Skip to content

Commit

Permalink
Merge 856ede1 into 0238ccd
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Dec 6, 2014
2 parents 0238ccd + 856ede1 commit 5252d95
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem 'refinerycms-i18n', git: 'https://github.com/refinery/refinerycms-i18n', bra
gem 'quiet_assets'
gem 'spring'
gem 'spring-commands-rspec'
gem 'poltergeist'

# Add support for refinerycms-acts-as-indexed
gem 'refinerycms-acts-as-indexed', ['~> 2.0', '>= 2.0.0']
Expand Down
23 changes: 13 additions & 10 deletions pages/spec/features/refinery/admin/pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ module Admin
end
end

describe 'Previewing' do
describe 'Previewing', :js, :firefox do
let(:preview_content) { "Some changes I'm unsure what they will look like".freeze }
context "an existing page" do
before { Page.create :title => 'Preview me' }

it 'will show the preview changes in a new window', :js do
it 'will show the preview changes in a new window' do
visit refinery.admin_pages_path

find('a[tooltip^=Edit]').click
Expand All @@ -224,7 +224,7 @@ module Admin
window.close
end

it 'will not show the site bar', :js do
it 'will not show the site bar' do
visit refinery.admin_pages_path

find('a[tooltip^=Edit]').click
Expand All @@ -245,7 +245,7 @@ module Admin
window.close
end

it 'will not save the preview changes', :js do
it 'will not save the preview changes' do
visit refinery.admin_pages_path

find('a[tooltip^=Edit]').click
Expand All @@ -265,7 +265,7 @@ module Admin
end

# Regression test for previewing after save-and_continue
it 'will show the preview in a new window after save-and-continue', :js do
it 'will show the preview in a new window after save-and-continue' do
visit refinery.admin_pages_path

find('a[tooltip^=Edit]').click
Expand All @@ -286,7 +286,7 @@ module Admin
window.close
end

it 'will show pages with inherited templates', :js do
it 'will show pages with inherited templates' do
visit refinery.admin_pages_path

find('a[tooltip^=Edit]').click
Expand All @@ -300,7 +300,7 @@ module Admin
end

context 'a brand new page' do
it "will not save when just previewing", :js do
it "will not save when just previewing" do
visit refinery.admin_pages_path

click_link "Add new page"
Expand All @@ -320,7 +320,7 @@ module Admin
let!(:parent_page) { Page.create :title => "Our Parent Page" }
let!(:nested_page) { parent_page.children.create :title => 'Preview Me' }

it "works like an un-nested page", :js do
it "works like an un-nested page" do
visit refinery.admin_pages_path

within "#page_#{nested_page.id}" do
Expand Down Expand Up @@ -659,7 +659,10 @@ module Admin

2.times do
click_link "delete_page_part"
page.driver.browser.switch_to.alert.accept
# Poltergeist automatically accepts dialogues.
if Capybara.javascript_driver != :poltergeist
page.driver.browser.switch_to.alert.accept
end
end

within "#page_parts" do
Expand Down Expand Up @@ -819,7 +822,7 @@ module Admin
# see https://github.com/refinery/refinerycms/pull/1583
# this test needs to be moved to refinerycms-wymeditor somehow
context "when switching locales" do
specify "dialog has correct links", :js do
specify "dialog has correct links", :js, :firefox do
visit refinery.edit_admin_page_path(about_page)

find("#page_part_body .wym_tools_link a").click
Expand Down
9 changes: 9 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
config.run_all_when_everything_filtered = true
config.include ActionView::TestCase::Behavior, :file_path => %r{spec/presenters}
config.infer_spec_type_from_file_location!

config.around(:each, :firefox) do |example|
Capybara.javascript_driver = :selenium
example.call
Capybara.javascript_driver = :poltergeist
end
end

# Requires supporting files with custom matchers and macros, etc,
Expand All @@ -38,3 +44,6 @@
}.flatten.sort.each do |support_file|
require support_file
end

require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist

0 comments on commit 5252d95

Please sign in to comment.