Commit 40cfd00d authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch...

Merge branch '31404-flaky-spec-spec-features-profiles-user_visits_profile_preferences_page_spec-rb-40' into 'master'

Fix flaky select2 related specs

Closes #31404

See merge request gitlab-org/gitlab!17750
parents 3c1ca0e1 165b341a
......@@ -27,6 +27,8 @@ describe 'Edit group settings', :js do
it 'adds new LDAP synchronization', :js do
page.within('form#new_ldap_group_link') do
choose('sync_method_group')
select2 'my-group-cn', from: '#ldap_group_link_cn'
select 'Developer', from: 'ldap_group_link_group_access'
......@@ -45,7 +47,6 @@ describe 'Edit group settings', :js do
end
it 'shows the LDAP group section' do
choose('sync_method_filter') # choose filter first, as group's the default
choose('sync_method_group')
expect(page).to have_content("Synchronize #{group.name}'s members with this LDAP group")
......
......@@ -3,7 +3,6 @@
require 'spec_helper'
describe 'Import/Export - project import integration test', :js do
include Select2Helper
include GitHelpers
let(:user) { create(:user) }
......@@ -31,7 +30,6 @@ describe 'Import/Export - project import integration test', :js do
it 'user imports an exported project successfully' do
visit new_project_path
select2(namespace.id, from: '#project_namespace_id')
fill_in :project_name, with: project_name, visible: true
click_import_project_tab
click_link 'GitLab export'
......@@ -78,7 +76,6 @@ describe 'Import/Export - project import integration test', :js do
visit new_project_path
select2(user.namespace.id, from: '#project_namespace_id')
fill_in :project_name, with: project.name, visible: true
click_import_project_tab
click_link 'GitLab export'
......
......@@ -24,7 +24,7 @@ module Select2Helper
selector = options.fetch(:from)
first(selector, visible: false)
ensure_select2_loaded(selector)
if options[:multiple]
execute_script("$('#{selector}').select2('val', ['#{value}']).trigger('change');")
......@@ -34,14 +34,24 @@ module Select2Helper
end
def open_select2(selector)
ensure_select2_loaded(selector)
execute_script("$('#{selector}').select2('open');")
end
def close_select2(selector)
ensure_select2_loaded(selector)
execute_script("$('#{selector}').select2('close');")
end
def scroll_select2_to_bottom(selector)
evaluate_script "$('#{selector}').scrollTop($('#{selector}')[0].scrollHeight); $('#{selector}');"
end
private
def ensure_select2_loaded(selector)
first(selector, visible: :all).sibling('.select2-container')
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