Commit 5a68c20f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix MR factory and some MR tests

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent c2c7d14e
...@@ -61,8 +61,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -61,8 +61,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I submit new merge request "Wiki Feature"' do step 'I submit new merge request "Wiki Feature"' do
select "master", from: "merge_request_source_branch" select "fix", from: "merge_request_source_branch"
select "notes_refactoring", from: "merge_request_target_branch" select "feature", from: "merge_request_target_branch"
click_button "Compare branches" click_button "Compare branches"
fill_in "merge_request_title", with: "Wiki Feature" fill_in "merge_request_title", with: "Wiki Feature"
click_button "Submit merge request" click_button "Submit merge request"
...@@ -73,7 +73,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -73,7 +73,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
title: "Bug NS-04", title: "Bug NS-04",
source_project: project, source_project: project,
target_project: project, target_project: project,
source_branch: 'stable', source_branch: 'fix',
target_branch: 'master', target_branch: 'master',
author: project.users.first, author: project.users.first,
description: "# Description header" description: "# Description header"
...@@ -116,7 +116,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -116,7 +116,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I leave a comment on the diff page in commit' do step 'I leave a comment on the diff page in commit' do
find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click click_diff_line(sample_commit.line_code)
leave_comment "One comment to rule them all" leave_comment "One comment to rule them all"
end end
...@@ -126,7 +126,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -126,7 +126,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
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 line 185 of the first file in commit' do
find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click click_diff_line(sample_commit.line_code)
leave_comment "Line is wrong" leave_comment "Line is wrong"
end end
...@@ -248,7 +248,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -248,7 +248,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
def init_diff_note def init_diff_note
find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click click_diff_line(sample_commit.line_code)
end end
def leave_comment(message) def leave_comment(message)
...@@ -261,14 +261,18 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -261,14 +261,18 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
def init_diff_note_first_file def init_diff_note_first_file
find('a[data-line-code="a5cc2925ca8258af241be7e5b0381edf30266302_12_12"]').click click_diff_line(sample_commit.line_code)
end end
def init_diff_note_second_file def init_diff_note_second_file
find('a[data-line-code="8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_28_39"]').click click_diff_line(sample_commit.del_line_code)
end end
def have_visible_content (text) def have_visible_content (text)
have_css("*", text: text, visible: true) have_css("*", text: text, visible: true)
end end
def click_diff_line(code)
find("a[data-line-code='#{code}']").click
end
end end
module SharedDiffNote module SharedDiffNote
include Spinach::DSL include Spinach::DSL
include RepoHelpers
Given 'I cancel the diff comment' do Given 'I cancel the diff comment' do
within(diff_file_selector) do within(diff_file_selector) do
...@@ -19,8 +20,8 @@ module SharedDiffNote ...@@ -19,8 +20,8 @@ module SharedDiffNote
end end
Given 'I leave a diff comment like "Typo, please fix"' do Given 'I leave a diff comment like "Typo, please fix"' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Typo, please fix" fill_in "note[note]", with: "Typo, please fix"
find(".js-comment-button").trigger("click") find(".js-comment-button").trigger("click")
sleep 0.05 sleep 0.05
...@@ -28,28 +29,28 @@ module SharedDiffNote ...@@ -28,28 +29,28 @@ module SharedDiffNote
end end
Given 'I preview a diff comment text like "Should fix it :smile:"' do Given 'I preview a diff comment text like "Should fix it :smile:"' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:" fill_in "note[note]", with: "Should fix it :smile:"
find(".js-note-preview-button").trigger("click") find(".js-note-preview-button").trigger("click")
end end
end end
Given 'I preview another diff comment text like "DRY this up"' do Given 'I preview another diff comment text like "DRY this up"' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_57_41"]').click click_diff_line(sample_commit.del_line_code)
within("#{diff_file_selector} form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_57_41']") do within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
fill_in "note[note]", with: "DRY this up" fill_in "note[note]", with: "DRY this up"
find(".js-note-preview-button").trigger("click") find(".js-note-preview-button").trigger("click")
end end
end end
Given 'I open a diff comment form' do Given 'I open a diff comment form' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click click_diff_line(sample_commit.line_code)
end end
Given 'I open another diff comment form' do Given 'I open another diff comment form' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_57_41"]').click click_diff_line(sample_commit.del_line_code)
end end
Given 'I write a diff comment like ":-1: I don\'t like this"' do Given 'I write a diff comment like ":-1: I don\'t like this"' do
...@@ -155,6 +156,10 @@ module SharedDiffNote ...@@ -155,6 +156,10 @@ module SharedDiffNote
end end
def diff_file_selector def diff_file_selector
".diff-file" ".diff-file:nth-of-type(1)"
end
def click_diff_line(code)
find("a[data-line-code='#{code}']").click
end end
end end
...@@ -105,68 +105,6 @@ FactoryGirl.define do ...@@ -105,68 +105,6 @@ FactoryGirl.define do
factory :reopened_issue, traits: [:reopened] factory :reopened_issue, traits: [:reopened]
end end
factory :merge_request do
title
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"
trait :with_diffs do
end
trait :closed do
state :closed
end
trait :reopened do
state :reopened
end
trait :simple do
source_branch "simple_merge_request"
target_branch "master"
end
factory :closed_merge_request, traits: [:closed]
factory :reopened_merge_request, traits: [:reopened]
factory :merge_request_with_diffs, traits: [:with_diffs]
end
factory :note do factory :note do
project project
note "Note" note "Note"
......
FactoryGirl.define do
factory :merge_request do
title
author
source_project factory: :project
target_project { source_project }
# → git log --pretty=oneline feature..master
# 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com
# 570e7b2abdd848b95f2f578043fc23bd6f6fd24d Change some files
# 6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 More submodules
# d14d6c0abdd253381df51a723d58691b2ee1ab08 Remove ds_store files
# c1acaa58bbcbc3eafe538cb8274ba387047b69f8 Ignore DS files
source_branch "master"
target_branch "feature"
merge_status :can_be_merged
trait :with_diffs do
end
trait :closed do
state :closed
end
trait :reopened do
state :reopened
end
trait :simple do
source_branch "feature"
target_branch "master"
end
factory :closed_merge_request, traits: [:closed]
factory :reopened_merge_request, traits: [:reopened]
factory :merge_request_with_diffs, traits: [:with_diffs]
end
end
...@@ -32,6 +32,8 @@ eos ...@@ -32,6 +32,8 @@ eos
author_full_name: "Dmitriy Zaporozhets", author_full_name: "Dmitriy Zaporozhets",
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',
del_line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13',
message: <<eos message: <<eos
Change some files Change some files
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment