Merge pull request #5955 from cyrillefr/ReplaceLinkWithButtonInVariousComponentsPartI

Replace link with button in various components part i
This commit is contained in:
Sebastia
2025-07-09 15:26:38 +02:00
committed by GitHub
40 changed files with 212 additions and 180 deletions

View File

@@ -22,8 +22,8 @@ describe Devise::OmniauthFormComponent do
render_inline component
expect(page).to have_link "Twitter"
expect(page).to have_link count: 1
expect(page).to have_button "Twitter"
expect(page).to have_button count: 1
end
it "renders the facebook link when the feature is enabled" do
@@ -31,8 +31,8 @@ describe Devise::OmniauthFormComponent do
render_inline component
expect(page).to have_link "Facebook"
expect(page).to have_link count: 1
expect(page).to have_button "Facebook"
expect(page).to have_button count: 1
end
it "renders the google link when the feature is enabled" do
@@ -40,8 +40,8 @@ describe Devise::OmniauthFormComponent do
render_inline component
expect(page).to have_link "Google"
expect(page).to have_link count: 1
expect(page).to have_button "Google"
expect(page).to have_button count: 1
end
it "renders the wordpress link when the feature is enabled" do
@@ -49,8 +49,8 @@ describe Devise::OmniauthFormComponent do
render_inline component
expect(page).to have_link "Wordpress"
expect(page).to have_link count: 1
expect(page).to have_button "Wordpress"
expect(page).to have_button count: 1
end
end
end

View File

@@ -18,7 +18,7 @@ describe Layout::AdminHeaderComponent do
expect(page).to have_link "You don't have new notifications"
expect(page).to have_link "My content"
expect(page).to have_link "My account"
expect(page).to have_link "Sign out"
expect(page).to have_button "Sign out"
expect(page).to have_css "[data-toggle]"
end

View File

@@ -27,18 +27,18 @@ shared_examples "flaggable" do |factory_name, admin: false|
within "##{dom_id(flaggable)} .flag-content" do
click_button "Flag as inappropriate"
click_link "Flag as inappropriate"
within("form") { click_button "Flag as inappropriate" }
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
expect(page).to have_button "Unflag", visible: :hidden
expect(page).not_to have_button "Flag as inappropriate", visible: :all
end
refresh
within "##{dom_id(flaggable)} .flag-content" do
expect(page).to have_link "Unflag", visible: :hidden
expect(page).not_to have_link "Flag as inappropriate", visible: :all
expect(page).to have_button "Unflag", visible: :hidden
expect(page).not_to have_button "Flag as inappropriate", visible: :all
end
end
@@ -52,18 +52,18 @@ shared_examples "flaggable" do |factory_name, admin: false|
expect(page).to have_button "Unflag"
click_button "Unflag"
click_link "Unflag"
within("form") { click_button "Unflag" }
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
expect(page).to have_button "Flag as inappropriate", visible: :hidden
expect(page).not_to have_button "Unflag", visible: :all
end
visit path
within "##{dom_id(flaggable)} .flag-content" do
expect(page).to have_link "Flag as inappropriate", visible: :hidden
expect(page).not_to have_link "Unflag", visible: :all
expect(page).to have_button "Flag as inappropriate", visible: :hidden
expect(page).not_to have_button "Unflag", visible: :all
end
end
@@ -73,12 +73,12 @@ shared_examples "flaggable" do |factory_name, admin: false|
within "##{dom_id(flaggable)} .flag-content" do
click_button "Flag as inappropriate"
click_link "Flag as inappropriate"
within("form") { click_button "Flag as inappropriate" }
expect(page).to have_button "Unflag"
click_button "Unflag"
click_link "Unflag"
within("form") { click_button "Unflag" }
expect(page).not_to have_button "Unflag"
end
@@ -86,8 +86,8 @@ shared_examples "flaggable" do |factory_name, admin: false|
visit path
within "##{dom_id(flaggable)} .flag-content" do
expect(page).to have_link "Flag as inappropriate", visible: :hidden
expect(page).not_to have_link "Unflag", visible: :all
expect(page).to have_button "Flag as inappropriate", visible: :hidden
expect(page).not_to have_button "Unflag", visible: :all
end
end
@@ -99,7 +99,7 @@ shared_examples "flaggable" do |factory_name, admin: false|
within "##{dom_id(flaggable)} > .comment-body .flag-content" do
click_button "Flag as inappropriate"
click_link "Flag as inappropriate"
within("form") { click_button "Flag as inappropriate" }
expect(page).to have_button "Unflag"
end

View File

@@ -17,7 +17,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
expect(page).not_to have_link("Follow")
expect(page).not_to have_button("Follow")
end
end
@@ -28,7 +28,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
end
end
@@ -37,7 +37,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
login_as(user)
visit send(followable_path, arguments)
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
end
scenario "Should display unfollow after user clicks on follow button" do
@@ -46,10 +46,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Follow #{followable.model_name.human.downcase}")
click_button("Follow #{followable.model_name.human.downcase}")
expect(page).not_to have_link("Follow")
expect(page).to have_link("Following")
expect(page).not_to have_button("Follow")
expect(page).to have_button("Following")
end
end
@@ -59,7 +59,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Follow #{followable.model_name.human.downcase}")
click_button("Follow #{followable.model_name.human.downcase}")
end
expect(page).to have_content "We will notify you of changes as they occur"
@@ -71,7 +71,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
expect(page).to have_link("Following")
expect(page).to have_button("Following")
end
scenario "Updates follow button & show destroy notice after unfollow button is clicked" do
@@ -80,10 +80,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Unfollow #{followable.model_name.human.downcase}")
click_button("Unfollow #{followable.model_name.human.downcase}")
expect(page).not_to have_link("Unfollow")
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
expect(page).not_to have_button("Unfollow")
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
end
end
@@ -93,7 +93,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Unfollow #{followable.model_name.human.downcase}")
click_button("Unfollow #{followable.model_name.human.downcase}")
end
expect(page).to have_content "You will no longer receive notifications"

View File

@@ -146,10 +146,10 @@ shared_examples "relationable" do |relationable_model_name|
visit polymorphic_path(relationable)
within("#related-content-list") do
click_link "Yes"
click_button "Yes"
expect(page).not_to have_link "Yes"
expect(page).not_to have_link "No"
expect(page).not_to have_button "Yes"
expect(page).not_to have_button "No"
end
end
@@ -163,10 +163,10 @@ shared_examples "relationable" do |relationable_model_name|
visit polymorphic_path(relationable)
within("#related-content-list") do
click_link "No"
click_button "No"
expect(page).not_to have_link "Yes"
expect(page).not_to have_link "No"
expect(page).not_to have_button "Yes"
expect(page).not_to have_button "No"
end
end

View File

@@ -1696,7 +1696,7 @@ describe "Budget Investments" do
within("aside") do
expect(page).not_to have_content "Author"
expect(page).not_to have_link "Edit"
expect(page).not_to have_link "Remove image"
expect(page).not_to have_button "Remove image"
end
end
@@ -1709,7 +1709,7 @@ describe "Budget Investments" do
within("aside") do
expect(page).to have_content "AUTHOR"
expect(page).to have_link "Edit"
expect(page).not_to have_link "Remove image"
expect(page).not_to have_button "Remove image"
end
end
@@ -1723,7 +1723,7 @@ describe "Budget Investments" do
within("aside") do
expect(page).to have_content "AUTHOR"
expect(page).not_to have_link "Edit"
expect(page).to have_link "Remove image"
expect(page).to have_button "Remove image"
end
end
end

View File

@@ -10,17 +10,17 @@ describe "Proposal's dashboard" do
expect(page).to have_link("Edit my proposal")
expect(page).to have_link("Edit proposal")
expect(page).to have_link("Withdraw proposal")
expect(page).to have_link("Publish proposal")
expect(page).to have_button("Publish proposal")
expect(page).to have_link("Polls")
expect(page).to have_link("E-mail")
expect(page).to have_link("Poster")
end
scenario "Publish link dissapears after proposal's publication" do
scenario "Publish button dissapears after proposal's publication" do
visit proposal_dashboard_path(proposal)
click_link "Publish proposal"
click_button "Publish proposal"
expect(page).not_to have_link("Publish proposal")
expect(page).not_to have_button("Publish proposal")
end
scenario "Dashboard progress shows current goal" do

View File

@@ -13,11 +13,11 @@ describe "Mailing" do
end
scenario "Has a link to send the mail" do
expect(page).to have_link("Send to #{proposal.author.email}")
expect(page).to have_button("Send to #{proposal.author.email}")
end
scenario "User receives feedback after the email is sent" do
click_link "Send to #{proposal.author.email}"
click_button "Send to #{proposal.author.email}"
expect(page).to have_content("The email has been sent")
end
@@ -31,6 +31,6 @@ describe "Mailing" do
click_link "Preview"
expect(page).not_to have_link("Preview")
expect(page).to have_link("Send to #{proposal.author.email}")
expect(page).to have_button("Send to #{proposal.author.email}")
end
end

View File

@@ -149,7 +149,7 @@ describe "Managed User" do
expect(page).to have_content "Identified as"
expect(page).to have_content user.username.to_s
click_link "Change user"
click_button "Change user"
end
expect(page).to have_content "User session signed out successfully."

View File

@@ -39,7 +39,7 @@ describe "Moderate users" do
expect(page).to have_css "h1", exact_text: debate3.title
expect(page).not_to have_content(comment3.body)
click_link "Sign out"
click_button "Sign out"
expect(page).to have_content "You have been signed out successfully"

View File

@@ -55,7 +55,7 @@ describe "Multitenancy", :seed_tenants do
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
expect(page).to have_content "You've created a proposal!"

View File

@@ -59,7 +59,7 @@ describe "Notifications" do
click_notifications_icon
within("#notification_#{notification1.id}") do
click_link "Mark as read"
click_button "Mark as read"
end
expect(page).to have_css(".notification", count: 1)
@@ -74,7 +74,7 @@ describe "Notifications" do
click_notifications_icon
expect(page).to have_css(".notification", count: 2)
click_link "Mark all as read"
click_button "Mark all as read"
expect(page).to have_css(".notification", count: 0)
end
@@ -89,7 +89,7 @@ describe "Notifications" do
expect(page).to have_css(".notification", count: 1)
within("#notification_#{notification1.id}") do
click_link "Mark as unread"
click_button "Mark as unread"
end
expect(page).to have_css(".notification", count: 0)

View File

@@ -294,7 +294,7 @@ describe "Polls" do
expect(page).to have_content "Vote introduced!"
within("#notice") { click_button "Close" }
click_link "Sign out"
click_button "Sign out"
expect(page).to have_content "You must sign in or register to continue."

View File

@@ -356,7 +356,7 @@ describe "Proposals" do
expect(page).to have_content "Help refugees"
expect(page).not_to have_content "You can also see more information about improving your campaign"
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
expect(page).to have_content "Improve your campaign and get more support"
click_link "Not now, go to my proposal"
@@ -424,7 +424,7 @@ describe "Proposals" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
click_link "Dashboard"
@@ -450,7 +450,7 @@ describe "Proposals" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
expect(page).to have_css "h1", exact_text: "Help refugees"
@@ -481,7 +481,7 @@ describe "Proposals" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
expect(page).to have_content "Testing an attack"
@@ -504,7 +504,7 @@ describe "Proposals" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
expect(page).to have_content "Testing auto link"
@@ -528,7 +528,7 @@ describe "Proposals" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
expect(page).to have_content "Testing auto link"
@@ -568,7 +568,7 @@ describe "Proposals" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
within "#geozone" do
@@ -613,7 +613,7 @@ describe "Proposals" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
within "#geozone" do

View File

@@ -16,7 +16,7 @@ describe "Sessions" do
within("#notice") { click_button "Close" }
click_link "Sign out"
click_button "Sign out"
expect(page).to have_content("You have been signed out successfully")
expect(page).to have_current_path(debate_path(debate))
@@ -63,7 +63,7 @@ describe "Sessions" do
expect(page).to have_content(/errors prevented the verification of your residence/)
click_link "Sign out"
click_button "Sign out"
expect(page).to have_content "You must sign in or register to continue."
expect(page).to have_current_path new_user_session_path

View File

@@ -74,7 +74,7 @@ describe "Tags" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
expect(page).to have_content "Economía"
@@ -99,7 +99,7 @@ describe "Tags" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
expect(page).to have_css "h1", exact_text: "Help refugees"
@@ -144,7 +144,7 @@ describe "Tags" do
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
click_link "No, I want to publish the proposal"
click_button "No, I want to publish the proposal"
click_link "Not now, go to my proposal"
expect(page).to have_content "user_id1"

View File

@@ -131,7 +131,7 @@ describe "Topics" do
login_as(user)
visit community_topic_path(topic.community, topic)
click_link "Delete topic"
click_button "Delete topic"
expect(page).to have_content "Topic deleted successfully."
expect(page).not_to have_content topic.title

View File

@@ -85,7 +85,7 @@ describe "Users" do
expect(page).to have_link "My content", href: user_path(u1)
within("#notice") { click_button "Close" }
click_link "Sign out"
click_button "Sign out"
expect(page).to have_content "You have been signed out successfully."
@@ -130,7 +130,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect_to_be_signed_in
@@ -149,7 +149,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect(page).to have_current_path(new_user_session_path)
expect(page).to have_content "To continue, please click on the confirmation " \
@@ -160,7 +160,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Twitter"
click_button "Sign in with Twitter"
expect_to_be_signed_in
within("#notice") { click_button "Close" }
@@ -177,7 +177,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect(page).to have_current_path(finish_signup_path)
fill_in "Email", with: "manueladelascarmenas@example.com"
@@ -191,7 +191,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Twitter"
click_button "Sign in with Twitter"
expect_to_be_signed_in
within("#notice") { click_button "Close" }
@@ -208,10 +208,10 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect(page).to have_current_path(finish_signup_path)
click_link "Cancel login"
click_button "Cancel login"
expect(page).to have_content "You have been signed out successfully"
@@ -228,7 +228,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Twitter"
click_button "Sign in with Twitter"
expect_to_be_signed_in
@@ -247,7 +247,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect(page).to have_current_path(finish_signup_path)
@@ -275,7 +275,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect(page).to have_current_path(finish_signup_path)
expect(page).to have_field "Username", with: "manuela"
@@ -296,7 +296,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Twitter"
click_button "Sign in with Twitter"
within("#notice") { click_button "Close" }
click_link "My account"
@@ -312,7 +312,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect(page).to have_current_path(finish_signup_path)
@@ -332,7 +332,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Twitter"
click_button "Sign in with Twitter"
expect_to_be_signed_in
within("#notice") { click_button "Close" }
@@ -350,7 +350,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Twitter"
click_button "Sign up with Twitter"
expect(page).to have_current_path(finish_signup_path)
@@ -366,7 +366,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Twitter"
click_button "Sign in with Twitter"
expect_to_be_signed_in
within("#notice") { click_button "Close" }
@@ -398,7 +398,7 @@ describe "Users" do
create(:user, username: "manuela", email: "manuelacarmena@example.com")
visit new_user_session_path
click_link "Sign in with Google"
click_button "Sign in with Google"
expect_to_be_signed_in
end
@@ -423,7 +423,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Wordpress"
click_button "Sign up with Wordpress"
expect(page).to have_current_path(new_user_session_path)
expect(page).to have_content "To continue, please click on the confirmation " \
@@ -434,7 +434,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Wordpress"
click_button "Sign in with Wordpress"
expect_to_be_signed_in
within("#notice") { click_button "Close" }
@@ -452,7 +452,7 @@ describe "Users" do
visit "/"
click_link "Register"
click_link "Sign up with Wordpress"
click_button "Sign up with Wordpress"
expect(page).to have_current_path(finish_signup_path)
@@ -475,7 +475,7 @@ describe "Users" do
visit "/"
click_link "Sign in"
click_link "Sign in with Wordpress"
click_button "Sign in with Wordpress"
expect_to_be_signed_in
@@ -495,7 +495,7 @@ describe "Users" do
login_as(user)
visit "/"
click_link "Sign out"
click_button "Sign out"
expect(page).to have_content "You have been signed out successfully."
end

View File

@@ -8,7 +8,7 @@ describe "Verify Letter" do
login_as(user)
visit new_letter_path
click_link "Send me a letter with the code"
click_button "Send me a letter with the code"
expect(page).to have_content "Thank you for requesting your maximum security code " \
"(only required for the final votes). In a few days " \

View File

@@ -76,7 +76,7 @@ describe "Level three verification" do
verify_residence
confirm_phone(code: "1234")
click_link "Send me a letter with the code"
click_button "Send me a letter with the code"
expect(page).to have_content "Thank you for requesting your maximum security code " \
"(only required for the final votes). In a few days " \