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 share spec

Tobias Dillmannd758437c282e
diff --git a/spec/features/work_packages/share/share_spec.rb b/spec/features/work_packages/share/share_spec.rb
index 8f6ae718c43..321c5edef56 100644
--- a/spec/features/work_packages/share/share_spec.rb
+++ b/spec/features/work_packages/share/share_spec.rb
@@ -460,7 +460,7 @@ RSpec.describe "Work package sharing",
it "allows filtering by and displaying user emails" do
share_modal.search_user(richard.mail)
- share_modal.expect_ng_option("", "Richard Hendricks#{richard.mail}", results_selector: "body")
+ share_modal.expect_ng_option("", "Richard Hendricks #{richard.mail}", results_selector: "body")
end
end
@@ -469,7 +469,7 @@ RSpec.describe "Work package sharing",
# does not display any email addresses
share_modal.search_user("Richard Hendricks")
share_modal.expect_ng_option("", "Richard Hendricks", results_selector: "body")
- share_modal.expect_no_ng_option("", "Richard Hendricks#{richard.mail}", results_selector: "body")
+ share_modal.expect_no_ng_option("", "Richard Hendricks #{richard.mail}", results_selector: "body")
# does not allow filtering by email
share_modal.search_user(richard.mail)
diff --git a/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb b/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb
index 2a73b537b5a..a21b4e2a6dc 100644
--- a/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb
+++ b/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb
@@ -132,12 +132,16 @@ module Components::Autocompleter
#
# The order of elements in the Array is equal to the visible order on the website.
def visible_user_auto_completer_options
- find(".ng-dropdown-panel [role='listbox']").all(".ng-option[role='option']").map do |opt|
+ find(".ng-dropdown-panel [role='listbox']").all(".ng-option[role='option']").filter_map do |opt|
name = opt.find(".op-user-autocompleter--name").text
email_element = opt.all(".op-autocompleter__option-principal-email").first
email = email_element&.text
{ name:, email: }
+ rescue Capybara::ElementNotFound
+ # In rare cases, the auto completer result body includes additional elements that do not contain all of the
+ # expected information. For example in the share modal. We will omit these entries.
+ nil
end
end
end