Commit 1885b567 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Fix form_spec.rb failure relating to wait_for_ajax and unneeded commands

parent e012427c
require 'rails_helper' require 'rails_helper'
describe 'New/edit issue', feature: true, js: true do describe 'New/edit issue', :feature, :js do
include GitlabRoutingHelper include GitlabRoutingHelper
include ActionView::Helpers::JavaScriptHelper include ActionView::Helpers::JavaScriptHelper
include WaitForAjax
let!(:project) { create(:project) } let!(:project) { create(:project) }
let!(:user) { create(:user)} let!(:user) { create(:user)}
...@@ -28,6 +29,8 @@ describe 'New/edit issue', feature: true, js: true do ...@@ -28,6 +29,8 @@ describe 'New/edit issue', feature: true, js: true do
click_button 'Unassigned' click_button 'Unassigned'
end end
wait_for_ajax
it 'unselects other assignees when unassigned is selected' do it 'unselects other assignees when unassigned is selected' do
page.within '.dropdown-menu-user' do page.within '.dropdown-menu-user' do
click_link user2.name click_link user2.name
...@@ -65,6 +68,9 @@ describe 'New/edit issue', feature: true, js: true do ...@@ -65,6 +68,9 @@ describe 'New/edit issue', feature: true, js: true do
expect(find('a', text: 'Assign to me')).to be_visible expect(find('a', text: 'Assign to me')).to be_visible
click_button 'Unassigned' click_button 'Unassigned'
wait_for_ajax
page.within '.dropdown-menu-user' do page.within '.dropdown-menu-user' do
click_link user2.name click_link user2.name
end end
...@@ -148,16 +154,15 @@ describe 'New/edit issue', feature: true, js: true do ...@@ -148,16 +154,15 @@ describe 'New/edit issue', feature: true, js: true do
it 'correctly updates the selected user when changing assignee' do it 'correctly updates the selected user when changing assignee' do
click_button 'Unassigned' click_button 'Unassigned'
wait_for_ajax
page.within '.dropdown-menu-user' do page.within '.dropdown-menu-user' do
click_link user.name click_link user.name
end end
expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user.id.to_s) expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user.id.to_s)
click_button user.name
expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user.id.to_s) expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user.id.to_s)
# check the ::before pseudo element to ensure checkmark icon is present # check the ::before pseudo element to ensure checkmark icon is present
expect(before_for_selector('.dropdown-menu-selectable a.is-active')).not_to eq('') expect(before_for_selector('.dropdown-menu-selectable a.is-active')).not_to eq('')
expect(before_for_selector('.dropdown-menu-selectable a:not(.is-active)')).to eq('') expect(before_for_selector('.dropdown-menu-selectable a:not(.is-active)')).to eq('')
...@@ -167,9 +172,6 @@ describe 'New/edit issue', feature: true, js: true do ...@@ -167,9 +172,6 @@ describe 'New/edit issue', feature: true, js: true do
end end
expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user2.id.to_s) expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user2.id.to_s)
click_button user2.name
expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user2.id.to_s) expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user2.id.to_s)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment