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:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2013-01-15 02:55:02 +0400
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2013-01-15 03:52:55 +0400
commitf8e1f4a7c9ee2554efcf7376a0cfbefae8956d7b (patch)
tree7397bc6ca94310d9317c7970700d6bd9b25ecedf /features
parent30227869482bbbdbfea153f2b45ef3bb9a9fd218 (diff)
Replace commit note request specs with spinach features
Diffstat (limited to 'features')
-rw-r--r--features/project/commits/commit_comments.feature46
-rw-r--r--features/steps/project/comments_on_commits.rb (renamed from features/steps/project/project_comment_commit.rb)4
-rw-r--r--features/steps/shared/note.rb105
3 files changed, 143 insertions, 12 deletions
diff --git a/features/project/commits/commit_comments.feature b/features/project/commits/commit_comments.feature
index 5acf541ab96..a1aa745a681 100644
--- a/features/project/commits/commit_comments.feature
+++ b/features/project/commits/commit_comments.feature
@@ -1,10 +1,48 @@
-Feature: Project Comment commit
+Feature: Comments on commits
Background:
Given I sign in as a user
And I own project "Shop"
- Given I visit project commit page
+ And I visit project commit page
@javascript
- Scenario: I comment commit
+ Scenario: I can comment on a commit
Given I leave a comment like "XML attached"
- Then I should see comment "XML attached"
+ Then I should see a comment saying "XML attached"
+
+ @javascript
+ Scenario: I can't cancel the main form
+ Then I should not see the cancel comment button
+
+ @javascript
+ Scenario: I can't preview without text
+ Given I haven't written any comment text
+ Then I should not see the comment preview button
+
+ @javascript
+ Scenario: I can preview with text
+ Given I write a comment like "Nice"
+ Then I should see the comment preview button
+
+ @javascript
+ Scenario: I preview a comment
+ Given I preview a comment text like "Bug fixed :smile:"
+ Then I should see the comment preview
+ And I should not see the comment text field
+
+ @javascript
+ Scenario: I can edit after preview
+ Given I preview a comment text like "Bug fixed :smile:"
+ Then I should see the comment edit button
+
+ @javascript
+ Scenario: I have a reset form after posting from preview
+ Given I preview a comment text like "Bug fixed :smile:"
+ And I submit the comment
+ Then I should see an empty comment text field
+ And I should not see the comment preview
+
+ @javascript
+ Scenario: I can delete a comment
+ Given I leave a comment like "XML attached"
+ And I delete a comment
+ Then I should not see a comment saying "XML attached"
diff --git a/features/steps/project/project_comment_commit.rb b/features/steps/project/comments_on_commits.rb
index cb8385e1ce5..56bb12a8209 100644
--- a/features/steps/project/project_comment_commit.rb
+++ b/features/steps/project/comments_on_commits.rb
@@ -1,6 +1,6 @@
-class ProjectCommentCommit < Spinach::FeatureSteps
+class CommentsOnCommits < Spinach::FeatureSteps
include SharedAuthentication
- include SharedProject
include SharedNote
include SharedPaths
+ include SharedProject
end
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index 923e69b6b07..3d5441c40b0 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -1,18 +1,111 @@
module SharedNote
include Spinach::DSL
+ Given 'I delete a comment' do
+ first(".js-note-delete").trigger("click")
+ end
+
+ Given 'I haven\'t written any comment text' do
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: ""
+ end
+ end
+
Given 'I leave a comment like "XML attached"' do
- fill_in "note_note", :with => "XML attached"
- click_button "Add Comment"
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: "XML attached"
+ click_button "Add Comment"
+ end
end
- Then 'I should see comment "XML attached"' do
- page.should have_content "XML attached"
+ Given 'I preview a comment text like "Bug fixed :smile:"' do
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: "Bug fixed :smile:"
+ find(".js-note-preview-button").trigger("click")
+ end
end
+ Given 'I submit the comment' do
+ within(".js-main-target-form") do
+ click_button "Add Comment"
+ end
+ end
+
+ Given 'I write a comment like "Nice"' do
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: "Nice"
+ end
+ end
+
+
+
+ Then 'I should not see a comment saying "XML attached"' do
+ page.should_not have_css(".note")
+ end
+
+ Then 'I should not see the cancel comment button' do
+ within(".js-main-target-form") do
+ should_not have_link("Cancel")
+ end
+ end
+
+ Then 'I should not see the comment preview' do
+ within(".js-main-target-form") do
+ page.should have_css(".js-note-preview", visible: false)
+ end
+ end
+
+ Then 'I should not see the comment preview button' do
+ within(".js-main-target-form") do
+ page.should have_css(".js-note-preview-button", visible: false)
+ end
+ end
+
+ Then 'I should not see the comment text field' do
+ within(".js-main-target-form") do
+ page.should have_css(".js-note-text", visible: false)
+ end
+ end
+
+ Then 'I should see a comment saying "XML attached"' do
+ within(".note") do
+ page.should have_content("XML attached")
+ end
+ end
+
+ Then 'I should see an empty comment text field' do
+ within(".js-main-target-form") do
+ page.should have_field("note[note]", with: "")
+ end
+ end
+
+ Then 'I should see the comment edit button' do
+ within(".js-main-target-form") do
+ page.should have_css(".js-note-edit-button", visible: true)
+ end
+ end
+
+ Then 'I should see the comment preview' do
+ within(".js-main-target-form") do
+ page.should have_css(".js-note-preview", visible: true)
+ end
+ end
+
+ Then 'I should see the comment preview button' do
+ within(".js-main-target-form") do
+ page.should have_css(".js-note-preview-button", visible: true)
+ end
+ end
+
+
+
+ # Wall
+
Given 'I write new comment "my special test message"' do
- fill_in "note_note", :with => "my special test message"
- click_button "Add Comment"
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: "my special test message"
+ click_button "Add Comment"
+ end
end
Then 'I should see project wall note "my special test message"' do