diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-23 12:55:43 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-23 12:55:43 +0200 |
commit | 380342784d3efbecb98de81c9b2679e3d720f7c9 (patch) | |
tree | 19be027f48dc182440ab20b70ed5c0021119c364 /features | |
parent | cee68dec8a9b9531690da0f81fbe1ebdc31a7eea (diff) | |
download | gitlab-ce-380342784d3efbecb98de81c9b2679e3d720f7c9.tar.gz |
Fix MR spinach tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'features')
-rw-r--r-- | features/project/merge_requests.feature | 8 | ||||
-rw-r--r-- | features/steps/project/deploy_keys.rb | 2 | ||||
-rw-r--r-- | features/steps/project/project_forked_merge_requests.rb | 2 | ||||
-rw-r--r-- | features/steps/project/project_merge_requests.rb | 51 |
4 files changed, 36 insertions, 27 deletions
diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index 4e4ac1a68e4..946f6760126 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -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 diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index 7f7492bfd6d..914da31322f 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -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 diff --git a/features/steps/project/project_forked_merge_requests.rb b/features/steps/project/project_forked_merge_requests.rb index 57ab6439564..48e76277487 100644 --- a/features/steps/project/project_forked_merge_requests.rb +++ b/features/steps/project/project_forked_merge_requests.rb @@ -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 diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb index 8ef952cf3d1..e848a0b455b 100644 --- a/features/steps/project/project_merge_requests.rb +++ b/features/steps/project/project_merge_requests.rb @@ -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 @@ -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 @@ -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 @@ -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 |