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 features reliant on Capybara hidden heuristics

Alexander Brandon Coles088da4bd59aa
diff --git a/spec/features/wiki/child_pages_spec.rb b/spec/features/wiki/child_pages_spec.rb
index ac5bee7c961..f8b1501db8d 100644
--- a/spec/features/wiki/child_pages_spec.rb
+++ b/spec/features/wiki/child_pages_spec.rb
@@ -69,8 +69,8 @@ RSpec.describe "wiki child pages", :js, :selenium do
end
# hierarchy displayed in the sidebar
- expect(page).to have_css(".pages-hierarchy",
- text: "#{parent_page.title}\n#{child_page_name}")
+ expect(page).to have_css(".pages-hierarchy", text: parent_page.title)
+ expect(page).to have_css(".pages-hierarchy", text: child_page_name)
# on toc page
visit index_project_wiki_index_path(project)
diff --git a/spec/features/work_packages/table/configuration_modal/column_spec.rb b/spec/features/work_packages/table/configuration_modal/column_spec.rb
index 067dd119857..222accbcb51 100644
--- a/spec/features/work_packages/table/configuration_modal/column_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/column_spec.rb
@@ -78,14 +78,11 @@ RSpec.describe "Work Package table configuration modal columns spec", :js do
sleep 1
columns.apply
- expect(page).to have_css(".wp-table--table-header", text: "ID")
- expect(page).to have_css(".wp-table--table-header", text: "PROJECT")
- expect(page).to have_css(".wp-table--table-header", text: "SUBJECT")
-
- names = all(".wp-table--table-header").map(&:text)
- # Depending on what browser is used, subject column may be first or second
- # it doesn't matter for the outcome of this test
- expect(names).to eq(%w[SUBJECT ID PROJECT]).or(eq(%w[ID SUBJECT PROJECT]))
+
+ expect(page).to have_selector :columnheader, text: /.+/, count: 3
+ expect(page).to have_selector :columnheader, "ID"
+ expect(page).to have_selector :columnheader, "Subject"
+ expect(page).to have_selector :columnheader, "Project", colindex: 2
end
end
end