OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Adapt tests to new PageHeader structure
Henriette Darge46860150b115
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rbindex c5f4f6c9f91..efe0e2795a4 100644--- a/app/helpers/users_helper.rb+++ b/app/helpers/users_helper.rb@@ -128,7 +128,7 @@ module UsersHelperhref: change_status_user_path(user,name.to_sym => "1",back_url: request.fullpath),- method: :post) do |button|+ data: { method: :post }) do |button|button.with_leading_visual_icon(icon: change_user_status_icons[name])titleenddiff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erbindex 369ad1d9d3a..2891a345637 100644--- a/app/views/groups/show.html.erb+++ b/app/views/groups/show.html.erb@@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details.<%=render(Primer::OpenProject::PageHeader.new) do |header|- header.with_title { @group.name }+ header.with_title(test_selector: "groups--title") { @group.name }header.with_breadcrumbs([{ href: groups_path, text: t(:label_group_plural) },@@ -44,6 +44,7 @@ See COPYRIGHT and LICENSE files for more details.size: :medium,href: edit_group_path(@group),aria: { label: I18n.t(:button_edit) },+ data: { "test-selector": "groups--edit-group-button" },title: I18n.t(:button_edit)) do |button|button.with_leading_visual_icon(icon: :pencil)t(:button_edit)diff --git a/app/views/placeholder_users/_toolbar.html.erb b/app/views/placeholder_users/_toolbar.html.erbindex d969dec61a2..2d5f18d9153 100644--- a/app/views/placeholder_users/_toolbar.html.erb+++ b/app/views/placeholder_users/_toolbar.html.erb@@ -57,6 +57,7 @@ See COPYRIGHT and LICENSE files for more details.disabled: !deletable,href: deletable ? deletion_info_placeholder_user_path(@placeholder_user) : "#",aria: { label: I18n.t(:button_delete) },+ data: { "test-selector": "placeholder-user--delete-button" },title: deletable ?I18n.t(:button_delete) :I18n.t("placeholder_users.right_to_manage_members_missing")) do |button|diff --git a/app/views/placeholder_users/show.html.erb b/app/views/placeholder_users/show.html.erbindex 5fc19af8b28..72537fe3ef0 100644--- a/app/views/placeholder_users/show.html.erb+++ b/app/views/placeholder_users/show.html.erb@@ -64,6 +64,7 @@ See COPYRIGHT and LICENSE files for more details.disabled: !deletable,href: deletable ? deletion_info_placeholder_user_path(@placeholder_user) : "#",aria: { label: I18n.t(:button_delete) },+ data: { "test-selector": "placeholder-user--delete-button" },title: deletable ?I18n.t(:button_delete) :I18n.t("placeholder_users.right_to_manage_members_missing")) do |button|diff --git a/app/views/roles/index.html.erb b/app/views/roles/index.html.erbindex 2e03178fbcf..2c87cc4218a 100644--- a/app/views/roles/index.html.erb+++ b/app/views/roles/index.html.erb@@ -43,6 +43,7 @@ See COPYRIGHT and LICENSE files for more details.aria: { label: I18n.t(:label_role_new) },title: I18n.t(:label_role_new),tag: :a,+ test_selector: "roles--create-button",href: new_role_path) do |button|button.with_leading_visual_icon(icon: :plus)Role.model_name.humandiff --git a/spec/features/groups/group_show_spec.rb b/spec/features/groups/group_show_spec.rbindex e1971fb18d1..87ff37e61d4 100644--- a/spec/features/groups/group_show_spec.rb+++ b/spec/features/groups/group_show_spec.rb@@ -42,8 +42,8 @@ RSpec.describe "group show page" doit "I can visit the group page" dovisit show_group_path(group)- expect(page).to have_css("h2", text: "Bob's Team")- expect(page).to have_css(".toolbar-item", text: "Edit")+ expect(page).to have_test_selector("groups--title", text: "Bob's Team")+ expect(page).to have_test_selector("groups--edit-group-button", text: "Edit")expect(page).to have_css("li", text: member.name)endend@@ -53,8 +53,8 @@ RSpec.describe "group show page" doit "I can visit the group page" dovisit show_group_path(group)- expect(page).to have_css("h2", text: "Bob's Team")- expect(page).to have_no_css(".toolbar-item")+ expect(page).to have_test_selector("groups--title", text: "Bob's Team")+ expect(page).not_to have_test_selector("groups--edit-group-button")expect(page).to have_no_css("li", text: member.name)endenddiff --git a/spec/features/placeholder_users/delete_spec.rb b/spec/features/placeholder_users/delete_spec.rbindex 87763aaee28..9e67de49bec 100644--- a/spec/features/placeholder_users/delete_spec.rb+++ b/spec/features/placeholder_users/delete_spec.rb@@ -35,11 +35,11 @@ RSpec.describe "delete placeholder user", :js doit "can delete name" dovisit placeholder_user_path(placeholder_user)- expect(page).to have_css ".button", text: "Delete"+ expect(page).to have_test_selector "placeholder-user--delete-button", text: "Delete"visit edit_placeholder_user_path(placeholder_user)- expect(page).to have_css ".button", text: "Delete"+ expect(page).to have_test_selector "placeholder-user--delete-button", text: "Delete"click_on "Delete"# Expect to be on delete confirmation@@ -89,11 +89,11 @@ RSpec.describe "delete placeholder user", :js dovisit placeholder_user_path(placeholder_user)- expect(page).to have_css ".button.-disabled", text: "Delete"+ expect(page).to have_css("[data-test-selector='placeholder-user--delete-button'][disabled='disabled']", text: "Delete")visit edit_placeholder_user_path(placeholder_user)- expect(page).to have_css ".button.-disabled", text: "Delete"+ expect(page).to have_css("[data-test-selector='placeholder-user--delete-button'][disabled='disabled']", text: "Delete")endenddiff --git a/spec/features/roles/create_spec.rb b/spec/features/roles/create_spec.rbindex 5b75ce12599..a1c4500254a 100644--- a/spec/features/roles/create_spec.rb+++ b/spec/features/roles/create_spec.rb@@ -44,8 +44,8 @@ RSpec.describe "Role creation", :js, :with_cuprite doit "allows creating roles and handles errors" dovisit roles_path- within ".toolbar-item" do- click_link "Role"+ within ".SubHeader" do+ page.find_test_selector("roles--create-button").clickendfill_in "Name", with: existing_role.namediff --git a/spec/features/users/edit_users_spec.rb b/spec/features/users/edit_users_spec.rbindex 07e481b9394..18d0c003c3a 100644--- a/spec/features/users/edit_users_spec.rb+++ b/spec/features/users/edit_users_spec.rb@@ -85,7 +85,7 @@ RSpec.describe "edit users", :js, :with_cuprite doenddef have_visible_tab(label)- have_css(".op-tab-row--link", text: label.upcase)+ have_css(".tabnav-tab", text: label)endcontext "as admin" do@@ -93,7 +93,7 @@ RSpec.describe "edit users", :js, :with_cuprite doanother_admin = create(:admin)visit edit_user_path(another_admin)- expect(page).to have_visible_tab("GENERAL")+ expect(page).to have_visible_tab("General")endend@@ -104,7 +104,7 @@ RSpec.describe "edit users", :js, :with_cuprite doit "can too edit the user" dovisit edit_user_path(user)- expect(page).to have_visible_tab("GENERAL")+ expect(page).to have_visible_tab("General")expect(page).to have_no_css(".admin-overview-menu-item", text: "Overview")expect(page).to have_no_css(".users-and-permissions-menu-item", text: "Users and permissions")@@ -138,7 +138,7 @@ RSpec.describe "edit users", :js, :with_cuprite doit "can reinvite the user" dovisit edit_user_path(user)- click_button "Send invitation"+ click_on "Send invitation"expect(page).to have_css(".op-toast.-success", text: "An invitation has been sent to [email protected]")end@@ -146,8 +146,8 @@ RSpec.describe "edit users", :js, :with_cuprite doit "can not edit attributes of an admin user" dovisit edit_user_path(admin)- expect(page).to have_visible_tab("PROJECTS")- expect(page).not_to have_visible_tab("GENERAL")+ expect(page).to have_visible_tab("Projects")+ expect(page).not_to have_visible_tab("General")endendenddiff --git a/spec/support/pages/admin/individual_principals/edit.rb b/spec/support/pages/admin/individual_principals/edit.rbindex a8ca6fc2420..5900da868ad 100644--- a/spec/support/pages/admin/individual_principals/edit.rb+++ b/spec/support/pages/admin/individual_principals/edit.rb@@ -47,7 +47,7 @@ module Pagesenddef open_projects_tab!- within(".content--tabs") do+ within(".PageHeader-tabNav") doclick_on "Projects"endenddiff --git a/spec/support/pages/admin/users/edit.rb b/spec/support/pages/admin/users/edit.rbindex 23abae8920f..028022ac6c1 100644--- a/spec/support/pages/admin/users/edit.rb+++ b/spec/support/pages/admin/users/edit.rb@@ -105,8 +105,8 @@ module Pagesenddef activate!- within ".toolbar-items" do- click_button "Activate"+ within ".PageHeader-actions" do+ click_on "Activate"endendenddiff --git a/spec/support/pages/groups.rb b/spec/support/pages/groups.rbindex 40bfbd13272..7eb7f2709a0 100644--- a/spec/support/pages/groups.rb+++ b/spec/support/pages/groups.rb@@ -82,13 +82,13 @@ module Pagesenddef open_users_tab!- within(".content--tabs") do+ within(".PageHeader-tabNav") doclick_on "Users"endenddef open_projects_tab!- within(".content--tabs") do+ within(".PageHeader-tabNav") doclick_on "Projects"endend