2014-09-22 10:30:25 -04:00
|
|
|
class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
|
2012-09-10 11:35:03 -04:00
|
|
|
include SharedAuthentication
|
2014-10-17 00:10:50 -04:00
|
|
|
include SharedIssuable
|
2012-09-10 11:35:03 -04:00
|
|
|
include SharedProject
|
|
|
|
include SharedNote
|
|
|
|
include SharedPaths
|
2014-02-04 02:48:33 -05:00
|
|
|
include SharedMarkdown
|
2014-09-19 09:26:20 -04:00
|
|
|
include SharedDiffNote
|
2015-06-23 08:30:21 -04:00
|
|
|
include SharedUser
|
2012-09-10 11:35:03 -04:00
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I click link "New Merge Request"' do
|
2012-10-29 17:23:49 -04:00
|
|
|
click_link "New Merge Request"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I click link "Bug NS-04"' do
|
2012-10-29 17:23:49 -04:00
|
|
|
click_link "Bug NS-04"
|
|
|
|
end
|
|
|
|
|
2016-03-01 06:32:20 -05:00
|
|
|
step 'I click link "Feature NS-05"' do
|
|
|
|
click_link "Feature NS-05"
|
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I click link "All"' do
|
2012-10-29 17:23:49 -04:00
|
|
|
click_link "All"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2016-03-01 06:32:20 -05:00
|
|
|
step 'I click link "Merged"' do
|
|
|
|
click_link "Merged"
|
|
|
|
end
|
|
|
|
|
2015-06-18 13:15:17 -04:00
|
|
|
step 'I click link "Closed"' do
|
|
|
|
click_link "Closed"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I should see merge request "Wiki Feature"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.merge-request' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Wiki Feature"
|
2013-10-21 02:55:41 -04:00
|
|
|
end
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I should see closed merge request "Bug NS-04"' do
|
2014-01-19 13:55:59 -05:00
|
|
|
merge_request = MergeRequest.find_by!(title: "Bug NS-04")
|
2015-06-18 22:13:32 -04:00
|
|
|
expect(merge_request).to be_closed
|
2015-06-18 13:15:17 -04:00
|
|
|
expect(page).to have_content "Closed by"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I should see merge request "Bug NS-04"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Bug NS-04"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2016-03-01 06:32:20 -05:00
|
|
|
step 'I should see merge request "Feature NS-05"' do
|
|
|
|
expect(page).to have_content "Feature NS-05"
|
|
|
|
end
|
|
|
|
|
2015-11-03 09:44:14 -05:00
|
|
|
step 'I should not see "master" branch' do
|
2016-01-20 01:52:01 -05:00
|
|
|
expect(find('.merge-request-info')).not_to have_content "master"
|
2015-11-03 09:44:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "other_branch" branch' do
|
|
|
|
expect(page).to have_content "other_branch"
|
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I should see "Bug NS-04" in merge requests' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Bug NS-04"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I should see "Feature NS-03" in merge requests' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Feature NS-03"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I should not see "Feature NS-03" in merge requests' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content "Feature NS-03"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I should not see "Bug NS-04" in merge requests' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content "Bug NS-04"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2015-03-16 11:20:17 -04:00
|
|
|
step 'I should see that I am subscribed' do
|
2016-04-12 08:34:03 -04:00
|
|
|
expect(find('.issuable-subscribe-button span')).to have_content 'Unsubscribe'
|
2015-03-16 11:20:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see that I am unsubscribed' do
|
2016-04-12 08:34:03 -04:00
|
|
|
expect(find('.issuable-subscribe-button span')).to have_content 'Subscribe'
|
2015-03-16 11:20:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click button "Unsubscribe"' do
|
|
|
|
click_on "Unsubscribe"
|
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I click link "Close"' do
|
2014-12-22 09:42:26 -05:00
|
|
|
first(:css, '.close-mr-link').click
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I submit new merge request "Wiki Feature"' do
|
2016-04-06 07:52:07 -04:00
|
|
|
find('.js-source-branch').click
|
|
|
|
find('.dropdown-source-branch .dropdown-content a', text: 'fix').click
|
|
|
|
|
|
|
|
find('.js-target-branch').click
|
|
|
|
first('.dropdown-target-branch .dropdown-content a', text: 'feature').click
|
|
|
|
|
2014-05-08 09:30:39 -04:00
|
|
|
click_button "Compare branches"
|
|
|
|
fill_in "merge_request_title", with: "Wiki Feature"
|
2015-12-02 08:33:14 -05:00
|
|
|
click_button "Submit merge request"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'project "Shop" have "Bug NS-04" open merge request' do
|
2013-02-18 07:49:56 -05:00
|
|
|
create(:merge_request,
|
2012-10-29 17:23:49 -04:00
|
|
|
title: "Bug NS-04",
|
2013-04-25 10:15:33 -04:00
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
2014-07-31 11:07:24 -04:00
|
|
|
source_branch: 'fix',
|
2014-01-23 05:55:43 -05:00
|
|
|
target_branch: 'master',
|
2014-02-04 02:48:33 -05:00
|
|
|
author: project.users.first,
|
|
|
|
description: "# Description header"
|
|
|
|
)
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2015-11-03 09:44:14 -05:00
|
|
|
step 'project "Shop" have "Bug NS-06" open merge request' do
|
|
|
|
create(:merge_request,
|
|
|
|
title: "Bug NS-06",
|
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
|
|
|
source_branch: 'fix',
|
|
|
|
target_branch: 'other_branch',
|
|
|
|
author: project.users.first,
|
|
|
|
description: "# Description header"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do
|
2012-10-29 17:23:49 -04:00
|
|
|
create(:merge_request_with_diffs,
|
|
|
|
title: "Bug NS-05",
|
2013-04-25 10:15:33 -04:00
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
2012-10-29 17:23:49 -04:00
|
|
|
author: project.users.first)
|
2016-03-01 06:32:20 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'project "Shop" have "Feature NS-05" merged merge request' do
|
|
|
|
create(:merged_merge_request,
|
|
|
|
title: "Feature NS-05",
|
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
2012-10-29 17:23:49 -04:00
|
|
|
author: project.users.first)
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
2016-02-04 13:23:58 -05:00
|
|
|
step 'project "Shop" have "Bug NS-07" open merge request with rebased branch' do
|
|
|
|
create(:merge_request, :rebased,
|
|
|
|
title: "Bug NS-07",
|
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
|
|
|
author: project.users.first)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'project "Shop" have "Bug NS-08" open merge request with diverged branch' do
|
|
|
|
create(:merge_request, :diverged,
|
|
|
|
title: "Bug NS-08",
|
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
|
|
|
author: project.users.first)
|
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'project "Shop" have "Feature NS-03" closed merge request' do
|
2013-02-18 05:43:08 -05:00
|
|
|
create(:closed_merge_request,
|
2012-10-29 17:23:49 -04:00
|
|
|
title: "Feature NS-03",
|
2013-04-25 10:15:33 -04:00
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
2013-02-18 05:43:08 -05:00
|
|
|
author: project.users.first)
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2015-06-23 08:30:21 -04:00
|
|
|
step 'project "Community" has "Bug CO-01" open merge request with diffs inside' do
|
|
|
|
project = Project.find_by(name: "Community")
|
|
|
|
create(:merge_request_with_diffs,
|
|
|
|
title: "Bug CO-01",
|
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
|
|
|
author: project.users.first)
|
|
|
|
end
|
|
|
|
|
2016-02-17 08:32:02 -05:00
|
|
|
step 'merge request "Bug NS-04" have 2 upvotes and 1 downvote' do
|
|
|
|
merge_request = MergeRequest.find_by(title: 'Bug NS-04')
|
2016-05-25 09:43:07 -04:00
|
|
|
create_list(:award_emoji, 2, awardable: merge_request)
|
|
|
|
create(:award_emoji, :downvote, awardable: merge_request)
|
2016-02-17 08:32:02 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'merge request "Bug NS-06" have 1 upvote and 2 downvotes' do
|
2016-04-25 14:10:20 -04:00
|
|
|
awardable = MergeRequest.find_by(title: 'Bug NS-06')
|
2016-05-25 09:43:07 -04:00
|
|
|
create(:award_emoji, awardable: awardable)
|
2016-06-01 05:23:09 -04:00
|
|
|
create_list(:award_emoji, 2, :downvote, awardable: awardable)
|
2016-02-17 08:32:02 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'The list should be sorted by "Least popular"' do
|
|
|
|
page.within '.mr-list' do
|
|
|
|
page.within 'li.merge-request:nth-child(1)' do
|
|
|
|
expect(page).to have_content 'Bug NS-06'
|
|
|
|
expect(page).to have_content '1 2'
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within 'li.merge-request:nth-child(2)' do
|
|
|
|
expect(page).to have_content 'Bug NS-04'
|
|
|
|
expect(page).to have_content '2 1'
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within 'li.merge-request:nth-child(3)' do
|
|
|
|
expect(page).to have_content 'Bug NS-05'
|
2016-05-23 19:37:59 -04:00
|
|
|
expect(page).not_to have_content '0 0'
|
2016-02-17 08:32:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'The list should be sorted by "Most popular"' do
|
|
|
|
page.within '.mr-list' do
|
|
|
|
page.within 'li.merge-request:nth-child(1)' do
|
|
|
|
expect(page).to have_content 'Bug NS-04'
|
|
|
|
expect(page).to have_content '2 1'
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within 'li.merge-request:nth-child(2)' do
|
|
|
|
expect(page).to have_content 'Bug NS-06'
|
|
|
|
expect(page).to have_content '1 2'
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within 'li.merge-request:nth-child(3)' do
|
|
|
|
expect(page).to have_content 'Bug NS-05'
|
2016-05-23 19:37:59 -04:00
|
|
|
expect(page).not_to have_content '0 0'
|
2016-02-17 08:32:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-25 21:30:18 -04:00
|
|
|
step 'I click on the Changes tab' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.merge-request-tabs' do
|
2015-05-27 22:39:11 -04:00
|
|
|
click_link 'Changes'
|
|
|
|
end
|
|
|
|
|
2015-06-25 21:30:18 -04:00
|
|
|
# Waits for load
|
|
|
|
expect(page).to have_css('.tab-content #diffs.active')
|
2015-03-26 02:39:34 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see the proper Inline and Side-by-side links' do
|
2015-09-03 16:25:52 -04:00
|
|
|
expect(page).to have_css('#parallel-diff-btn', count: 1)
|
|
|
|
expect(page).to have_css('#inline-diff-btn', count: 1)
|
2015-03-26 02:39:34 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I switch to the merge request\'s comments tab' do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2014-07-31 12:19:40 -04:00
|
|
|
step 'I click on the commit in the merge request' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.merge-request-tabs' do
|
2014-12-25 08:55:12 -05:00
|
|
|
click_link 'Commits'
|
|
|
|
end
|
|
|
|
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.commits' do
|
2014-10-10 11:42:05 -04:00
|
|
|
click_link Commit.truncate_sha(sample_commit.id)
|
2014-01-23 05:55:43 -05:00
|
|
|
end
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'I leave a comment on the diff page' do
|
2013-04-11 03:45:18 -04:00
|
|
|
init_diff_note
|
2014-01-23 05:55:43 -05:00
|
|
|
leave_comment "One comment to rule them all"
|
|
|
|
end
|
2013-01-15 10:12:53 -05:00
|
|
|
|
2014-01-23 05:55:43 -05:00
|
|
|
step 'I leave a comment on the diff page in commit' do
|
2014-07-31 11:07:24 -04:00
|
|
|
click_diff_line(sample_commit.line_code)
|
2014-01-23 05:55:43 -05:00
|
|
|
leave_comment "One comment to rule them all"
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2014-07-31 12:19:40 -04:00
|
|
|
step 'I leave a comment like "Line is wrong" on diff' do
|
2013-04-11 03:45:18 -04:00
|
|
|
init_diff_note
|
2014-01-23 05:55:43 -05:00
|
|
|
leave_comment "Line is wrong"
|
|
|
|
end
|
2012-10-29 17:23:49 -04:00
|
|
|
|
2016-01-19 12:17:56 -05:00
|
|
|
step 'user "John Doe" leaves a comment like "Line is wrong" on diff' do
|
|
|
|
mr = MergeRequest.find_by(title: "Bug NS-05")
|
|
|
|
create(:note_on_merge_request_diff, project: project,
|
2016-05-18 13:38:52 -04:00
|
|
|
noteable: mr,
|
2016-01-19 12:17:56 -05:00
|
|
|
author: user_exists("John Doe"),
|
|
|
|
line_code: sample_commit.line_code,
|
|
|
|
note: 'Line is wrong')
|
|
|
|
end
|
|
|
|
|
2014-07-31 12:19:40 -04:00
|
|
|
step 'I leave a comment like "Line is wrong" on diff in commit' do
|
2014-07-31 11:07:24 -04:00
|
|
|
click_diff_line(sample_commit.line_code)
|
2014-01-23 05:55:43 -05:00
|
|
|
leave_comment "Line is wrong"
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2015-12-09 08:30:21 -05:00
|
|
|
step 'I change the comment "Line is wrong" to "Typo, please fix" on diff' do
|
|
|
|
page.within('.diff-file:nth-of-type(5) .note') do
|
|
|
|
find('.js-note-edit').click
|
|
|
|
|
|
|
|
page.within('.current-note-edit-form', visible: true) do
|
|
|
|
fill_in 'note_note', with: 'Typo, please fix'
|
|
|
|
click_button 'Save Comment'
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).not_to have_button 'Save Comment', disabled: true, visible: true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see a diff comment saying "Line is wrong"' do
|
|
|
|
page.within('.diff-file:nth-of-type(5) .note') do
|
|
|
|
expect(page).not_to have_visible_content 'Line is wrong'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a diff comment saying "Typo, please fix"' do
|
|
|
|
page.within('.diff-file:nth-of-type(5) .note') do
|
|
|
|
expect(page).to have_visible_content 'Typo, please fix'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-12-10 19:07:25 -05:00
|
|
|
step 'I delete the comment "Line is wrong" on diff' do
|
|
|
|
page.within('.diff-file:nth-of-type(5) .note') do
|
|
|
|
find('.js-note-delete').click
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on the Discussion tab' do
|
|
|
|
page.within '.merge-request-tabs' do
|
|
|
|
click_link 'Discussion'
|
|
|
|
end
|
|
|
|
|
|
|
|
# Waits for load
|
|
|
|
expect(page).to have_css('.tab-content #notes.active')
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see any discussion' do
|
|
|
|
expect(page).not_to have_css('.notes .discussion')
|
|
|
|
end
|
|
|
|
|
2014-07-31 12:19:40 -04:00
|
|
|
step 'I should see a discussion has started on diff' do
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within(".notes .discussion") do
|
2016-03-30 04:05:05 -04:00
|
|
|
page.should have_content "#{current_user.name} #{current_user.to_reference} started a discussion"
|
2015-06-18 22:13:32 -04:00
|
|
|
page.should have_content sample_commit.line_code_path
|
|
|
|
page.should have_content "Line is wrong"
|
|
|
|
end
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2016-01-19 12:17:56 -05:00
|
|
|
step 'I should see a discussion by user "John Doe" has started on diff' do
|
|
|
|
page.within(".notes .discussion") do
|
2016-03-30 04:05:05 -04:00
|
|
|
page.should have_content "#{user_exists("John Doe").name} #{user_exists("John Doe").to_reference} started a discussion"
|
2016-01-19 12:17:56 -05:00
|
|
|
page.should have_content sample_commit.line_code_path
|
|
|
|
page.should have_content "Line is wrong"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a badge of "1" next to the discussion link' do
|
|
|
|
expect_discussion_badge_to_have_counter("1")
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a badge of "0" next to the discussion link' do
|
|
|
|
expect_discussion_badge_to_have_counter("0")
|
|
|
|
end
|
|
|
|
|
2014-07-31 12:19:40 -04:00
|
|
|
step 'I should see a discussion has started on commit diff' do
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within(".notes .discussion") do
|
2016-03-30 04:05:05 -04:00
|
|
|
page.should have_content "#{current_user.name} #{current_user.to_reference} started a discussion on commit"
|
2015-06-18 22:13:32 -04:00
|
|
|
page.should have_content sample_commit.line_code_path
|
|
|
|
page.should have_content "Line is wrong"
|
|
|
|
end
|
2012-10-29 17:23:49 -04:00
|
|
|
end
|
|
|
|
|
2014-07-31 12:19:40 -04:00
|
|
|
step 'I should see a discussion has started on commit' do
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within(".notes .discussion") do
|
2016-03-30 04:05:05 -04:00
|
|
|
page.should have_content "#{current_user.name} #{current_user.to_reference} started a discussion on commit"
|
2015-06-18 22:13:32 -04:00
|
|
|
page.should have_content "One comment to rule them all"
|
|
|
|
end
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
2013-02-28 02:43:48 -05:00
|
|
|
|
2014-01-14 04:49:54 -05:00
|
|
|
step 'merge request is mergeable' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_button 'Accept Merge Request'
|
2014-01-14 04:49:54 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I modify merge commit message' do
|
|
|
|
find('.modify-merge-commit-link').click
|
2014-09-26 18:41:17 -04:00
|
|
|
fill_in 'commit_message', with: 'wow such merge'
|
2014-01-14 04:49:54 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'merge request "Bug NS-05" is mergeable' do
|
|
|
|
merge_request.mark_as_mergeable
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I accept this merge request' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.mr-state-widget' do
|
2015-01-28 18:36:12 -05:00
|
|
|
click_button "Accept Merge Request"
|
|
|
|
end
|
2014-01-14 04:49:54 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see merged request' do
|
2015-12-16 10:13:22 -05:00
|
|
|
page.within '.status-box' do
|
2015-06-18 13:15:17 -04:00
|
|
|
expect(page).to have_content "Merged"
|
2014-01-14 04:49:54 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-03-03 03:21:50 -05:00
|
|
|
step 'I click link "Reopen"' do
|
2014-12-22 09:42:26 -05:00
|
|
|
first(:css, '.reopen-mr-link').click
|
2014-03-03 03:21:50 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see reopened merge request "Bug NS-04"' do
|
2015-12-16 10:13:22 -05:00
|
|
|
page.within '.status-box' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Open"
|
2014-03-03 03:21:50 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I click link "Hide inline discussion" of the third file' do
|
|
|
|
page.within '.files [id^=diff]:nth-child(3)' do
|
2015-09-03 16:15:21 -04:00
|
|
|
find('.js-toggle-diff-comments').trigger('click')
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I click link "Show inline discussion" of the third file' do
|
|
|
|
page.within '.files [id^=diff]:nth-child(3)' do
|
2015-09-03 16:15:21 -04:00
|
|
|
find('.js-toggle-diff-comments').trigger('click')
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I should not see a comment like "Line is wrong" in the third file' do
|
|
|
|
page.within '.files [id^=diff]:nth-child(3)' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_visible_content "Line is wrong"
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I should see a comment like "Line is wrong" in the third file' do
|
|
|
|
page.within '.files [id^=diff]:nth-child(3) .note-body > .note-text' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_visible_content "Line is wrong"
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I should not see a comment like "Line is wrong here" in the third file' do
|
|
|
|
page.within '.files [id^=diff]:nth-child(3)' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_visible_content "Line is wrong here"
|
2014-10-06 09:07:48 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I should see a comment like "Line is wrong here" in the third file' do
|
|
|
|
page.within '.files [id^=diff]:nth-child(3) .note-body > .note-text' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_visible_content "Line is wrong here"
|
2014-10-06 09:07:48 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I leave a comment like "Line is correct" on line 12 of the second file' do
|
2014-01-09 11:50:27 -05:00
|
|
|
init_diff_note_first_file
|
|
|
|
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-discussion-note-form") do
|
2014-01-09 11:50:27 -05:00
|
|
|
fill_in "note_note", with: "Line is correct"
|
2016-03-04 07:22:27 -05:00
|
|
|
click_button "Comment"
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
page.within ".files [id^=diff]:nth-child(2) .note-body > .note-text" do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Line is correct"
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I leave a comment like "Line is wrong" on line 39 of the third file' do
|
2014-01-09 11:50:27 -05:00
|
|
|
init_diff_note_second_file
|
|
|
|
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-discussion-note-form") do
|
2014-10-06 09:07:48 -04:00
|
|
|
fill_in "note_note", with: "Line is wrong on here"
|
2016-03-04 08:52:29 -05:00
|
|
|
click_button "Comment"
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-30 09:29:52 -04:00
|
|
|
step 'I should still see a comment like "Line is correct" in the second file' do
|
|
|
|
page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_visible_content "Line is correct"
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-02 11:12:01 -04:00
|
|
|
step 'I unfold diff' do
|
2015-06-25 21:30:18 -04:00
|
|
|
expect(page).to have_css('.js-unfold')
|
|
|
|
|
2014-08-02 11:12:01 -04:00
|
|
|
first('.js-unfold').click
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see additional file lines' do
|
|
|
|
expect(first('.text-file')).to have_content('.bundle')
|
|
|
|
end
|
|
|
|
|
2014-09-12 14:12:31 -04:00
|
|
|
step 'I click Side-by-side Diff tab' do
|
2014-12-29 06:31:30 -05:00
|
|
|
find('a', text: 'Side-by-side').trigger('click')
|
2014-09-12 14:12:31 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see comments on the side-by-side diff page' do
|
2015-09-30 09:29:52 -04:00
|
|
|
page.within '.files [id^=diff]:nth-child(2) .parallel .note-body > .note-text' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_visible_content "Line is correct"
|
2014-09-12 14:12:31 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-03-12 19:20:58 -04:00
|
|
|
step 'I fill in merge request search with "Fe"' do
|
|
|
|
fill_in 'issue_search', with: "Fe"
|
|
|
|
end
|
|
|
|
|
2015-05-28 21:00:37 -04:00
|
|
|
step 'I click the "Target branch" dropdown' do
|
|
|
|
first('.target_branch').click
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I select a new target branch' do
|
|
|
|
select "feature", from: "merge_request_target_branch"
|
|
|
|
click_button 'Save'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see new target branch changes' do
|
2015-08-10 08:15:27 -04:00
|
|
|
expect(page).to have_content 'Request to merge fix into feature'
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content 'Target branch changed from master to feature'
|
2015-05-28 21:00:37 -04:00
|
|
|
end
|
|
|
|
|
2015-06-23 08:30:21 -04:00
|
|
|
step 'I click on "Email Patches"' do
|
|
|
|
click_link "Email Patches"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on "Plain Diff"' do
|
|
|
|
click_link "Plain Diff"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a patch diff' do
|
|
|
|
expect(page).to have_content('diff --git')
|
|
|
|
end
|
|
|
|
|
2015-10-23 11:01:25 -04:00
|
|
|
step '"Bug NS-05" has CI status' do
|
|
|
|
project = merge_request.source_project
|
|
|
|
project.enable_ci
|
2016-06-03 10:22:26 -04:00
|
|
|
pipeline = create :ci_pipeline, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch
|
|
|
|
create :ci_build, pipeline: pipeline
|
2015-10-23 11:01:25 -04:00
|
|
|
end
|
|
|
|
|
2015-10-23 12:21:43 -04:00
|
|
|
step 'I should see merge request "Bug NS-05" with CI status' do
|
|
|
|
page.within ".mr-list" do
|
2016-05-14 15:51:57 -04:00
|
|
|
expect(page).to have_link "Pipeline: pending"
|
2015-10-23 12:21:43 -04:00
|
|
|
end
|
|
|
|
end
|
2015-10-23 11:01:25 -04:00
|
|
|
|
2016-02-04 13:23:58 -05:00
|
|
|
step 'I should see the diverged commits count' do
|
|
|
|
page.within ".mr-source-target" do
|
|
|
|
expect(page).to have_content /([0-9]+ commits behind)/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the diverged commits count' do
|
|
|
|
page.within ".mr-source-target" do
|
|
|
|
expect(page).not_to have_content /([0-9]+ commit[s]? behind)/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-02-28 02:43:48 -05:00
|
|
|
def merge_request
|
2014-01-19 13:55:59 -05:00
|
|
|
@merge_request ||= MergeRequest.find_by!(title: "Bug NS-05")
|
2013-02-28 02:43:48 -05:00
|
|
|
end
|
2013-04-11 03:45:18 -04:00
|
|
|
|
|
|
|
def init_diff_note
|
2014-07-31 11:07:24 -04:00
|
|
|
click_diff_line(sample_commit.line_code)
|
2014-01-23 05:55:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def leave_comment(message)
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within(".js-discussion-note-form", visible: true) do
|
2014-01-23 05:55:43 -05:00
|
|
|
fill_in "note_note", with: message
|
2016-03-04 08:52:29 -05:00
|
|
|
click_button "Comment"
|
2014-01-23 05:55:43 -05:00
|
|
|
end
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within(".notes_holder", visible: true) do
|
|
|
|
expect(page).to have_content message
|
|
|
|
end
|
2013-04-11 03:45:18 -04:00
|
|
|
end
|
2014-01-09 11:50:27 -05:00
|
|
|
|
|
|
|
def init_diff_note_first_file
|
2014-07-31 12:19:40 -04:00
|
|
|
click_diff_line(sample_compare.changes[0][:line_code])
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def init_diff_note_second_file
|
2014-07-31 12:19:40 -04:00
|
|
|
click_diff_line(sample_compare.changes[1][:line_code])
|
2014-01-09 11:50:27 -05:00
|
|
|
end
|
|
|
|
|
2016-05-30 08:41:34 -04:00
|
|
|
def have_visible_content(text)
|
2014-01-09 11:50:27 -05:00
|
|
|
have_css("*", text: text, visible: true)
|
|
|
|
end
|
2016-01-19 12:17:56 -05:00
|
|
|
|
|
|
|
def expect_discussion_badge_to_have_counter(value)
|
|
|
|
page.within(".notes-tab .badge") do
|
|
|
|
page.should have_content value
|
|
|
|
end
|
|
|
|
end
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|