From 5eb5f02cbe252749ac07794b9795dc0def4a5c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Fri, 25 Jan 2019 11:50:57 +0100 Subject: [PATCH] Fix budget investment specs After adding investment translatable fields to forms, they will be generated with nested translations names and ids so we can no longer use standard id locator. Using input label text to fill in fields works with both types of forms. --- .../features/admin/budget_investments_spec.rb | 6 ++--- spec/features/budgets/investments_spec.rb | 18 +++++++------- spec/features/emails_spec.rb | 4 ++-- .../management/budget_investments_spec.rb | 4 ++-- spec/features/tags/budget_investments_spec.rb | 24 +++++++++---------- spec/shared/features/mappable.rb | 4 ++-- spec/shared/features/nested_documentable.rb | 4 ++-- spec/shared/features/nested_imageable.rb | 4 ++-- 8 files changed, 34 insertions(+), 34 deletions(-) diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 829adbff1..6b40587a2 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -1102,8 +1102,8 @@ describe "Admin budget investments" do visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment) click_link "Edit" - fill_in "budget_investment_title", with: "Potatoes" - fill_in "budget_investment_description", with: "Carrots" + fill_in "Title", with: "Potatoes" + fill_in "Description", with: "Carrots" select "#{budget_investment.group.name}: Barbate", from: "budget_investment[heading_id]" uncheck "budget_investment_incompatible" check "budget_investment_selected" @@ -1365,7 +1365,7 @@ describe "Admin budget investments" do visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment) click_link "Edit" - fill_in "budget_investment_title", with: "" + fill_in "Title", with: "" click_button "Update" diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 50c0e4d07..eed55a159 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -860,9 +860,9 @@ describe "Budget Investments" do visit new_budget_investment_path(budget) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "I am a bot" + fill_in "Title", with: "I am a bot" fill_in "budget_investment_subtitle", with: "This is the honeypot" - fill_in "budget_investment_description", with: "This is the description" + fill_in "Description", with: "This is the description" check "budget_investment_terms_of_service" click_button "Create Investment" @@ -879,8 +879,8 @@ describe "Budget Investments" do visit new_budget_investment_path(budget) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "I am a bot" - fill_in "budget_investment_description", with: "This is the description" + fill_in "Title", with: "I am a bot" + fill_in "Description", with: "This is the description" check "budget_investment_terms_of_service" click_button "Create Investment" @@ -895,8 +895,8 @@ describe "Budget Investments" do visit new_budget_investment_path(budget) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a skyscraper" - fill_in "budget_investment_description", with: "I want to live in a high tower over the clouds" + fill_in "Title", with: "Build a skyscraper" + fill_in "Description", with: "I want to live in a high tower over the clouds" fill_in "budget_investment_location", with: "City center" fill_in "budget_investment_organization_name", with: "T.I.A." fill_in "budget_investment_tag_list", with: "Towers" @@ -936,7 +936,7 @@ describe "Budget Investments" do create(factory, title: "This is the last #{factory}", budget: budget) visit new_budget_investment_path(budget) - fill_in "budget_investment_title", with: "search" + fill_in "Title", with: "search" within("div#js-suggest") do expect(page).to have_content "You are seeing 5 of 6 investments containing the term 'search'" @@ -951,7 +951,7 @@ describe "Budget Investments" do end visit new_budget_investment_path(budget) - fill_in "budget_investment_title", with: "item" + fill_in "Title", with: "item" within("div#js-suggest") do expect(page).not_to have_content "You are seeing" @@ -966,7 +966,7 @@ describe "Budget Investments" do end visit new_budget_investment_path(other_budget) - fill_in "budget_investment_title", with: "search" + fill_in "Title", with: "search" within("div#js-suggest") do expect(page).not_to have_content "You are seeing" diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index ce98a6bb2..975a3c536 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -365,8 +365,8 @@ describe "Emails" do visit new_budget_investment_path(budget_id: budget.id) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a hospital" - fill_in "budget_investment_description", with: "We have lots of people that require medical attention" + fill_in "Title", with: "Build a hospital" + fill_in "Description", with: "We have lots of people that require medical attention" check "budget_investment_terms_of_service" click_button "Create Investment" diff --git a/spec/features/management/budget_investments_spec.rb b/spec/features/management/budget_investments_spec.rb index 14297ab41..9e53da5a3 100644 --- a/spec/features/management/budget_investments_spec.rb +++ b/spec/features/management/budget_investments_spec.rb @@ -66,8 +66,8 @@ describe "Budget Investments" do end select "Health", from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a park in my neighborhood" - fill_in "budget_investment_description", with: "There is no parks here..." + fill_in "Title", with: "Build a park in my neighborhood" + fill_in "Description", with: "There is no parks here..." fill_in "budget_investment_location", with: "City center" fill_in "budget_investment_organization_name", with: "T.I.A." fill_in "budget_investment_tag_list", with: "green" diff --git a/spec/features/tags/budget_investments_spec.rb b/spec/features/tags/budget_investments_spec.rb index a0fb60339..836e4d4fd 100644 --- a/spec/features/tags/budget_investments_spec.rb +++ b/spec/features/tags/budget_investments_spec.rb @@ -67,8 +67,8 @@ describe "Tags" do visit new_budget_investment_path(budget_id: budget.id) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a skyscraper" - fill_in "budget_investment_description", with: "I want to live in a high tower over the clouds" + fill_in "Title", with: "Build a skyscraper" + fill_in "Description", with: "I want to live in a high tower over the clouds" check "budget_investment_terms_of_service" fill_in "budget_investment_tag_list", with: "#{tag_medio_ambiente.name}, #{tag_economia.name}" @@ -86,8 +86,8 @@ describe "Tags" do visit new_budget_investment_path(budget_id: budget.id) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a skyscraper" - fill_in_ckeditor "budget_investment_description", with: "If I had a gym near my place I could go do Zumba" + fill_in "Title", with: "Build a skyscraper" + fill_in_ckeditor "Description", with: "If I had a gym near my place I could go do Zumba" check "budget_investment_terms_of_service" find(".js-add-tag-link", text: tag_economia.name).click @@ -111,8 +111,8 @@ describe "Tags" do click_link "Create a budget investment" select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a skyscraper" - fill_in_ckeditor "budget_investment_description", with: "If I had a gym near my place I could go do Zumba" + fill_in "Title", with: "Build a skyscraper" + fill_in_ckeditor "Description", with: "If I had a gym near my place I could go do Zumba" check "budget_investment_terms_of_service" find(".js-add-tag-link", text: "Education").click @@ -136,8 +136,8 @@ describe "Tags" do click_link "Create a budget investment" select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a skyscraper" - fill_in_ckeditor "budget_investment_description", with: "If I had a gym near my place I could go do Zumba" + fill_in "Title", with: "Build a skyscraper" + fill_in_ckeditor "Description", with: "If I had a gym near my place I could go do Zumba" check "budget_investment_terms_of_service" find(".js-add-tag-link", text: "Education").click @@ -157,8 +157,8 @@ describe "Tags" do visit new_budget_investment_path(budget_id: budget.id) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a skyscraper" - fill_in "budget_investment_description", with: "I want to live in a high tower over the clouds" + fill_in "Title", with: "Build a skyscraper" + fill_in "Description", with: "I want to live in a high tower over the clouds" check "budget_investment_terms_of_service" fill_in "budget_investment_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" @@ -175,8 +175,8 @@ describe "Tags" do visit new_budget_investment_path(budget_id: budget.id) select heading.name, from: "budget_investment_heading_id" - fill_in "budget_investment_title", with: "Build a skyscraper" - fill_in "budget_investment_description", with: "I want to live in a high tower over the clouds" + fill_in "Title", with: "Build a skyscraper" + fill_in "Description", with: "I want to live in a high tower over the clouds" check "budget_investment_terms_of_service" fill_in "budget_investment_tag_list", with: "user_id=1, &a=3, " diff --git a/spec/shared/features/mappable.rb b/spec/shared/features/mappable.rb index eb426bc34..e9fff3662 100644 --- a/spec/shared/features/mappable.rb +++ b/spec/shared/features/mappable.rb @@ -271,8 +271,8 @@ end def fill_in_budget_investment_form page.select mappable.heading.name_scoped_by_group, from: :budget_investment_heading_id - fill_in :budget_investment_title, with: "Budget investment title" - fill_in_ckeditor "budget_investment_description", with: "Budget investment description" + fill_in "Title", with: "Budget investment title" + fill_in_ckeditor "Description", with: "Budget investment description" check :budget_investment_terms_of_service end diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb index 9111d085b..a70e29d5f 100644 --- a/spec/shared/features/nested_documentable.rb +++ b/spec/shared/features/nested_documentable.rb @@ -375,7 +375,7 @@ end def documentable_fill_new_valid_budget_investment page.select documentable.heading.name_scoped_by_group, from: :budget_investment_heading_id - fill_in :budget_investment_title, with: "Budget investment title" - fill_in_ckeditor "budget_investment_description", with: "Budget investment description" + fill_in "Title", with: "Budget investment title" + fill_in_ckeditor "Description", with: "Budget investment description" check :budget_investment_terms_of_service end diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/features/nested_imageable.rb index 41819fba6..8f0493c4c 100644 --- a/spec/shared/features/nested_imageable.rb +++ b/spec/shared/features/nested_imageable.rb @@ -296,8 +296,8 @@ end def imageable_fill_new_valid_budget_investment page.select imageable.heading.name_scoped_by_group, from: :budget_investment_heading_id - fill_in :budget_investment_title, with: "Budget investment title" - fill_in_ckeditor "budget_investment_description", with: "Budget investment description" + fill_in "Title", with: "Budget investment title" + fill_in_ckeditor "Description", with: "Budget investment description" check :budget_investment_terms_of_service end