Fixed test for updated form

This commit is contained in:
Raúl Fuentes
2018-02-16 12:33:09 +01:00
parent df899cde6e
commit ee19c2fef0

View File

@@ -137,27 +137,28 @@ feature 'Admin budget investments' do
expect(page).to have_link("Plant trees")
select "Central Park", from: "heading_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).not_to have_link("Realocate visitors")
expect(page).not_to have_link("Change name")
expect(page).to have_link("Plant trees")
click_button I18n.t("admin.budget_investments.index.buttons.filter")
select "All headings", from: "heading_id"
click_button 'Filter'
expect(page).to have_link("Realocate visitors")
expect(page).to have_link("Change name")
expect(page).to have_link("Plant trees")
select "Streets: Main Avenue", from: "heading_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_link("Realocate visitors")
expect(page).not_to have_link("Change name")
expect(page).not_to have_link("Plant trees")
select "Streets: Mercy Street", from: "heading_id"
click_button 'Filter'
expect(page).not_to have_link("Realocate visitors")
expect(page).to have_link("Change name")
@@ -176,21 +177,21 @@ feature 'Admin budget investments' do
expect(page).to have_link("Destroy the city")
select "Admin 1", from: "administrator_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There is 1 investment')
expect(page).not_to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "All administrators", from: "administrator_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There are 2 investments')
expect(page).to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "Admin 1", from: "administrator_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There is 1 investment')
expect(page).not_to have_link("Destroy the city")
@@ -211,21 +212,21 @@ feature 'Admin budget investments' do
expect(page).to have_link("Destroy the city")
select "Valuator 1", from: "valuator_or_group_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There is 1 investment')
expect(page).not_to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "All valuators", from: "valuator_or_group_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There are 2 investments')
expect(page).to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "Valuator 1", from: "valuator_or_group_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There is 1 investment')
expect(page).not_to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
@@ -247,21 +248,21 @@ feature 'Admin budget investments' do
expect(page).to have_link("Build a theatre")
select "Health", from: "valuator_or_group_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There is 1 investment')
expect(page).to have_link("Build a hospital")
expect(page).not_to have_link("Build a theatre")
select "All valuators", from: "valuator_or_group_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There are 2 investments')
expect(page).to have_link("Build a hospital")
expect(page).to have_link("Build a theatre")
select "Culture", from: "valuator_or_group_id"
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There is 1 investment')
expect(page).to have_link("Build a theatre")
@@ -432,7 +433,7 @@ feature 'Admin budget investments' do
click_link 'Advanced filters'
fill_in "max_per_heading", with: 5
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('There are 15 investments')
expect(page).not_to have_link("Park with 2 supports")
@@ -470,7 +471,7 @@ feature 'Admin budget investments' do
expect(page).to have_content('Some other investment')
fill_in 'title_or_id', with: 'Some investment'
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('Some investment')
expect(page).not_to have_content('Some other investment')
@@ -483,7 +484,7 @@ feature 'Admin budget investments' do
expect(page).to have_content('Some other investment')
fill_in 'title_or_id', with: 999999
click_button I18n.t("admin.budget_investments.index.buttons.filter")
click_button 'Filter'
expect(page).to have_content('Some other investment')
expect(page).not_to have_content('Some investment')
@@ -864,8 +865,8 @@ feature 'Admin budget investments' do
expect(page).to have_content(winner_bi.title)
click_link 'Advanced filters'
within('#advanced_filters') { find(:css, "#advanced_filters_[value='feasible']").set(true) }
click_button I18n.t("admin.budget_investments.index.buttons.filter")
within('#advanced_filters') { find(:css, "#advanced_filters_feasible").set(true) }
click_button 'Filter'
expect(page).not_to have_content(unfeasible_bi.title)
expect(page).not_to have_content(feasible_bi.title)
@@ -873,9 +874,9 @@ feature 'Admin budget investments' do
expect(page).to have_content(selected_bi.title)
expect(page).to have_content(winner_bi.title)
within('#advanced_filters') { find(:css, "#advanced_filters_[value='selected']").set(true) }
within('#advanced_filters') { find(:css, "#advanced_filters_[value='feasible']").set(false) }
click_button I18n.t("admin.budget_investments.index.buttons.filter")
within('#advanced_filters') { find(:css, "#advanced_filters_selected").set(true) }
within('#advanced_filters') { find(:css, "#advanced_filters_feasible").set(false) }
click_button 'Filter'
expect(page).not_to have_content(unfeasible_bi.title)
expect(page).not_to have_content(feasible_bi.title)
@@ -895,8 +896,8 @@ feature 'Admin budget investments' do
visit admin_budget_budget_investments_path(budget)
click_link 'Advanced filters'
within('#advanced_filters') { find(:css, "#advanced_filters_[value='undecided']").set(true) }
click_button I18n.t("admin.budget_investments.index.buttons.filter")
within('#advanced_filters') { find(:css, "#advanced_filters_undecided").set(true) }
click_button 'Filter'
expect(page).to have_content(undecided_bi.title)
expect(page).not_to have_content(winner_bi.title)
@@ -905,8 +906,8 @@ feature 'Admin budget investments' do
expect(page).not_to have_content(unfeasible_bi.title)
expect(page).not_to have_content(feasible_vf_bi.title)
within('#advanced_filters') { find(:css, "#advanced_filters_[value='unfeasible']").set(true) }
click_button I18n.t("admin.budget_investments.index.buttons.filter")
within('#advanced_filters') { find(:css, "#advanced_filters_unfeasible").set(true) }
click_button 'Filter'
expect(page).to have_content(undecided_bi.title)
expect(page).to have_content(unfeasible_bi.title)
@@ -949,8 +950,8 @@ feature 'Admin budget investments' do
end
click_link 'Advanced filters'
within('#advanced_filters') { find(:css, "#advanced_filters_[value='selected']").set(true) }
click_button I18n.t("admin.budget_investments.index.buttons.filter")
within('#advanced_filters') { find(:css, "#advanced_filters_selected").set(true) }
click_button 'Filter'
within("#budget_investment_#{feasible_vf_bi.id}") do
expect(page).not_to have_link('Select')
@@ -961,13 +962,10 @@ feature 'Admin budget investments' do
scenario "Unselecting an investment", :js do
visit admin_budget_budget_investments_path(budget)
click_link 'Advanced filters'
within('#advanced_filters') { find(:css, "#advanced_filters_[value='selected']").set(true) }
<<<<<<< HEAD
click_button 'Filter'
=======
click_button I18n.t("admin.budget_investments.index.buttons.filter")
>>>>>>> 901dbf6... Fixed test for the refactored form
within('#advanced_filters') { find(:css, "#advanced_filters_selected").set(true) }
click_button 'Filter'
expect(page).to have_content('There are 2 investments')