Use JavaScripts in tests using CKEditor

We were filling in textareas, so we were only testing how the
application behaves for about 1%-2% of our users.
This commit is contained in:
Javi Martín
2021-03-29 13:49:09 +02:00
parent b2bc4d19f5
commit 287c488734
17 changed files with 75 additions and 74 deletions

View File

@@ -35,7 +35,7 @@ module CommonActions
def fill_in_proposal def fill_in_proposal
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..." 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_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service" check "proposal_terms_of_service"

View File

@@ -21,6 +21,6 @@ module Emails
fill_in "Subject", with: (options[:subject] || "This is a different subject") fill_in "Subject", with: (options[:subject] || "This is a different subject")
fill_in "E-mail address that will appear as sending the newsletter", fill_in "E-mail address that will appear as sending the newsletter",
with: (options[:from] || "no-reply@consul.dev") with: (options[:from] || "no-reply@consul.dev")
fill_in "Email content", with: (options[:body] || "This is a different body") fill_in_ckeditor "Email content", with: (options[:body] || "This is a different body")
end end
end end

View File

@@ -1034,7 +1034,7 @@ describe "Admin budget investments", :admin do
end end
context "Edit" do context "Edit" do
scenario "Change title, incompatible, description or heading" do scenario "Change title, incompatible, description or heading", :js do
budget_investment = create(:budget_investment, :incompatible) budget_investment = create(:budget_investment, :incompatible)
create(:budget_heading, group: budget_investment.group, name: "Barbate") create(:budget_heading, group: budget_investment.group, name: "Barbate")
@@ -1042,7 +1042,7 @@ describe "Admin budget investments", :admin do
click_link "Edit" click_link "Edit"
fill_in "Title", with: "Potatoes" fill_in "Title", with: "Potatoes"
fill_in "Description", with: "Carrots" fill_in_ckeditor "Description", with: "Carrots"
select "#{budget_investment.group.name}: Barbate", from: "budget_investment[heading_id]" select "#{budget_investment.group.name}: Barbate", from: "budget_investment[heading_id]"
uncheck "budget_investment_incompatible" uncheck "budget_investment_incompatible"
check "budget_investment_selected" check "budget_investment_selected"

View File

@@ -46,9 +46,9 @@ describe "Admin dashboard actions", :admin do
click_link "Create resource or action" click_link "Create resource or action"
end end
scenario "Creates a new action" do scenario "Creates a new action", :js do
fill_in "Title", with: action.title fill_in "Title", with: action.title
fill_in "Description", with: action.description fill_in_ckeditor "Description", with: action.description
click_button "Save" click_button "Save"

View File

@@ -58,7 +58,7 @@ describe "Admin newsletter emails", :admin do
end end
end end
scenario "Create" do scenario "Create", :js do
visit admin_newsletters_path visit admin_newsletters_path
click_link "New newsletter" click_link "New newsletter"
@@ -76,7 +76,7 @@ describe "Admin newsletter emails", :admin do
expect(page).to have_content "This is a body" expect(page).to have_content "This is a body"
end end
scenario "Update" do scenario "Update", :js do
newsletter = create(:newsletter) newsletter = create(:newsletter)
visit admin_newsletters_path visit admin_newsletters_path
@@ -161,7 +161,7 @@ describe "Admin newsletter emails", :admin do
end end
end end
scenario "Select list of users to send newsletter" do scenario "Select list of users to send newsletter", :js do
UserSegments::SEGMENTS.each do |user_segment| UserSegments::SEGMENTS.each do |user_segment|
visit new_admin_newsletter_path visit new_admin_newsletter_path

View File

@@ -1,14 +1,14 @@
require "rails_helper" require "rails_helper"
describe "Answers", :admin do describe "Answers", :admin do
scenario "Create" do scenario "Create", :js do
question = create(:poll_question) question = create(:poll_question)
visit admin_question_path(question) visit admin_question_path(question)
click_link "Add answer" click_link "Add answer"
fill_in "Answer", with: "The answer is always 42" fill_in "Answer", with: "The answer is always 42"
fill_in "Description", with: "The Hitchhiker's Guide To The Universe" fill_in_ckeditor "Description", with: "The Hitchhiker's Guide To The Universe"
click_button "Save" click_button "Save"
@@ -16,7 +16,7 @@ describe "Answers", :admin do
expect(page).to have_content "The Hitchhiker's Guide To The Universe" expect(page).to have_content "The Hitchhiker's Guide To The Universe"
end end
scenario "Create second answer and place after the first one" do scenario "Create second answer and place after the first one", :js do
question = create(:poll_question) question = create(:poll_question)
create(:poll_question_answer, title: "First", question: question, given_order: 1) create(:poll_question_answer, title: "First", question: question, given_order: 1)
@@ -24,7 +24,7 @@ describe "Answers", :admin do
click_link "Add answer" click_link "Add answer"
fill_in "Answer", with: "Second" fill_in "Answer", with: "Second"
fill_in "Description", with: "Description" fill_in_ckeditor "Description", with: "Description"
click_button "Save" click_button "Save"

View File

@@ -29,10 +29,11 @@ describe "Admin custom pages", :admin do
end end
context "Create" do context "Create" do
scenario "Valid custom page" do scenario "Valid custom page", :js do
visit admin_root_path visit admin_root_path
within("#side_menu") do within("#side_menu") do
click_link "Site content"
click_link "Custom pages" click_link "Custom pages"
end end
@@ -44,7 +45,7 @@ describe "Admin custom pages", :admin do
fill_in "Title", with: "An example custom page" fill_in "Title", with: "An example custom page"
fill_in "Subtitle", with: "Page subtitle" fill_in "Subtitle", with: "Page subtitle"
fill_in "site_customization_page_slug", with: "example-page" fill_in "site_customization_page_slug", with: "example-page"
fill_in "Content", with: "This page is about..." fill_in_ckeditor "Content", with: "This page is about..."
click_button "Create Custom page" click_button "Create Custom page"

View File

@@ -518,7 +518,7 @@ describe "Budget Investments" do
expect(page).to have_current_path(budget_investments_path(budget)) expect(page).to have_current_path(budget_investments_path(budget))
end end
scenario "Create budget investment too fast" do scenario "Create budget investment too fast", :js do
allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY) allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY)
login_as(author) login_as(author)
@@ -526,7 +526,7 @@ describe "Budget Investments" do
select heading.name, from: "budget_investment_heading_id" select heading.name, from: "budget_investment_heading_id"
fill_in "Title", with: "I am a bot" fill_in "Title", with: "I am a bot"
fill_in "Description", with: "This is the description" fill_in_ckeditor "Description", with: "This is the description"
check "budget_investment_terms_of_service" check "budget_investment_terms_of_service"
click_button "Create Investment" click_button "Create Investment"
@@ -535,14 +535,14 @@ describe "Budget Investments" do
expect(page).to have_current_path(new_budget_investment_path(budget)) expect(page).to have_current_path(new_budget_investment_path(budget))
end end
scenario "Create" do scenario "Create", :js do
login_as(author) login_as(author)
visit new_budget_investment_path(budget) visit new_budget_investment_path(budget)
select heading.name, from: "budget_investment_heading_id" select heading.name, from: "budget_investment_heading_id"
fill_in "Title", with: "Build a skyscraper" fill_in "Title", with: "Build a skyscraper"
fill_in "Description", with: "I want to live in a high tower over the clouds" fill_in_ckeditor "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_location", with: "City center"
fill_in "budget_investment_organization_name", with: "T.I.A." fill_in "budget_investment_organization_name", with: "T.I.A."
fill_in "budget_investment_tag_list", with: "Towers" fill_in "budget_investment_tag_list", with: "Towers"

View File

@@ -201,13 +201,13 @@ describe "Debates" do
expect(page).to have_content("-6 votes") expect(page).to have_content("-6 votes")
end end
scenario "Create" do scenario "Create", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "A title for a debate" fill_in "Debate title", with: "A title for a debate"
fill_in "Initial debate text", with: "This is very important because..." fill_in_ckeditor "Initial debate text", with: "This is very important because..."
check "debate_terms_of_service" check "debate_terms_of_service"
click_button "Start a debate" click_button "Start a debate"
@@ -236,7 +236,7 @@ describe "Debates" do
expect(page).to have_current_path(debates_path) expect(page).to have_current_path(debates_path)
end end
scenario "Create debate too fast" do scenario "Create debate too fast", :js do
allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY) allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY)
author = create(:user) author = create(:user)
@@ -244,7 +244,7 @@ describe "Debates" do
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "I am a bot" fill_in "Debate title", with: "I am a bot"
fill_in "Initial debate text", with: "This is the description" fill_in_ckeditor "Initial debate text", with: "This is the description"
check "debate_terms_of_service" check "debate_terms_of_service"
click_button "Start a debate" click_button "Start a debate"
@@ -281,13 +281,13 @@ describe "Debates" do
expect(page.html).not_to include "<p>This is" expect(page.html).not_to include "<p>This is"
end end
scenario "Autolinking is applied to description" do scenario "Autolinking is applied to description", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "Testing auto link" fill_in "Debate title", with: "Testing auto link"
fill_in "Initial debate text", with: "<p>This is a link www.example.org</p>" fill_in_ckeditor "Initial debate text", with: "This is a link www.example.org"
check "debate_terms_of_service" check "debate_terms_of_service"
click_button "Start a debate" click_button "Start a debate"
@@ -347,7 +347,7 @@ describe "Debates" do
expect(page).to have_content "You do not have permission to" expect(page).to have_content "You do not have permission to"
end end
scenario "Update should be posible for the author of an editable debate" do scenario "Update should be posible for the author of an editable debate", :js do
debate = create(:debate) debate = create(:debate)
login_as(debate.author) login_as(debate.author)
@@ -355,7 +355,7 @@ describe "Debates" do
expect(page).to have_current_path(edit_debate_path(debate)) expect(page).to have_current_path(edit_debate_path(debate))
fill_in "Debate title", with: "End child poverty" fill_in "Debate title", with: "End child poverty"
fill_in "Initial debate text", with: "Let's do something to end child poverty" fill_in_ckeditor "Initial debate text", with: "Let's do something to end child poverty"
click_button "Save changes" click_button "Save changes"

View File

@@ -342,13 +342,13 @@ describe "Emails" do
let(:budget) { create(:budget) } let(:budget) { create(:budget) }
let!(:heading) { create(:budget_heading, name: "More hospitals", budget: budget) } let!(:heading) { create(:budget_heading, name: "More hospitals", budget: budget) }
scenario "Investment created" do scenario "Investment created", :js do
login_as(author) login_as(author)
visit new_budget_investment_path(budget_id: budget.id) visit new_budget_investment_path(budget_id: budget.id)
select heading.name, from: "budget_investment_heading_id" select heading.name, from: "budget_investment_heading_id"
fill_in "Title", with: "Build a hospital" fill_in "Title", with: "Build a hospital"
fill_in "Description", with: "We have lots of people that require medical attention" fill_in_ckeditor "Description", with: "We have lots of people that require medical attention"
check "budget_investment_terms_of_service" check "budget_investment_terms_of_service"
click_button "Create Investment" click_button "Create Investment"
@@ -464,7 +464,7 @@ describe "Emails" do
end end
context "Newsletter", :admin do context "Newsletter", :admin do
scenario "Send newsletter email to selected users" do scenario "Send newsletter email to selected users", :js do
user_with_newsletter_in_segment_1 = create(:user, :with_proposal, newsletter: true) user_with_newsletter_in_segment_1 = create(:user, :with_proposal, newsletter: true)
user_with_newsletter_in_segment_2 = create(:user, :with_proposal, newsletter: true) user_with_newsletter_in_segment_2 = create(:user, :with_proposal, newsletter: true)
user_with_newsletter_not_in_segment = create(:user, newsletter: true) user_with_newsletter_not_in_segment = create(:user, newsletter: true)
@@ -476,7 +476,7 @@ describe "Emails" do
expect(page).to have_content "Newsletter created successfully" expect(page).to have_content "Newsletter created successfully"
click_link "Send" accept_confirm { click_link "Send" }
expect(page).to have_content "Newsletter sent successfully" expect(page).to have_content "Newsletter sent successfully"

View File

@@ -33,7 +33,7 @@ describe "Budget Investments" do
context "Create" do context "Create" do
before { heading.budget.update(phase: "accepting") } before { heading.budget.update(phase: "accepting") }
scenario "Creating budget investments on behalf of someone, selecting a budget" do scenario "Creating budget investments on behalf of someone, selecting a budget", :js do
user = create(:user, :level_two) user = create(:user, :level_two)
login_managed_user(user) login_managed_user(user)
@@ -52,7 +52,7 @@ describe "Budget Investments" do
select "Health", from: "budget_investment_heading_id" select "Health", from: "budget_investment_heading_id"
fill_in "Title", with: "Build a park in my neighborhood" fill_in "Title", with: "Build a park in my neighborhood"
fill_in "Description", with: "There is no parks here..." fill_in_ckeditor "Description", with: "There is no parks here..."
fill_in "budget_investment_location", with: "City center" fill_in "budget_investment_location", with: "City center"
fill_in "budget_investment_organization_name", with: "T.I.A." fill_in "budget_investment_organization_name", with: "T.I.A."
fill_in "budget_investment_tag_list", with: "green" fill_in "budget_investment_tag_list", with: "green"

View File

@@ -6,7 +6,7 @@ describe "Proposals" do
end end
context "Create" do context "Create" do
scenario "Creating proposals on behalf of someone" do scenario "Creating proposals on behalf of someone", :js do
user = create(:user, :level_two) user = create(:user, :level_two)
login_managed_user(user) login_managed_user(user)
@@ -21,7 +21,7 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..." 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" fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yRYFKcMa_Ek"
check "proposal_terms_of_service" check "proposal_terms_of_service"

View File

@@ -357,7 +357,7 @@ describe "Proposals" do
expect(page).to have_css "meta[property='og:title'][content=\'#{proposal.title}\']", visible: :hidden expect(page).to have_css "meta[property='og:title'][content=\'#{proposal.title}\']", visible: :hidden
end end
scenario "Create and publish" do scenario "Create and publish", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
@@ -365,7 +365,7 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..." 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_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "proposal_tag_list", with: "Refugees, Solidarity" fill_in "proposal_tag_list", with: "Refugees, Solidarity"
@@ -411,7 +411,7 @@ describe "Proposals" do
expect(page).to have_current_path(proposals_path) expect(page).to have_current_path(proposals_path)
end end
scenario "Create proposal too fast" do scenario "Create proposal too fast", :js do
allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY) allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY)
author = create(:user) author = create(:user)
@@ -420,7 +420,7 @@ describe "Proposals" do
visit new_proposal_path 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 summary", with: "This is the summary" fill_in "Proposal summary", with: "This is the summary"
fill_in "Proposal text", with: "This is the description" fill_in_ckeditor "Proposal text", with: "This is the description"
fill_in "proposal_responsible_name", with: "Some other robot" fill_in "proposal_responsible_name", with: "Some other robot"
check "proposal_terms_of_service" check "proposal_terms_of_service"
@@ -431,14 +431,14 @@ describe "Proposals" do
expect(page).to have_current_path(new_proposal_path) expect(page).to have_current_path(new_proposal_path)
end end
scenario "Responsible name is stored for anonymous users" do scenario "Responsible name is stored for anonymous users", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
visit new_proposal_path visit new_proposal_path
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..." fill_in_ckeditor "Proposal text", with: "This is very important because..."
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service" check "proposal_terms_of_service"
@@ -452,7 +452,7 @@ describe "Proposals" do
expect(Proposal.last.responsible_name).to eq("Isabel Garcia") expect(Proposal.last.responsible_name).to eq("Isabel Garcia")
end end
scenario "Responsible name field is not shown for verified users" do scenario "Responsible name field is not shown for verified users", :js do
author = create(:user, :level_two) author = create(:user, :level_two)
login_as(author) login_as(author)
@@ -461,7 +461,7 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..." fill_in_ckeditor "Proposal text", with: "This is very important because..."
check "proposal_terms_of_service" check "proposal_terms_of_service"
click_button "Create proposal" click_button "Create proposal"
@@ -505,14 +505,14 @@ describe "Proposals" do
expect(page.html).not_to include "&lt;p&gt;This is" expect(page.html).not_to include "&lt;p&gt;This is"
end end
scenario "Autolinking is applied to description" do scenario "Autolinking is applied to description", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
visit new_proposal_path visit new_proposal_path
fill_in "Proposal title", with: "Testing auto link" fill_in "Proposal title", with: "Testing auto link"
fill_in "Proposal summary", with: "In summary, what we want is..." 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_ckeditor "Proposal text", with: "This is a link www.example.org"
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service" check "proposal_terms_of_service"
@@ -563,7 +563,7 @@ describe "Proposals" do
end end
context "Geozones" do context "Geozones" do
scenario "Default whole city" do scenario "Default whole city", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
@@ -581,7 +581,7 @@ describe "Proposals" do
end end
end end
scenario "Specific geozone" do scenario "Specific geozone", :js do
create(:geozone, name: "California") create(:geozone, name: "California")
create(:geozone, name: "New York") create(:geozone, name: "New York")
login_as(create(:user)) login_as(create(:user))
@@ -590,7 +590,7 @@ describe "Proposals" do
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..." 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_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service" check "proposal_terms_of_service"
@@ -749,7 +749,7 @@ describe "Proposals" do
Setting["max_votes_for_proposal_edit"] = 1000 Setting["max_votes_for_proposal_edit"] = 1000
end end
scenario "Update should be posible for the author of an editable proposal" do scenario "Update should be posible for the author of an editable proposal", :js do
proposal = create(:proposal) proposal = create(:proposal)
login_as(proposal.author) login_as(proposal.author)
@@ -758,7 +758,7 @@ describe "Proposals" do
fill_in "Proposal title", with: "End child poverty" fill_in "Proposal title", with: "End child poverty"
fill_in "Proposal summary", with: "Basically..." fill_in "Proposal summary", with: "Basically..."
fill_in "Proposal text", with: "Let's do something to end child poverty" fill_in_ckeditor "Proposal text", with: "Let's do something to end child poverty"
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
click_button "Save changes" click_button "Save changes"
@@ -1584,7 +1584,7 @@ describe "Successful proposals" do
Setting["feature.user.skip_verification"] = "true" Setting["feature.user.skip_verification"] = "true"
end end
scenario "Create" do scenario "Create", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
@@ -1598,7 +1598,7 @@ describe "Successful proposals" do
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary what we want is..." fill_in "Proposal summary", with: "In summary what we want is..."
fill_in "Proposal text", with: "This is very important because..." 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_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_tag_list", with: "Refugees, Solidarity" fill_in "proposal_tag_list", with: "Refugees, Solidarity"
check "proposal_terms_of_service" check "proposal_terms_of_service"

View File

@@ -61,14 +61,14 @@ describe "Tags" do
expect(page).to have_content(tag_economia.name) expect(page).to have_content(tag_economia.name)
end end
scenario "Create with custom tags" do scenario "Create with custom tags", :js do
login_as(author) login_as(author)
visit new_budget_investment_path(budget_id: budget.id) visit new_budget_investment_path(budget_id: budget.id)
select heading.name, from: "budget_investment_heading_id" select heading.name, from: "budget_investment_heading_id"
fill_in "Title", with: "Build a skyscraper" fill_in "Title", with: "Build a skyscraper"
fill_in "Description", with: "I want to live in a high tower over the clouds" fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds"
check "budget_investment_terms_of_service" check "budget_investment_terms_of_service"
fill_in "budget_investment_tag_list", with: "#{tag_medio_ambiente.name}, #{tag_economia.name}" fill_in "budget_investment_tag_list", with: "#{tag_medio_ambiente.name}, #{tag_economia.name}"
@@ -149,14 +149,14 @@ describe "Tags" do
end end
end end
scenario "Create with too many tags" do scenario "Create with too many tags", :js do
login_as(author) login_as(author)
visit new_budget_investment_path(budget_id: budget.id) visit new_budget_investment_path(budget_id: budget.id)
select heading.name, from: "budget_investment_heading_id" select heading.name, from: "budget_investment_heading_id"
fill_in "Title", with: "Build a skyscraper" fill_in "Title", with: "Build a skyscraper"
fill_in "Description", with: "I want to live in a high tower over the clouds" fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds"
check "budget_investment_terms_of_service" check "budget_investment_terms_of_service"
fill_in "budget_investment_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" fill_in "budget_investment_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
@@ -167,14 +167,14 @@ describe "Tags" do
expect(page).to have_content "tags must be less than or equal to 6" expect(page).to have_content "tags must be less than or equal to 6"
end end
scenario "Create with dangerous strings" do scenario "Create with dangerous strings", :js do
login_as(author) login_as(author)
visit new_budget_investment_path(budget_id: budget.id) visit new_budget_investment_path(budget_id: budget.id)
select heading.name, from: "budget_investment_heading_id" select heading.name, from: "budget_investment_heading_id"
fill_in "Title", with: "Build a skyscraper" fill_in "Title", with: "Build a skyscraper"
fill_in "Description", with: "I want to live in a high tower over the clouds" fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds"
check "budget_investment_terms_of_service" check "budget_investment_terms_of_service"
fill_in "budget_investment_tag_list", with: "user_id=1, &a=3, <script>alert('hey');</script>" fill_in "budget_investment_tag_list", with: "user_id=1, &a=3, <script>alert('hey');</script>"

View File

@@ -60,13 +60,13 @@ describe "Tags" do
expect(page).to have_content "Hacienda" expect(page).to have_content "Hacienda"
end end
scenario "Create" do scenario "Create", :js do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "Title" fill_in "Debate title", with: "Title"
fill_in "Initial debate text", with: "Description" fill_in_ckeditor "Initial debate text", with: "Description"
check "debate_terms_of_service" check "debate_terms_of_service"
fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda"
@@ -79,13 +79,13 @@ describe "Tags" do
expect(page).to have_content "Impuestos" expect(page).to have_content "Impuestos"
end end
scenario "Create with too many tags" do scenario "Create with too many tags", :js do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "Title" fill_in "Debate title", with: "Title"
fill_in "Initial debate text", with: "Description" fill_in_ckeditor "Initial debate text", with: "Description"
check "debate_terms_of_service" check "debate_terms_of_service"
fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
@@ -96,14 +96,14 @@ describe "Tags" do
expect(page).to have_content "tags must be less than or equal to 6" expect(page).to have_content "tags must be less than or equal to 6"
end end
scenario "Create with dangerous strings" do scenario "Create with dangerous strings", :js do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "A test of dangerous strings" fill_in "Debate title", with: "A test of dangerous strings"
fill_in "Initial debate text", with: "A description suitable for this test" fill_in_ckeditor "Initial debate text", with: "A description suitable for this test"
check "debate_terms_of_service" check "debate_terms_of_service"
fill_in "debate_tag_list", with: "user_id=1, &a=3, <script>alert('hey');</script>" fill_in "debate_tag_list", with: "user_id=1, &a=3, <script>alert('hey');</script>"

View File

@@ -59,14 +59,14 @@ describe "Tags" do
expect(page).to have_content "Hacienda" expect(page).to have_content "Hacienda"
end end
scenario "Create with custom tags" do scenario "Create with custom tags", :js do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
visit new_proposal_path visit new_proposal_path
fill_in "Proposal title", with: "Help refugees" fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..." fill_in_ckeditor "Proposal text", with: "This is very important because..."
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "proposal_tag_list", with: "Economía, Hacienda" fill_in "proposal_tag_list", with: "Economía, Hacienda"
check "proposal_terms_of_service" check "proposal_terms_of_service"
@@ -108,13 +108,13 @@ describe "Tags" do
end end
end end
scenario "Create with too many tags" do scenario "Create with too many tags", :js do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
visit new_proposal_path visit new_proposal_path
fill_in "Proposal title", with: "Title" fill_in "Proposal title", with: "Title"
fill_in "Proposal text", with: "Description" fill_in_ckeditor "Proposal text", with: "Description"
check "proposal_terms_of_service" check "proposal_terms_of_service"
fill_in "proposal_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" fill_in "proposal_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
@@ -125,7 +125,7 @@ describe "Tags" do
expect(page).to have_content "tags must be less than or equal to 6" expect(page).to have_content "tags must be less than or equal to 6"
end end
scenario "Create with dangerous strings" do scenario "Create with dangerous strings", :js do
author = create(:user) author = create(:user)
login_as(author) login_as(author)
@@ -133,7 +133,7 @@ describe "Tags" do
fill_in "Proposal title", with: "A test of dangerous strings" fill_in "Proposal title", with: "A test of dangerous strings"
fill_in "Proposal summary", with: "In summary, what we want is..." fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "A description suitable for this test" fill_in_ckeditor "Proposal text", with: "A description suitable for this test"
fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service" check "proposal_terms_of_service"

View File

@@ -53,13 +53,13 @@ describe "Tags" do
expect(page).to have_content "Hacienda" expect(page).to have_content "Hacienda"
end end
scenario "Create" do scenario "Create", :js do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "Title" fill_in "Debate title", with: "Title"
fill_in "Initial debate text", with: "Description" fill_in_ckeditor "Initial debate text", with: "Description"
check "debate_terms_of_service" check "debate_terms_of_service"
fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda"
@@ -72,13 +72,13 @@ describe "Tags" do
expect(page).to have_content "Impuestos" expect(page).to have_content "Impuestos"
end end
scenario "Create with too many tags" do scenario "Create with too many tags", :js do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
visit new_debate_path visit new_debate_path
fill_in "Debate title", with: "Title" fill_in "Debate title", with: "Title"
fill_in "Initial debate text", with: "Description" fill_in_ckeditor "Initial debate text", with: "Description"
check "debate_terms_of_service" check "debate_terms_of_service"
fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"