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
attempt to fix flickering spec - use expectation instead of all
ulferts98ad58542d78
diff --git a/spec/features/work_packages/edit_work_package_spec.rb b/spec/features/work_packages/edit_work_package_spec.rbindex 6f041160ac4..86fa32985bd 100644--- a/spec/features/work_packages/edit_work_package_spec.rb+++ b/spec/features/work_packages/edit_work_package_spec.rb@@ -275,14 +275,12 @@ RSpec.describe "edit work package", :js docompleter = wp_page.edit_field field_namecompleter.activate!- options = visible_user_auto_completer_options-expected_options = [{ name: manager.name, email: nil }, # Manager's email should not be visible{ name: dev.name, email: dev.mail } # Developer's email should be visible]- expect(options).to eq(expected_options)+ expect_visible_user_auto_completer_options(expected_options)endend@@ -291,8 +289,6 @@ RSpec.describe "edit work package", :js docompleter = wp_page.edit_field field_namecompleter.activate!- options = visible_user_auto_completer_options-expected_options = [# With the right permissions, you can see other users email address{ name: manager.name,@@ -302,7 +298,7 @@ RSpec.describe "edit work package", :js doemail: dev.mail }]- expect(options).to eq(expected_options)+ expect_visible_user_auto_completer_options(expected_options)endenddiff --git a/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb b/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rbindex 76bd7b5a259..89a5e80da42 100644--- a/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb+++ b/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb@@ -159,31 +159,33 @@ module Components::Autocompleterexpect(element).to have_css(".ng-value .ng-value-label", text: value, wait: 10)end- # Finds the currently visible, expanded user auto completer and returns its dropdown menu options.+ # Checks for the currently visible, expanded user auto completer to contain the provided options.# A user always has a name, but their email is only visible in certain circumstances, so that value# might be nil.#- # The options are returned as an Array of Hashes, like this example with two users:+ # The expected options are to be provided as an Array of Hashes, like this example with two users:## [# { name: "Bob", email: nil },# { name: "Alice", email: "[email protected]" }# ]#- # 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']").filter_map do |opt|- name = opt.find(".op-user-autocompleter--name", wait: 0).text- email =- if opt.has_css?(".op-autocompleter__option-principal-email", wait: 0)- opt.find(".op-autocompleter__option-principal-email", wait: 0).text+ # The order the elements are provided in is also expected.+ def expect_visible_user_auto_completer_options(expected)+ within(".ng-dropdown-panel [role='listbox']") do+ expected.each_with_index do |option, index|+ expect(page)+ .to have_css(".ng-option[role='option']:nth-child(#{index + 1}) .op-user-autocompleter--name",+ text: option[:name])+ if option[:email]+ expect(page)+ .to have_css(".ng-option[role='option']:nth-child(#{index + 1}) .op-autocompleter__option-principal-email",+ text: option[:email])+ else+ expect(page)+ .to have_no_css(".ng-option[role='option']:nth-child(#{index + 1}) .op-autocompleter__option-principal-email")end-- { 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+ endendendenddiff --git a/spec/support/components/common/filters.rb b/spec/support/components/common/filters.rbindex 42bc90d5eb0..e9e7fdbdce0 100644--- a/spec/support/components/common/filters.rb+++ b/spec/support/components/common/filters.rb@@ -109,10 +109,8 @@ module Componentswithin(selected_filter) dofind('[data-filter-autocomplete="true"]').clickend- wait_for_network_idle if using_cuprite?- options = visible_user_auto_completer_options- expect(options).to eq(expected_options)+ expect_visible_user_auto_completer_options(expected_options)enddef apply_operator(name, human_operator)