Skip to content
Snippets Groups Projects
Verified Commit 38034278 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix MR spinach tests

parent cee68dec
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -142,7 +142,7 @@ class MergeRequest < ActiveRecord::Base
end
 
def automerge!(current_user, commit_message = nil)
if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(commit_message) && self.unmerged_commits.empty?
if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(commit_message)
self.merge!(current_user.id)
true
end
Loading
Loading
Loading
Loading
@@ -55,18 +55,18 @@ Feature: Project Merge Requests
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05"
And I click on the first commit in the merge request
And I leave a comment like "Line is wrong" on line 185 of the first file
And I leave a comment like "Line is wrong" on line 185 of the first file in commit
And I switch to the merge request's comments tab
Then I should see a discussion has started on commit bcf03b5de6c:L185
Then I should see a discussion has started on commit b1e6a9dbf1:L185
 
@javascript
Scenario: I comment on a commit in merge request
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05"
And I click on the first commit in the merge request
And I leave a comment on the diff page
And I leave a comment on the diff page in commit
And I switch to the merge request's comments tab
Then I should see a discussion has started on commit bcf03b5de6c
Then I should see a discussion has started on commit b1e6a9dbf1
 
@javascript
Scenario: I accept merge request with custom commit message
Loading
Loading
Loading
Loading
@@ -34,7 +34,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
 
step 'other project has deploy key' do
@second_project = create :project, namespace: current_user.namespace
@second_project = create :project, namespace: create(:group)
@second_project.team << [current_user, :master]
create(:deploy_keys_project, project: @second_project)
end
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
@forking_user = @user
forked_project_link = build(:forked_project_link)
@forked_project = Project.find_by_name "Forked Shop"
@forked_project ||= create(:source_project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace)
@forked_project ||= create(:project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace)
 
forked_project_link.forked_from_project = @project
forked_project_link.forked_to_project = @forked_project
Loading
Loading
Loading
Loading
@@ -81,6 +81,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps
title: "Bug NS-04",
source_project: project,
target_project: project,
source_branch: 'stable',
target_branch: 'master',
author: project.users.first)
end
 
Loading
Loading
@@ -109,33 +111,29 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
 
step 'I click on the first commit in the merge request' do
click_link merge_request.commits.first.short_id(8)
within '.first-commits' do
click_link merge_request.commits.first.short_id(8)
end
end
 
step 'I leave a comment on the diff page' do
init_diff_note
leave_comment "One comment to rule them all"
end
 
within('.js-discussion-note-form') do
fill_in "note_note", with: "One comment to rule them all"
click_button "Add Comment"
end
within ".note-text" do
page.should have_content "One comment to rule them all"
end
step 'I leave a comment on the diff page in commit' do
find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click
leave_comment "One comment to rule them all"
end
 
step 'I leave a comment like "Line is wrong" on line 185 of the first file' do
init_diff_note
leave_comment "Line is wrong"
end
 
within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is wrong"
click_button "Add Comment"
end
within ".note-text" do
page.should have_content "Line is wrong"
end
step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do
find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click
leave_comment "Line is wrong"
end
 
step 'I should see a discussion has started on line 185' do
Loading
Loading
@@ -144,14 +142,14 @@ class ProjectMergeRequests < Spinach::FeatureSteps
page.should have_content "Line is wrong"
end
 
step 'I should see a discussion has started on commit bcf03b5de6c:L185' do
step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do
page.should have_content "#{current_user.name} started a discussion on commit"
page.should have_content "app/assets/stylesheets/tree.scss:L185"
page.should have_content "Line is wrong"
end
 
step 'I should see a discussion has started on commit bcf03b5de6c' do
page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c"
step 'I should see a discussion has started on commit b1e6a9dbf1' do
page.should have_content "#{current_user.name} started a discussion on commit"
page.should have_content "One comment to rule them all"
page.should have_content "app/assets/stylesheets/tree.scss:L185"
end
Loading
Loading
@@ -188,6 +186,17 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
 
def init_diff_note
find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click
find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click
end
def leave_comment(message)
within(".js-discussion-note-form") do
fill_in "note_note", with: message
click_button "Add Comment"
end
within ".note-text" do
page.should have_content message
end
end
end
Loading
Loading
@@ -89,6 +89,39 @@ FactoryGirl.define do
author
source_project factory: :project
target_project { source_project }
# → git log stable..master --pretty=oneline
# b1e6a9dbf1c85e6616497a5e7bad9143a4bd0828 tree css fixes
# 8716fc78f3c65bbf7bcf7b574febd583bc5d2812 Added loading animation for notes
# cd5c4bac5042c5469dcdf7e7b2f768d3c6fd7088 notes count for wall
# 8470d70da67355c9c009e4401746b1d5410af2e3 notes controller refactored
# 1e689bfba39525ead225eaf611948cfbe8ac34cf fixed notes logic
# f0f14c8eaba69ebddd766498a9d0b0e79becd633 finished scss refactoring
# 3a4b4fb4cde7809f033822a171b9feae19d41fff Moving ui styles to one scss file, Added ui class to body
# 065c200c33f68c2bb781e35a43f9dc8138a893b5 removed unnecessary hr tags & titles
# 1e8b111be85df0db6c8000ef9a710bc0221eae83 Merge branch 'master' of github.com:gitlabhq/gitlabhq
# f403da73f5e62794a0447aca879360494b08f678 Fixed ajax loading image. Fixed wrong wording
# e6ea73c77600d413d370249b8e392734f7d1dbee Merge pull request #468 from bencevans/patch-1
# 4a3c05b69355deee25767a74d0512ec4b510d4ef Merge pull request #470 from bgondy/patch-1
# 0347fe2412eb51d3efeccc35210e9268bc765ac5 Update app/views/projects/team.html.haml
# 2b5c61bdece1f7eb2b901ceea7d364065cdf76ac Title for a link fixed
# 460eeb13b7560b40104044973ff933b1a6dbbcaa Increased count of notes loaded when visit wall page
# 21c141afb1c53a9180a99d2cca29ffa613eb7e3a Merge branch 'notes_refactoring'
# 292a41cbe295f16f7148913b31eb0fb91f3251c3 Fixed comments for snippets. Tests fixed
# d41d8ffb02fa74fd4571603548bd7e401ec99e0c Reply button, Comments for Merge Request diff
# b1a36b552be2a7a6bc57fbed6c52dc6ed82111f8 Merge pull request #466 from skroutz/no-rbenv
# db75dae913e8365453ca231f101b067314a7ea71 Merge pull request #465 from skroutz/branches_commit_link
# 75f040fbfe4b5af23ff004ad3207c3976df097a8 Don't enforce rbenv version
# e42fb4fda475370dcb0d8f8f1268bfdc7a0cc437 Fix broken commit link in branches page
# 215a01f63ccdc085f75a48f6f7ab6f2b15b5852c move notes login to one controller
# 81092c01984a481e312de10a28e3f1a6dda182a3 Status codes for errors, New error pages
# 7d279f9302151e3c8f4c5df9c5200a72799409b9 better error handling for not found resource, gitolite error
# 9e6d0710e927aa8ea834b8a9ae9f277be617ac7d Merge pull request #443 from CedricGatay/fix/incorrectLineNumberingInDiff
# 6ea87c47f0f8a24ae031c3fff17bc913889ecd00 Incorrect line numbering in diff
#
# → git log master..stable --pretty=oneline
# empty
source_branch "master"
target_branch "stable"
 
Loading
Loading
Loading
Loading
@@ -73,6 +73,10 @@ module TestEnv
version: '6.3.0'
)
 
Gitlab::Satellite::MergeAction.any_instance.stub(
merge!: true,
)
Gitlab::Satellite::Satellite.any_instance.stub(
exists?: true,
destroy: true,
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment