Use human labels to fill in proposal form in tests

This way we make sure the label is correctly associated with a field.
This commit is contained in:
Javi Martín
2021-04-10 19:41:25 +02:00
parent 386771f2df
commit 7b15cc290d
4 changed files with 49 additions and 48 deletions

View File

@@ -36,9 +36,9 @@ module CommonActions
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "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"
fill_in "External video URL", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
end
def set_officing_booth(booth = nil)

View File

@@ -19,8 +19,8 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "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"
fill_in "External video URL", with: "https://www.youtube.com/watch?v=yRYFKcMa_Ek"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"

View File

@@ -364,10 +364,10 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "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"
check "proposal_terms_of_service"
fill_in "External video URL", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
fill_in "Tags", with: "Refugees, Solidarity"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -396,11 +396,11 @@ describe "Proposals" do
visit new_proposal_path
fill_in "Proposal title", with: "I am a bot"
fill_in "proposal_subtitle", with: "This is the honeypot field"
fill_in "If you are human, ignore this field", with: "This is the honeypot field"
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"
fill_in "Full name of the person submitting the proposal", with: "Some other robot"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -419,8 +419,8 @@ describe "Proposals" do
fill_in "Proposal title", with: "I am a bot"
fill_in "Proposal summary", with: "This is the summary"
fill_in_ckeditor "Proposal text", with: "This is the description"
fill_in "proposal_responsible_name", with: "Some other robot"
check "proposal_terms_of_service"
fill_in "Full name of the person submitting the proposal", with: "Some other robot"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -437,8 +437,8 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "Proposal text", with: "This is very important because..."
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -454,12 +454,13 @@ describe "Proposals" do
login_as(author)
visit new_proposal_path
expect(page).not_to have_selector("#proposal_responsible_name")
expect(page).not_to have_field "Full name of the person submitting the proposal"
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "Proposal text", with: "This is very important because..."
check "proposal_terms_of_service"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
@@ -487,8 +488,8 @@ describe "Proposals" do
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"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -510,8 +511,8 @@ describe "Proposals" do
fill_in "Proposal title", with: "Testing auto link"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "Proposal text", with: "This is a link www.example.org"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -532,8 +533,8 @@ describe "Proposals" do
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"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -588,9 +589,9 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "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"
fill_in "External video URL", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
select("California", from: "proposal_geozone_id")
click_button "Create proposal"
@@ -755,7 +756,7 @@ describe "Proposals" do
fill_in "Proposal title", with: "End child poverty"
fill_in "Proposal summary", with: "Basically..."
fill_in_ckeditor "Proposal text", with: "Let's do something to end child poverty"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
click_button "Save changes"
@@ -1413,7 +1414,7 @@ describe "Proposals" do
login_as(create(:user))
visit new_proposal_path
fill_in "Proposal title", with: "search"
check "proposal_terms_of_service"
check "I agree to the Privacy Policy and the Terms and conditions of use"
within("div.js-suggest") do
expect(page).to have_content "You are seeing 5 of 6 proposals containing the term 'search'"
@@ -1427,7 +1428,7 @@ describe "Proposals" do
login_as(create(:user))
visit new_proposal_path
fill_in "Proposal title", with: "debate"
check "proposal_terms_of_service"
check "I agree to the Privacy Policy and the Terms and conditions of use"
within("div.js-suggest") do
expect(page).not_to have_content "You are seeing"
@@ -1617,9 +1618,9 @@ describe "Successful proposals" do
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary what we want is..."
fill_in_ckeditor "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"
fill_in "External video URL", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "Tags", with: "Refugees, Solidarity"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -1640,9 +1641,9 @@ describe "Successful proposals" do
visit new_proposal_path
fill_in "Proposal title", with: "A title for a proposal related with SDG related content"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
click_sdg_goal(1)
check "proposal_terms_of_service"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"

View File

@@ -67,9 +67,9 @@ describe "Tags" do
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "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"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
fill_in "Tags", with: "Economía, Hacienda"
check "I agree to the Privacy Policy and the Terms and conditions of use"
click_button "Create proposal"
@@ -91,9 +91,9 @@ describe "Tags" do
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"
fill_in "External video URL", with: "https://www.youtube.com/watch?v=Ae6gQmhaMn4"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
find(".js-add-tag-link", text: "Education").click
click_button "Create proposal"
@@ -115,9 +115,9 @@ describe "Tags" do
visit new_proposal_path
fill_in "Proposal title", with: "Title"
fill_in_ckeditor "Proposal text", with: "Description"
check "proposal_terms_of_service"
check "I agree to the Privacy Policy and the Terms and conditions of use"
fill_in "proposal_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
fill_in "Tags", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
click_button "Create proposal"
@@ -134,10 +134,10 @@ describe "Tags" do
fill_in "Proposal title", with: "A test of dangerous strings"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "Proposal text", with: "A description suitable for this test"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
check "I agree to the Privacy Policy and the Terms and conditions of use"
fill_in "proposal_tag_list", with: "user_id=1, &a=3, <script>alert('hey');</script>"
fill_in "Tags", with: "user_id=1, &a=3, <script>alert('hey');</script>"
click_button "Create proposal"
@@ -159,7 +159,7 @@ describe "Tags" do
expect(page).to have_selector("input[value='Economía']")
fill_in "proposal_tag_list", with: "Economía, Hacienda"
fill_in "Tags", with: "Economía, Hacienda"
click_button "Save changes"
expect(page).to have_content "Proposal updated successfully."
@@ -175,7 +175,7 @@ describe "Tags" do
login_as(proposal.author)
visit edit_proposal_path(proposal)
fill_in "proposal_tag_list", with: ""
fill_in "Tags", with: ""
click_button "Save changes"
expect(page).to have_content "Proposal updated successfully."