diff --git a/spec/features/annotations/annotations_editing_spec.rb b/spec/features/annotations/annotations_editing_spec.rb index e3b5b8d68f..0edfc4a25e 100644 --- a/spec/features/annotations/annotations_editing_spec.rb +++ b/spec/features/annotations/annotations_editing_spec.rb @@ -56,7 +56,7 @@ expect { click_button 'Save' }.not_to change { Annotation.count } end expect(annotation.text).to eql('Foo bar') - expect(Annotation.order('created_at').last.text).to eql('Noo bar') + expect(Annotation.order('created_at').last.text).to eql('

Noo bar

') expect(page).not_to have_errors end diff --git a/spec/features/feedback_requests_spec.rb b/spec/features/feedback_requests_spec.rb index 91da633e09..4d6eaccfdf 100644 --- a/spec/features/feedback_requests_spec.rb +++ b/spec/features/feedback_requests_spec.rb @@ -35,7 +35,7 @@ end # Click "Request feedback" button within panel - within('div.panel') do + within('.tab-pane.active') do click_link 'Request feedback' end diff --git a/spec/features/questions/checkbox_questions_spec.rb b/spec/features/questions/checkbox_questions_spec.rb index 9e8a3b658b..50262f9022 100644 --- a/spec/features/questions/checkbox_questions_spec.rb +++ b/spec/features/questions/checkbox_questions_spec.rb @@ -26,7 +26,7 @@ # Expectations expect(current_path).to eql(edit_plan_path(@plan)) # 4 sections x 3 questions - expect(page).to have_text('0/1 answered') + expect(page).to have_text('(0 / 1)') # Action find("#section-panel-#{@section.id}").click @@ -38,7 +38,7 @@ # Expectations expect(page).to have_text 'Answered just now' - expect(page).to have_text '1/1 answered' + expect(page).to have_text '(1 / 1)' expect(Answer.where(question_id: @question.id)).to be_any end end diff --git a/spec/features/questions/dropdown_questions_spec.rb b/spec/features/questions/dropdown_questions_spec.rb index d9c5a52ca5..f157dd4621 100644 --- a/spec/features/questions/dropdown_questions_spec.rb +++ b/spec/features/questions/dropdown_questions_spec.rb @@ -26,7 +26,7 @@ # Expectations expect(current_path).to eql(edit_plan_path(@plan)) # 4 sections x 3 questions - expect(page).to have_text('0/1 answered') + expect(page).to have_text('(0 / 1)') # Action find("#section-panel-#{@section.id}").click diff --git a/spec/features/questions/radiobuttons_questions_spec.rb b/spec/features/questions/radiobuttons_questions_spec.rb index c41a51aec1..fa44b8cd6e 100644 --- a/spec/features/questions/radiobuttons_questions_spec.rb +++ b/spec/features/questions/radiobuttons_questions_spec.rb @@ -26,7 +26,7 @@ # Expectations expect(current_path).to eql(edit_plan_path(@plan)) # 4 sections x 3 questions - expect(page).to have_text('0/1 answered') + expect(page).to have_text('(0 / 1)') # Action find("#section-panel-#{@section.id}").click diff --git a/spec/features/questions/textarea_questions_spec.rb b/spec/features/questions/textarea_questions_spec.rb index 2b9ed8c874..34e3fcf84c 100644 --- a/spec/features/questions/textarea_questions_spec.rb +++ b/spec/features/questions/textarea_questions_spec.rb @@ -26,7 +26,7 @@ # Expectations expect(current_path).to eql(edit_plan_path(@plan)) # 4 sections x 3 questions - expect(page).to have_text('0/1 answered') + expect(page).to have_text('(0 / 1)') # Action find("#section-panel-#{@section.id}").click @@ -39,7 +39,7 @@ # Expectations expect(page).to have_text 'Answered just now' - expect(page).to have_text '1/1 answered' + expect(page).to have_text '(1 / 1)' expect(Answer.where(question_id: @question.id)).to be_any end end diff --git a/spec/features/questions/textfield_questions_spec.rb b/spec/features/questions/textfield_questions_spec.rb index 2d3476a9e4..7df6366f37 100644 --- a/spec/features/questions/textfield_questions_spec.rb +++ b/spec/features/questions/textfield_questions_spec.rb @@ -26,7 +26,7 @@ # Expectations expect(current_path).to eql(edit_plan_path(@plan)) # 4 sections x 3 questions - expect(page).to have_text('0/1 answered') + expect(page).to have_text('(0 / 1)') # Action find("#section-panel-#{@section.id}").click @@ -39,7 +39,7 @@ # Expectations expect(page).to have_text 'Answered just now' - expect(page).to have_text '1/1 answered' + expect(page).to have_text '(1 / 1)' expect(Answer.where(question_id: @question.id)).to be_any end end diff --git a/spec/features/super_admins/orgs_spec.rb b/spec/features/super_admins/orgs_spec.rb index 06f6a61b34..b250b8b9c6 100644 --- a/spec/features/super_admins/orgs_spec.rb +++ b/spec/features/super_admins/orgs_spec.rb @@ -27,9 +27,9 @@ # Edit the first org in the table find('table .dropdown-toggle').click find('.dropdown-menu > li > a').click - nbr_links = all('.link').length + nbr_links = all('input[name="link_link"]').length add_link - expect(all('.link').length).to eql(nbr_links + 1) + expect(all('input[name="link_link"]').length).to eql(nbr_links + 1) end scenario 'Super admin removes links' do @@ -39,8 +39,8 @@ find('table .dropdown-toggle').click find('.dropdown-menu > li > a').click add_link - nbr_links = all('.link').length + nbr_links = all('input[name="link_link"]').length remove_link - expect(all('.link').length).to eql(nbr_links - 1) + expect(all('input[name="link_link"]').length).to eql(nbr_links - 1) end end diff --git a/spec/features/templates/templates_editings_spec.rb b/spec/features/templates/templates_editings_spec.rb index bc84511cd7..a56237f880 100644 --- a/spec/features/templates/templates_editings_spec.rb +++ b/spec/features/templates/templates_editings_spec.rb @@ -44,7 +44,7 @@ click_button 'Save' end # Make sure annotation has been updated - expect(Question.find(template.question_ids.first).annotations.first.text).to eql('Foo bar') + expect(Question.find(template.question_ids.first).annotations.first.text).to eql('

Foo bar

') # Make sure blank records are not created for empty annotation form expect(Question.find(template.question_ids.first).annotations.count).to eql(1) expect(page).not_to have_errors diff --git a/spec/support/helpers/links_helper.rb b/spec/support/helpers/links_helper.rb index a4501227d5..8b27295757 100644 --- a/spec/support/helpers/links_helper.rb +++ b/spec/support/helpers/links_helper.rb @@ -6,6 +6,15 @@ def add_link end def remove_link - all('.link a > .fa-circle-xmark').last.click + # # Scroll the element into view + last_link = all('a.delete > .fas.fa-circle-xmark.fa-reverse', visible: false).last + scroll_to_element(last_link) + # Use Javascript to click link element, as it appears to be size 0 + execute_script("arguments[0].click();", last_link); + end + + def scroll_to_element(element) + script = 'arguments[0].scrollIntoView(true)' + execute_script(script, element.native) end end