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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f062f8ef
Commit
f062f8ef
authored
Feb 04, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve discussion / comments shared examples
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
4c57c316
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
25 deletions
+20
-25
spec/support/shared_examples/features/discussion_comments_shared_example.rb
...d_examples/features/discussion_comments_shared_example.rb
+20
-25
No files found.
spec/support/shared_examples/features/discussion_comments_shared_example.rb
View file @
f062f8ef
...
...
@@ -8,44 +8,40 @@ RSpec.shared_examples 'thread comments' do |resource_name|
let
(
:submit_selector
)
{
"
#{
form_selector
}
.js-comment-submit-button"
}
let
(
:close_selector
)
{
"
#{
form_selector
}
.btn-comment-and-close"
}
let
(
:comments_selector
)
{
'.timeline > .note.timeline-entry'
}
let
(
:comment
)
{
'My comment'
}
it
'clicking "Comment" will post a comment'
,
:quarantine
do
it
'clicking "Comment" will post a comment'
do
expect
(
page
).
to
have_selector
toggle_selector
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
'a'
)
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
comment
)
find
(
submit_selector
).
click
click_button
'Comment'
wait_for_requests
expect
(
page
).
to
have_content
(
comment
)
find
(
comments_selector
,
match: :first
)
new_comment
=
all
(
comments_selector
).
last
expect
(
new_comment
).
to
have_content
'a'
expect
(
new_comment
).
not_to
have_selector
'.discussion'
end
if
resource_name
==
'issue'
it
"clicking 'Comment & close
#{
resource_name
}
' will post a comment and close the
#{
resource_name
}
"
do
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
'a'
)
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
comment
)
find
(
close_selector
).
click
wait_for_requests
click_button
'Comment & close issue'
find
(
comments_selector
,
match: :first
)
find
(
"
#{
comments_selector
}
.system-note"
)
entries
=
all
(
comments_selector
)
close_note
=
entries
.
last
new_comment
=
entries
[
-
2
]
expect
(
page
).
to
have_content
(
comment
)
expect
(
page
).
to
have_content
"@
#{
user
.
username
}
closed"
new_comment
=
all
(
comments_selector
).
last
expect
(
close_note
).
to
have_content
'closed'
expect
(
new_comment
).
not_to
have_selector
'.discussion'
end
end
describe
'when the toggle is clicked'
do
before
do
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
'a'
)
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
comment
)
find
(
toggle_selector
).
click
end
...
...
@@ -153,10 +149,11 @@ RSpec.shared_examples 'thread comments' do |resource_name|
end
it
'clicking "Start thread" will post a thread'
do
expect
(
page
).
to
have_content
(
comment
)
new_comment
=
all
(
comments_selector
).
last
expect
(
new_comment
).
to
have_content
'a'
expect
(
new_comment
).
to
have_selector
'.discussion'
expect
(
new_comment
).
to
have_selector
(
'.discussion'
)
end
if
resource_name
=~
/(issue|merge request)/
...
...
@@ -208,15 +205,13 @@ RSpec.shared_examples 'thread comments' do |resource_name|
if
resource_name
==
'issue'
it
"clicking 'Start thread & close
#{
resource_name
}
' will post a thread and close the
#{
resource_name
}
"
do
find
(
close_selector
).
click
click_button
'Start thread & close issue'
find
(
comments_selector
,
match: :first
)
find
(
"
#{
comments_selector
}
.system-note"
)
entries
=
all
(
comments_selector
)
close_note
=
entries
.
last
new_discussion
=
entries
[
-
2
]
expect
(
page
).
to
have_content
(
comment
)
expect
(
page
).
to
have_content
"@
#{
user
.
username
}
closed"
new_discussion
=
all
(
comments_selector
)[
-
2
]
expect
(
close_note
).
to
have_content
'closed'
expect
(
new_discussion
).
to
have_selector
'.discussion'
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