Fix proposal specs
After adding proposal 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.
This commit is contained in:
committed by
voodoorai2000
parent
dd310f7507
commit
78c2f54c5d
@@ -21,9 +21,9 @@ describe "Proposals" do
|
||||
expect(page).to have_content user.document_number.to_s
|
||||
end
|
||||
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yRYFKcMa_Ek"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
|
||||
@@ -238,9 +238,9 @@ describe "Proposals" do
|
||||
|
||||
visit new_proposal_path
|
||||
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
fill_in "proposal_tag_list", with: "Refugees, Solidarity"
|
||||
@@ -272,10 +272,10 @@ describe "Proposals" do
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "I am a bot"
|
||||
fill_in "Proposal title", with: "I am a bot"
|
||||
fill_in "proposal_subtitle", with: "This is the honeypot field"
|
||||
fill_in "proposal_summary", with: "This is the summary"
|
||||
fill_in "proposal_description", with: "This is the description"
|
||||
fill_in "Proposal summary", with: "This is the summary"
|
||||
fill_in "Proposal text", with: "This is the description"
|
||||
fill_in "proposal_responsible_name", with: "Some other robot"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
@@ -293,9 +293,9 @@ describe "Proposals" do
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "I am a bot"
|
||||
fill_in "proposal_summary", with: "This is the summary"
|
||||
fill_in "proposal_description", with: "This is the description"
|
||||
fill_in "Proposal title", with: "I am a bot"
|
||||
fill_in "Proposal summary", with: "This is the summary"
|
||||
fill_in "Proposal text", with: "This is the description"
|
||||
fill_in "proposal_responsible_name", with: "Some other robot"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
@@ -311,9 +311,9 @@ describe "Proposals" do
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
@@ -334,9 +334,9 @@ describe "Proposals" do
|
||||
visit new_proposal_path
|
||||
expect(page).not_to have_selector("#proposal_responsible_name")
|
||||
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
click_button "Create proposal"
|
||||
@@ -362,9 +362,9 @@ describe "Proposals" do
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "Testing an attack"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "<p>This is <script>alert('an attack');</script></p>"
|
||||
fill_in "Proposal title", with: "Testing an attack"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "<p>This is <script>alert('an attack');</script></p>"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
@@ -385,9 +385,9 @@ describe "Proposals" do
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "Testing auto link"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "<p>This is a link www.example.org</p>"
|
||||
fill_in "Proposal title", with: "Testing auto link"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "<p>This is a link www.example.org</p>"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
@@ -407,9 +407,9 @@ describe "Proposals" do
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "Testing auto link"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: js_injection_string
|
||||
fill_in "Proposal title", with: "Testing auto link"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: js_injection_string
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
@@ -465,9 +465,9 @@ describe "Proposals" do
|
||||
|
||||
visit new_proposal_path
|
||||
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
@@ -622,9 +622,9 @@ describe "Proposals" do
|
||||
visit edit_proposal_path(proposal)
|
||||
expect(page).to have_current_path(edit_proposal_path(proposal))
|
||||
|
||||
fill_in "proposal_title", with: "End child poverty"
|
||||
fill_in "proposal_summary", with: "Basically..."
|
||||
fill_in "proposal_description", with: "Let's do something to end child poverty"
|
||||
fill_in "Proposal title", with: "End child poverty"
|
||||
fill_in "Proposal summary", with: "Basically..."
|
||||
fill_in "Proposal text", with: "Let's do something to end child poverty"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
|
||||
click_button "Save changes"
|
||||
@@ -640,7 +640,7 @@ describe "Proposals" do
|
||||
login_as(proposal.author)
|
||||
|
||||
visit edit_proposal_path(proposal)
|
||||
fill_in "proposal_title", with: ""
|
||||
fill_in "Proposal title", with: ""
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content error_message
|
||||
@@ -1719,7 +1719,7 @@ describe "Proposals" do
|
||||
create(:proposal, title: "Seventh proposal, has search term")
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "search"
|
||||
fill_in "Proposal title", with: "search"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
within("div#js-suggest") do
|
||||
@@ -1735,7 +1735,7 @@ describe "Proposals" do
|
||||
create(:proposal, title: "Second proposal").update_column(:confidence_score, 8)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "debate"
|
||||
fill_in "Proposal title", with: "debate"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
within("div#js-suggest") do
|
||||
@@ -1913,9 +1913,9 @@ describe "Successful proposals" do
|
||||
|
||||
expect(current_path).to eq(new_proposal_path)
|
||||
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
|
||||
fill_in "proposal_tag_list", with: "Refugees, Solidarity"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
@@ -69,9 +69,9 @@ describe "Tags" do
|
||||
login_as(user)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
fill_in "proposal_tag_list", with: "Economía, Hacienda"
|
||||
check "proposal_terms_of_service"
|
||||
@@ -95,9 +95,9 @@ describe "Tags" do
|
||||
|
||||
visit new_proposal_path
|
||||
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in_ckeditor "proposal_description", with: "A description with enough characters"
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in_ckeditor "Proposal text", with: "A description with enough characters"
|
||||
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=Ae6gQmhaMn4"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
@@ -120,8 +120,8 @@ describe "Tags" do
|
||||
login_as(user)
|
||||
|
||||
visit new_proposal_path
|
||||
fill_in "proposal_title", with: "Title"
|
||||
fill_in "proposal_description", with: "Description"
|
||||
fill_in "Proposal title", with: "Title"
|
||||
fill_in "Proposal text", with: "Description"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
fill_in "proposal_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
|
||||
@@ -138,9 +138,9 @@ describe "Tags" do
|
||||
|
||||
visit new_proposal_path
|
||||
|
||||
fill_in "proposal_title", with: "A test of dangerous strings"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "proposal_description", with: "A description suitable for this test"
|
||||
fill_in "Proposal title", with: "A test of dangerous strings"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "A description suitable for this test"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
do_login_for mappable.author
|
||||
|
||||
visit send(mappable_edit_path, id: mappable.id)
|
||||
fill_in "#{mappable_factory_name}_title", with: "New title"
|
||||
fill_in "#{mappable_factory_name.camelize} title", with: "New title"
|
||||
click_on("Save changes")
|
||||
mappable.reload
|
||||
|
||||
@@ -172,7 +172,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
do_login_for mappable.author
|
||||
|
||||
visit send(mappable_edit_path, id: mappable.id)
|
||||
fill_in "#{mappable_factory_name}_title", with: "New title"
|
||||
fill_in "#{mappable_factory_name.camelize} title", with: "New title"
|
||||
click_on("Save changes")
|
||||
|
||||
expect(page).not_to have_css(".map_location")
|
||||
@@ -249,8 +249,8 @@ def do_login_for(user)
|
||||
end
|
||||
|
||||
def fill_in_proposal_form
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
end
|
||||
|
||||
def submit_proposal_form
|
||||
|
||||
@@ -363,8 +363,8 @@ def expect_document_has_cached_attachment(index, extension)
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_proposal
|
||||
fill_in :proposal_title, with: "Proposal title #{rand(9999)}"
|
||||
fill_in :proposal_summary, with: "Proposal summary"
|
||||
fill_in "Proposal title", with: "Proposal title #{rand(9999)}"
|
||||
fill_in "Proposal summary", with: "Proposal summary"
|
||||
check :proposal_terms_of_service
|
||||
end
|
||||
|
||||
|
||||
@@ -289,8 +289,8 @@ def imageable_attach_new_file(_imageable_factory_name, path, success = true)
|
||||
end
|
||||
|
||||
def imageable_fill_new_valid_proposal
|
||||
fill_in :proposal_title, with: "Proposal title"
|
||||
fill_in :proposal_summary, with: "Proposal summary"
|
||||
fill_in "Proposal title", with: "Proposal title"
|
||||
fill_in "Proposal summary", with: "Proposal summary"
|
||||
check :proposal_terms_of_service
|
||||
end
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ module CommonActions
|
||||
end
|
||||
|
||||
def fill_in_proposal
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_summary", with: "In summary what we want is..."
|
||||
fill_in "proposal_description", with: "This is very important because..."
|
||||
fill_in "Proposal title", with: "Help refugees"
|
||||
fill_in "Proposal summary", with: "In summary, what we want is..."
|
||||
fill_in "Proposal text", with: "This is very important because..."
|
||||
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
|
||||
fill_in "proposal_responsible_name", with: "Isabel Garcia"
|
||||
check "proposal_terms_of_service"
|
||||
|
||||
Reference in New Issue
Block a user