From 43377979c6cfee922702a5dc6324fded96b1f111 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 16 Oct 2017 12:37:52 -0500 Subject: Check for element before evaluate_script Tip from https://robots.thoughtbot.com/write-reliable-asynchronous-integration-tests-with-capybara#directly-interacting-with-javascript --- spec/features/dashboard/issues_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/features/dashboard') diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 5610894fd9a..a8919976c31 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -87,8 +87,10 @@ RSpec.describe 'Dashboard Issues' do project_path = "/#{project.path_with_namespace}" project_json = { name: project.name_with_namespace, url: project_path }.to_json - # similate selection, and prevent overlap by dropdown menu + # simulate selection, and prevent overlap by dropdown menu + first('.project-item-select', visible: false) execute_script("$('.project-item-select').val('#{project_json}').trigger('change');") + find('#select2-drop-mask', visible: false) execute_script("$('#select2-drop-mask').remove();") find('.new-project-item-link').trigger('click') -- cgit v1.2.1