summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-21 01:20:51 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-21 01:20:51 +0200
commite45e6ba2c3e25afb138e5f0ece71c6f677f2ab86 (patch)
treed648ae6a8335ceda3007b881427ce4a7770cff56 /features
parentbcc04adb1342155d4ec2b670702406285145cb32 (diff)
parent0f7d47f695afa051374996cb1c72bc3ec55820c5 (diff)
downloadgitlab-ce-e45e6ba2c3e25afb138e5f0ece71c6f677f2ab86.tar.gz
Merge branch 'master' into sidebar-nav
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: app/views/layouts/group.html.haml
Diffstat (limited to 'features')
-rw-r--r--features/project/commits/comments.feature8
-rw-r--r--features/project/commits/diff_comments.feature6
-rw-r--r--features/project/issues/issues.feature34
-rw-r--r--features/project/merge_requests.feature31
-rw-r--r--features/steps/project/issues/issues.rb1
-rw-r--r--features/steps/project/merge_requests.rb1
-rw-r--r--features/steps/shared/diff_note.rb26
-rw-r--r--features/steps/shared/issuable.rb15
-rw-r--r--features/steps/shared/markdown.rb45
-rw-r--r--features/steps/shared/note.rb26
10 files changed, 162 insertions, 31 deletions
diff --git a/features/project/commits/comments.feature b/features/project/commits/comments.feature
index e176752cfbf..a45245917e3 100644
--- a/features/project/commits/comments.feature
+++ b/features/project/commits/comments.feature
@@ -16,12 +16,12 @@ Feature: Project Commits Comments
@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
+ Then The comment preview tab should say there is nothing to do
@javascript
Scenario: I can preview with text
- Given I write a comment like "Nice"
- Then I should see the comment preview button
+ Given I write a comment like ":+1: Nice"
+ Then The comment preview tab should be display rendered Markdown
@javascript
Scenario: I preview a comment
@@ -32,7 +32,7 @@ Feature: Project Commits Comments
@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
+ Then I should see the comment write tab
@javascript
Scenario: I have a reset form after posting from preview
diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature
index a145ec84b78..9c4cc723d1b 100644
--- a/features/project/commits/diff_comments.feature
+++ b/features/project/commits/diff_comments.feature
@@ -58,13 +58,13 @@ Feature: Project Commits Diff Comments
Scenario: I can't preview without text
Given I open a diff comment form
And I haven't written any diff comment text
- Then I should not see the diff comment preview button
+ Then The diff comment preview tab should say there is nothing to do
@javascript
Scenario: I can preview with text
Given I open a diff comment form
And I write a diff comment like ":-1: I don't like this"
- Then I should see the diff comment preview button
+ Then The diff comment preview tab should display rendered Markdown
@javascript
Scenario: I preview a diff comment
@@ -75,7 +75,7 @@ Feature: Project Commits Diff Comments
@javascript
Scenario: I can edit after preview
Given I preview a diff comment text like "Should fix it :smile:"
- Then I should see the diff comment edit button
+ Then I should see the diff comment write tab
@javascript
Scenario: The form gets removed after posting
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature
index 4db8551559b..28ea44530fe 100644
--- a/features/project/issues/issues.feature
+++ b/features/project/issues/issues.feature
@@ -159,3 +159,37 @@ Feature: Project Issues
Given project "Shop" has "Tasks-closed" closed issue with task markdown
When I visit issue page "Tasks-closed"
Then Task checkboxes should be disabled
+
+ # 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
diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature
index d20358a7dc6..7c029f05d75 100644
--- a/features/project/merge_requests.feature
+++ b/features/project/merge_requests.feature
@@ -187,3 +187,34 @@ Feature: Project Merge Requests
And I visit merge request page "MR-task-open"
And I click link "Close"
Then Task checkboxes should be disabled
+
+ # Description preview
+
+ @javascript
+ Scenario: I can't preview without text
+ Given I visit merge request page "Bug NS-04"
+ And I click link "Edit" for the merge request
+ 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 visit merge request page "Bug NS-04"
+ And I click link "Edit" for the merge request
+ And I write a description like ":+1: Nice"
+ Then The Markdown preview tab should display rendered Markdown
+
+ @javascript
+ Scenario: I preview a merge request description
+ Given I visit merge request page "Bug NS-04"
+ And I click link "Edit" for the merge request
+ 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 visit merge request page "Bug NS-04"
+ And I click link "Edit" for the merge request
+ And I preview a description text like "Bug fixed :smile:"
+ Then I should see the Markdown write tab
diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb
index 640603562dd..c0ae5208541 100644
--- a/features/steps/project/issues/issues.rb
+++ b/features/steps/project/issues/issues.rb
@@ -1,5 +1,6 @@
class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
include SharedAuthentication
+ include SharedIssuable
include SharedProject
include SharedNote
include SharedPaths
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index fae0cec53a6..d5e060bdbe8 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -1,5 +1,6 @@
class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
include SharedAuthentication
+ include SharedIssuable
include SharedProject
include SharedNote
include SharedPaths
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb
index 10f3ed90b56..28964d54a8f 100644
--- a/features/steps/shared/diff_note.rb
+++ b/features/steps/shared/diff_note.rb
@@ -32,7 +32,7 @@ module SharedDiffNote
click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:"
- find(".js-note-preview-button").trigger("click")
+ find('.js-md-preview-button').click
end
end
@@ -41,7 +41,7 @@ module SharedDiffNote
within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
fill_in "note[note]", with: "DRY this up"
- find(".js-note-preview-button").trigger("click")
+ find('.js-md-preview-button').click
end
end
@@ -71,9 +71,10 @@ module SharedDiffNote
end
end
- step 'I should not see the diff comment preview button' do
+ step 'The diff comment preview tab should say there is nothing to do' do
within(diff_file_selector) do
- page.should have_css(".js-note-preview-button", visible: false)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
@@ -131,27 +132,28 @@ module SharedDiffNote
step 'I should see the diff comment preview' do
within("#{diff_file_selector} form") do
- page.should have_css(".js-note-preview", visible: false)
+ expect(page).to have_css('.js-md-preview', visible: true)
end
end
- step 'I should see the diff comment edit button' do
+ step 'I should see the diff comment write tab' do
within(diff_file_selector) do
- page.should have_css(".js-note-write-button", visible: true)
+ expect(page).to have_css('.js-md-write-button', visible: true)
end
end
- step 'I should see the diff comment preview button' do
+ step 'The diff comment preview tab should display rendered Markdown' do
within(diff_file_selector) do
- page.should have_css(".js-note-preview-button", visible: true)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
end
step 'I should see two separate previews' do
within(diff_file_selector) do
- page.should have_css(".js-note-preview", visible: true, count: 2)
- page.should have_content("Should fix it")
- page.should have_content("DRY this up")
+ expect(page).to have_css('.js-md-preview', visible: true, count: 2)
+ expect(page).to have_content('Should fix it')
+ expect(page).to have_content('DRY this up')
end
end
diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb
new file mode 100644
index 00000000000..a0150e90380
--- /dev/null
+++ b/features/steps/shared/issuable.rb
@@ -0,0 +1,15 @@
+module SharedIssuable
+ include Spinach::DSL
+
+ def edit_issuable
+ find('.issue-btn-group').click_link 'Edit'
+ end
+
+ step 'I click link "Edit" for the merge request' do
+ edit_issuable
+ end
+
+ step 'I click link "Edit" for the issue' do
+ edit_issuable
+ end
+end
diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb
index 8bf138065b0..e71700880cd 100644
--- a/features/steps/shared/markdown.rb
+++ b/features/steps/shared/markdown.rb
@@ -54,4 +54,49 @@ EOT
'div.description li.task-list-item input[type="checkbox"]:disabled'
)
end
+
+ step 'I should not see the Markdown preview' do
+ expect(find('.gfm-form .js-md-preview')).not_to be_visible
+ end
+
+ step 'The Markdown preview tab should say there is nothing to do' do
+ 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(find('.gfm-form')).to have_css('.js-md-write-button', 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
+ within('.gfm-form') do
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_css('img.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
+ within('.gfm-form') do
+ fill_in 'Description', with: 'Bug fixed :smile:'
+ find('.js-md-preview-button').click
+ end
+ end
+
+ step 'I haven\'t written any description text' do
+ find('.gfm-form').fill_in 'Description', with: ''
+ end
end
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index 2b2cb47a715..17adec3eda1 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -23,7 +23,7 @@ module SharedNote
step '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")
+ find('.js-md-preview-button').click
end
end
@@ -33,9 +33,9 @@ module SharedNote
end
end
- step 'I write a comment like "Nice"' do
+ step 'I write a comment like ":+1: Nice"' do
within(".js-main-target-form") do
- fill_in "note[note]", with: "Nice"
+ fill_in 'note[note]', with: ':+1: Nice'
end
end
@@ -51,13 +51,14 @@ module SharedNote
step 'I should not see the comment preview' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview", visible: false)
+ expect(find('.js-md-preview')).not_to be_visible
end
end
- step 'I should not see the comment preview button' do
+ step 'The comment preview tab should say there is nothing to do' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview-button", visible: false)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
@@ -79,21 +80,22 @@ module SharedNote
end
end
- step 'I should see the comment edit button' do
+ step 'I should see the comment write tab' do
within(".js-main-target-form") do
- page.should have_css(".js-note-write-button", visible: true)
+ expect(page).to have_css('.js-md-write-button', visible: true)
end
end
- step 'I should see the comment preview' do
+ step 'The comment preview tab should be display rendered Markdown' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview", visible: true)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
end
- step 'I should see the comment preview button' do
+ step 'I should see the comment preview' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview-button", visible: true)
+ expect(page).to have_css('.js-md-preview', visible: true)
end
end