Commit 8b43c5c9 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'ichernikov/add-asignee-to-mr' into 'master'

[QA] Extend create_merge_request_spec to set assignee to MR

See merge request gitlab-org/gitlab-ce!23488
parents 77a21b2a ba5e5f8a
......@@ -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
......
......@@ -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}"
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
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