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

Christophe Bliard083f939fe35c
diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rb
index 8b4509e9a69..43e468d7f68 100644
--- a/spec/features/support/components/time_logging_modal.rb
+++ b/spec/features/support/components/time_logging_modal.rb
@@ -52,6 +52,7 @@ module Components
end
def submit
+ wait_for_autocompleter_options_to_be_loaded
within modal_container do
click_on I18n.t("button_log_time")
end
diff --git a/spec/support/form_fields/primerized/autocomplete_field.rb b/spec/support/form_fields/primerized/autocomplete_field.rb
index eede4cc6020..fc06de865c7 100644
--- a/spec/support/form_fields/primerized/autocomplete_field.rb
+++ b/spec/support/form_fields/primerized/autocomplete_field.rb
@@ -50,12 +50,6 @@ module FormFields
field_container.find(".ng-clear-wrapper", visible: :all).click
end
- def wait_for_autocompleter_options_to_be_loaded
- if has_css?(".ng-spinner-loader", wait: 0.1)
- expect(page).to have_no_css(".ng-spinner-loader")
- end
- end
-
### expectations
def expect_selected(*values)
diff --git a/spec/support/shared/loading_indicator_saveguard.rb b/spec/support/shared/loading_indicator_saveguard.rb
index 0f857ed4429..cc60291f70f 100644
--- a/spec/support/shared/loading_indicator_saveguard.rb
+++ b/spec/support/shared/loading_indicator_saveguard.rb
@@ -36,3 +36,11 @@
def loading_indicator_saveguard
expect(page).to have_no_css(".op-loading-indicator")
end
+
+# ng-select uses a loading indicator with css class .ng-spinner-loader when
+# loading.
+def wait_for_autocompleter_options_to_be_loaded
+ if has_css?(".ng-spinner-loader", wait: 0.1)
+ expect(page).to have_no_css(".ng-spinner-loader")
+ end
+end