Merge pull request #1271 from opf/feature/update_capybara_to_2-2-1

[Feature] 7198 Intermittent database deadlock in Work package Capybara spec
pull/1275/merge
Alex Coles 11 years ago
commit f72683f990
  1. 2
      Gemfile.lock
  2. 43
      spec/features/accessibility/support/toggable_fieldsets.rb
  3. 1
      spec/features/accessibility/work_packages/index_toggable_fieldsets_spec.rb
  4. 42
      spec/features/accessibility/work_packages/work_package_query_spec.rb

@ -72,7 +72,7 @@ GEM
byebug (2.7.0)
columnize (~> 0.3)
debugger-linecache (~> 1.2)
capybara (2.1.0)
capybara (2.2.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)

@ -29,31 +29,29 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
shared_context 'find legend with text' do
let(:legend_text) { find('legend a span', text: fieldset_name) }
let(:fieldset) { legend_text.find(:xpath, '../../..') }
end
shared_context 'Toggable fieldset examples' do
def toggable_title
find('legend a span', text: fieldset_name)
end
shared_context 'find toggle label' do
let(:link) { legend_text.find(:xpath, '..') }
let(:toggle_state_label) { link.find("span.hidden-for-sighted", visible: false) }
def toggable_content
link = toggable_title.find(:xpath, '..')
link.find('span.hidden-for-sighted', visible: false)
end
it { expect(toggle_state_label).not_to be_nil }
end
shared_context 'find toggle label' do
it { expect(toggable_content).not_to be_nil }
end
shared_context 'Toggable fieldset examples' do
shared_examples_for 'toggable fieldset initially collapsed' do
it_behaves_like 'collapsed fieldset'
describe 'initial state' do
include_context 'find legend with text'
it_behaves_like 'toggle state set collapsed'
end
describe 'after click' do
include_context 'find legend with text'
before { legend_text.click }
before { toggable_title.click }
it_behaves_like 'expanded fieldset'
end
@ -63,31 +61,26 @@ shared_context 'Toggable fieldset examples' do
it_behaves_like 'expanded fieldset'
describe 'initial state' do
include_context 'find legend with text'
it_behaves_like 'toggle state set expanded'
end
describe 'after click' do
include_context 'find legend with text'
before { legend_text.click }
before { toggable_title.click }
it_behaves_like 'collapsed fieldset'
end
end
shared_examples_for 'toggle state set collapsed' do
include_context 'find legend with text'
include_context 'find toggle label'
it { expect(toggle_state_label.text(:all)).to include(I18n.t('js.label_collapsed')) }
it { expect(toggable_content.text(:all)).to include(I18n.t('js.label_collapsed')) }
end
shared_examples_for 'toggle state set expanded' do
include_context 'find legend with text'
include_context 'find toggle label'
it { expect(toggle_state_label.text(:all)).to include(I18n.t('js.label_expanded')) }
it { expect(toggable_content.text(:all)).to include(I18n.t('js.label_expanded')) }
end
shared_context 'collapsed CSS' do
@ -96,15 +89,13 @@ shared_context 'Toggable fieldset examples' do
shared_examples_for 'collapsed fieldset' do
include_context 'collapsed CSS'
include_context 'find legend with text'
it { expect(fieldset[:class]).to include(collapsed_class_name) }
it { expect(toggable_title.find(:xpath, '../../..')[:class]).to include(collapsed_class_name) }
end
shared_examples_for 'expanded fieldset' do
include_context 'collapsed CSS'
include_context 'find legend with text'
it { expect(fieldset[:class]).not_to include(collapsed_class_name) }
it { expect(toggable_title.find(:xpath, '../../..')[:class]).not_to include(collapsed_class_name) }
end
end

@ -27,6 +27,7 @@
#++
require 'spec_helper'
require 'features/accessibility/support/toggable_fieldsets'
require 'features/work_packages/work_packages_page'
describe 'Work package index' do

@ -43,8 +43,13 @@ describe 'Work package index accessibility' do
end
describe 'Select all link' do
let(:select_all_link) { find('table.list.issues th.checkbox a') }
let(:description_for_blind) { select_all_link.find(:xpath, 'span/span[@class="hidden-for-sighted"]') }
def select_all_link
find('table.list.issues th.checkbox a')
end
def description_for_blind
select_all_link.find(:xpath, 'span/span[@class="hidden-for-sighted"]')
end
describe 'Initial state', js: true do
it { expect(select_all_link).not_to be_nil }
@ -53,11 +58,13 @@ describe 'Work package index accessibility' do
it { expect(select_all_link[:alt]).to eq(I18n.t(:button_check_all)) }
# TODO: This test is failing because of what seems to be a bug in selenium.
# The hidden-for-sighted elements cannot be found using because they are styled with
# absolute positioning and have an x index off the side of the page. If you remove
# the x coord then it will find them but that doesn't seem like a satisfactory solution.
# it { expect(description_for_blind.text).to eq(I18n.t(:button_check_all)) }
it do
pending("This test is failing because of what seems to be a bug in selenium. " \
"The hidden-for-sighted elements cannot be found using because they are styled with " \
"absolute positioning and have an x index off the side of the page. If you remove " \
"the x coord then it will find them but that doesn't seem like a satisfactory solution.")
expect(description_for_blind.text).to eq(I18n.t(:button_check_all))
end
end
describe 'Change state', js: true do
@ -66,8 +73,19 @@ describe 'Work package index accessibility' do
end
describe 'Sort link', js: true do
def sort_link
find(sort_link_selector)
end
shared_examples_for 'sort column' do
it { expect(find(sort_header_selector).find("span")[:title]).to eq(sort_text) }
def sort_header
find(sort_header_selector)
end
it do
expect(sort_header).not_to be_nil
expect(sort_header.find("span")[:title]).to eq(sort_text)
end
end
shared_examples_for 'unsorted column' do
@ -90,12 +108,12 @@ describe 'Work package index accessibility' do
shared_examples_for 'descending sortable first' do
describe 'one click' do
before { find(sort_link_selector).click }
before { sort_link.click }
it_behaves_like 'descending sorted column'
describe 'two clicks' do
before { find(sort_link_selector).click }
before { sort_link.click }
it_behaves_like 'ascending sorted column'
end
@ -104,12 +122,12 @@ describe 'Work package index accessibility' do
shared_examples_for 'ascending sortable first' do
describe 'one click' do
before { find(sort_link_selector).click }
before { sort_link.click }
it_behaves_like 'ascending sorted column'
describe 'two clicks' do
before { find(sort_link_selector).click }
before { sort_link.click }
it_behaves_like 'descending sorted column'
end

Loading…
Cancel
Save