Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'features/steps/project/merge_requests.rb')
-rw-r--r--features/steps/project/merge_requests.rb159
1 files changed, 100 insertions, 59 deletions
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index f67e6e3d8ca..a1a26abd8ca 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -6,6 +6,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
include SharedPaths
include SharedMarkdown
include SharedDiffNote
+ include SharedUser
step 'I click link "New Merge Request"' do
click_link "New Merge Request"
@@ -24,44 +25,44 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see merge request "Wiki Feature"' do
- within '.merge-request' do
- page.should have_content "Wiki Feature"
+ page.within '.merge-request' do
+ expect(page).to have_content "Wiki Feature"
end
end
step 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by!(title: "Bug NS-04")
- merge_request.closed?.should be_true
- page.should have_content "Closed by"
+ expect(merge_request).to be_closed
+ expect(page).to have_content "Closed by"
end
step 'I should see merge request "Bug NS-04"' do
- page.should have_content "Bug NS-04"
+ expect(page).to have_content "Bug NS-04"
end
step 'I should see "Bug NS-04" in merge requests' do
- page.should have_content "Bug NS-04"
+ expect(page).to have_content "Bug NS-04"
end
step 'I should see "Feature NS-03" in merge requests' do
- page.should have_content "Feature NS-03"
+ expect(page).to have_content "Feature NS-03"
end
step 'I should not see "Feature NS-03" in merge requests' do
- page.should_not have_content "Feature NS-03"
+ expect(page).not_to have_content "Feature NS-03"
end
step 'I should not see "Bug NS-04" in merge requests' do
- page.should_not have_content "Bug NS-04"
+ expect(page).not_to have_content "Bug NS-04"
end
step 'I should see that I am subscribed' do
- find(".subscribe-button span").text.should == "Unsubscribe"
+ expect(find('.subscribe-button span')).to have_content 'Unsubscribe'
end
step 'I should see that I am unsubscribed' do
- find(".subscribe-button span").should have_content("Subscribe")
+ expect(find('.subscribe-button span')).to have_content 'Subscribe'
end
step 'I click button "Unsubscribe"' do
@@ -108,22 +109,26 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
author: project.users.first)
end
- step 'I switch to the diff tab' do
- visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request)
+ 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
- step 'I click on the Changes tab via Javascript' do
- find('.diffs-tab').click
- sleep 2
+ step 'I click on the Changes tab' do
+ page.within '.merge-request-tabs' do
+ click_link 'Changes'
+ end
+
+ # Waits for load
+ expect(page).to have_css('.tab-content #diffs.active')
end
step 'I should see the proper Inline and Side-by-side links' do
- buttons = all('#commit-diff-viewtype')
- expect(buttons.count).to eq(2)
-
- buttons.each do |b|
- expect(b['href']).should_not have_content('json')
- end
+ expect(page).to have_css('#commit-diff-viewtype', count: 2)
end
step 'I switch to the merge request\'s comments tab' do
@@ -131,11 +136,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click on the commit in the merge request' do
- within '.merge-request-tabs' do
+ page.within '.merge-request-tabs' do
click_link 'Commits'
end
- within '.commits' do
+ page.within '.commits' do
click_link Commit.truncate_sha(sample_commit.id)
end
end
@@ -161,24 +166,30 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see a discussion has started on diff' do
- page.should have_content "#{current_user.name} started a discussion"
- page.should have_content sample_commit.line_code_path
- page.should have_content "Line is wrong"
+ page.within(".notes .discussion") do
+ page.should have_content "#{current_user.name} started a discussion"
+ page.should have_content sample_commit.line_code_path
+ page.should have_content "Line is wrong"
+ end
end
step 'I should see a discussion has started on commit diff' do
- page.should have_content "#{current_user.name} started a discussion on commit"
- page.should have_content sample_commit.line_code_path
- page.should have_content "Line is wrong"
+ page.within(".notes .discussion") do
+ page.should have_content "#{current_user.name} started a discussion on commit"
+ page.should have_content sample_commit.line_code_path
+ page.should have_content "Line is wrong"
+ end
end
step 'I should see a discussion has started on commit' do
- page.should have_content "#{current_user.name} started a discussion on commit"
- page.should have_content "One comment to rule them all"
+ page.within(".notes .discussion") do
+ page.should have_content "#{current_user.name} started a discussion on commit"
+ page.should have_content "One comment to rule them all"
+ end
end
step 'merge request is mergeable' do
- page.should have_button 'Accept Merge Request'
+ expect(page).to have_button 'Accept Merge Request'
end
step 'I modify merge commit message' do
@@ -187,6 +198,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'merge request "Bug NS-05" is mergeable' do
+ merge_request.project.satellite.create
merge_request.mark_as_mergeable
end
@@ -195,14 +207,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
merge!: true,
)
- within '.can_be_merged' do
+ page.within '.mr-state-widget' do
click_button "Accept Merge Request"
end
end
step 'I should see merged request' do
- within '.issue-box' do
- page.should have_content "Merged"
+ page.within '.issue-box' do
+ expect(page).to have_content "Merged"
end
end
@@ -211,76 +223,78 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see reopened merge request "Bug NS-04"' do
- within '.issue-box' do
- page.should have_content "Open"
+ page.within '.issue-box' do
+ expect(page).to have_content "Open"
end
end
step 'I click link "Hide inline discussion" of the second file' do
- within '.files [id^=diff]:nth-child(2)' do
+ page.within '.files [id^=diff]:nth-child(2)' do
find('.js-toggle-diff-comments').click
end
end
step 'I click link "Show inline discussion" of the second file' do
- within '.files [id^=diff]:nth-child(2)' do
+ page.within '.files [id^=diff]:nth-child(2)' do
find('.js-toggle-diff-comments').click
end
end
step 'I should not see a comment like "Line is wrong" in the second file' do
- within '.files [id^=diff]:nth-child(2)' do
- page.should_not have_visible_content "Line is wrong"
+ page.within '.files [id^=diff]:nth-child(2)' do
+ expect(page).not_to have_visible_content "Line is wrong"
end
end
step 'I should see a comment like "Line is wrong" in the second file' do
- within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
- page.should have_visible_content "Line is wrong"
+ page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
+ expect(page).to have_visible_content "Line is wrong"
end
end
step 'I should not see a comment like "Line is wrong here" in the second file' do
- within '.files [id^=diff]:nth-child(2)' do
- page.should_not have_visible_content "Line is wrong here"
+ page.within '.files [id^=diff]:nth-child(2)' do
+ expect(page).not_to have_visible_content "Line is wrong here"
end
end
step 'I should see a comment like "Line is wrong here" in the second file' do
- within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
- page.should have_visible_content "Line is wrong here"
+ page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
+ expect(page).to have_visible_content "Line is wrong here"
end
end
step 'I leave a comment like "Line is correct" on line 12 of the first file' do
init_diff_note_first_file
- within(".js-discussion-note-form") do
+ page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is correct"
click_button "Add Comment"
end
- within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do
- page.should have_content "Line is correct"
+ page.within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do
+ expect(page).to have_content "Line is correct"
end
end
step 'I leave a comment like "Line is wrong" on line 39 of the second file' do
init_diff_note_second_file
- within(".js-discussion-note-form") do
+ page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is wrong on here"
click_button "Add Comment"
end
end
step 'I should still see a comment like "Line is correct" in the first file' do
- within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do
- page.should have_visible_content "Line is correct"
+ page.within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do
+ expect(page).to have_visible_content "Line is correct"
end
end
step 'I unfold diff' do
+ expect(page).to have_css('.js-unfold')
+
first('.js-unfold').click
end
@@ -293,8 +307,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see comments on the side-by-side diff page' do
- within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do
- page.should have_visible_content "Line is correct"
+ page.within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do
+ expect(page).to have_visible_content "Line is correct"
end
end
@@ -302,6 +316,32 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
fill_in 'issue_search', with: "Fe"
end
+ 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
+ expect(page).to have_content 'From fix into feature'
+ expect(page).to have_content 'Target branch changed from master to feature'
+ end
+
+ 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
+
def merge_request
@merge_request ||= MergeRequest.find_by!(title: "Bug NS-05")
end
@@ -311,12 +351,13 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
def leave_comment(message)
- within(".js-discussion-note-form") do
+ page.within(".js-discussion-note-form", visible: true) do
fill_in "note_note", with: message
click_button "Add Comment"
end
-
- page.should have_content message
+ page.within(".notes_holder", visible: true) do
+ expect(page).to have_content message
+ end
end
def init_diff_note_first_file