Wait for requests in specs before interacting with select2

This commit is contained in:
Nick Thomas 2019-01-26 00:39:28 +00:00
parent 49c12f9b0f
commit 654f7fe8ff
No known key found for this signature in database
GPG Key ID: 2A313A47AFADACE9
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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)