Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 21:09:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 21:09:19 +0300
commit3290d46655f07d7ae3dca788d6df9f326972ffd8 (patch)
tree0d24713e1592cdd3583257f14a52d46a22539ed1 /spec/features
parentc6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/issues/user_sorts_issue_comments_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/features/issues/user_sorts_issue_comments_spec.rb b/spec/features/issues/user_sorts_issue_comments_spec.rb
new file mode 100644
index 00000000000..e1c0acc32f1
--- /dev/null
+++ b/spec/features/issues/user_sorts_issue_comments_spec.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'Comment sort direction' do
+ let_it_be(:project) { create(:project, :public, :repository) }
+ let_it_be(:issue) { create(:issue, project: project) }
+ let_it_be(:comment_1) { create(:note_on_issue, noteable: issue, project: project, note: 'written first') }
+ let_it_be(:comment_2) { create(:note_on_issue, noteable: issue, project: project, note: 'written second') }
+
+ context 'on issue page', :js do
+ before do
+ visit project_issue_path(project, issue)
+ end
+
+ it 'saves sort order' do
+ # open dropdown, and select 'Newest first'
+ page.within('.issuable-details') do
+ click_button('Oldest first')
+ click_button('Newest first')
+ end
+
+ expect(first_comment).to have_content(comment_2.note)
+ expect(last_comment).to have_content(comment_1.note)
+
+ visit project_issue_path(project, issue)
+ wait_for_requests
+
+ expect(first_comment).to have_content(comment_2.note)
+ expect(last_comment).to have_content(comment_1.note)
+ end
+ end
+
+ def all_comments
+ all('.timeline > .note.timeline-entry')
+ end
+
+ def first_comment
+ all_comments.first
+ end
+
+ def last_comment
+ all_comments.last
+ end
+end