summaryrefslogtreecommitdiff
path: root/spec/support/select2_helper.rb
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-10-16 12:37:52 -0500
committerEric Eastwood <contact@ericeastwood.com>2017-10-19 14:01:15 -0500
commit43377979c6cfee922702a5dc6324fded96b1f111 (patch)
tree8ac0061a979a611c9927e04815a1df5a71d2d505 /spec/support/select2_helper.rb
parent96d8c7fff114911faa7d3e1b6322c2b9e3377e9b (diff)
downloadgitlab-ce-43377979c6cfee922702a5dc6324fded96b1f111.tar.gz
Check for element before evaluate_script
Tip from https://robots.thoughtbot.com/write-reliable-asynchronous-integration-tests-with-capybara#directly-interacting-with-javascript
Diffstat (limited to 'spec/support/select2_helper.rb')
-rw-r--r--spec/support/select2_helper.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/spec/support/select2_helper.rb b/spec/support/select2_helper.rb
index 6b1853c2364..55da961e173 100644
--- a/spec/support/select2_helper.rb
+++ b/spec/support/select2_helper.rb
@@ -16,6 +16,7 @@ module Select2Helper
selector = options.fetch(:from)
+ first(selector, visible: false)
if options[:multiple]
execute_script("$('#{selector}').select2('val', ['#{value}']).trigger('change');")
else