Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
dc4ae317
Commit
dc4ae317
authored
Apr 03, 2018
by
blackst0ne
Committed by
Rémy Coutable
Apr 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the `project/issues/issues.feature` spinach test with an rspec analog
parent
95b3bf26
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
532 additions
and
580 deletions
+532
-580
changelogs/unreleased/blackst0ne-replace-spinach-project-issues-issues-feature.yml
...ckst0ne-replace-spinach-project-issues-issues-feature.yml
+5
-0
features/project/issues/issues.feature
features/project/issues/issues.feature
+0
-180
features/project/issues/milestones.feature
features/project/issues/milestones.feature
+1
-0
features/steps/project/issues/issues.rb
features/steps/project/issues/issues.rb
+0
-181
features/steps/shared/issuable.rb
features/steps/shared/issuable.rb
+0
-23
features/steps/shared/markdown.rb
features/steps/shared/markdown.rb
+0
-37
features/steps/shared/note.rb
features/steps/shared/note.rb
+0
-22
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-26
features/steps/shared/project.rb
features/steps/shared/project.rb
+0
-4
features/steps/shared/user.rb
features/steps/shared/user.rb
+0
-4
spec/features/dashboard/issues_filter_spec.rb
spec/features/dashboard/issues_filter_spec.rb
+3
-3
spec/features/dashboard/merge_requests_spec.rb
spec/features/dashboard/merge_requests_spec.rb
+3
-3
spec/features/issues/user_uses_slash_commands_spec.rb
spec/features/issues/user_uses_slash_commands_spec.rb
+13
-13
spec/features/merge_request/user_uses_slash_commands_spec.rb
spec/features/merge_request/user_uses_slash_commands_spec.rb
+11
-11
spec/features/projects/issues/user_comments_on_issue_spec.rb
spec/features/projects/issues/user_comments_on_issue_spec.rb
+73
-0
spec/features/projects/issues/user_creates_issue_spec.rb
spec/features/projects/issues/user_creates_issue_spec.rb
+87
-0
spec/features/projects/issues/user_edits_issue_spec.rb
spec/features/projects/issues/user_edits_issue_spec.rb
+25
-0
spec/features/projects/issues/user_sorts_issues_spec.rb
spec/features/projects/issues/user_sorts_issues_spec.rb
+42
-0
spec/features/projects/issues/user_toggles_subscription_spec.rb
...eatures/projects/issues/user_toggles_subscription_spec.rb
+28
-0
spec/features/projects/issues/user_views_issue_spec.rb
spec/features/projects/issues/user_views_issue_spec.rb
+16
-0
spec/features/projects/issues/user_views_issues_spec.rb
spec/features/projects/issues/user_views_issues_spec.rb
+90
-30
spec/features/projects/milestones/milestones_sorting_spec.rb
spec/features/projects/milestones/milestones_sorting_spec.rb
+0
-1
spec/features/user_sorts_things_spec.rb
spec/features/user_sorts_things_spec.rb
+57
-0
spec/support/features/issuable_slash_commands_shared_examples.rb
...pport/features/issuable_slash_commands_shared_examples.rb
+14
-14
spec/support/helpers/features/notes_helpers.rb
spec/support/helpers/features/notes_helpers.rb
+27
-0
spec/support/helpers/features/sorting_helpers.rb
spec/support/helpers/features/sorting_helpers.rb
+26
-0
spec/support/matchers/issuable_matchers.rb
spec/support/matchers/issuable_matchers.rb
+11
-0
spec/support/quick_actions_helpers.rb
spec/support/quick_actions_helpers.rb
+0
-10
spec/support/sorting_helper.rb
spec/support/sorting_helper.rb
+0
-18
No files found.
changelogs/unreleased/blackst0ne-replace-spinach-project-issues-issues-feature.yml
0 → 100644
View file @
dc4ae317
---
title
:
Replace the spinach test with an rspec analog
merge_request
:
17950
author
:
blackst0ne
type
:
other
features/project/issues/issues.feature
deleted
100644 → 0
View file @
95b3bf26
@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"
features/project/issues/milestones.feature
View file @
dc4ae317
...
@@ -39,4 +39,5 @@ Feature: Project Issues Milestones
...
@@ -39,4 +39,5 @@ Feature: Project Issues Milestones
Scenario
:
Headers inside the description should have ids generated for them.
Scenario
:
Headers inside the description should have ids generated for them.
Given
I click link
"v2.2"
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
Then
Header
"Description header"
should have correct id and link
features/steps/project/issues/issues.rb
View file @
dc4ae317
...
@@ -7,36 +7,14 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -7,36 +7,14 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
include
SharedMarkdown
include
SharedMarkdown
include
SharedUser
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
step
'I should not see "Release 0.3" in issues'
do
expect
(
page
).
not_to
have_content
"Release 0.3"
expect
(
page
).
not_to
have_content
"Release 0.3"
end
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
step
'I click link "Closed"'
do
find
(
'.issues-state-filters [data-state="closed"] span'
,
text:
'Closed'
).
click
find
(
'.issues-state-filters [data-state="closed"] span'
,
text:
'Closed'
).
click
end
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
step
'I should see "Release 0.3" in issues'
do
expect
(
page
).
to
have_content
"Release 0.3"
expect
(
page
).
to
have_content
"Release 0.3"
end
end
...
@@ -51,24 +29,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -51,24 +29,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect
(
find
(
'.issues-state-filters > .active'
)).
to
have_content
'All'
expect
(
find
(
'.issues-state-filters > .active'
)).
to
have_content
'All'
end
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
step
'I should see issue "Tweet control"'
do
expect
(
page
).
to
have_content
"Tweet control"
expect
(
page
).
to
have_content
"Tweet control"
end
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
step
'I click "author" dropdown'
do
page
.
find
(
'.js-author-search'
).
click
page
.
find
(
'.js-author-search'
).
click
sleep
1
sleep
1
...
@@ -81,18 +45,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -81,18 +45,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect
(
users
[
1
].
text
).
to
eq
"
#{
current_user
.
name
}
#{
current_user
.
to_reference
}
"
expect
(
users
[
1
].
text
).
to
eq
"
#{
current_user
.
name
}
#{
current_user
.
to_reference
}
"
end
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
step
'I click link "500 error on profile"'
do
click_link
"500 error on profile"
click_link
"500 error on profile"
end
end
...
@@ -103,13 +55,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -103,13 +55,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
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
step
'I fill in issue search with "Re"'
do
filter_issue
"Re"
filter_issue
"Re"
end
end
...
@@ -163,49 +108,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -163,49 +108,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect
(
find
(
issues_assignee_selector
)).
to
have_content
(
assignee_name
)
expect
(
find
(
issues_assignee_selector
)).
to
have_content
(
assignee_name
)
end
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
step
'The list should be sorted by "Least popular"'
do
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
page
.
within
'li.issue:nth-child(1)'
do
page
.
within
'li.issue:nth-child(1)'
do
...
@@ -225,69 +127,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -225,69 +127,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
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
When
'I visit empty project page'
do
project
=
Project
.
find_by
(
name:
'Empty Project'
)
project
=
Project
.
find_by
(
name:
'Empty Project'
)
visit
project_path
(
project
)
visit
project_path
(
project
)
end
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
When
"I visit project
\"
Community
\"
issues page"
do
project
=
Project
.
find_by
(
name:
'Community'
)
project
=
Project
.
find_by
(
name:
'Community'
)
visit
project_issues_path
(
project
)
visit
project_issues_path
(
project
)
end
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:
"```
\n
Command [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
(
"```
\n
Command [1]: /usr/local/bin/git , see [text](doc/text)
\n
```"
)
end
step
'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\''
do
step
'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\''
do
create
(
:issue
,
title:
'Bugfix1'
,
description:
'Description for issue1'
,
project:
project
)
create
(
:issue
,
title:
'Bugfix1'
,
description:
'Description for issue1'
,
project:
project
)
end
end
...
@@ -320,36 +169,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -320,36 +169,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect
(
page
).
not_to
have_content
'Bugfix1'
expect
(
page
).
not_to
have_content
'Bugfix1'
end
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
)
def
filter_issue
(
text
)
fill_in
'issuable_search'
,
with:
text
fill_in
'issuable_search'
,
with:
text
end
end
...
...
features/steps/shared/issuable.rb
View file @
dc4ae317
...
@@ -105,17 +105,6 @@ module SharedIssuable
...
@@ -105,17 +105,6 @@ module SharedIssuable
edit_issuable
edit_issuable
end
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
step
'I sort the list by "Least popular"'
do
find
(
'button.dropdown-toggle'
).
click
find
(
'button.dropdown-toggle'
).
click
...
@@ -124,18 +113,6 @@ module SharedIssuable
...
@@ -124,18 +113,6 @@ module SharedIssuable
end
end
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
step
'I click link "Next" in the sidebar'
do
page
.
within
'.issuable-sidebar'
do
page
.
within
'.issuable-sidebar'
do
click_link
'Next'
click_link
'Next'
...
...
features/steps/shared/markdown.rb
View file @
dc4ae317
...
@@ -18,43 +18,6 @@ module SharedMarkdown
...
@@ -18,43 +18,6 @@ module SharedMarkdown
expect
(
find
(
'.gfm-form .js-md-preview'
)).
not_to
be_visible
expect
(
find
(
'.gfm-form .js-md-preview'
)).
not_to
be_visible
end
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
step
'I haven\'t written any description text'
do
find
(
'.gfm-form'
).
fill_in
'Description'
,
with:
''
find
(
'.gfm-form'
).
fill_in
'Description'
,
with:
''
end
end
...
...
features/steps/shared/note.rb
View file @
dc4ae317
...
@@ -114,34 +114,12 @@ module SharedNote
...
@@ -114,34 +114,12 @@ module SharedNote
end
end
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
step
'I should see no notes at all'
do
expect
(
page
).
not_to
have_css
(
'.note'
)
expect
(
page
).
not_to
have_css
(
'.note'
)
end
end
# Markdown
# 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
step
'I edit the last comment with a +1'
do
page
.
within
(
".main-notes-list"
)
do
page
.
within
(
".main-notes-list"
)
do
note
=
find
(
'.note'
)
note
=
find
(
'.note'
)
...
...
features/steps/shared/paths.rb
View file @
dc4ae317
...
@@ -96,10 +96,6 @@ module SharedPaths
...
@@ -96,10 +96,6 @@ module SharedPaths
visit
assigned_issues_dashboard_path
visit
assigned_issues_dashboard_path
end
end
step
'I visit dashboard merge requests page'
do
visit
assigned_mrs_dashboard_path
end
step
'I visit dashboard search page'
do
step
'I visit dashboard search page'
do
visit
search_path
visit
search_path
end
end
...
@@ -200,10 +196,6 @@ module SharedPaths
...
@@ -200,10 +196,6 @@ module SharedPaths
# Generic Project
# 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
step
"I visit my project's settings page"
do
visit
edit_project_path
(
@project
)
visit
edit_project_path
(
@project
)
end
end
...
@@ -339,10 +331,6 @@ module SharedPaths
...
@@ -339,10 +331,6 @@ module SharedPaths
visit
project_commit_path
(
@project
,
sample_commit
.
id
)
visit
project_commit_path
(
@project
,
sample_commit
.
id
)
end
end
step
'I visit project "Shop" issues page'
do
visit
project_issues_path
(
project
)
end
step
'I visit issue page "Release 0.4"'
do
step
'I visit issue page "Release 0.4"'
do
issue
=
Issue
.
find_by
(
title:
"Release 0.4"
)
issue
=
Issue
.
find_by
(
title:
"Release 0.4"
)
visit
project_issue_path
(
issue
.
project
,
issue
)
visit
project_issue_path
(
issue
.
project
,
issue
)
...
@@ -394,10 +382,6 @@ module SharedPaths
...
@@ -394,10 +382,6 @@ module SharedPaths
wait_for_requests
wait_for_requests
end
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
step
'I visit forked project "Shop" merge requests page'
do
visit
project_merge_requests_path
(
project
)
visit
project_merge_requests_path
(
project
)
end
end
...
@@ -418,11 +402,6 @@ module SharedPaths
...
@@ -418,11 +402,6 @@ module SharedPaths
# Visibility Projects
# 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
step
'I visit project "Community" source page'
do
project
=
Project
.
find_by
(
name:
'Community'
)
project
=
Project
.
find_by
(
name:
'Community'
)
visit
project_tree_path
(
project
,
root_ref
)
visit
project_tree_path
(
project
,
root_ref
)
...
@@ -442,11 +421,6 @@ module SharedPaths
...
@@ -442,11 +421,6 @@ module SharedPaths
# Empty Projects
# 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
step
"I should not see command line instructions"
do
expect
(
page
).
not_to
have_css
(
'.empty_wrapper'
)
expect
(
page
).
not_to
have_css
(
'.empty_wrapper'
)
end
end
...
...
features/steps/shared/project.rb
View file @
dc4ae317
...
@@ -236,10 +236,6 @@ module SharedProject
...
@@ -236,10 +236,6 @@ module SharedProject
@project
.
update
(
public_builds:
false
)
@project
.
update
(
public_builds:
false
)
end
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
)
def
user_owns_project
(
user_name
:,
project_name
:,
visibility: :private
)
user
=
user_exists
(
user_name
,
username:
user_name
.
gsub
(
/\s/
,
''
).
underscore
)
user
=
user_exists
(
user_name
,
username:
user_name
.
gsub
(
/\s/
,
''
).
underscore
)
project
=
Project
.
find_by
(
name:
project_name
)
project
=
Project
.
find_by
(
name:
project_name
)
...
...
features/steps/shared/user.rb
View file @
dc4ae317
...
@@ -19,10 +19,6 @@ module SharedUser
...
@@ -19,10 +19,6 @@ module SharedUser
User
.
find_by
(
name:
name
)
||
create
(
:user
,
{
name:
name
,
admin:
false
}.
merge
(
options
))
User
.
find_by
(
name:
name
)
||
create
(
:user
,
{
name:
name
,
admin:
false
}.
merge
(
options
))
end
end
step
'I have an ssh key'
do
create
(
:personal_key
,
user:
@user
)
end
step
'I have no ssh keys'
do
step
'I have no ssh keys'
do
@user
.
keys
.
delete_all
@user
.
keys
.
delete_all
end
end
...
...
spec/features/dashboard/issues_filter_spec.rb
View file @
dc4ae317
require
'spec_helper'
require
'spec_helper'
feature
'Dashboard Issues filtering'
,
:js
do
feature
'Dashboard Issues filtering'
,
:js
do
include
S
ortingHelper
include
S
pec
::
Support
::
Helpers
::
Features
::
SortingHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
...
@@ -90,14 +90,14 @@ feature 'Dashboard Issues filtering', :js do
...
@@ -90,14 +90,14 @@ feature 'Dashboard Issues filtering', :js do
context
'sorting'
do
context
'sorting'
do
it
'shows sorted issues'
do
it
'shows sorted issues'
do
sort
ing
_by
(
'Created date'
)
sort_by
(
'Created date'
)
visit_issues
visit_issues
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
end
end
it
'keeps sorting issues after visiting Projects Issues page'
do
it
'keeps sorting issues after visiting Projects Issues page'
do
sort
ing
_by
(
'Created date'
)
sort_by
(
'Created date'
)
visit
project_issues_path
(
project
)
visit
project_issues_path
(
project
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
...
...
spec/features/dashboard/merge_requests_spec.rb
View file @
dc4ae317
require
'spec_helper'
require
'spec_helper'
feature
'Dashboard Merge Requests'
do
feature
'Dashboard Merge Requests'
do
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
FilterItemSelectHelper
include
FilterItemSelectHelper
include
SortingHelper
include
ProjectForksHelper
include
ProjectForksHelper
let
(
:current_user
)
{
create
:user
}
let
(
:current_user
)
{
create
:user
}
...
@@ -115,7 +115,7 @@ feature 'Dashboard Merge Requests' do
...
@@ -115,7 +115,7 @@ feature 'Dashboard Merge Requests' do
end
end
it
'shows sorted merge requests'
do
it
'shows sorted merge requests'
do
sort
ing
_by
(
'Created date'
)
sort_by
(
'Created date'
)
visit
merge_requests_dashboard_path
(
assignee_id:
current_user
.
id
)
visit
merge_requests_dashboard_path
(
assignee_id:
current_user
.
id
)
...
@@ -123,7 +123,7 @@ feature 'Dashboard Merge Requests' do
...
@@ -123,7 +123,7 @@ feature 'Dashboard Merge Requests' do
end
end
it
'keeps sorting merge requests after visiting Projects MR page'
do
it
'keeps sorting merge requests after visiting Projects MR page'
do
sort
ing
_by
(
'Created date'
)
sort_by
(
'Created date'
)
visit
project_merge_requests_path
(
project
)
visit
project_merge_requests_path
(
project
)
...
...
spec/features/issues/user_uses_slash_commands_spec.rb
View file @
dc4ae317
require
'rails_helper'
require
'rails_helper'
feature
'Issues > User uses quick actions'
,
:js
do
feature
'Issues > User uses quick actions'
,
:js
do
include
QuickAction
sHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
Note
sHelpers
it_behaves_like
'issuable record that supports quick actions in its description and notes'
,
:issue
do
it_behaves_like
'issuable record that supports quick actions in its description and notes'
,
:issue
do
let
(
:issuable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issuable
)
{
create
(
:issue
,
project:
project
)
}
...
@@ -36,7 +36,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -36,7 +36,7 @@ feature 'Issues > User uses quick actions', :js do
context
'when the current user can update the due date'
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
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
).
not_to
have_content
'/due 2016-08-28'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -57,7 +57,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -57,7 +57,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'does not create a note, and sets the due date accordingly'
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
'Commands applied'
expect
(
page
).
not_to
have_content
'Commands applied'
...
@@ -75,7 +75,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -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
it
'does not create a note, and removes the due date accordingly'
do
expect
(
issue
.
due_date
).
to
eq
Date
.
new
(
2016
,
8
,
28
)
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
).
not_to
have_content
'/remove_due_date'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -96,7 +96,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -96,7 +96,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'does not create a note, and sets the due date accordingly'
do
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'
expect
(
page
).
not_to
have_content
'Commands applied'
...
@@ -111,7 +111,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -111,7 +111,7 @@ feature 'Issues > User uses quick actions', :js do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
it
'does not recognize the command nor create a note'
do
it
'does not recognize the command nor create a note'
do
write
_note
(
"/wip"
)
add
_note
(
"/wip"
)
expect
(
page
).
not_to
have_content
'/wip'
expect
(
page
).
not_to
have_content
'/wip'
end
end
...
@@ -123,7 +123,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -123,7 +123,7 @@ feature 'Issues > User uses quick actions', :js do
context
'when the current user can update issues'
do
context
'when the current user can update issues'
do
it
'does not create a note, and marks the issue as a duplicate'
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
).
not_to
have_content
"/duplicate
#{
original_issue
.
to_reference
}
"
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -143,7 +143,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -143,7 +143,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'does not create a note, and does not mark the issue as a duplicate'
do
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
'Commands applied'
expect
(
page
).
not_to
have_content
"marked this issue as a duplicate of
#{
original_issue
.
to_reference
}
"
expect
(
page
).
not_to
have_content
"marked this issue as a duplicate of
#{
original_issue
.
to_reference
}
"
...
@@ -166,7 +166,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -166,7 +166,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'moves the issue'
do
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
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
expect
(
issue
.
reload
).
to
be_closed
...
@@ -186,7 +186,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -186,7 +186,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'does not move the issue'
do
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
(
page
).
not_to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_open
expect
(
issue
.
reload
).
to
be_open
...
@@ -200,7 +200,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -200,7 +200,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'does not move the issue'
do
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
(
page
).
not_to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_open
expect
(
issue
.
reload
).
to
be_open
...
@@ -223,7 +223,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -223,7 +223,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'applies the commands to both issues and moves the issue'
do
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
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
expect
(
issue
.
reload
).
to
be_closed
...
@@ -242,7 +242,7 @@ feature 'Issues > User uses quick actions', :js do
...
@@ -242,7 +242,7 @@ feature 'Issues > User uses quick actions', :js do
end
end
it
'moves the issue and applies the commands to both issues'
do
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
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
expect
(
issue
.
reload
).
to
be_closed
...
...
spec/features/merge_request/user_uses_slash_commands_spec.rb
View file @
dc4ae317
require
'rails_helper'
require
'rails_helper'
describe
'Merge request > User uses quick actions'
,
:js
do
describe
'Merge request > User uses quick actions'
,
:js
do
include
QuickAction
sHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
Note
sHelpers
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
project
.
creator
}
let
(
:user
)
{
project
.
creator
}
...
@@ -33,7 +33,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -33,7 +33,7 @@ describe 'Merge request > User uses quick actions', :js do
describe
'toggling the WIP prefix in the title from note'
do
describe
'toggling the WIP prefix in the title from note'
do
context
'when the current user can toggle the WIP prefix'
do
context
'when the current user can toggle the WIP prefix'
do
it
'adds the WIP: prefix to the title'
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
).
not_to
have_content
'/wip'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -44,7 +44,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -44,7 +44,7 @@ describe 'Merge request > User uses quick actions', :js do
it
'removes the WIP: prefix from the title'
do
it
'removes the WIP: prefix from the title'
do
merge_request
.
title
=
merge_request
.
wip_title
merge_request
.
title
=
merge_request
.
wip_title
merge_request
.
save
merge_request
.
save
write
_note
(
"/wip"
)
add
_note
(
"/wip"
)
expect
(
page
).
not_to
have_content
'/wip'
expect
(
page
).
not_to
have_content
'/wip'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -62,7 +62,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -62,7 +62,7 @@ describe 'Merge request > User uses quick actions', :js do
end
end
it
'does not change the WIP prefix'
do
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
'/wip'
expect
(
page
).
not_to
have_content
'Commands applied'
expect
(
page
).
not_to
have_content
'Commands applied'
...
@@ -75,7 +75,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -75,7 +75,7 @@ describe 'Merge request > User uses quick actions', :js do
describe
'merging the MR from the note'
do
describe
'merging the MR from the note'
do
context
'when the current user can merge the MR'
do
context
'when the current user can merge the MR'
do
it
'merges the MR'
do
it
'merges the MR'
do
write
_note
(
"/merge"
)
add
_note
(
"/merge"
)
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -90,7 +90,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -90,7 +90,7 @@ describe 'Merge request > User uses quick actions', :js do
end
end
it
'does not merge the MR'
do
it
'does not merge the MR'
do
write
_note
(
"/merge"
)
add
_note
(
"/merge"
)
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
...
@@ -107,7 +107,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -107,7 +107,7 @@ describe 'Merge request > User uses quick actions', :js do
end
end
it
'does not merge the MR'
do
it
'does not merge the MR'
do
write
_note
(
"/merge"
)
add
_note
(
"/merge"
)
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
...
@@ -118,7 +118,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -118,7 +118,7 @@ describe 'Merge request > User uses quick actions', :js do
describe
'adding a due date from note'
do
describe
'adding a due date from note'
do
it
'does not recognize the command nor create a 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'
expect
(
page
).
not_to
have_content
'/due 2016-08-28'
end
end
...
@@ -162,7 +162,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -162,7 +162,7 @@ describe 'Merge request > User uses quick actions', :js do
describe
'/target_branch command from note'
do
describe
'/target_branch command from note'
do
context
'when the current user can change target branch'
do
context
'when the current user can change target branch'
do
it
'changes target branch from a note'
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
wait_for_requests
expect
(
page
).
not_to
have_content
(
'/target_branch'
)
expect
(
page
).
not_to
have_content
(
'/target_branch'
)
...
@@ -173,7 +173,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -173,7 +173,7 @@ describe 'Merge request > User uses quick actions', :js do
end
end
it
'does not fail when target branch does not exists'
do
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'
)
expect
(
page
).
not_to
have_content
(
'/target_branch'
)
...
@@ -190,7 +190,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -190,7 +190,7 @@ describe 'Merge request > User uses quick actions', :js do
end
end
it
'does not change target branch'
do
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'
expect
(
page
).
not_to
have_content
'/target_branch merge-test'
...
...
spec/features/projects/issues/user_comments_on_issue_spec.rb
0 → 100644
View file @
dc4ae317
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
=
"```
\n
Command [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
spec/features/projects/issues/user_creates_issue_spec.rb
0 → 100644
View file @
dc4ae317
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
spec/features/projects/issues/user_edits_issue_spec.rb
0 → 100644
View file @
dc4ae317
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
spec/features/projects/issues/user_sorts_issues_spec.rb
0 → 100644
View file @
dc4ae317
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
spec/features/projects/issues/user_toggles_subscription_spec.rb
0 → 100644
View file @
dc4ae317
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
spec/features/projects/issues/user_views_issue_spec.rb
0 → 100644
View file @
dc4ae317
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
spec/features/projects/issues/user_views_issues_spec.rb
View file @
dc4ae317
require
'spec_helper'
require
"spec_helper"
describe
'User views issues'
do
describe
"User views issues"
do
let!
(
:closed_issue
)
{
create
(
:closed_issue
,
project:
project
)
}
let!
(
:open_issue1
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:open_issue2
)
{
create
(
:issue
,
project:
project
)
}
set
(
:user
)
{
create
(
:user
)
}
set
(
:user
)
{
create
(
:user
)
}
shared_examples_for
'shows issues'
do
shared_examples
"opens issue from list"
do
it
'shows issues'
do
it
"opens issue"
do
click_link
(
issue
.
title
)
expect
(
page
).
to
have_content
(
issue
.
title
)
end
end
shared_examples
"open issues"
do
context
"open issues"
do
let
(
:label
)
{
create
(
:label
,
project:
project
,
title:
"bug"
)
}
before
do
open_issue1
.
labels
<<
label
visit
(
project_issues_path
(
project
,
state: :opened
))
end
it
"shows open issues"
do
expect
(
page
).
to
have_content
(
project
.
name
)
expect
(
page
).
to
have_content
(
project
.
name
)
.
and
have_content
(
issue1
.
title
)
.
and
have_content
(
open_issue1
.
title
)
.
and
have_content
(
issue2
.
title
)
.
and
have_content
(
open_issue2
.
title
)
.
and
have_no_selector
(
'.js-new-board-list'
)
.
and
have_no_content
(
closed_issue
.
title
)
.
and
have_no_selector
(
".js-new-board-list"
)
end
it
"opens issues by label"
do
page
.
within
(
".issues-list"
)
do
click_link
(
label
.
title
)
end
end
expect
(
page
).
to
have_content
(
open_issue1
.
title
)
.
and
have_no_content
(
open_issue2
.
title
)
.
and
have_no_content
(
closed_issue
.
title
)
end
end
context
'when project is public'
do
include_examples
"opens issue from list"
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
let
(
:issue
)
{
open_issue1
}
set
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
end
set
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
end
end
context
'when signed in'
do
shared_examples
"closed issues"
do
context
"closed issues"
do
before
do
before
do
project
.
add_developer
(
user
)
visit
(
project_issues_path
(
project
,
state: :closed
)
)
sign_in
(
user
)
end
visit
(
project_issues_path
(
project
))
it
"shows closed issues"
do
expect
(
page
).
to
have_content
(
project
.
name
)
.
and
have_content
(
closed_issue
.
title
)
.
and
have_no_content
(
open_issue1
.
title
)
.
and
have_no_content
(
open_issue2
.
title
)
.
and
have_no_selector
(
".js-new-board-list"
)
end
end
include_examples
'shows issues'
include_examples
"opens issue from list"
do
let
(
:issue
)
{
closed_issue
}
end
end
end
end
context
'when not signed in'
do
shared_examples
"all issues"
do
context
"all issues"
do
before
do
before
do
visit
(
project_issues_path
(
project
))
visit
(
project_issues_path
(
project
,
state: :all
))
end
it
"shows all issues"
do
expect
(
page
).
to
have_content
(
project
.
name
)
.
and
have_content
(
closed_issue
.
title
)
.
and
have_content
(
open_issue1
.
title
)
.
and
have_content
(
open_issue2
.
title
)
.
and
have_no_selector
(
".js-new-board-list"
)
end
end
include_examples
'shows issues'
include_examples
"opens issue from list"
do
let
(
:issue
)
{
closed_issue
}
end
end
end
end
end
context
'when project is internal'
do
%w[internal public]
.
each
do
|
visibility
|
s
et
(
:project
)
{
create
(
:project_empty_repo
,
:internal
)
}
s
hared_examples
"
#{
visibility
}
project"
do
set
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
context
"when project is
#{
visibility
}
"
do
set
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
let
(
:project
)
{
create
(
:project_empty_repo
,
:"
#{
visibility
}
"
)
}
context
'when signed in'
do
include_examples
"open issues"
include_examples
"closed issues"
include_examples
"all issues"
end
end
end
context
"when signed in as developer"
do
before
do
before
do
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
visit
(
project_issues_path
(
project
))
end
end
include_examples
'shows issues'
include_examples
"public project"
include_examples
"internal project"
end
end
context
"when not signed in"
do
include_examples
"public project"
end
end
end
end
spec/features/projects/milestones/milestones_sorting_spec.rb
View file @
dc4ae317
require
'spec_helper'
require
'spec_helper'
feature
'Milestones sorting'
,
:js
do
feature
'Milestones sorting'
,
:js
do
include
SortingHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
...
...
spec/features/user_sorts_things_spec.rb
0 → 100644
View file @
dc4ae317
require
"spec_helper"
# The main goal of this spec is not to check whether the sorting UI works, but
# to check if the sorting option set by user is being kept persisted while going through pages.
# The `it`s are named here by convention `starting point -> some pages -> final point`.
# All those specs are moved out to this spec intentionally to keep them all in one place.
describe
"User sorts things"
do
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
Helpers
::
DashboardHelper
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
set
(
:current_user
)
{
create
(
:user
)
}
# Using `current_user` instead of just `user` because of the hardoced call in `assigned_mrs_dashboard_path` which is used below.
set
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
current_user
)
}
set
(
:merge_request
)
{
create
(
:merge_request
,
target_project:
project
,
source_project:
project
,
author:
current_user
)
}
before
do
project
.
add_developer
(
current_user
)
sign_in
(
current_user
)
end
it
"issues -> project home page -> issues"
do
sort_option
=
"Last updated"
visit
(
project_issues_path
(
project
))
sort_by
(
sort_option
)
visit
(
project_path
(
project
))
visit
(
project_issues_path
(
project
))
expect
(
find
(
".issues-filters"
)).
to
have_content
(
sort_option
)
end
it
"issues -> merge requests"
do
sort_option
=
"Last updated"
visit
(
project_issues_path
(
project
))
sort_by
(
sort_option
)
visit
(
project_merge_requests_path
(
project
))
expect
(
find
(
".issues-filters"
)).
to
have_content
(
sort_option
)
end
it
"merge requests -> dashboard merge requests"
do
sort_option
=
"Last updated"
visit
(
project_merge_requests_path
(
project
))
sort_by
(
sort_option
)
visit
(
assigned_mrs_dashboard_path
)
expect
(
find
(
".issues-filters"
)).
to
have_content
(
sort_option
)
end
end
spec/support/features/issuable_slash_commands_shared_examples.rb
View file @
dc4ae317
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# It takes a `issuable_type`, and expect an `issuable`.
# It takes a `issuable_type`, and expect an `issuable`.
shared_examples
'issuable record that supports quick actions in its description and notes'
do
|
issuable_type
|
shared_examples
'issuable record that supports quick actions in its description and notes'
do
|
issuable_type
|
include
QuickAction
sHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
Note
sHelpers
let
(
:master
)
{
create
(
:user
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:project
)
do
let
(
:project
)
do
...
@@ -61,7 +61,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -61,7 +61,7 @@ shared_examples 'issuable record that supports quick actions in its description
context
'with a note containing commands'
do
context
'with a note containing commands'
do
it
'creates a note without the commands and interpret the commands accordingly'
do
it
'creates a note without the commands and interpret the commands accordingly'
do
assignee
=
create
(
:user
,
username:
'bob'
)
assignee
=
create
(
:user
,
username:
'bob'
)
write
_note
(
"Awesome!
\n\n
/assign @bob
\n\n
/label ~bug
\n\n
/milestone %
\"
ASAP
\"
"
)
add
_note
(
"Awesome!
\n\n
/assign @bob
\n\n
/label ~bug
\n\n
/milestone %
\"
ASAP
\"
"
)
expect
(
page
).
to
have_content
'Awesome!'
expect
(
page
).
to
have_content
'Awesome!'
expect
(
page
).
not_to
have_content
'/assign @bob'
expect
(
page
).
not_to
have_content
'/assign @bob'
...
@@ -82,7 +82,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -82,7 +82,7 @@ shared_examples 'issuable record that supports quick actions in its description
context
'with a note containing only commands'
do
context
'with a note containing only commands'
do
it
'does not create a note but interpret the commands accordingly'
do
it
'does not create a note but interpret the commands accordingly'
do
assignee
=
create
(
:user
,
username:
'bob'
)
assignee
=
create
(
:user
,
username:
'bob'
)
write
_note
(
"/assign @bob
\n\n
/label ~bug
\n\n
/milestone %
\"
ASAP
\"
"
)
add
_note
(
"/assign @bob
\n\n
/label ~bug
\n\n
/milestone %
\"
ASAP
\"
"
)
expect
(
page
).
not_to
have_content
'/assign @bob'
expect
(
page
).
not_to
have_content
'/assign @bob'
expect
(
page
).
not_to
have_content
'/label ~bug'
expect
(
page
).
not_to
have_content
'/label ~bug'
...
@@ -105,7 +105,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -105,7 +105,7 @@ shared_examples 'issuable record that supports quick actions in its description
context
"when current user can close
#{
issuable_type
}
"
do
context
"when current user can close
#{
issuable_type
}
"
do
it
"closes the
#{
issuable_type
}
"
do
it
"closes the
#{
issuable_type
}
"
do
write
_note
(
"/close"
)
add
_note
(
"/close"
)
expect
(
page
).
not_to
have_content
'/close'
expect
(
page
).
not_to
have_content
'/close'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -125,7 +125,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -125,7 +125,7 @@ shared_examples 'issuable record that supports quick actions in its description
end
end
it
"does not close the
#{
issuable_type
}
"
do
it
"does not close the
#{
issuable_type
}
"
do
write
_note
(
"/close"
)
add
_note
(
"/close"
)
expect
(
page
).
not_to
have_content
'Commands applied'
expect
(
page
).
not_to
have_content
'Commands applied'
...
@@ -142,7 +142,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -142,7 +142,7 @@ shared_examples 'issuable record that supports quick actions in its description
context
"when current user can reopen
#{
issuable_type
}
"
do
context
"when current user can reopen
#{
issuable_type
}
"
do
it
"reopens the
#{
issuable_type
}
"
do
it
"reopens the
#{
issuable_type
}
"
do
write
_note
(
"/reopen"
)
add
_note
(
"/reopen"
)
expect
(
page
).
not_to
have_content
'/reopen'
expect
(
page
).
not_to
have_content
'/reopen'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -162,7 +162,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -162,7 +162,7 @@ shared_examples 'issuable record that supports quick actions in its description
end
end
it
"does not reopen the
#{
issuable_type
}
"
do
it
"does not reopen the
#{
issuable_type
}
"
do
write
_note
(
"/reopen"
)
add
_note
(
"/reopen"
)
expect
(
page
).
not_to
have_content
'Commands applied'
expect
(
page
).
not_to
have_content
'Commands applied'
...
@@ -174,7 +174,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -174,7 +174,7 @@ shared_examples 'issuable record that supports quick actions in its description
context
"with a note changing the
#{
issuable_type
}
's title"
do
context
"with a note changing the
#{
issuable_type
}
's title"
do
context
"when current user can change title of
#{
issuable_type
}
"
do
context
"when current user can change title of
#{
issuable_type
}
"
do
it
"reopens the
#{
issuable_type
}
"
do
it
"reopens the
#{
issuable_type
}
"
do
write
_note
(
"/title Awesome new title"
)
add
_note
(
"/title Awesome new title"
)
expect
(
page
).
not_to
have_content
'/title'
expect
(
page
).
not_to
have_content
'/title'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -194,7 +194,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -194,7 +194,7 @@ shared_examples 'issuable record that supports quick actions in its description
end
end
it
"does not change the
#{
issuable_type
}
title"
do
it
"does not change the
#{
issuable_type
}
title"
do
write
_note
(
"/title Awesome new title"
)
add
_note
(
"/title Awesome new title"
)
expect
(
page
).
not_to
have_content
'Commands applied'
expect
(
page
).
not_to
have_content
'Commands applied'
...
@@ -205,7 +205,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -205,7 +205,7 @@ shared_examples 'issuable record that supports quick actions in its description
context
"with a note marking the
#{
issuable_type
}
as todo"
do
context
"with a note marking the
#{
issuable_type
}
as todo"
do
it
"creates a new todo for the
#{
issuable_type
}
"
do
it
"creates a new todo for the
#{
issuable_type
}
"
do
write
_note
(
"/todo"
)
add
_note
(
"/todo"
)
expect
(
page
).
not_to
have_content
'/todo'
expect
(
page
).
not_to
have_content
'/todo'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -236,7 +236,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -236,7 +236,7 @@ shared_examples 'issuable record that supports quick actions in its description
expect
(
todo
.
author
).
to
eq
master
expect
(
todo
.
author
).
to
eq
master
expect
(
todo
.
user
).
to
eq
master
expect
(
todo
.
user
).
to
eq
master
write
_note
(
"/done"
)
add
_note
(
"/done"
)
expect
(
page
).
not_to
have_content
'/done'
expect
(
page
).
not_to
have_content
'/done'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -249,7 +249,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -249,7 +249,7 @@ shared_examples 'issuable record that supports quick actions in its description
it
"creates a new todo for the
#{
issuable_type
}
"
do
it
"creates a new todo for the
#{
issuable_type
}
"
do
expect
(
issuable
.
subscribed?
(
master
,
project
)).
to
be_falsy
expect
(
issuable
.
subscribed?
(
master
,
project
)).
to
be_falsy
write
_note
(
"/subscribe"
)
add
_note
(
"/subscribe"
)
expect
(
page
).
not_to
have_content
'/subscribe'
expect
(
page
).
not_to
have_content
'/subscribe'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -266,7 +266,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -266,7 +266,7 @@ shared_examples 'issuable record that supports quick actions in its description
it
"creates a new todo for the
#{
issuable_type
}
"
do
it
"creates a new todo for the
#{
issuable_type
}
"
do
expect
(
issuable
.
subscribed?
(
master
,
project
)).
to
be_truthy
expect
(
issuable
.
subscribed?
(
master
,
project
)).
to
be_truthy
write
_note
(
"/unsubscribe"
)
add
_note
(
"/unsubscribe"
)
expect
(
page
).
not_to
have_content
'/unsubscribe'
expect
(
page
).
not_to
have_content
'/unsubscribe'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
@@ -277,7 +277,7 @@ shared_examples 'issuable record that supports quick actions in its description
...
@@ -277,7 +277,7 @@ shared_examples 'issuable record that supports quick actions in its description
context
"with a note assigning the
#{
issuable_type
}
to the current user"
do
context
"with a note assigning the
#{
issuable_type
}
to the current user"
do
it
"assigns the
#{
issuable_type
}
to the current user"
do
it
"assigns the
#{
issuable_type
}
to the current user"
do
write
_note
(
"/assign me"
)
add
_note
(
"/assign me"
)
expect
(
page
).
not_to
have_content
'/assign me'
expect
(
page
).
not_to
have_content
'/assign me'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'Commands applied'
...
...
spec/support/helpers/features/notes_helpers.rb
0 → 100644
View file @
dc4ae317
# These helpers allow you to manipulate with notes.
#
# Usage:
# describe "..." do
# include Spec::Support::Helpers::Features::NotesHelpers
# ...
#
# add_note("Hello world!")
#
module
Spec
module
Support
module
Helpers
module
Features
module
NotesHelpers
def
add_note
(
text
)
Sidekiq
::
Testing
.
fake!
do
page
.
within
(
".js-main-target-form"
)
do
fill_in
(
"note[note]"
,
with:
text
)
find
(
".js-comment-submit-button"
).
click
end
end
end
end
end
end
end
end
spec/support/helpers/features/sorting_helpers.rb
0 → 100644
View file @
dc4ae317
# These helpers allow you to manipulate with sorting features.
#
# Usage:
# describe "..." do
# include Spec::Support::Helpers::Features::SortingHelpers
# ...
#
# sort_by("Last updated")
#
module
Spec
module
Support
module
Helpers
module
Features
module
SortingHelpers
def
sort_by
(
value
)
find
(
'button.dropdown-toggle'
).
click
page
.
within
(
'.content ul.dropdown-menu.dropdown-menu-align-right li'
)
do
click_link
(
value
)
end
end
end
end
end
end
end
spec/support/matchers/issuable_matchers.rb
0 → 100644
View file @
dc4ae317
RSpec
::
Matchers
.
define
:have_header_with_correct_id_and_link
do
|
level
,
text
,
id
,
parent
=
".wiki"
|
match
do
|
actual
|
node
=
find
(
"
#{
parent
}
h
#{
level
}
a#user-content-
#{
id
}
"
)
expect
(
node
[
:href
]).
to
end_with
(
"#
#{
id
}
"
)
# Work around a weird Capybara behavior where calling `parent` on a node
# returns the whole document, not the node's actual parent element
expect
(
find
(
:xpath
,
"
#{
node
.
path
}
/.."
).
text
).
to
eq
(
text
)
end
end
spec/support/quick_actions_helpers.rb
deleted
100644 → 0
View file @
95b3bf26
module
QuickActionsHelpers
def
write_note
(
text
)
Sidekiq
::
Testing
.
fake!
do
page
.
within
(
'.js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
text
find
(
'.js-comment-submit-button'
).
click
end
end
end
end
spec/support/sorting_helper.rb
deleted
100644 → 0
View file @
95b3bf26
# Helper allows you to sort items
#
# Params
# value - value for sorting
#
# Usage:
# include SortingHelper
#
# sorting_by('Oldest updated')
#
module
SortingHelper
def
sorting_by
(
value
)
find
(
'button.dropdown-toggle'
).
click
page
.
within
(
'.content ul.dropdown-menu.dropdown-menu-align-right li'
)
do
click_link
value
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment