summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorblackst0ne <blackst0ne.ru@gmail.com>2018-05-14 07:09:27 +0000
committerRémy Coutable <remy@rymai.me>2018-05-14 07:09:27 +0000
commitbdaf3b48fa48cf2f5971c908a4c5ae176b9f0486 (patch)
treec32c25e6ba39493c64b0c826ce1af0973930b35c /features
parentb5163a79596bd2d3ff727f9246481dca47016470 (diff)
downloadgitlab-ce-bdaf3b48fa48cf2f5971c908a4c5ae176b9f0486.tar.gz
Replace the `project/commits/diff_comments.feature` spinach test with an rspec analog
Diffstat (limited to 'features')
-rw-r--r--features/project/commits/diff_comments.feature96
-rw-r--r--features/steps/shared/diff_note.rb193
-rw-r--r--features/steps/shared/paths.rb4
-rw-r--r--features/steps/shared/project.rb7
4 files changed, 0 insertions, 300 deletions
diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature
deleted file mode 100644
index 35687aac9ea..00000000000
--- a/features/project/commits/diff_comments.feature
+++ /dev/null
@@ -1,96 +0,0 @@
-@project_commits
-Feature: Project Commits Diff Comments
- Background:
- Given I sign in as a user
- And I own project "Shop"
- And I visit project commit page
-
- @javascript
- Scenario: I can comment on a commit diff
- Given I leave a diff comment like "Typo, please fix"
- Then I should see a diff comment saying "Typo, please fix"
-
- @javascript
- Scenario: I can add a diff comment with a single emoji
- Given I open a diff comment form
- And I write a diff comment like ":smile:"
- Then I should see a diff comment with an emoji image
-
- @javascript
- Scenario: I get a temporary form for the first comment on a diff line
- Given I open a diff comment form
- Then I should see a temporary diff comment form
-
- @javascript
- Scenario: I have a cancel button on the diff form
- Given I open a diff comment form
- Then I should see the cancel comment button
-
- @javascript
- Scenario: I can cancel a diff form
- Given I open a diff comment form
- And I cancel the diff comment
- Then I should not see the diff comment form
-
- @javascript
- Scenario: I can't open a second form for a diff line
- Given I open a diff comment form
- And I open a diff comment form
- Then I should only see one diff form
-
- @javascript
- Scenario: I can have multiple forms
- Given I open a diff comment form
- And I write a diff comment like ":-1: I don't like this"
- And I open another diff comment form
- Then I should see a diff comment form with ":-1: I don't like this"
- And I should see an empty diff comment form
-
- @javascript
- Scenario: I can preview multiple forms separately
- Given I preview a diff comment text like "Should fix it :smile:"
- And I preview another diff comment text like "DRY this up"
- Then I should see two separate previews
-
- @javascript
- Scenario: I have a reply button in discussions
- Given I leave a diff comment like "Typo, please fix"
- Then I should see a discussion reply button
-
- @javascript
- Scenario: I can preview with text
- Given I open a diff comment form
- And I write a diff comment like ":-1: I don't like this"
- Then The diff comment preview tab should display rendered Markdown
-
- @javascript
- Scenario: I preview a diff comment
- Given I preview a diff comment text like "Should fix it :smile:"
- Then I should see the diff comment preview
- And I should not see the diff comment text field
-
- @javascript
- Scenario: I can edit after preview
- Given I preview a diff comment text like "Should fix it :smile:"
- Then I should see the diff comment write tab
-
- @javascript
- Scenario: The form gets removed after posting
- Given I preview a diff comment text like "Should fix it :smile:"
- And I submit the diff comment
- Then I should not see the diff comment form
- And I should see a discussion reply button
-
- @javascript
- Scenario: I can add a comment on a side-by-side commit diff (left side)
- Given I open a diff comment form
- And I click side-by-side diff button
- When I leave a diff comment in a parallel view on the left side like "Old comment"
- Then I should see a diff comment on the left side saying "Old comment"
-
- @javascript
- Scenario: I can add a comment on a side-by-side commit diff (right side)
- Given I open a diff comment form
- And I click side-by-side diff button
- When I leave a diff comment in a parallel view on the right side like "New comment"
- Then I should see a diff comment on the right side saying "New comment"
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb
index aa32528a7ca..22f397947b0 100644
--- a/features/steps/shared/diff_note.rb
+++ b/features/steps/shared/diff_note.rb
@@ -7,12 +7,6 @@ module SharedDiffNote
wait_for_requests if javascript_test?
end
- step 'I cancel the diff comment' do
- page.within(diff_file_selector) do
- find(".js-close-discussion-note-form").click
- end
- end
-
step 'I delete a diff comment' do
find('.note').hover
find(".js-note-delete").click
@@ -24,96 +18,6 @@ module SharedDiffNote
end
end
- step 'I leave a diff comment like "Typo, please fix"' do
- page.within(diff_file_selector) do
- click_diff_line(sample_commit.line_code)
-
- page.within("form[data-line-code='#{sample_commit.line_code}']") do
- fill_in "note[note]", with: "Typo, please fix"
- find(".js-comment-button").click
- end
- end
- end
-
- step 'I leave a diff comment in a parallel view on the left side like "Old comment"' do
- click_parallel_diff_line(sample_commit.del_line_code, 'old')
- page.within("#{diff_file_selector} form[data-line-code='#{sample_commit.del_line_code}']") do
- fill_in "note[note]", with: "Old comment"
- find(".js-comment-button").click
- end
- end
-
- step 'I leave a diff comment in a parallel view on the right side like "New comment"' do
- click_parallel_diff_line(sample_commit.line_code, 'new')
- page.within("#{diff_file_selector} form[data-line-code='#{sample_commit.line_code}']") do
- fill_in "note[note]", with: "New comment"
- find(".js-comment-button").click
- end
- end
-
- step 'I preview a diff comment text like "Should fix it :smile:"' do
- page.within(diff_file_selector) do
- click_diff_line(sample_commit.line_code)
-
- page.within("form[data-line-code='#{sample_commit.line_code}']") do
- fill_in "note[note]", with: "Should fix it :smile:"
- find('.js-md-preview-button').click
- end
- end
- end
-
- step 'I preview another diff comment text like "DRY this up"' do
- page.within(diff_file_selector) do
- click_diff_line(sample_commit.del_line_code)
-
- page.within("form[data-line-code='#{sample_commit.del_line_code}']") do
- fill_in "note[note]", with: "DRY this up"
- find('.js-md-preview-button').click
- end
- end
- end
-
- step 'I open a diff comment form' do
- page.within(diff_file_selector) do
- click_diff_line(sample_commit.line_code)
- end
- end
-
- step 'I open another diff comment form' do
- page.within(diff_file_selector) do
- click_diff_line(sample_commit.del_line_code)
- end
- end
-
- step 'I write a diff comment like ":-1: I don\'t like this"' do
- page.within(diff_file_selector) do
- fill_in "note[note]", with: ":-1: I don\'t like this"
- end
- end
-
- step 'I write a diff comment like ":smile:"' do
- page.within(diff_file_selector) do
- click_diff_line(sample_commit.line_code)
-
- page.within("form[data-line-code='#{sample_commit.line_code}']") do
- fill_in 'note[note]', with: ':smile:'
- click_button('Comment')
- end
- end
- end
-
- step 'I submit the diff comment' do
- page.within(diff_file_selector) do
- click_button("Comment")
- end
- end
-
- step 'I should not see the diff comment form' do
- page.within(diff_file_selector) do
- expect(page).not_to have_css("form.new_note")
- end
- end
-
step 'The diff comment preview tab should say there is nothing to do' do
page.within(diff_file_selector) do
find('.js-md-preview-button').click
@@ -121,103 +25,6 @@ module SharedDiffNote
end
end
- step 'I should not see the diff comment text field' do
- page.within(diff_file_selector) do
- expect(find('.js-note-text')).not_to be_visible
- end
- end
-
- step 'I should only see one diff form' do
- page.within(diff_file_selector) do
- expect(page).to have_css("form.new-note", count: 1)
- end
- end
-
- step 'I should see a diff comment form with ":-1: I don\'t like this"' do
- page.within(diff_file_selector) do
- expect(page).to have_field("note[note]", with: ":-1: I don\'t like this")
- end
- end
-
- step 'I should see a diff comment saying "Typo, please fix"' do
- page.within("#{diff_file_selector} .note") do
- expect(page).to have_content("Typo, please fix")
- end
- end
-
- step 'I should see a diff comment on the left side saying "Old comment"' do
- page.within("#{diff_file_selector} .notes_content.parallel.old") do
- expect(page).to have_content("Old comment")
- end
- end
-
- step 'I should see a diff comment on the right side saying "New comment"' do
- page.within("#{diff_file_selector} .notes_content.parallel.new") do
- expect(page).to have_content("New comment")
- end
- end
-
- step 'I should see a discussion reply button' do
- page.within(diff_file_selector) do
- expect(page).to have_button('Reply...')
- end
- end
-
- step 'I should see a temporary diff comment form' do
- page.within(diff_file_selector) do
- expect(page).to have_css(".js-temp-notes-holder form.new-note")
- end
- end
-
- step 'I should see an empty diff comment form' do
- page.within(diff_file_selector) do
- expect(page).to have_field("note[note]", with: "")
- end
- end
-
- step 'I should see the cancel comment button' do
- page.within("#{diff_file_selector} form") do
- expect(page).to have_css(".js-close-discussion-note-form", text: "Cancel")
- end
- end
-
- step 'I should see the diff comment preview' do
- page.within("#{diff_file_selector} form") do
- expect(page).to have_css('.js-md-preview', visible: true)
- end
- end
-
- step 'I should see the diff comment write tab' do
- page.within(diff_file_selector) do
- expect(page).to have_css('.js-md-write-button', visible: true)
- end
- end
-
- step 'The diff comment preview tab should display rendered Markdown' do
- page.within(diff_file_selector) do
- find('.js-md-preview-button').click
- expect(find('.js-md-preview')).to have_css('gl-emoji', visible: true)
- end
- end
-
- step 'I should see two separate previews' do
- page.within(diff_file_selector) do
- expect(page).to have_css('.js-md-preview', visible: true, count: 2)
- expect(page).to have_content('Should fix it')
- expect(page).to have_content('DRY this up')
- end
- end
-
- step 'I should see a diff comment with an emoji image' do
- page.within("#{diff_file_selector} .note") do
- expect(page).to have_xpath("//gl-emoji[@data-name='smile']")
- end
- end
-
- step 'I click side-by-side diff button' do
- find('#parallel-diff-btn').click
- end
-
step 'I see side-by-side diff button' do
expect(page).to have_content "Side-by-side"
end
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index a6bf7008955..fec57812af5 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -303,10 +303,6 @@ module SharedPaths
visit project_tags_path(@project)
end
- step 'I visit project commit page' do
- visit project_commit_path(@project, sample_commit.id)
- end
-
step 'I visit issue page "Release 0.4"' do
issue = Issue.find_by(title: "Release 0.4")
visit project_issue_path(issue.project, issue)
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index dbfb90fcc48..d0277257320 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -13,13 +13,6 @@ module SharedProject
@project.add_master(@user)
end
- # Create a specific project called "Shop"
- step 'I own project "Shop"' do
- @project = Project.find_by(name: "Shop")
- @project ||= create(:project, :repository, name: "Shop", namespace: @user.namespace)
- @project.add_master(@user)
- end
-
def current_project
@project ||= Project.first
end