From 92af93e8bd2478ffc4d8c018b162f8a6b0f1b2a3 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 16 Mar 2018 13:19:58 -0400 Subject: [PATCH] Fix failing tests that simulated a click against the DOM The now-deprecated `.trigger('click')` API simulated a click against the DOM rather a click on the UI, which made our tests fragile and wouldn't simulate actual user interaction --- spec/features/budgets/ballots_spec.rb | 8 ++++---- spec/features/comments/legislation_annotations_spec.rb | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/features/budgets/ballots_spec.rb b/spec/features/budgets/ballots_spec.rb index 3b9f16403..86e6f0596 100644 --- a/spec/features/budgets/ballots_spec.rb +++ b/spec/features/budgets/ballots_spec.rb @@ -375,7 +375,7 @@ feature 'Ballots' do expect(page).to have_content("You have voted one investment") within("#budget_investment_#{investment.id}") do - find(".remove-investment-project").click + find('.icon-x').click end expect(page).to have_current_path(budget_ballot_path(budget)) @@ -404,7 +404,7 @@ feature 'Ballots' do end within("#sidebar #budget_investment_#{investment1.id}_sidebar") do - find(".remove-investment-project").click + find('.icon-x').click end expect(page).to have_css("#amount-spent", text: "€20,000") @@ -431,7 +431,7 @@ feature 'Ballots' do expect(page).to have_content("You have voted one investment") within("#budget_investment_#{investment.id}") do - find(".remove-investment-project").click + find('.icon-x').click end expect(page).to have_content("You have voted 0 investments") @@ -609,7 +609,7 @@ feature 'Ballots' do end within("#budget_investment_#{bi1.id}_sidebar") do - find('.remove-investment-project').click + find('.icon-x').click end expect(page).not_to have_css "#budget_investment_#{bi1.id}_sidebar" diff --git a/spec/features/comments/legislation_annotations_spec.rb b/spec/features/comments/legislation_annotations_spec.rb index ff4e4790d..1b54bf33a 100644 --- a/spec/features/comments/legislation_annotations_spec.rb +++ b/spec/features/comments/legislation_annotations_spec.rb @@ -620,7 +620,7 @@ feature 'Commenting legislation questions' do scenario 'View comments of annotations in an included range' do within("#annotation-link") do - first(:css, "a").click + find('.icon-expand').click end expect(page).to have_css(".comment", count: 2) @@ -656,7 +656,7 @@ feature 'Commenting legislation questions' do end within("#annotation-link") do - first(:css, "a").click + find('.icon-expand').click end expect(page).to have_css(".comment", count: 3) @@ -667,7 +667,7 @@ feature 'Commenting legislation questions' do scenario "Reply on a multiple annotation thread and display it in the single annotation thread" do within("#annotation-link") do - first(:css, "a").click + find('.icon-expand').click end comment = annotation2.comments.first