Commit d85adbac authored by Sanad Liaquat's avatar Sanad Liaquat

Now using API to create group

parent 588ff19a
......@@ -65,6 +65,16 @@ module QA
end
def sign_in_using_admin_credentials
# Don't try to log-in if we're already logged-in as admin
return if Page::Main::Menu.perform do |menu|
menu.has_admin_area_link?(wait: 0)
end
# If already logged in as non admin, logout first
Page::Main::Menu.perform do |menu|
menu.sign_out if menu.has_personal_area?(wait: 0)
end
admin = QA::Resource::User.new.tap do |user|
user.username = QA::Runtime::User.admin_username
user.password = QA::Runtime::User.admin_password
......
......@@ -101,6 +101,8 @@ module QA
url: url,
payload: payload,
verify_ssl: false)
rescue RestClient::ExceptionWithResponse => e
e.response
end
def get(url)
......@@ -108,6 +110,8 @@ module QA
method: :get,
url: url,
verify_ssl: false)
rescue RestClient::ExceptionWithResponse => e
e.response
end
end
end
......
......@@ -23,7 +23,7 @@ module QA
create_users_via_api(users)
Runtime::Browser.visit(:gitlab, Page::Main::Login)
create_sandbox_group_with_user(user: 'enguser1', group_name: 'Synched-engineering-group')
create_group_with_user_via_api(user: 'enguser1', group_name: 'Synched-engineering-group')
EE::Page::Group::Menu.perform(&:go_to_ldap_sync_settings)
......@@ -60,7 +60,7 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login)
create_sandbox_group_with_user(user: 'hruser1', group_name: 'Synched-human-resources-group')
create_group_with_user_via_api(user: 'hruser1', group_name: 'Synched-human-resources-group')
EE::Page::Group::Menu.perform(&:go_to_ldap_sync_settings)
......@@ -86,7 +86,7 @@ module QA
end
end
def create_sandbox_group_with_user(user: nil, group_name: nil)
def create_group_with_user_via_api(user: nil, group_name: nil)
Page::Main::Login.perform do |login_page|
login_page.sign_in_using_ldap_credentials(username: user, password: 'password')
end
......@@ -95,9 +95,13 @@ module QA
expect(menu).to have_personal_area
end
Resource::Sandbox.fabricate_via_browser_ui! do |resource|
Runtime::Env.personal_access_token = Resource::PersonalAccessToken.fabricate!.access_token
group = Resource::Sandbox.fabricate_via_api! do |resource|
resource.path = "#{group_name}-#{SecureRandom.hex(4)}"
end
group.visit!
end
def verify_users_synched(expected_users)
......
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