summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2015-12-15 14:02:28 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2015-12-15 14:02:28 +0000
commit4493d3fd556af6ded47f940f258b0fc26c9eb3e8 (patch)
tree3879f17a3a175e13d7ebaf33dc2b06a1e6ad4f6b
parent9451db3819ae45734c4343e55a74d347cdacf70d (diff)
parent8fe821cfa5acea2a4ab1fce7f35a76455d5a1cac (diff)
downloadgitlab-ce-4493d3fd556af6ded47f940f258b0fc26c9eb3e8.tar.gz
Merge branch 'tests/note-polling' into 'master'
Add feature specs for note polling Ref. #4032, !2084 cc @rspeicher See merge request !2086
-rw-r--r--app/views/projects/notes/_notes_with_form.html.haml2
-rw-r--r--features/project/issues/issues.feature6
-rw-r--r--features/steps/project/issues/issues.rb10
-rw-r--r--features/support/capybara.rb2
-rw-r--r--spec/features/issues/note_polling_spec.rb16
5 files changed, 34 insertions, 2 deletions
diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml
index 99c1b0fa43e..eb378b42603 100644
--- a/app/views/projects/notes/_notes_with_form.html.haml
+++ b/app/views/projects/notes/_notes_with_form.html.haml
@@ -7,4 +7,4 @@
= render "projects/notes/form", view: diff_view
:javascript
- new Notes("#{namespace_project_notes_path(namespace_id: @project.namespace, target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}")
+ var notes = new Notes("#{namespace_project_notes_path(namespace_id: @project.namespace, target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}")
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature
index f08b30e0b88..ab234bc7507 100644
--- a/features/project/issues/issues.feature
+++ b/features/project/issues/issues.feature
@@ -197,3 +197,9 @@ Feature: Project Issues
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"
+
+ @javascript
+ Scenario: Another user adds a comment to issue I'm currently viewing
+ Given I visit issue page "Release 0.4"
+ And another user adds a comment with text "Yay!" to issue "Release 0.4"
+ Then I should see a new comment with text "Yay!"
diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb
index a13044c3ae1..4a7ff21d385 100644
--- a/features/steps/project/issues/issues.rb
+++ b/features/steps/project/issues/issues.rb
@@ -284,6 +284,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
+ step 'another user adds a comment with text "Yay!" to issue "Release 0.4"' do
+ issue = Issue.find_by!(title: 'Release 0.4')
+ create(:note_on_issue, noteable: issue, note: 'Yay!')
+ end
+
+ step 'I should see a new comment with text "Yay!"' do
+ page.within '#notes' do
+ expect(page).to have_content('Yay!')
+ end
+ end
def filter_issue(text)
fill_in 'issue_search', with: text
end
diff --git a/features/support/capybara.rb b/features/support/capybara.rb
index 31dbf0feb2f..4156c7ec484 100644
--- a/features/support/capybara.rb
+++ b/features/support/capybara.rb
@@ -2,7 +2,7 @@ require 'spinach/capybara'
require 'capybara/poltergeist'
# Give CI some extra time
-timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 10
+timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 15
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
diff --git a/spec/features/issues/note_polling_spec.rb b/spec/features/issues/note_polling_spec.rb
new file mode 100644
index 00000000000..e4efdbe2421
--- /dev/null
+++ b/spec/features/issues/note_polling_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+feature 'Issue notes polling' do
+ let!(:project) { create(:project, :public) }
+ let!(:issue) { create(:issue, project: project) }
+
+ background do
+ visit namespace_project_issue_path(project.namespace, project, issue)
+ end
+
+ scenario 'Another user adds a comment to an issue', js: true do
+ note = create(:note_on_issue, noteable: issue, note: 'Looks good!')
+ page.execute_script('notes.refresh();')
+ expect(page).to have_selector("#note_#{note.id}", text: 'Looks good!')
+ end
+end