Commit b4c0fa17 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '345509-spec-failure-in-spec-features-issues' into 'master'

Make spec expectations more robust for creating an issue from a thread

See merge request gitlab-org/gitlab!74598
parents fff3d03e bd4df3db
# frozen_string_literal: true
RSpec.shared_examples 'creating an issue for a thread' do
it 'shows an issue with the title filled in' do
it 'shows an issue creation form' do
# Title field is filled in
title_field = page.find_field('issue[title]')
expect(title_field.value).to include(merge_request.title)
end
it 'has a mention of the discussion in the description' do
description_field = page.find_field('issue[description]')
# Has a hidden field for the merge request
merge_request_field = find('#merge_request_to_resolve_discussions_of', visible: false)
expect(merge_request_field.value).to eq(merge_request.iid.to_s)
# Has a mention of the discussion in the description
description_field = page.find_field('issue[description]')
expect(description_field.value).to include(discussion.first_note.note)
end
it 'can create a new issue for the project' do
it 'creates a new issue for the project' do
# Actually creates an issue for the project
expect { click_button 'Create issue' }.to change { project.issues.reload.size }.by(1)
end
it 'resolves the discussion in the merge request' do
click_button 'Create issue'
# Resolves the discussion in the merge request
discussion.first_note.reload
expect(discussion.resolved?).to eq(true)
end
it 'shows a flash messaage after resolving a discussion' do
click_button 'Create issue'
page.within '.flash-notice' do
# Only check for the word 'Resolved' since the spec might have resolved
# multiple discussions
expect(page).to have_content('Resolved')
end
end
it 'has a hidden field for the merge request' do
merge_request_field = find('#merge_request_to_resolve_discussions_of', visible: false)
expect(merge_request_field.value).to eq(merge_request.iid.to_s)
# Issue title inludes MR title
expect(page).to have_content(%Q(Follow-up from "#{merge_request.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