Commit c9780a46 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'fix-e2e-invite-group-method' into 'master'

Fix and Refactor invite_group Method and Update invite_group_to_project_spec

See merge request gitlab-org/gitlab!77609
parents 3e98649b 8acbce17
......@@ -47,40 +47,43 @@ module QA
fill_element :members_token_select_input, username
Support::WaitForRequests.wait_for_requests
click_button username
# Guest option is selected by default, skipping these steps if desired option is 'Guest'
unless access_level == 'Guest'
click_element :access_level_dropdown
click_button access_level
end
click_element :invite_button
set_access_level(access_level)
end
Support::WaitForRequests.wait_for_requests
page.refresh
send_invite
end
def invite_group(group_name, group_access = Resource::Members::AccessLevel::GUEST)
def invite_group(group_name, access_level = 'Guest')
open_invite_group_modal
fill_element :access_level_dropdown, with: group_access
within_element(:invite_members_modal_content) do
click_button 'Select a group'
click_button 'Select a group'
# Helps stabilize race condition with concurrent group API calls while searching
# TODO: Replace with `fill_element :group_select_dropdown_search_field, group_name` when this bug is resolved: https://gitlab.com/gitlab-org/gitlab/-/issues/349379
send_keys_to_element(:group_select_dropdown_search_field, group_name)
# Helps stabilize race condition with concurrent group API calls while searching
# TODO: Replace with `fill_element :group_select_dropdown_search_field, group_name` when this bug is resolved: https://gitlab.com/gitlab-org/gitlab/-/issues/349379
send_keys_to_element(:group_select_dropdown_search_field, group_name)
Support::WaitForRequests.wait_for_requests
click_button group_name
set_access_level(access_level)
end
Support::WaitForRequests.wait_for_requests
send_invite
end
click_button group_name
private
click_element :invite_button
def set_access_level(access_level)
# Guest option is selected by default, skipping these steps if desired option is 'Guest'
unless access_level == 'Guest'
click_element :access_level_dropdown
click_button access_level
end
end
def send_invite
click_element :invite_button
Support::WaitForRequests.wait_for_requests
page.refresh
end
end
......
......@@ -5,10 +5,10 @@ module QA
RSpec.describe 'Manage', :requires_admin, :transient, issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/349379' do
describe 'Invite group' do
shared_examples 'invites group to project' do
it 'verifies group is added and members can access project' do
it 'verifies group is added and members can access project with correct access level' do
Page::Project::Menu.perform(&:click_members)
Page::Project::Members.perform do |project_members|
project_members.invite_group(group.path)
project_members.invite_group(group.path, 'Developer')
expect(project_members).to have_group(group.path)
end
......@@ -16,7 +16,7 @@ module QA
Flow::Login.sign_in(as: @user)
Page::Dashboard::Projects.perform do |projects|
expect(projects).to have_project_with_access_role(project.name, 'Guest')
expect(projects).to have_project_with_access_role(project.name, 'Developer')
end
project.visit!
......@@ -28,13 +28,13 @@ module QA
end
before(:context) do
Runtime::Feature.enable(:invite_members_group_modal)
@user = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
end
before do
Runtime::Feature.enable(:invite_members_group_modal)
Flow::Login.sign_in
group.add_member(@user, Resource::Members::AccessLevel::GUEST)
group.add_member(@user, Resource::Members::AccessLevel::MAINTAINER)
project.visit!
end
......@@ -78,6 +78,9 @@ module QA
after do
project&.remove_via_api!
group&.remove_via_api!
end
after(:context) do
Runtime::Feature.disable(:invite_members_group_modal)
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