Commit f4c0abd5 authored by Sanad Liaquat's avatar Sanad Liaquat

Test is complete

parent 4ef33e00
......@@ -108,7 +108,7 @@
= link_to group_group_members_path(@group) do
.nav-icon-container
= sprite_icon('users')
%span.nav-item-name
%span.nav-item-name.qa-group-members-item
= _('Members')
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(path: 'group_members#index', html_options: { class: "fly-out-top-item" } ) do
......
- if Gitlab::Auth::LDAP::Config.group_sync_enabled? && can?(current_user, :admin_ldap_group_links, @group)
= nav_link(path: 'ldap_group_links#index') do
= link_to group_ldap_group_links_path(@group), title: 'LDAP Group' do
= link_to group_ldap_group_links_path(@group), title: 'LDAP Group', class: 'qa-ldap-synchronization-link' do
%span
LDAP Synchronization
......
......@@ -7,7 +7,7 @@
= icon("refresh spin")
Pending sync…
- else
= link_to sync_group_ldap_path(@group), method: :put, class: 'btn' do
= link_to sync_group_ldap_path(@group), method: :put, class: 'btn qa-sync-now-button' do
= icon("refresh")
Sync now
- if @group.ldap_sync_ready? && @group.ldap_sync_last_successful_update_at
......
......@@ -25,7 +25,7 @@
= f.label :cn, class: 'col-form-label col-sm-2' do
LDAP Group cn
.col-sm-10
= f.hidden_field :cn, placeholder: 'Ex. QA group', class: 'xxlarge ajax-ldap-groups-select input-mn-300'
= f.hidden_field :cn, placeholder: 'Ex. QA group', class: 'xxlarge ajax-ldap-groups-select input-mn-300 qa-ldap-group-cn-select'
.form-text.text-muted
Synchronize #{group.name}'s members with this LDAP group.
%br
......@@ -54,4 +54,4 @@
You can manage permission levels for individual group members in the Members tab.
.form-actions
= f.submit 'Add synchronization', class: 'btn btn-success'
= f.submit 'Add synchronization', class: 'btn btn-success qa-add-sync-button'
......@@ -276,6 +276,7 @@ module QA
autoload :GroupsFilter, 'qa/page/component/groups_filter'
autoload :Select2, 'qa/page/component/select2'
autoload :DropdownFilter, 'qa/page/component/dropdown_filter'
autoload :Select2Search, 'qa/page/component/select2_search'
autoload :UsersSelect, 'qa/page/component/users_select'
module Issuable
......
......@@ -17,9 +17,11 @@ module QA
module Group
autoload :Menu, 'qa/ee/page/group/menu'
autoload :SamlSSOSignIn, 'qa/ee/page/group/saml_sso_sign_in'
autoload :Members, 'qa/ee/page/group/members'
module Settings
autoload :SamlSSO, 'qa/ee/page/group/settings/saml_sso'
autoload :LDAPSync, 'qa/ee/page/group/settings/ldap_sync'
end
end
......
# frozen_string_literal: true
module QA
module EE
module Page
module Group
class Members < QA::Page::Base
view 'ee/app/views/groups/group_members/_sync_button.html.haml' do
element :sync_now_button
end
def click_sync_now
click_element :sync_now_button
end
end
end
end
end
end
......@@ -7,12 +7,14 @@ module QA
class Menu < ::QA::Page::Base
view 'ee/app/views/groups/ee/_settings_nav.html.haml' do
element :group_saml_sso_link
element :ldap_synchronization_link
end
view 'app/views/layouts/nav/sidebar/_group.html.haml' do
element :group_sidebar
element :group_sidebar_submenu
element :group_settings_item
element :group_members_item
end
view 'ee/app/views/layouts/nav/ee/_epic_link.html.haml' do
......@@ -27,6 +29,20 @@ module QA
end
end
def go_to_ldap_sync_settings
hover_settings do
within_submenu do
click_element(:ldap_synchronization_link)
end
end
end
def go_to_members
within_sidebar do
click_element(:group_members_item)
end
end
def go_to_group_epics
within_sidebar do
click_element(:group_epics_link)
......
# frozen_string_literal: true
module QA
module EE
module Page
module Group
module Settings
class LDAPSync < ::QA::Page::Base
include QA::Page::Component::Select2Search
view 'ee/app/views/ldap_group_links/_form.html.haml' do
element :ldap_group_cn_select
element :add_sync_button
end
def set_sync_method(method)
choose method
end
def set_group_cn(group_cn)
click_element :ldap_group_cn_select
search_and_select(group_cn)
end
def click_add_sync_button
click_element :add_sync_button
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module Page
module Component
module Select2Search
def search_and_select(item)
wait(reload: false) do
page.has_css?('.select2-input')
end
find('.select2-input').set(item)
find('.select2-result-label', text: item).click
end
end
end
end
end
......@@ -124,16 +124,16 @@ module QA
click_element :standard_tab
end
private
def sign_in_using_ldap_credentials
def sign_in_using_ldap_credentials(username: Runtime::User.ldap_username, password: Runtime::User.ldap_password)
switch_to_ldap_tab
fill_element :username_field, Runtime::User.ldap_username
fill_element :password_field, Runtime::User.ldap_password
fill_element :username_field, username
fill_element :password_field, password
click_element :sign_in_button
end
private
def sign_in_with_saml
set_initial_password_if_present
click_element :saml_login_button
......
# frozen_string_literal: true
module QA
context 'Manage', :orchestrated, :ldap_tls do
describe 'LDAP Group Sync' do
it 'Has LDAP user synced with group' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
# Login and Logout enguser3
Page::Main::Login.perform do |login_page|
login_page.sign_in_using_ldap_credentials(username: 'enguser3', password: 'password')
end
Page::Main::Menu.perform do |menu|
expect(menu).to have_personal_area
end
Page::Main::Menu.perform(&:sign_out)
# Login and Logout enguser2
Page::Main::Login.perform do |login_page|
login_page.sign_in_using_ldap_credentials(username: 'enguser2', password: 'password')
end
Page::Main::Menu.perform do |menu|
expect(menu).to have_personal_area
end
Page::Main::Menu.perform(&:sign_out)
# Login enguser1
Page::Main::Login.perform do |login_page|
login_page.sign_in_using_ldap_credentials(username: 'enguser1', password: 'password')
end
Page::Main::Menu.perform do |menu|
expect(menu).to have_personal_area
end
# Create a sand box group
Factory::Resource::Sandbox.fabricate_via_browser_ui! do |resource|
resource.path = "Synched-engineering-group-#{SecureRandom.hex(4)}"
end
EE::Page::Group::Menu.perform(&:go_to_ldap_sync_settings)
EE::Page::Group::Settings::LDAPSync.perform do |page|
page.set_sync_method('LDAP Group cn')
page.set_group_cn('Engineering')
page.click_add_sync_button
end
EE::Page::Group::Menu.perform(&:go_to_members)
EE::Page::Group::Members.perform(&:click_sync_now)
expect(page).to have_content('ENG User 2')
expect(page).to have_content('ENG User 3')
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