Add E2E spec to ensure that issue closes
Add E2E spec to test that issue closes with commit message
This commit is contained in:
parent
a3c25718ac
commit
8a5aa52813
7 changed files with 77 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
|||
= render partial: 'signature', object: @commit.signature
|
||||
%strong
|
||||
#{ s_('CommitBoxTitle|Commit') }
|
||||
%span.commit-sha= @commit.short_id
|
||||
%span.commit-sha{ data: { qa_selector: 'commit_sha_content' } }= @commit.short_id
|
||||
= clipboard_button(text: @commit.id, title: _('Copy commit SHA to clipboard'))
|
||||
%span.d-none.d-sm-inline= _('authored')
|
||||
#{time_ago_with_tooltip(@commit.authored_date)}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class: "d-none d-sm-none d-md-block btn btn-grouped btn-close js-btn-issue-action #{issuable_button_visibility(issuable, true)}", title: "Close #{display_issuable_type}"
|
||||
- if can_reopen
|
||||
= link_to "Reopen #{display_issuable_type}", reopen_issuable_path(issuable), method: button_method,
|
||||
class: "d-none d-sm-none d-md-block btn btn-grouped btn-reopen js-btn-issue-action #{issuable_button_visibility(issuable, false)}", title: "Reopen #{display_issuable_type}"
|
||||
class: "d-none d-sm-none d-md-block btn btn-grouped btn-reopen js-btn-issue-action #{issuable_button_visibility(issuable, false)}", title: "Reopen #{display_issuable_type}", data: { qa_selector: 'reopen_issue_button' }
|
||||
- else
|
||||
- if can_update && !are_close_and_open_buttons_hidden
|
||||
= render 'shared/issuable/close_reopen_report_toggle', issuable: issuable
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#{issuables_state_counter_text(type, :closed, display_count)}
|
||||
- else
|
||||
%li{ class: active_when(params[:state] == 'closed') }>
|
||||
= link_to page_filter_path(state: 'closed'), id: 'state-closed', title: 'Filter by issues that are currently closed.', data: { state: 'closed' } do
|
||||
= link_to page_filter_path(state: 'closed'), id: 'state-closed', title: 'Filter by issues that are currently closed.', data: { state: 'closed', qa_selector: 'closed_issues_link' } do
|
||||
#{issuables_state_counter_text(type, :closed, display_count)}
|
||||
|
||||
= render 'shared/issuable/nav_links/all', page_context_word: page_context_word, counter: issuables_state_counter_text(type, :all, display_count)
|
||||
|
|
|
@ -9,6 +9,7 @@ module QA
|
|||
element :options_button
|
||||
element :email_patches
|
||||
element :plain_diff
|
||||
element :commit_sha_content
|
||||
end
|
||||
|
||||
def select_email_patches
|
||||
|
@ -20,6 +21,10 @@ module QA
|
|||
click_element :options_button
|
||||
click_element :plain_diff
|
||||
end
|
||||
|
||||
def commit_sha
|
||||
find_element(:commit_sha_content).text
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,9 +9,17 @@ module QA
|
|||
element :issue_link, 'link_to issue.title' # rubocop:disable QA/ElementWithPattern
|
||||
end
|
||||
|
||||
view 'app/views/shared/issuable/_nav.html.haml' do
|
||||
element :closed_issues_link
|
||||
end
|
||||
|
||||
def click_issue_link(title)
|
||||
click_link(title)
|
||||
end
|
||||
|
||||
def click_closed_issues_link
|
||||
click_element :closed_issues_link
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,6 +37,10 @@ module QA
|
|||
element :dropdown_menu_labels
|
||||
end
|
||||
|
||||
view 'app/views/shared/issuable/_close_reopen_button.html.haml' do
|
||||
element :reopen_issue_button
|
||||
end
|
||||
|
||||
# Adds a comment to an issue
|
||||
# attachment option should be an absolute path
|
||||
def comment(text, attachment: nil, filter: :all_activities)
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
context 'Plan' do
|
||||
describe 'Close issue' do
|
||||
let(:issue_title) { 'issue title' }
|
||||
let(:commit_message) { 'Closes' }
|
||||
|
||||
before do
|
||||
Runtime::Browser.visit(:gitlab, Page::Main::Login)
|
||||
Page::Main::Login.perform(&:sign_in_using_credentials)
|
||||
|
||||
issue = Resource::Issue.fabricate_via_api! do |issue|
|
||||
issue.title = issue_title
|
||||
end
|
||||
|
||||
@project = issue.project
|
||||
@issue_id = issue.api_response[:iid]
|
||||
|
||||
# Initial commit should be pushed because
|
||||
# the very first commit to the project doesn't close the issue
|
||||
# https://gitlab.com/gitlab-org/gitlab-ce/issues/38965
|
||||
push_commit('Initial commit')
|
||||
end
|
||||
|
||||
it 'user closes an issue by pushing commit' do
|
||||
push_commit("#{commit_message} ##{@issue_id}", false)
|
||||
|
||||
@project.visit!
|
||||
Page::Project::Show.perform do |show|
|
||||
show.click_commit(commit_message)
|
||||
end
|
||||
commit_sha = Page::Project::Commit::Show.perform(&:commit_sha)
|
||||
|
||||
Page::Project::Menu.perform(&:click_issues)
|
||||
Page::Project::Issue::Index.perform do |index|
|
||||
index.click_closed_issues_link
|
||||
index.click_issue_link(issue_title)
|
||||
end
|
||||
|
||||
Page::Project::Issue::Show.perform do |show|
|
||||
expect(show).to have_element(:reopen_issue_button)
|
||||
expect(show).to have_content("closed via commit #{commit_sha}")
|
||||
end
|
||||
end
|
||||
|
||||
def push_commit(commit_message, new_branch = true)
|
||||
Resource::Repository::ProjectPush.fabricate! do |push|
|
||||
push.commit_message = commit_message
|
||||
push.new_branch = new_branch
|
||||
push.file_content = commit_message
|
||||
push.project = @project
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue