Commit 5944ff57 authored by Mark Lapierre's avatar Mark Lapierre

Add test to add a new project member

Adds a new QA test and the required page objects and related changes
parent 8f13e071
...@@ -309,7 +309,7 @@ ...@@ -309,7 +309,7 @@
%span %span
= _('General') = _('General')
= nav_link(controller: :project_members) do = nav_link(controller: :project_members) do
= link_to project_project_members_path(@project), title: _('Members') do = link_to project_project_members_path(@project), title: _('Members'), class: 'qa-link-members-settings' do
%span %span
= _('Members') = _('Members')
- if can_edit - if can_edit
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= form_for @project_member, as: :project_member, url: project_project_members_path(@project), html: { class: 'users-project-form' } do |f| = form_for @project_member, as: :project_member, url: project_project_members_path(@project), html: { class: 'users-project-form' } do |f|
.form-group .form-group
= label_tag :user_ids, "Select members to invite", class: "label-bold" = label_tag :user_ids, "Select members to invite", class: "label-bold"
= users_select_tag(:user_ids, multiple: true, class: "input-clamp", scope: :all, email_user: true, placeholder: "Search for members to update or invite") = users_select_tag(:user_ids, multiple: true, class: "input-clamp qa-member-select-input", scope: :all, email_user: true, placeholder: "Search for members to update or invite")
.form-group .form-group
= label_tag :access_level, "Choose a role permission", class: "label-bold" = label_tag :access_level, "Choose a role permission", class: "label-bold"
.select-wrapper .select-wrapper
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
= label_tag :expires_at, 'Access expiration date', class: 'label-bold' = label_tag :expires_at, 'Access expiration date', class: 'label-bold'
= text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date', placeholder: 'Expiration date' = text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date', placeholder: 'Expiration date'
%i.clear-icon.js-clear-input %i.clear-icon.js-clear-input
= f.submit "Add to project", class: "btn btn-success" = f.submit "Add to project", class: "btn btn-success qa-add-member-button"
= link_to "Import", import_project_project_members_path(@project), class: "btn btn-default", title: "Import members from another project" = link_to "Import", import_project_project_members_path(@project), class: "btn btn-default", title: "Import members from another project"
...@@ -14,5 +14,5 @@ ...@@ -14,5 +14,5 @@
%button.member-search-btn{ type: "submit", "aria-label" => "Submit search" } %button.member-search-btn{ type: "submit", "aria-label" => "Submit search" }
= icon("search") = icon("search")
= render 'shared/members/sort_dropdown' = render 'shared/members/sort_dropdown'
%ul.content-list.members-list %ul.content-list.members-list.qa-members-list
= render partial: 'shared/members/member', collection: members, as: :member = render partial: 'shared/members/member', collection: members, as: :member
...@@ -180,6 +180,7 @@ module QA ...@@ -180,6 +180,7 @@ module QA
autoload :SecretVariables, 'qa/page/project/settings/secret_variables' autoload :SecretVariables, 'qa/page/project/settings/secret_variables'
autoload :Runners, 'qa/page/project/settings/runners' autoload :Runners, 'qa/page/project/settings/runners'
autoload :MergeRequest, 'qa/page/project/settings/merge_request' autoload :MergeRequest, 'qa/page/project/settings/merge_request'
autoload :Members, 'qa/page/project/settings/members'
end end
module Issue module Issue
...@@ -267,6 +268,7 @@ module QA ...@@ -267,6 +268,7 @@ module QA
autoload :GroupsFilter, 'qa/page/component/groups_filter' autoload :GroupsFilter, 'qa/page/component/groups_filter'
autoload :Select2, 'qa/page/component/select2' autoload :Select2, 'qa/page/component/select2'
autoload :DropdownFilter, 'qa/page/component/dropdown_filter' autoload :DropdownFilter, 'qa/page/component/dropdown_filter'
autoload :UsersSelect, 'qa/page/component/users_select'
module Issuable module Issuable
autoload :Common, 'qa/page/component/issuable/common' autoload :Common, 'qa/page/component/issuable/common'
......
# frozen_string_literal: true
module QA
module Page
module Component
module UsersSelect
def select_user(element, username)
find("#{element_selector_css(element)} input").set(username)
find('.ajax-users-dropdown .user-username', text: "@#{username}").click
end
end
end
end
end
...@@ -9,6 +9,7 @@ module QA ...@@ -9,6 +9,7 @@ module QA
element :settings_link, 'link_to edit_project_path' element :settings_link, 'link_to edit_project_path'
element :repository_link, "title: _('Repository')" element :repository_link, "title: _('Repository')"
element :link_pipelines element :link_pipelines
element :link_members_settings
element :pipelines_settings_link, "title: _('CI / CD')" element :pipelines_settings_link, "title: _('CI / CD')"
element :operations_kubernetes_link, "title: _('Kubernetes')" element :operations_kubernetes_link, "title: _('Kubernetes')"
element :operations_environments_link element :operations_environments_link
...@@ -51,6 +52,14 @@ module QA ...@@ -51,6 +52,14 @@ module QA
end end
end end
def click_members_settings
hover_settings do
within_submenu do
click_element :link_members_settings
end
end
end
def click_operations_kubernetes def click_operations_kubernetes
hover_operations do hover_operations do
within_submenu do within_submenu do
......
# frozen_string_literal: true
module QA
module Page
module Project
module Settings
class Members < Page::Base
include Page::Component::UsersSelect
view 'app/views/projects/project_members/_new_project_member.html.haml' do
element :member_select_input
element :add_member_button
end
view 'app/views/projects/project_members/_team.html.haml' do
element :members_list
end
def add_member(username)
select_user :member_select_input, username
click_element :add_member_button
end
end
end
end
end
end
# frozen_string_literal: true
module QA
context :manage do
describe 'Add project member' do
it 'user adds project member' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
user = Factory::Resource::User.fabricate!
Page::Main::Menu.perform { |main| main.sign_out }
Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::Project.fabricate! do |resource|
resource.name = 'add-member-project'
end
Page::Project::Menu.act { click_members_settings }
Page::Project::Settings::Members.perform do |page|
page.add_member(user.username)
end
expect(page).to have_content("#{user.name} @#{user.username} Given access")
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