Skip to content

Commit

Permalink
Switch to Apparition as the js driver
Browse files Browse the repository at this point in the history
Apparition is maintained by the same person who maintains Capybara, so it's easier to maintain.
It also defaults to a sensible size viewport
  • Loading branch information
jcoyne authored and cbeer committed Jan 5, 2021
1 parent 613e9d3 commit c6d7955
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 51 deletions.
3 changes: 1 addition & 2 deletions blacklight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec-its"
s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
s.add_development_dependency "capybara", '~> 3'
s.add_development_dependency 'webdrivers', '~> 3.0'
s.add_development_dependency "selenium-webdriver", '>= 3.13.1'
s.add_development_dependency 'apparition'
s.add_development_dependency 'engine_cart', '~> 2.1'
s.add_development_dependency "equivalent-xml"
s.add_development_dependency "simplecov"
Expand Down
27 changes: 1 addition & 26 deletions spec/features/facets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@

expect(page).to have_css('#facet-format', visible: false)

within('#facets .facets-header') do
page.find('button.navbar-toggler').click
end

page.find('h3.facet-field-heading button', text: 'Format').click

sleep(1) # let facet animation finish and wait for it to potentially re-collapse
Expand All @@ -70,14 +66,10 @@
it 'is able to expand pivot facets when javascript is enabled', js: true do
visit root_path

within('#facets .facets-header') do
page.find('button.navbar-toggler').click
end

page.find('h3.facet-field-heading button', text: 'Pivot Field').click

within '#facet-example_pivot_field' do
expect(page).to have_css('.facet-leaf-node', text: 'Book 30')
expect(page).to have_css('.facet-leaf-node', text: "Book\t30")
expect(page).not_to have_css('.facet-select', text: 'Tibetan')
page.find('.facet-toggle-handle').click
click_link 'Tibetan'
Expand All @@ -87,23 +79,6 @@
expect(page).to have_css('.constraint-value', text: 'Language Tibetan')
end

describe 'heading button focus with Firefox' do
before do
Capybara.current_driver = :selenium_headless
end

after do
Capybara.current_driver = :rack_test
end

it 'changes to the button on button click in Firefox' do
visit root_path
page.find('h3.facet-field-heading button', text: 'Format').click
focused_element_data_target = page.evaluate_script("document.activeElement")['data-target']
expect(focused_element_data_target).to eq '#facet-format'
end
end

describe '"More" links' do
it 'has default more link with sr-only text' do
visit root_path
Expand Down
20 changes: 0 additions & 20 deletions spec/features/search_filters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,16 @@
end

it "is collapsed when not selected", js: true do
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
visit root_path

within('#facets .facets-header') do
page.find('button.navbar-toggler').click
end

within(".blacklight-subject_ssim") do
expect(page).not_to have_selector(".card-body", visible: true)
end
end

it "expands when the heading button is clicked", js: true do
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
visit root_path

within('#facets .facets-header') do
page.find('button.navbar-toggler').click
end

within(".blacklight-subject_ssim") do
expect(page).not_to have_selector(".card-body", visible: true)
find(".card-header button").click
Expand All @@ -196,13 +186,8 @@
end

it "expands when the button is clicked", js: true do
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
visit root_path

within('#facets .facets-header') do
page.find('button.navbar-toggler').click
end

within(".blacklight-subject_ssim") do
expect(page).not_to have_selector(".card-body", visible: true)
find(".card-header").click
Expand All @@ -211,13 +196,8 @@
end

it "keeps selected facets expanded on page load", js: true do
skip("Test passes locally but not on Travis.") if ENV['TRAVIS']
visit root_path

within('#facets .facets-header') do
page.find('button.navbar-toggler').click
end

within(".blacklight-subject_ssim") do
page.find('h3.facet-field-heading', text: 'Topic').click
expect(page).to have_selector(".panel-collapse", visible: true)
Expand Down
11 changes: 8 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
require 'rspec/its'
require 'rspec/collection_matchers'
require 'capybara/rspec'
require 'selenium-webdriver'
require 'capybara/apparition'
require 'equivalent-xml'
require 'webdrivers'

Capybara.javascript_driver = :selenium_chrome_headless
Capybara.javascript_driver = :apparition
Capybara.disable_animation = true
# Capybara.enable_aria_label = true

# Uncomment for a headed browser
# Capybara.register_driver :apparition do |app|
# Capybara::Apparition::Driver.new(app, headless: false)
# end

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Expand Down

0 comments on commit c6d7955

Please sign in to comment.