Commit ba5e5f8a authored by ievgenChernikov's avatar ievgenChernikov

Extended MR spec to set assignee

parent c8fa8da2
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
- if current_user - if current_user
.block.todo.hide-expanded .block.todo.hide-expanded
= render "shared/issuable/sidebar_todo", todo: todo, issuable: issuable, is_collapsed: true = 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 "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 = render_if_exists 'shared/issuable/sidebar_item_epic', issuable: issuable
......
...@@ -5,4 +5,4 @@ ...@@ -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", = 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"} }) 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 ...@@ -26,6 +26,10 @@ module QA
element :issuable_label element :issuable_label
end end
view 'app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml' do
element :assign_to_me_link
end
def create_merge_request def create_merge_request
click_element :issuable_create_button click_element :issuable_create_button
end end
...@@ -50,6 +54,10 @@ module QA ...@@ -50,6 +54,10 @@ module QA
click_link label.title click_link label.title
end end
def assign_to_me
click_element :assign_to_me_link
end
end end
end end
end end
......
...@@ -52,6 +52,7 @@ module QA ...@@ -52,6 +52,7 @@ module QA
end end
view 'app/views/shared/issuable/_sidebar.html.haml' do view 'app/views/shared/issuable/_sidebar.html.haml' do
element :assignee_block
element :labels_block element :labels_block
end end
...@@ -100,6 +101,12 @@ module QA ...@@ -100,6 +101,12 @@ module QA
end end
end end
def has_assignee?(username)
page.within(element_selector_css(:assignee_block)) do
has_text?(username)
end
end
def has_label?(label) def has_label?(label)
page.within(element_selector_css(:labels_block)) do page.within(element_selector_css(:labels_block)) do
element = find('span', text: label) element = find('span', text: label)
......
...@@ -63,6 +63,7 @@ module QA ...@@ -63,6 +63,7 @@ module QA
page.fill_title(@title) page.fill_title(@title)
page.fill_description(@description) page.fill_description(@description)
page.choose_milestone(@milestone) if @milestone page.choose_milestone(@milestone) if @milestone
page.assign_to_me if @assignee == 'me'
labels.each do |label| labels.each do |label|
page.select_label(label) page.select_label(label)
end end
......
...@@ -4,6 +4,8 @@ module QA ...@@ -4,6 +4,8 @@ module QA
context 'Create' do context 'Create' do
describe 'Merge request creation' do describe 'Merge request creation' do
it 'user creates a new merge request' do it 'user creates a new merge request' do
gitlab_account_username = "@#{Runtime::User.username}"
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials } Page::Main::Login.act { sign_in_using_credentials }
...@@ -27,6 +29,7 @@ module QA ...@@ -27,6 +29,7 @@ module QA
merge_request.description = 'Great feature with milestone' merge_request.description = 'Great feature with milestone'
merge_request.project = current_project merge_request.project = current_project
merge_request.milestone = current_milestone merge_request.milestone = current_milestone
merge_request.assignee = 'me'
merge_request.labels.push(new_label) merge_request.labels.push(new_label)
end end
...@@ -34,6 +37,7 @@ module QA ...@@ -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('This is a merge request with a milestone')
expect(merge_request).to have_content('Great feature with 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_content(/Opened [\w\s]+ ago/)
expect(merge_request).to have_assignee(gitlab_account_username)
expect(merge_request).to have_label(new_label.title) expect(merge_request).to have_label(new_label.title)
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