diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index 5295e656ab0..9eecfa39390 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -16,7 +16,7 @@ - if current_user .block.todo.hide-expanded = render "shared/issuable/sidebar_todo", todo: todo, issuable: issuable, is_collapsed: true - .block.assignee + .block.assignee.qa-assignee-block = render "shared/issuable/sidebar_assignees", issuable: issuable, can_edit_issuable: can_edit_issuable, signed_in: current_user.present? = render_if_exists 'shared/issuable/sidebar_item_epic', issuable: issuable diff --git a/app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml b/app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml index 3521f71f409..60c34094108 100644 --- a/app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml +++ b/app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml @@ -5,4 +5,4 @@ = dropdown_tag(user_dropdown_label(issuable.assignee_id, "Assignee"), options: { toggle_class: "js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search", title: "Select assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit", placeholder: "Search assignee", data: { first_user: current_user.try(:username), null_user: true, current_user: true, project_id: issuable.project.try(:id), selected: issuable.assignee_id, field_name: "#{issuable.class.model_name.param_key}[assignee_id]", default_label: "Assignee"} }) - = link_to 'Assign to me', '#', class: "assign-to-me-link #{'hide' if issuable.assignee_id == current_user.id}" + = link_to 'Assign to me', '#', class: "assign-to-me-link qa-assign-to-me-link #{'hide' if issuable.assignee_id == current_user.id}" diff --git a/qa/qa/page/merge_request/new.rb b/qa/qa/page/merge_request/new.rb index 1f8f1fbca8e..20d9c336367 100644 --- a/qa/qa/page/merge_request/new.rb +++ b/qa/qa/page/merge_request/new.rb @@ -26,6 +26,10 @@ module QA element :issuable_label end + view 'app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml' do + element :assign_to_me_link + end + def create_merge_request click_element :issuable_create_button end @@ -50,6 +54,10 @@ module QA click_link label.title end + + def assign_to_me + click_element :assign_to_me_link + end end end end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 2fd30e15ffb..869dc0b9d21 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -52,6 +52,7 @@ module QA end view 'app/views/shared/issuable/_sidebar.html.haml' do + element :assignee_block element :labels_block end @@ -100,6 +101,12 @@ module QA end end + def has_assignee?(username) + page.within(element_selector_css(:assignee_block)) do + has_text?(username) + end + end + def has_label?(label) page.within(element_selector_css(:labels_block)) do element = find('span', text: label) diff --git a/qa/qa/resource/merge_request.rb b/qa/qa/resource/merge_request.rb index 77afb3cfcba..45cb317e0eb 100644 --- a/qa/qa/resource/merge_request.rb +++ b/qa/qa/resource/merge_request.rb @@ -63,6 +63,7 @@ module QA page.fill_title(@title) page.fill_description(@description) page.choose_milestone(@milestone) if @milestone + page.assign_to_me if @assignee == 'me' labels.each do |label| page.select_label(label) end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb index d33947f41da..6ddd7dde2cf 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb @@ -4,6 +4,8 @@ module QA context 'Create' do describe 'Merge request creation' do it 'user creates a new merge request' do + gitlab_account_username = "@#{Runtime::User.username}" + Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } @@ -27,6 +29,7 @@ module QA merge_request.description = 'Great feature with milestone' merge_request.project = current_project merge_request.milestone = current_milestone + merge_request.assignee = 'me' merge_request.labels.push(new_label) end @@ -34,6 +37,7 @@ module QA expect(merge_request).to have_content('This is a merge request with a milestone') expect(merge_request).to have_content('Great feature with milestone') expect(merge_request).to have_content(/Opened [\w\s]+ ago/) + expect(merge_request).to have_assignee(gitlab_account_username) expect(merge_request).to have_label(new_label.title) end