From 8fe96f4e50e8711e376d3ac33a04bced8f6d4f55 Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Tue, 30 Oct 2018 14:43:25 -0400 Subject: [PATCH] Update merge request page object and selectors These are changes from EE that are also relevant to CE from: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8372 --- app/views/projects/merge_requests/_mr_title.html.haml | 2 +- qa/qa/page/merge_request/show.rb | 8 ++++++++ qa/qa/resource/merge_request.rb | 10 +++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/views/projects/merge_requests/_mr_title.html.haml b/app/views/projects/merge_requests/_mr_title.html.haml index 1bf42ded97a..3cd83feb842 100644 --- a/app/views/projects/merge_requests/_mr_title.html.haml +++ b/app/views/projects/merge_requests/_mr_title.html.haml @@ -37,6 +37,6 @@ = link_to 'Reopen', merge_request_path(@merge_request, merge_request: { state_event: :reopen }), method: :put, class: 'reopen-mr-link', title: 'Reopen merge request' - if can_update_merge_request - = link_to 'Edit', edit_project_merge_request_path(@project, @merge_request), class: "d-none d-sm-none d-md-block btn btn-grouped js-issuable-edit" + = link_to 'Edit', edit_project_merge_request_path(@project, @merge_request), class: "d-none d-sm-none d-md-block btn btn-grouped js-issuable-edit qa-edit-button" = render 'shared/issuable/close_reopen_button', issuable: @merge_request, can_update: can_update_merge_request, can_reopen: can_update_merge_request diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 2e69a89e386..2fd30e15ffb 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -55,6 +55,10 @@ module QA element :labels_block end + view 'app/views/projects/merge_requests/_mr_title.html.haml' do + element :edit_button + end + def fast_forward_possible? !has_text?('Fast-forward merge is not possible') end @@ -163,6 +167,10 @@ module QA all_elements(:discussion_reply).last.click fill_element :reply_input, reply_text end + + def edit! + click_element :edit_button + end end end end diff --git a/qa/qa/resource/merge_request.rb b/qa/qa/resource/merge_request.rb index 466a7942dc6..77afb3cfcba 100644 --- a/qa/qa/resource/merge_request.rb +++ b/qa/qa/resource/merge_request.rb @@ -11,7 +11,9 @@ module QA :target_branch, :assignee, :milestone, - :labels + :labels, + :file_name, + :file_content attribute :project do Project.fabricate! do |resource| @@ -35,8 +37,8 @@ module QA resource.branch_name = target_branch resource.remote_branch = source_branch resource.new_branch = false - resource.file_name = "added_file.txt" - resource.file_content = "File Added" + resource.file_name = file_name + resource.file_content = file_content end end @@ -48,6 +50,8 @@ module QA @assignee = nil @milestone = nil @labels = [] + @file_name = "added_file.txt" + @file_content = "File Added" end def fabricate!