diff options
author | Nick Thomas <nick@gitlab.com> | 2019-01-26 00:39:28 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-01-28 11:20:54 +0000 |
commit | 654f7fe8ffbce488c11c38f46e2b2f3bea3b9fee (patch) | |
tree | 861426cfb440df96bd073646e63a8a68a02bf00d | |
parent | 49c12f9b0fec9a0153f866a0f6f27ed5eb336bf0 (diff) | |
download | gitlab-ce-654f7fe8ffbce488c11c38f46e2b2f3bea3b9fee.tar.gz |
Wait for requests in specs before interacting with select2
-rw-r--r-- | spec/features/projects/settings/user_changes_default_branch_spec.rb | 3 | ||||
-rw-r--r-- | spec/support/helpers/select2_helper.rb | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/spec/features/projects/settings/user_changes_default_branch_spec.rb b/spec/features/projects/settings/user_changes_default_branch_spec.rb index 7dc18601f50..fcf05e04a5c 100644 --- a/spec/features/projects/settings/user_changes_default_branch_spec.rb +++ b/spec/features/projects/settings/user_changes_default_branch_spec.rb @@ -15,9 +15,6 @@ describe 'Projects > Settings > User changes default branch' do let(:project) { create(:project, :repository, namespace: user.namespace) } it 'allows to change the default branch', :js do - # Otherwise, running JS may overwrite our change to project_default_branch - wait_for_requests - select2('fix', from: '#project_default_branch') page.within '#default-branch-settings' do diff --git a/spec/support/helpers/select2_helper.rb b/spec/support/helpers/select2_helper.rb index 90618ba5b19..100e62489ab 100644 --- a/spec/support/helpers/select2_helper.rb +++ b/spec/support/helpers/select2_helper.rb @@ -11,9 +11,13 @@ # module Select2Helper + include WaitForRequests + def select2(value, options = {}) raise ArgumentError, 'options must be a Hash' unless options.is_a?(Hash) + wait_for_requests unless options[:async] + selector = options.fetch(:from) first(selector, visible: false) |