From f77e7df33e455e5e9e31987d1648cc3eccd60804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Fri, 25 Jan 2019 11:40:43 +0100 Subject: [PATCH] Fix debate specs After adding debate 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. --- spec/features/ckeditor_spec.rb | 6 +++--- spec/features/debates_spec.rb | 34 +++++++++++++++--------------- spec/features/tags/debates_spec.rb | 12 +++++------ spec/features/tags_spec.rb | 8 +++---- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/spec/features/ckeditor_spec.rb b/spec/features/ckeditor_spec.rb index 568441d5d..8b5ee04de 100644 --- a/spec/features/ckeditor_spec.rb +++ b/spec/features/ckeditor_spec.rb @@ -8,12 +8,12 @@ describe "CKEditor" do visit new_debate_path - expect(page).to have_css "#cke_debate_description" + expect(page).to have_css ".translatable-fields[data-locale='en'] .cke_wysiwyg_frame" click_link "Debates" click_link "Start a debate" - expect(page).to have_css "#cke_debate_description" + expect(page).to have_css ".translatable-fields[data-locale='en'] .cke_wysiwyg_frame" end -end \ No newline at end of file +end diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index c65483c6d..579ede59d 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -169,8 +169,8 @@ describe "Debates" do login_as(author) visit new_debate_path - fill_in "debate_title", with: "A title for a debate" - fill_in "debate_description", with: "This is very important because..." + fill_in "Debate title", with: "A title for a debate" + fill_in "Initial debate text", with: "This is very important because..." check "debate_terms_of_service" click_button "Start a debate" @@ -187,9 +187,9 @@ describe "Debates" do login_as(author) visit new_debate_path - fill_in "debate_title", with: "I am a bot" + fill_in "Debate title", with: "I am a bot" fill_in "debate_subtitle", with: "This is a honeypot field" - fill_in "debate_description", with: "This is the description" + fill_in "Initial debate text", with: "This is the description" check "debate_terms_of_service" click_button "Start a debate" @@ -206,8 +206,8 @@ describe "Debates" do login_as(author) visit new_debate_path - fill_in "debate_title", with: "I am a bot" - fill_in "debate_description", with: "This is the description" + fill_in "Debate title", with: "I am a bot" + fill_in "Initial debate text", with: "This is the description" check "debate_terms_of_service" click_button "Start a debate" @@ -231,8 +231,8 @@ describe "Debates" do login_as(author) visit new_debate_path - fill_in "debate_title", with: "Testing an attack" - fill_in "debate_description", with: "

This is

" + fill_in "Debate title", with: "Testing an attack" + fill_in "Initial debate text", with: "

This is

" check "debate_terms_of_service" click_button "Start a debate" @@ -249,8 +249,8 @@ describe "Debates" do login_as(author) visit new_debate_path - fill_in "debate_title", with: "Testing auto link" - fill_in "debate_description", with: "

This is a link www.example.org

" + fill_in "Debate title", with: "Testing auto link" + fill_in "Initial debate text", with: "

This is a link www.example.org

" check "debate_terms_of_service" click_button "Start a debate" @@ -266,8 +266,8 @@ describe "Debates" do login_as(author) visit new_debate_path - fill_in "debate_title", with: "Testing auto link" - fill_in "debate_description", with: js_injection_string + fill_in "Debate title", with: "Testing auto link" + fill_in "Initial debate text", with: js_injection_string check "debate_terms_of_service" click_button "Start a debate" @@ -318,8 +318,8 @@ describe "Debates" do visit 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_description", with: "Let's do something to 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" click_button "Save changes" @@ -333,7 +333,7 @@ describe "Debates" do login_as(debate.author) visit edit_debate_path(debate) - fill_in "debate_title", with: "" + fill_in "Debate title", with: "" click_button "Save changes" expect(page).to have_content error_message @@ -1108,7 +1108,7 @@ describe "Debates" do debate7 = create(:debate, title: "This has seven votes, and is not suggest", description: "This is the seven", cached_votes_up: 7) visit new_debate_path - fill_in "debate_title", with: "debate" + fill_in "Debate title", with: "debate" check "debate_terms_of_service" within("div#js-suggest") do @@ -1124,7 +1124,7 @@ describe "Debates" do debate2 = create(:debate, title: "Second debate has 2 votes", cached_votes_up: 2) visit new_debate_path - fill_in "debate_title", with: "proposal" + fill_in "Debate title", with: "proposal" check "debate_terms_of_service" within("div#js-suggest") do diff --git a/spec/features/tags/debates_spec.rb b/spec/features/tags/debates_spec.rb index ba582a294..2fcd2bb6e 100644 --- a/spec/features/tags/debates_spec.rb +++ b/spec/features/tags/debates_spec.rb @@ -66,8 +66,8 @@ describe "Tags" do login_as(user) visit new_debate_path - fill_in "debate_title", with: "Title" - fill_in "debate_description", with: "Description" + fill_in "Debate title", with: "Title" + fill_in "Initial debate text", with: "Description" check "debate_terms_of_service" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda" @@ -85,8 +85,8 @@ describe "Tags" do login_as(user) visit new_debate_path - fill_in "debate_title", with: "Title" - fill_in "debate_description", with: "Description" + fill_in "Debate title", with: "Title" + fill_in "Initial debate text", with: "Description" check "debate_terms_of_service" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" @@ -103,8 +103,8 @@ describe "Tags" do visit new_debate_path - fill_in "debate_title", with: "A test of dangerous strings" - fill_in "debate_description", with: "A description suitable for this test" + fill_in "Debate title", with: "A test of dangerous strings" + fill_in "Initial debate text", with: "A description suitable for this test" check "debate_terms_of_service" fill_in "debate_tag_list", with: "user_id=1, &a=3, " diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb index 1b349819c..0d1b28e43 100644 --- a/spec/features/tags_spec.rb +++ b/spec/features/tags_spec.rb @@ -59,8 +59,8 @@ describe "Tags" do login_as(user) visit new_debate_path - fill_in "debate_title", with: "Title" - fill_in "debate_description", with: "Description" + fill_in "Debate title", with: "Title" + fill_in "Initial debate text", with: "Description" check "debate_terms_of_service" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda" @@ -78,8 +78,8 @@ describe "Tags" do login_as(user) visit new_debate_path - fill_in "debate_title", with: "Title" - fill_in "debate_description", with: "Description" + fill_in "Debate title", with: "Title" + fill_in "Initial debate text", with: "Description" check "debate_terms_of_service" fill_in "debate_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"