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

Fix MR tests

parent 5a68c20f
Branches
Tags
No related merge requests found
Loading
@@ -52,27 +52,27 @@ Feature: Project Merge Requests
Loading
@@ -52,27 +52,27 @@ Feature: Project Merge Requests
Given project "Shop" have "Bug NS-05" open merge request with diffs inside Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05" And I visit merge request page "Bug NS-05"
And I switch to the diff tab And I switch to the diff tab
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 diff
And I switch to the merge request's comments tab And I switch to the merge request's comments tab
Then I should see a discussion has started on line 185 Then I should see a discussion has started on diff
   
@javascript @javascript
Scenario: I comment on a line of a commit in merge request Scenario: I comment on a line of a commit in merge request
Given project "Shop" have "Bug NS-05" open merge request with diffs inside Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05" And I visit merge request page "Bug NS-05"
And I click on the first commit in the merge request And I click on the commit in the merge request
And I leave a comment like "Line is wrong" on line 185 of the first file in commit And I leave a comment like "Line is wrong" on diff in commit
And I switch to the merge request's comments tab And I switch to the merge request's comments tab
Then I should see a discussion has started on commit b1e6a9dbf1:L185 Then I should see a discussion has started on commit diff
   
@javascript @javascript
Scenario: I comment on a commit in merge request Scenario: I comment on a commit in merge request
Given project "Shop" have "Bug NS-05" open merge request with diffs inside Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05" And I visit merge request page "Bug NS-05"
And I click on the first commit in the merge request And I click on the commit in the merge request
And I leave a comment on the diff page in commit And I leave a comment on the diff page in commit
And I switch to the merge request's comments tab And I switch to the merge request's comments tab
Then I should see a discussion has started on commit b1e6a9dbf1 Then I should see a discussion has started on commit
   
@javascript @javascript
Scenario: I accept merge request with custom commit message Scenario: I accept merge request with custom commit message
Loading
Loading
Loading
@@ -104,9 +104,9 @@ class ProjectMergeRequests < Spinach::FeatureSteps
Loading
@@ -104,9 +104,9 @@ class ProjectMergeRequests < Spinach::FeatureSteps
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
   
step 'I click on the first commit in the merge request' do step 'I click on the commit in the merge request' do
within '.first-commits' do within '.mr-commits' do
click_link merge_request.commits.first.short_id(8) click_link sample_commit.id[0..8]
end end
end end
   
Loading
@@ -120,32 +120,31 @@ class ProjectMergeRequests < Spinach::FeatureSteps
Loading
@@ -120,32 +120,31 @@ class ProjectMergeRequests < Spinach::FeatureSteps
leave_comment "One comment to rule them all" leave_comment "One comment to rule them all"
end end
   
step 'I leave a comment like "Line is wrong" on line 185 of the first file' do step 'I leave a comment like "Line is wrong" on diff' do
init_diff_note init_diff_note
leave_comment "Line is wrong" leave_comment "Line is wrong"
end end
   
step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do step 'I leave a comment like "Line is wrong" on diff in commit' do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
leave_comment "Line is wrong" leave_comment "Line is wrong"
end end
   
step 'I should see a discussion has started on line 185' do 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 "#{current_user.name} started a discussion"
page.should have_content "app/assets/stylesheets/tree.scss" page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong" page.should have_content "Line is wrong"
end end
   
step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do 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 "#{current_user.name} started a discussion on commit"
page.should have_content "app/assets/stylesheets/tree.scss" page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong" page.should have_content "Line is wrong"
end end
   
step 'I should see a discussion has started on commit b1e6a9dbf1' do 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 "#{current_user.name} started a discussion on commit"
page.should have_content "One comment to rule them all" page.should have_content "One comment to rule them all"
page.should have_content "app/assets/stylesheets/tree.scss"
end end
   
step 'merge request is mergeable' do step 'merge request is mergeable' do
Loading
@@ -162,6 +161,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps
Loading
@@ -162,6 +161,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
   
step 'I accept this merge request' do step 'I accept this merge request' do
Gitlab::Satellite::MergeAction.any_instance.stub(
merge!: true,
)
click_button "Accept Merge Request" click_button "Accept Merge Request"
end end
   
Loading
@@ -261,11 +264,11 @@ class ProjectMergeRequests < Spinach::FeatureSteps
Loading
@@ -261,11 +264,11 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
   
def init_diff_note_first_file def init_diff_note_first_file
click_diff_line(sample_commit.line_code) click_diff_line(sample_compare.changes[0][:line_code])
end end
   
def init_diff_note_second_file def init_diff_note_second_file
click_diff_line(sample_commit.del_line_code) click_diff_line(sample_compare.changes[1][:line_code])
end end
   
def have_visible_content (text) def have_visible_content (text)
Loading
Loading
Loading
@@ -33,6 +33,7 @@ eos
Loading
@@ -33,6 +33,7 @@ eos
author_email: "dmitriy.zaporozhets@gmail.com", author_email: "dmitriy.zaporozhets@gmail.com",
files_changed_count: 2, files_changed_count: 2,
line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14', line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14',
line_code_path: 'files/ruby/popen.rb',
del_line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13', del_line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13',
message: <<eos message: <<eos
Change some files Change some files
Loading
@@ -66,4 +67,23 @@ Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Loading
@@ -66,4 +67,23 @@ Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
eos eos
) )
end end
def sample_compare
changes = [
{
line_code: 'a5cc2925ca8258af241be7e5b0381edf30266302_20_20',
file_path: '.gitignore',
},
{
line_code: '7445606fbf8f3683cd42bdc54b05d7a0bc2dfc44_4_6',
file_path: '.gitmodules',
}
]
OpenStruct.new(
source_branch: 'master',
target_branch: 'feature',
changes: changes
)
end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment