Skip to content
Snippets Groups Projects
Commit dc4ae317 authored by blackst0ne's avatar blackst0ne Committed by Rémy Coutable
Browse files

Replace the `project/issues/issues.feature` spinach test with an rspec analog

parent 95b3bf26
No related branches found
No related tags found
No related merge requests found
Showing
with 307 additions and 507 deletions
---
title: Replace the spinach test with an rspec analog
merge_request: 17950
author: blackst0ne
type: other
@project_issues
Feature: Project Issues
Background:
Given I sign in as a user
And I own project "Shop"
And project "Shop" have "Release 0.4" open issue
And project "Shop" have "Tweet control" open issue
And project "Shop" have "Release 0.3" closed issue
And I visit project "Shop" issues page
Scenario: I should see open issues
Given I should see "Release 0.4" in issues
And I should not see "Release 0.3" in issues
@javascript
Scenario: I should see closed issues
Given I click link "Closed"
Then I should see "Release 0.3" in issues
And I should not see "Release 0.4" in issues
@javascript
Scenario: I should see all issues
Given I click link "All"
Then I should see "Release 0.3" in issues
And I should see "Release 0.4" in issues
Scenario: I visit issue page
Given I click link "Release 0.4"
Then I should see issue "Release 0.4"
Scenario: I submit new unassigned issue
Given I click link "New Issue"
And I submit new issue "500 error on profile"
Then I should see issue "500 error on profile"
@javascript
Scenario: I submit new unassigned issue with labels
Given project "Shop" has labels: "bug", "feature", "enhancement"
And I click link "New Issue"
And I submit new issue "500 error on profile" with label 'bug'
Then I should see issue "500 error on profile"
And I should see label 'bug' with issue
@javascript
Scenario: I comment issue
Given I visit issue page "Release 0.4"
And I leave a comment like "XML attached"
Then I should see comment "XML attached"
And I should see an error alert section within the comment form
@javascript
Scenario: Visiting Issues after being sorted the list
Given I visit project "Shop" issues page
And I sort the list by "Last updated"
And I visit my project's home page
And I visit project "Shop" issues page
Then The list should be sorted by "Last updated"
@javascript
Scenario: Visiting Merge Requests after being sorted the list
Given project "Shop" has a "Bugfix MR" merge request open
And I visit project "Shop" issues page
And I sort the list by "Last updated"
And I visit project "Shop" merge requests page
Then The list should be sorted by "Last updated"
@javascript
Scenario: Visiting Merge Requests from a differente Project after sorting
Given project "Shop" has a "Bugfix MR" merge request open
And I visit project "Shop" merge requests page
And I sort the list by "Last updated"
And I visit dashboard merge requests page
Then The list should be sorted by "Last updated"
@javascript
Scenario: Sort issues by upvotes/downvotes
Given project "Shop" have "Bugfix" open issue
And issue "Release 0.4" have 2 upvotes and 1 downvote
And issue "Tweet control" have 1 upvote and 2 downvotes
And I sort the list by "Popularity"
Then The list should be sorted by "Popularity"
# Markdown
@javascript
Scenario: Headers inside the description should have ids generated for them.
Given I visit issue page "Release 0.4"
Then Header "Description header" should have correct id and link
@javascript
Scenario: Headers inside comments should not have ids generated for them.
Given I visit issue page "Release 0.4"
And I leave a comment with a header containing "Comment with a header"
Then The comment with the header should not have an ID
@javascript
Scenario: Blocks inside comments should not build relative links
Given I visit issue page "Release 0.4"
And I leave a comment with code block
Then The code block should be unchanged
Scenario: Issues on empty project
Given empty project "Empty Project"
And I have an ssh key
When I visit empty project page
And I see empty project details with ssh clone info
When I visit empty project's issues page
Given I click link "New Issue"
And I submit new issue "500 error on profile"
Then I should see issue "500 error on profile"
Scenario: Clickable labels
Given issue 'Release 0.4' has label 'bug'
And I visit project "Shop" issues page
When I click label 'bug'
And I should see "Release 0.4" in issues
And I should not see "Tweet control" in issues
@javascript
Scenario: Issue notes should be editable with +1
Given project "Shop" have "Release 0.4" open issue
When I visit issue page "Release 0.4"
And I leave a comment with a header containing "Comment with a header"
Then The comment with the header should not have an ID
And I edit the last comment with a +1
Then I should see +1 in the description
# Issue description preview
@javascript
Scenario: I can't preview without text
Given I click link "New Issue"
And I haven't written any description text
Then The Markdown preview tab should say there is nothing to do
@javascript
Scenario: I can preview with text
Given I click link "New Issue"
And I write a description like ":+1: Nice"
Then The Markdown preview tab should display rendered Markdown
@javascript
Scenario: I preview an issue description
Given I click link "New Issue"
And I preview a description text like "Bug fixed :smile:"
Then I should see the Markdown preview
And I should not see the Markdown text field
@javascript
Scenario: I can edit after preview
Given I click link "New Issue"
And I preview a description text like "Bug fixed :smile:"
Then I should see the Markdown write tab
@javascript
Scenario: I can preview when editing an existing issue
Given I click link "Release 0.4"
And I click link "Edit" for the issue
And I preview a description text like "Bug fixed :smile:"
Then I should see the Markdown write tab
@javascript
Scenario: I can unsubscribe from issue
Given project "Shop" have "Release 0.4" open issue
When I visit issue page "Release 0.4"
Then I should see that I am subscribed
When I click the subscription toggle
Then I should see that I am unsubscribed
@javascript
Scenario: I submit new unassigned issue as guest
Given public project "Community"
When I visit project "Community" page
And I visit project "Community" issues page
And I click link "New Issue"
And I should not see assignee field
And I should not see milestone field
And I should not see labels field
And I submit new issue "500 error on profile"
Then I should see issue "500 error on profile"
Loading
Loading
@@ -39,4 +39,5 @@ Feature: Project Issues Milestones
 
Scenario: Headers inside the description should have ids generated for them.
Given I click link "v2.2"
# PLEASE USE the `have_header_with_correct_id_and_link(level, text, id, parent)` matcher on migrating this spec to rspec.
Then Header "Description header" should have correct id and link
Loading
Loading
@@ -7,36 +7,14 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
include SharedMarkdown
include SharedUser
 
step 'I should see "Release 0.4" in issues' do
expect(page).to have_content "Release 0.4"
end
step 'I should not see "Release 0.3" in issues' do
expect(page).not_to have_content "Release 0.3"
end
 
step 'I should not see "Tweet control" in issues' do
expect(page).not_to have_content "Tweet control"
end
step 'I should see that I am subscribed' do
wait_for_requests
expect(find('.js-issuable-subscribe-button')).to have_css 'button.is-checked'
end
step 'I should see that I am unsubscribed' do
wait_for_requests
expect(find('.js-issuable-subscribe-button')).to have_css 'button:not(.is-checked)'
end
step 'I click link "Closed"' do
find('.issues-state-filters [data-state="closed"] span', text: 'Closed').click
end
 
step 'I click the subscription toggle' do
find('.js-issuable-subscribe-button button').click
end
step 'I should see "Release 0.3" in issues' do
expect(page).to have_content "Release 0.3"
end
Loading
Loading
@@ -51,24 +29,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(find('.issues-state-filters > .active')).to have_content 'All'
end
 
step 'I click link "Release 0.4"' do
click_link "Release 0.4"
end
step 'I should see issue "Release 0.4"' do
expect(page).to have_content "Release 0.4"
end
step 'I should see issue "Tweet control"' do
expect(page).to have_content "Tweet control"
end
 
step 'I click link "New issue"' do
page.within '#content-body' do
page.has_link?('New Issue') ? click_link('New Issue') : click_link('New issue')
end
end
step 'I click "author" dropdown' do
page.find('.js-author-search').click
sleep 1
Loading
Loading
@@ -81,18 +45,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(users[1].text).to eq "#{current_user.name} #{current_user.to_reference}"
end
 
step 'I submit new issue "500 error on profile"' do
fill_in "issue_title", with: "500 error on profile"
click_button "Submit issue"
end
step 'I submit new issue "500 error on profile" with label \'bug\'' do
fill_in "issue_title", with: "500 error on profile"
click_button "Label"
click_link "bug"
click_button "Submit issue"
end
step 'I click link "500 error on profile"' do
click_link "500 error on profile"
end
Loading
Loading
@@ -103,13 +55,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
 
step 'I should see issue "500 error on profile"' do
issue = Issue.find_by(title: "500 error on profile")
expect(page).to have_content issue.title
expect(page).to have_content issue.author_name
expect(page).to have_content issue.project.name
end
step 'I fill in issue search with "Re"' do
filter_issue "Re"
end
Loading
Loading
@@ -163,49 +108,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(find(issues_assignee_selector)).to have_content(assignee_name)
end
 
step 'project "Shop" have "Release 0.4" open issue' do
create(:issue,
title: "Release 0.4",
project: project,
author: project.users.first,
description: "# Description header"
)
wait_for_requests
end
step 'project "Shop" have "Tweet control" open issue' do
create(:issue,
title: "Tweet control",
project: project,
author: project.users.first)
end
step 'project "Shop" have "Bugfix" open issue' do
create(:issue,
title: "Bugfix",
project: project,
author: project.users.first)
end
step 'project "Shop" have "Release 0.3" closed issue' do
create(:closed_issue,
title: "Release 0.3",
project: project,
author: project.users.first)
end
step 'issue "Release 0.4" have 2 upvotes and 1 downvote' do
awardable = Issue.find_by(title: 'Release 0.4')
create_list(:award_emoji, 2, awardable: awardable)
create(:award_emoji, :downvote, awardable: awardable)
end
step 'issue "Tweet control" have 1 upvote and 2 downvotes' do
awardable = Issue.find_by(title: 'Tweet control')
create(:award_emoji, :upvote, awardable: awardable)
create_list(:award_emoji, 2, awardable: awardable, name: 'thumbsdown')
end
step 'The list should be sorted by "Least popular"' do
page.within '.issues-list' do
page.within 'li.issue:nth-child(1)' do
Loading
Loading
@@ -225,69 +127,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
 
step 'The list should be sorted by "Popularity"' do
page.within '.issues-list' do
page.within 'li.issue:nth-child(1)' do
expect(page).to have_content 'Release 0.4'
expect(page).to have_content '2 1'
end
page.within 'li.issue:nth-child(2)' do
expect(page).to have_content 'Tweet control'
expect(page).to have_content '1 2'
end
page.within 'li.issue:nth-child(3)' do
expect(page).to have_content 'Bugfix'
expect(page).not_to have_content '0 0'
end
end
end
step 'empty project "Empty Project"' do
create :project_empty_repo, name: 'Empty Project', namespace: @user.namespace
end
When 'I visit empty project page' do
project = Project.find_by(name: 'Empty Project')
visit project_path(project)
end
 
step 'I see empty project details with ssh clone info' do
project = Project.find_by(name: 'Empty Project')
page.all(:css, '.git-empty .clone').each do |element|
expect(element.text).to include(project.url_to_repo)
end
end
When "I visit project \"Community\" issues page" do
project = Project.find_by(name: 'Community')
visit project_issues_path(project)
end
 
When "I visit empty project's issues page" do
project = Project.find_by(name: 'Empty Project')
visit project_issues_path(project)
end
step 'I leave a comment with code block' do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
click_button "Comment"
sleep 0.05
end
end
step 'I should see an error alert section within the comment form' do
page.within(".js-main-target-form") do
find(".error-alert")
end
end
step 'The code block should be unchanged' do
expect(page).to have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```")
end
step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do
create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project)
end
Loading
Loading
@@ -320,36 +169,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(page).not_to have_content 'Bugfix1'
end
 
step 'issue \'Release 0.4\' has label \'bug\'' do
label = project.labels.create!(name: 'bug', color: '#990000')
issue = Issue.find_by!(title: 'Release 0.4')
issue.labels << label
end
step 'I click label \'bug\'' do
page.within ".issues-list" do
click_link 'bug'
end
end
step 'I should not see labels field' do
page.within '.issue-form' do
expect(page).not_to have_content("Labels")
end
end
step 'I should not see milestone field' do
page.within '.issue-form' do
expect(page).not_to have_content("Milestone")
end
end
step 'I should not see assignee field' do
page.within '.issue-form' do
expect(page).not_to have_content("Assign to")
end
end
def filter_issue(text)
fill_in 'issuable_search', with: text
end
Loading
Loading
Loading
Loading
@@ -105,17 +105,6 @@ module SharedIssuable
edit_issuable
end
 
step 'I click link "Edit" for the issue' do
edit_issuable
end
step 'I sort the list by "Last updated"' do
find('button.dropdown-toggle').click
page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do
click_link "Last updated"
end
end
step 'I sort the list by "Least popular"' do
find('button.dropdown-toggle').click
 
Loading
Loading
@@ -124,18 +113,6 @@ module SharedIssuable
end
end
 
step 'I sort the list by "Popularity"' do
find('button.dropdown-toggle').click
page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do
click_link 'Popularity'
end
end
step 'The list should be sorted by "Last updated"' do
expect(find('.issues-filters')).to have_content('Last updated')
end
step 'I click link "Next" in the sidebar' do
page.within '.issuable-sidebar' do
click_link 'Next'
Loading
Loading
Loading
Loading
@@ -18,43 +18,6 @@ module SharedMarkdown
expect(find('.gfm-form .js-md-preview')).not_to be_visible
end
 
step 'The Markdown preview tab should say there is nothing to do' do
page.within('.gfm-form') do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
step 'I should not see the Markdown text field' do
expect(find('.gfm-form textarea')).not_to be_visible
end
step 'I should see the Markdown write tab' do
expect(first('.gfm-form')).to have_link('Write', visible: true)
end
step 'I should see the Markdown preview' do
expect(find('.gfm-form')).to have_css('.js-md-preview', visible: true)
end
step 'The Markdown preview tab should display rendered Markdown' do
page.within('.gfm-form') do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('gl-emoji', visible: true)
end
end
step 'I write a description like ":+1: Nice"' do
find('.gfm-form').fill_in 'Description', with: ':+1: Nice'
end
step 'I preview a description text like "Bug fixed :smile:"' do
page.within(first('.gfm-form')) do
fill_in 'Description', with: 'Bug fixed :smile:'
click_link 'Preview'
end
end
step 'I haven\'t written any description text' do
find('.gfm-form').fill_in 'Description', with: ''
end
Loading
Loading
Loading
Loading
@@ -114,34 +114,12 @@ module SharedNote
end
end
 
step 'I should see comment "XML attached"' do
page.within(".note") do
expect(page).to have_content("XML attached")
end
end
step 'I should see no notes at all' do
expect(page).not_to have_css('.note')
end
 
# Markdown
 
step 'I leave a comment with a header containing "Comment with a header"' do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "# Comment with a header"
click_button "Comment"
end
wait_for_requests
end
step 'The comment with the header should not have an ID' do
page.within(".note-body > .note-text") do
expect(page).to have_content("Comment with a header")
expect(page).not_to have_css("#comment-with-a-header")
end
end
step 'I edit the last comment with a +1' do
page.within(".main-notes-list") do
note = find('.note')
Loading
Loading
Loading
Loading
@@ -96,10 +96,6 @@ module SharedPaths
visit assigned_issues_dashboard_path
end
 
step 'I visit dashboard merge requests page' do
visit assigned_mrs_dashboard_path
end
step 'I visit dashboard search page' do
visit search_path
end
Loading
Loading
@@ -200,10 +196,6 @@ module SharedPaths
# Generic Project
# ----------------------------------------
 
step "I visit my project's home page" do
visit project_path(@project)
end
step "I visit my project's settings page" do
visit edit_project_path(@project)
end
Loading
Loading
@@ -339,10 +331,6 @@ module SharedPaths
visit project_commit_path(@project, sample_commit.id)
end
 
step 'I visit project "Shop" issues page' do
visit project_issues_path(project)
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)
Loading
Loading
@@ -394,10 +382,6 @@ module SharedPaths
wait_for_requests
end
 
step 'I visit project "Shop" merge requests page' do
visit project_merge_requests_path(project)
end
step 'I visit forked project "Shop" merge requests page' do
visit project_merge_requests_path(project)
end
Loading
Loading
@@ -418,11 +402,6 @@ module SharedPaths
# Visibility Projects
# ----------------------------------------
 
step 'I visit project "Community" page' do
project = Project.find_by(name: "Community")
visit project_path(project)
end
step 'I visit project "Community" source page' do
project = Project.find_by(name: 'Community')
visit project_tree_path(project, root_ref)
Loading
Loading
@@ -442,11 +421,6 @@ module SharedPaths
# Empty Projects
# ----------------------------------------
 
step "I visit empty project page" do
project = Project.find_by(name: "Empty Public Project")
visit project_path(project)
end
step "I should not see command line instructions" do
expect(page).not_to have_css('.empty_wrapper')
end
Loading
Loading
Loading
Loading
@@ -236,10 +236,6 @@ module SharedProject
@project.update(public_builds: false)
end
 
step 'project "Shop" has a "Bugfix MR" merge request open' do
create(:merge_request, title: "Bugfix MR", target_project: project, source_project: project, author: project.users.first)
end
def user_owns_project(user_name:, project_name:, visibility: :private)
user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore)
project = Project.find_by(name: project_name)
Loading
Loading
Loading
Loading
@@ -19,10 +19,6 @@ module SharedUser
User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options))
end
 
step 'I have an ssh key' do
create(:personal_key, user: @user)
end
step 'I have no ssh keys' do
@user.keys.delete_all
end
Loading
Loading
require 'spec_helper'
 
feature 'Dashboard Issues filtering', :js do
include SortingHelper
include Spec::Support::Helpers::Features::SortingHelpers
 
let(:user) { create(:user) }
let(:project) { create(:project) }
Loading
Loading
@@ -90,14 +90,14 @@ feature 'Dashboard Issues filtering', :js do
 
context 'sorting' do
it 'shows sorted issues' do
sorting_by('Created date')
sort_by('Created date')
visit_issues
 
expect(find('.issues-filters')).to have_content('Created date')
end
 
it 'keeps sorting issues after visiting Projects Issues page' do
sorting_by('Created date')
sort_by('Created date')
visit project_issues_path(project)
 
expect(find('.issues-filters')).to have_content('Created date')
Loading
Loading
require 'spec_helper'
 
feature 'Dashboard Merge Requests' do
include Spec::Support::Helpers::Features::SortingHelpers
include FilterItemSelectHelper
include SortingHelper
include ProjectForksHelper
 
let(:current_user) { create :user }
Loading
Loading
@@ -115,7 +115,7 @@ feature 'Dashboard Merge Requests' do
end
 
it 'shows sorted merge requests' do
sorting_by('Created date')
sort_by('Created date')
 
visit merge_requests_dashboard_path(assignee_id: current_user.id)
 
Loading
Loading
@@ -123,7 +123,7 @@ feature 'Dashboard Merge Requests' do
end
 
it 'keeps sorting merge requests after visiting Projects MR page' do
sorting_by('Created date')
sort_by('Created date')
 
visit project_merge_requests_path(project)
 
Loading
Loading
require 'rails_helper'
 
feature 'Issues > User uses quick actions', :js do
include QuickActionsHelpers
include Spec::Support::Helpers::Features::NotesHelpers
 
it_behaves_like 'issuable record that supports quick actions in its description and notes', :issue do
let(:issuable) { create(:issue, project: project) }
Loading
Loading
@@ -36,7 +36,7 @@ feature 'Issues > User uses quick actions', :js do
 
context 'when the current user can update the due date' do
it 'does not create a note, and sets the due date accordingly' do
write_note("/due 2016-08-28")
add_note("/due 2016-08-28")
 
expect(page).not_to have_content '/due 2016-08-28'
expect(page).to have_content 'Commands applied'
Loading
Loading
@@ -57,7 +57,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'does not create a note, and sets the due date accordingly' do
write_note("/due 2016-08-28")
add_note("/due 2016-08-28")
 
expect(page).not_to have_content 'Commands applied'
 
Loading
Loading
@@ -75,7 +75,7 @@ feature 'Issues > User uses quick actions', :js do
it 'does not create a note, and removes the due date accordingly' do
expect(issue.due_date).to eq Date.new(2016, 8, 28)
 
write_note("/remove_due_date")
add_note("/remove_due_date")
 
expect(page).not_to have_content '/remove_due_date'
expect(page).to have_content 'Commands applied'
Loading
Loading
@@ -96,7 +96,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'does not create a note, and sets the due date accordingly' do
write_note("/remove_due_date")
add_note("/remove_due_date")
 
expect(page).not_to have_content 'Commands applied'
 
Loading
Loading
@@ -111,7 +111,7 @@ feature 'Issues > User uses quick actions', :js do
let(:issue) { create(:issue, project: project) }
 
it 'does not recognize the command nor create a note' do
write_note("/wip")
add_note("/wip")
 
expect(page).not_to have_content '/wip'
end
Loading
Loading
@@ -123,7 +123,7 @@ feature 'Issues > User uses quick actions', :js do
 
context 'when the current user can update issues' do
it 'does not create a note, and marks the issue as a duplicate' do
write_note("/duplicate ##{original_issue.to_reference}")
add_note("/duplicate ##{original_issue.to_reference}")
 
expect(page).not_to have_content "/duplicate #{original_issue.to_reference}"
expect(page).to have_content 'Commands applied'
Loading
Loading
@@ -143,7 +143,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'does not create a note, and does not mark the issue as a duplicate' do
write_note("/duplicate ##{original_issue.to_reference}")
add_note("/duplicate ##{original_issue.to_reference}")
 
expect(page).not_to have_content 'Commands applied'
expect(page).not_to have_content "marked this issue as a duplicate of #{original_issue.to_reference}"
Loading
Loading
@@ -166,7 +166,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'moves the issue' do
write_note("/move #{target_project.full_path}")
add_note("/move #{target_project.full_path}")
 
expect(page).to have_content 'Commands applied'
expect(issue.reload).to be_closed
Loading
Loading
@@ -186,7 +186,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'does not move the issue' do
write_note("/move #{project_unauthorized.full_path}")
add_note("/move #{project_unauthorized.full_path}")
 
expect(page).not_to have_content 'Commands applied'
expect(issue.reload).to be_open
Loading
Loading
@@ -200,7 +200,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'does not move the issue' do
write_note("/move not/valid")
add_note("/move not/valid")
 
expect(page).not_to have_content 'Commands applied'
expect(issue.reload).to be_open
Loading
Loading
@@ -223,7 +223,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'applies the commands to both issues and moves the issue' do
write_note("/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"\n\n/move #{target_project.full_path}")
add_note("/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"\n\n/move #{target_project.full_path}")
 
expect(page).to have_content 'Commands applied'
expect(issue.reload).to be_closed
Loading
Loading
@@ -242,7 +242,7 @@ feature 'Issues > User uses quick actions', :js do
end
 
it 'moves the issue and applies the commands to both issues' do
write_note("/move #{target_project.full_path}\n\n/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"")
add_note("/move #{target_project.full_path}\n\n/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"")
 
expect(page).to have_content 'Commands applied'
expect(issue.reload).to be_closed
Loading
Loading
require 'rails_helper'
 
describe 'Merge request > User uses quick actions', :js do
include QuickActionsHelpers
include Spec::Support::Helpers::Features::NotesHelpers
 
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
Loading
Loading
@@ -33,7 +33,7 @@ describe 'Merge request > User uses quick actions', :js do
describe 'toggling the WIP prefix in the title from note' do
context 'when the current user can toggle the WIP prefix' do
it 'adds the WIP: prefix to the title' do
write_note("/wip")
add_note("/wip")
 
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
Loading
Loading
@@ -44,7 +44,7 @@ describe 'Merge request > User uses quick actions', :js do
it 'removes the WIP: prefix from the title' do
merge_request.title = merge_request.wip_title
merge_request.save
write_note("/wip")
add_note("/wip")
 
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
Loading
Loading
@@ -62,7 +62,7 @@ describe 'Merge request > User uses quick actions', :js do
end
 
it 'does not change the WIP prefix' do
write_note("/wip")
add_note("/wip")
 
expect(page).not_to have_content '/wip'
expect(page).not_to have_content 'Commands applied'
Loading
Loading
@@ -75,7 +75,7 @@ describe 'Merge request > User uses quick actions', :js do
describe 'merging the MR from the note' do
context 'when the current user can merge the MR' do
it 'merges the MR' do
write_note("/merge")
add_note("/merge")
 
expect(page).to have_content 'Commands applied'
 
Loading
Loading
@@ -90,7 +90,7 @@ describe 'Merge request > User uses quick actions', :js do
end
 
it 'does not merge the MR' do
write_note("/merge")
add_note("/merge")
 
expect(page).not_to have_content 'Your commands have been executed!'
 
Loading
Loading
@@ -107,7 +107,7 @@ describe 'Merge request > User uses quick actions', :js do
end
 
it 'does not merge the MR' do
write_note("/merge")
add_note("/merge")
 
expect(page).not_to have_content 'Your commands have been executed!'
 
Loading
Loading
@@ -118,7 +118,7 @@ describe 'Merge request > User uses quick actions', :js do
 
describe 'adding a due date from note' do
it 'does not recognize the command nor create a note' do
write_note('/due 2016-08-28')
add_note('/due 2016-08-28')
 
expect(page).not_to have_content '/due 2016-08-28'
end
Loading
Loading
@@ -162,7 +162,7 @@ describe 'Merge request > User uses quick actions', :js do
describe '/target_branch command from note' do
context 'when the current user can change target branch' do
it 'changes target branch from a note' do
write_note("message start \n/target_branch merge-test\n message end.")
add_note("message start \n/target_branch merge-test\n message end.")
 
wait_for_requests
expect(page).not_to have_content('/target_branch')
Loading
Loading
@@ -173,7 +173,7 @@ describe 'Merge request > User uses quick actions', :js do
end
 
it 'does not fail when target branch does not exists' do
write_note('/target_branch totally_not_existing_branch')
add_note('/target_branch totally_not_existing_branch')
 
expect(page).not_to have_content('/target_branch')
 
Loading
Loading
@@ -190,7 +190,7 @@ describe 'Merge request > User uses quick actions', :js do
end
 
it 'does not change target branch' do
write_note('/target_branch merge-test')
add_note('/target_branch merge-test')
 
expect(page).not_to have_content '/target_branch merge-test'
 
Loading
Loading
require "spec_helper"
describe "User comments on issue", :js do
include Spec::Support::Helpers::Features::NotesHelpers
let(:project) { create(:project_empty_repo, :public) }
let(:issue) { create(:issue, project: project) }
let(:user) { create(:user) }
before do
project.add_guest(user)
sign_in(user)
visit(project_issue_path(project, issue))
end
context "when adding comments" do
it "adds comment" do
content = "XML attached"
target_form = ".js-main-target-form"
add_note(content)
page.within(".note") do
expect(page).to have_content(content)
end
page.within(target_form) do
find(".error-alert", visible: false)
end
end
it "adds comment with code block" do
comment = "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
add_note(comment)
expect(page).to have_content(comment)
end
end
context "when editing comments" do
it "edits comment" do
add_note("# Comment with a header")
page.within(".note-body > .note-text") do
expect(page).to have_content("Comment with a header").and have_no_css("#comment-with-a-header")
end
page.within(".main-notes-list") do
note = find(".note")
note.hover
note.find(".js-note-edit").click
end
expect(page).to have_css(".current-note-edit-form textarea")
comment = "+1 Awesome!"
page.within(".current-note-edit-form") do
fill_in("note[note]", with: comment)
click_button("Save comment")
end
wait_for_requests
page.within(".note") do
expect(page).to have_content(comment)
end
end
end
end
require "spec_helper"
describe "User creates issue" do
let(:project) { create(:project_empty_repo, :public) }
let(:user) { create(:user) }
context "when signed in as guest" do
before do
project.add_guest(user)
sign_in(user)
visit(new_project_issue_path(project))
end
it "creates issue" do
page.within(".issue-form") do
expect(page).to have_no_content("Assign to")
.and have_no_content("Labels")
.and have_no_content("Milestone")
end
issue_title = "500 error on profile"
fill_in("Title", with: issue_title)
click_button("Submit issue")
expect(page).to have_content(issue_title)
.and have_content(user.name)
.and have_content(project.name)
end
end
context "when signed in as developer", :js do
before do
project.add_developer(user)
sign_in(user)
visit(new_project_issue_path(project))
end
context "when previewing" do
it "previews content" do
form = first(".gfm-form")
textarea = first(".gfm-form textarea")
page.within(form) do
click_link("Preview")
preview = find(".js-md-preview") # this element is findable only when the "Preview" link is clicked.
expect(preview).to have_content("Nothing to preview.")
click_link("Write")
fill_in("Description", with: "Bug fixed :smile:")
click_link("Preview")
expect(preview).to have_css("gl-emoji")
expect(textarea).not_to be_visible
end
end
end
context "with labels" do
LABEL_TITLES = %w(bug feature enhancement).freeze
before do
LABEL_TITLES.each do |title|
create(:label, project: project, title: title)
end
end
it "creates issue" do
issue_title = "500 error on profile"
fill_in("Title", with: issue_title)
click_button("Label")
click_link(LABEL_TITLES.first)
click_button("Submit issue")
expect(page).to have_content(issue_title)
.and have_content(user.name)
.and have_content(project.name)
.and have_content(LABEL_TITLES.first)
end
end
end
end
require "spec_helper"
describe "User edits issue", :js do
set(:project) { create(:project_empty_repo, :public) }
set(:user) { create(:user) }
set(:issue) { create(:issue, project: project, author: user) }
before do
project.add_developer(user)
sign_in(user)
visit(edit_project_issue_path(project, issue))
end
it "previews content" do
form = first(".gfm-form")
page.within(form) do
fill_in("Description", with: "Bug fixed :smile:")
click_link("Preview")
end
expect(form).to have_link("Write")
end
end
require "spec_helper"
describe "User sorts issues" do
set(:project) { create(:project_empty_repo, :public) }
set(:issue1) { create(:issue, project: project) }
set(:issue2) { create(:issue, project: project) }
set(:issue3) { create(:issue, project: project) }
before do
create_list(:award_emoji, 2, :upvote, awardable: issue1)
create_list(:award_emoji, 2, :downvote, awardable: issue2)
create(:award_emoji, :downvote, awardable: issue1)
create(:award_emoji, :upvote, awardable: issue2)
visit(project_issues_path(project))
end
it "sorts by popularity" do
find("button.dropdown-toggle").click
page.within(".content ul.dropdown-menu.dropdown-menu-align-right li") do
click_link("Popularity")
end
page.within(".issues-list") do
page.within("li.issue:nth-child(1)") do
expect(page).to have_content(issue1.title)
expect(page).to have_content("2 1")
end
page.within("li.issue:nth-child(2)") do
expect(page).to have_content(issue2.title)
expect(page).to have_content("1 2")
end
page.within("li.issue:nth-child(3)") do
expect(page).to have_content(issue3.title)
expect(page).not_to have_content("0 0")
end
end
end
end
require "spec_helper"
describe "User toggles subscription", :js do
set(:project) { create(:project_empty_repo, :public) }
set(:user) { create(:user) }
set(:issue) { create(:issue, project: project, author: user) }
before do
project.add_developer(user)
sign_in(user)
visit(project_issue_path(project, issue))
end
it "unsibscribes from issue" do
subscription_button = find(".js-issuable-subscribe-button")
# Check we're subscribed.
expect(subscription_button).to have_css("button.is-checked")
# Toggle subscription.
find(".js-issuable-subscribe-button button").click
wait_for_requests
# Check we're unsubscribed.
expect(subscription_button).to have_css("button:not(.is-checked)")
end
end
require "spec_helper"
describe "User views issue" do
set(:project) { create(:project_empty_repo, :public) }
set(:user) { create(:user) }
set(:issue) { create(:issue, project: project, description: "# Description header", author: user) }
before do
project.add_guest(user)
sign_in(user)
visit(project_issue_path(project, issue))
end
it { expect(page).to have_header_with_correct_id_and_link(1, "Description header", "description-header") }
end
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