diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml
index 450f51b8a..d0a650f32 100644
--- a/config/locales/en/general.yml
+++ b/config/locales/en/general.yml
@@ -946,7 +946,7 @@ en:
help:
alt: Select the text you want to comment and press the button with the pencil.
text: To comment this document you must %{sign_in} or %{sign_up}. Then select the text you want to comment and press the button with the pencil.
- title: How I can comment this document?
+ title: How can I comment this document?
links:
form:
delete_button: Delete
diff --git a/spec/shared/system/flaggable.rb b/spec/shared/system/flaggable.rb
index 502d1d130..0e5bc8881 100644
--- a/spec/shared/system/flaggable.rb
+++ b/spec/shared/system/flaggable.rb
@@ -26,10 +26,10 @@ shared_examples "flaggable" do |factory_name, admin: false|
visit path
within "##{dom_id(flaggable)} .flag-content" do
- find(".icon-flag").click
+ click_button "Flag as inappropriate"
click_link "Flag as inappropriate"
- expect(page).to have_css ".flag-active"
+ expect(page).to have_button "Unflag"
expect(page).to have_link "Unflag", visible: :hidden
expect(page).not_to have_link "Flag as inappropriate", visible: :all
end
@@ -49,12 +49,12 @@ shared_examples "flaggable" do |factory_name, admin: false|
visit path
within "##{dom_id(flaggable)} .flag-content" do
- expect(page).to have_css ".flag-active"
+ expect(page).to have_button "Unflag"
- find(".icon-flag").click
+ click_button "Unflag"
click_link "Unflag"
- expect(page).not_to have_css ".flag-active"
+ expect(page).not_to have_button "Unflag"
expect(page).to have_link "Flag as inappropriate", visible: :hidden
expect(page).not_to have_link "Unflag", visible: :all
end
@@ -72,15 +72,15 @@ shared_examples "flaggable" do |factory_name, admin: false|
visit path
within "##{dom_id(flaggable)} .flag-content" do
- find(".icon-flag").click
+ click_button "Flag as inappropriate"
click_link "Flag as inappropriate"
- expect(page).to have_css ".flag-active"
+ expect(page).to have_button "Unflag"
- find(".icon-flag").click
+ click_button "Unflag"
click_link "Unflag"
- expect(page).not_to have_css ".flag-active"
+ expect(page).not_to have_button "Unflag"
end
visit path
@@ -100,14 +100,14 @@ shared_examples "flaggable" do |factory_name, admin: false|
visit path
within "##{dom_id(flaggable)} > .comment-body .flag-content" do
- find(".icon-flag").click
+ click_button "Flag as inappropriate"
click_link "Flag as inappropriate"
- expect(page).to have_css ".flag-active"
+ expect(page).to have_button "Unflag"
end
within "##{dom_id(child_comment)} .flag-content" do
- expect(page).not_to have_css ".flag-active"
+ expect(page).not_to have_button "Unflag"
end
end
end
diff --git a/spec/system/dashboard/dashboard_spec.rb b/spec/system/dashboard/dashboard_spec.rb
index 6ec9caa05..e54acdca2 100644
--- a/spec/system/dashboard/dashboard_spec.rb
+++ b/spec/system/dashboard/dashboard_spec.rb
@@ -41,10 +41,15 @@ describe "Proposal's dashboard" do
expect(page).to have_content(goal.title)
expect(page).not_to have_content(future_goal.title)
- find(:css, "#see_complete_course_link").click
+ click_button "Check out the complete course"
expect(page).to have_content(goal.title)
expect(page).to have_content(future_goal.title)
+
+ click_button "Hide course"
+
+ expect(page).to have_content(goal.title)
+ expect(page).not_to have_content(future_goal.title)
end
end
@@ -69,7 +74,7 @@ describe "Proposal's dashboard" do
expect(page).to have_content(action.description)
expect(page).to have_content("This is a really very long description for a proposed")
expect(page).to have_selector("#truncated_description_dashboard_action_#{action_long.id}")
- expect(page).to have_selector("a", text: "Show description")
+ expect(page).to have_button("Show description")
end
scenario "Dashboard progress do not display from the fourth proposed actions", js: true do
@@ -420,9 +425,13 @@ describe "Proposal's dashboard" do
action_5 = create(:dashboard_action, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
- find(:css, "#see_proposed_actions_link_pending").click
+ click_button "Check out recommended actions"
expect(page).to have_content(action_5.title)
+
+ click_button "Hide recommended actions"
+
+ expect(page).not_to have_content(action_5.title)
end
scenario "On recommended actions section display four proposed actions", js: true do
diff --git a/spec/system/legislation/draft_versions_spec.rb b/spec/system/legislation/draft_versions_spec.rb
index 867222a7a..1a6cd908a 100644
--- a/spec/system/legislation/draft_versions_spec.rb
+++ b/spec/system/legislation/draft_versions_spec.rb
@@ -72,6 +72,25 @@ describe "Legislation Draft Versions" do
expect(page).to have_content("Current version")
end
+ scenario "show more info button", :js do
+ process.update!(additional_info: "Text for additional info of the process")
+ visit legislation_process_draft_version_path(process, original)
+
+ expect(page).not_to have_content "Text for additional info of the process"
+
+ click_button "More information and context"
+
+ expect(page).to have_content "Text for additional info of the process"
+ end
+
+ scenario "show help gif", :js do
+ visit legislation_process_draft_version_path(process, original)
+
+ click_button text: "How can I comment this document?"
+
+ expect(page).to have_content "select the text you want to comment and press the button with the pencil"
+ end
+
context "for final versions" do
it "does not show the comments panel" do
final_version = create(:legislation_draft_version, process: process, title: "Final version",
diff --git a/spec/system/legislation/processes_spec.rb b/spec/system/legislation/processes_spec.rb
index 4ccb9bf1e..2ebe7c229 100644
--- a/spec/system/legislation/processes_spec.rb
+++ b/spec/system/legislation/processes_spec.rb
@@ -187,13 +187,16 @@ describe "Legislation" do
end
end
- scenario "show additional info button" do
+ scenario "show additional info button", :js do
process = create(:legislation_process, additional_info: "Text for additional info of the process")
visit legislation_process_path(process)
- expect(page).to have_content("Additional information")
- expect(page).to have_content("Text for additional info of the process")
+ expect(page).not_to have_content "Text for additional info of the process"
+
+ click_button "Additional information"
+
+ expect(page).to have_content "Text for additional info of the process"
end
scenario "do not show additional info button if it is empty" do
@@ -201,7 +204,7 @@ describe "Legislation" do
visit legislation_process_path(process)
- expect(page).not_to have_content("Additional information")
+ expect(page).not_to have_button "Additional information"
end
scenario "Shows another translation when the default locale isn't available" do
diff --git a/spec/system/sdg/goals_spec.rb b/spec/system/sdg/goals_spec.rb
index e13e42bbf..ec4571aac 100644
--- a/spec/system/sdg/goals_spec.rb
+++ b/spec/system/sdg/goals_spec.rb
@@ -106,16 +106,16 @@ describe "SDG Goals", :js do
end
end
- scenario "has links to read more and read less for long description" do
+ scenario "has buttons to read more and read less for long description" do
visit sdg_goal_path(15)
- expect(page).to have_css("div.read-more a", text: "Read more about Life on Land")
- expect(page).to have_css("div.read-more a", text: "Read less about Life on Land", visible: :hidden)
+ expect(page).to have_button "Read more about Life on Land"
+ expect(page).to have_button "Read less about Life on Land", visible: :hidden
- find("div.read-more a", text: "Read more about Life on Land").click
+ click_button "Read more about Life on Land"
- expect(page).to have_css("div.read-more a", text: "Read more about Life on Land", visible: :hidden)
- expect(page).to have_css("div.read-more a", text: "Read less about Life on Land")
+ expect(page).to have_button "Read more about Life on Land", visible: :hidden
+ expect(page).to have_button "Read less about Life on Land"
end
scenario "has tab target section" do