Skip to content

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

Fix some specs

Henriette Darge9f8cf5970e79
diff --git a/app/views/repositories/destroy_info.html.erb b/app/views/repositories/destroy_info.html.erb
index 41393c3ce07..d483d99f0a8 100644
--- a/app/views/repositories/destroy_info.html.erb
+++ b/app/views/repositories/destroy_info.html.erb
@@ -86,9 +86,10 @@ See COPYRIGHT and LICENSE files for more details.
</p>
<p>
<%= link_to project_repository_path(@project),
- title: t(:button_delete),
- method: :delete,
- class: 'button' do %>
+ title: t(:button_delete),
+ method: :delete,
+ data: { "test-selector": "remove-repository-button"},
+ class: 'button' do %>
<%= op_icon('button--icon icon-remove') %>
<span class="button--text"><%= t(:button_remove) %></span>
<% end %>
diff --git a/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb
index c0c18fec83b..66d13427440 100644
--- a/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb
@@ -40,6 +40,7 @@ See COPYRIGHT and LICENSE files for more details.
mobile_label: t("ifc_models.label_show_defaults"),
href: defaults_bcf_project_ifc_models_path,
aria: { label: I18n.t("ifc_models.label_show_defaults") },
+ data: { test_selector: "ifc-show-default-button" },
title: I18n.t("ifc_models.label_show_defaults")) do |button|
button.with_leading_visual_icon(icon: :"eye")
t("ifc_models.label_show_defaults")
@@ -52,6 +53,7 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::SubHeader.new) do |subheader|
subheader.with_action_button(scheme: :primary,
aria: { label: I18n.t("ifc_models.label_new_ifc_model") },
+ data: { test_selector: "ifc-create-button" },
title: I18n.t("ifc_models.label_new_ifc_model"),
tag: :a,
href: new_bcf_project_ifc_model_path) do |button|
diff --git a/modules/bim/spec/support/pages/ifc_models/index.rb b/modules/bim/spec/support/pages/ifc_models/index.rb
index 581b3a6f498..76ca8d071a5 100644
--- a/modules/bim/spec/support/pages/ifc_models/index.rb
+++ b/modules/bim/spec/support/pages/ifc_models/index.rb
@@ -50,7 +50,7 @@ module Pages
def add_model_allowed(allowed)
if allowed
- click_toolbar_button "IFC model"
+ click_toolbar_button "ifc-create-button"
expect_correct_page_loaded '.button[type="submit"]'
expect(page).to have_current_path new_bcf_project_ifc_model_path(project)
@@ -112,7 +112,7 @@ module Pages
end
def show_defaults(models = [])
- click_toolbar_button "Show defaults"
+ click_toolbar_button "ifc-show-default-button"
expect_correct_page_loaded '[data-test-selector="op-ifc-viewer--container"]'
@@ -135,10 +135,8 @@ module Pages
end
end
- def click_toolbar_button(name)
- within ".toolbar" do
- page.find(".button", text: name).click
- end
+ def click_toolbar_button(test_selector)
+ page.find_test_selector(test_selector).click
end
def click_table_icon(model_name, icon_class)
diff --git a/modules/budgets/spec/support/pages/destroy_info.rb b/modules/budgets/spec/support/pages/destroy_info.rb
index 378756d8c61..692d409f599 100644
--- a/modules/budgets/spec/support/pages/destroy_info.rb
+++ b/modules/budgets/spec/support/pages/destroy_info.rb
@@ -38,7 +38,7 @@ module Pages
def expect_loaded
expect(page)
- .to have_content("#{I18n.t(:button_delete)} #{I18n.t(:label_budget_id, id: budget.id)}: #{budget.subject}")
+ .to have_content("#{I18n.t(:button_delete)} #{budget.subject}")
end
def expect_reassign_option
diff --git a/spec/features/repositories/repository_settings_spec.rb b/spec/features/repositories/repository_settings_spec.rb
index 4932ce5be88..2b074a36de6 100644
--- a/spec/features/repositories/repository_settings_spec.rb
+++ b/spec/features/repositories/repository_settings_spec.rb
@@ -86,7 +86,7 @@ RSpec.describe "Repository Settings", :js do
find("a.icon-remove", text: I18n.t(:button_remove)).click
expect(page).to have_css(".op-toast.-warning")
SeleniumHubWaiter.wait
- find("a", text: I18n.t(:button_remove)).click
+ page.find_test_selector("remove-repository-button").click
end
vendor = find('select[name="scm_vendor"]')