diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2014-10-06 19:29:06 +0400 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2014-10-06 19:29:06 +0400 |
commit | 0fed1b587630ff98808c61881511ee7c077c3db6 (patch) | |
tree | 8b164d6ac47fb33157952094184eb2f529a41a0c /features/steps | |
parent | 0c291f35f5324d159155d16aa632fad412a2d3a3 (diff) | |
parent | 31bc42de57b3cfd7bf068df06d15372307b8661b (diff) |
Merge pull request #7964 from mr-vinn/task-lists
Add task lists to issues and merge requests
Diffstat (limited to 'features/steps')
-rw-r--r-- | features/steps/project/issues/issues.rb | 26 | ||||
-rw-r--r-- | features/steps/project/merge_requests.rb | 14 | ||||
-rw-r--r-- | features/steps/shared/markdown.rb | 30 | ||||
-rw-r--r-- | features/steps/shared/note.rb | 14 | ||||
-rw-r--r-- | features/steps/shared/paths.rb | 20 |
5 files changed, 104 insertions, 0 deletions
diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index b55b3c6c8a2..26c3c7c14bc 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -153,6 +153,32 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps author: project.users.first) end + step 'project "Shop" has "Tasks-open" open issue with task markdown' do + desc_text = <<EOT.gsub(/^ {6}/, '') + * [ ] Task 1 + * [x] Task 2 +EOT + create(:issue, + title: 'Tasks-open', + project: project, + author: project.users.first, + description: desc_text + ) + end + + step 'project "Shop" has "Tasks-closed" closed issue with task markdown' do + desc_text = <<EOT.gsub(/^ {6}/, '') + * [ ] Task 1 + * [x] Task 2 +EOT + create(:closed_issue, + title: 'Tasks-closed', + project: project, + author: project.users.first, + description: desc_text + ) + end + step 'empty project "Empty Project"' do create :empty_project, name: 'Empty Project', namespace: @user.namespace end diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index fba03c2fc64..0fec2604915 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -97,6 +97,20 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps author: project.users.first) end + step 'project "Shop" has "MR-task-open" open MR with task markdown' do + desc_text = <<EOT.gsub(/^ {6}/, '') + * [ ] Task 1 + * [x] Task 2 +EOT + create(:merge_request, + title: 'MR-task-open', + source_project: project, + target_project: project, + author: project.users.first, + description: desc_text + ) + end + step 'I switch to the diff tab' do visit diffs_project_merge_request_path(project, merge_request) end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 092f2fceb57..1d9058cf256 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -9,4 +9,34 @@ module SharedMarkdown step 'Header "Description header" should have correct id and link' do header_should_have_correct_id_and_link(1, 'Description header', 'description-header') end + + step 'I should see task checkboxes in the description' do + expect(page).to have_selector( + 'div.description li.task-list-item input[type="checkbox"]' + ) + end + + step 'I should see the task status for issue "Tasks-open"' do + expect(find(:css, 'span.task-status').text).to eq( + '2 tasks (1 done, 1 unfinished)' + ) + end + + step 'I should see the task status for merge request "MR-task-open"' do + expect(find(:css, 'span.task-status').text).to eq( + '2 tasks (1 done, 1 unfinished)' + ) + end + + step 'Task checkboxes should be enabled' do + expect(page).to have_selector( + 'div.description li.task-list-item input[type="checkbox"]:enabled' + ) + end + + step 'Task checkboxes should be disabled' do + expect(page).to have_selector( + 'div.description li.task-list-item input[type="checkbox"]:disabled' + ) + end end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 4019fe3697a..2b2cb47a715 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -119,4 +119,18 @@ module SharedNote page.should_not have_css("#comment-with-a-header") end end + + step 'I leave a comment with task markdown' do + within('.js-main-target-form') do + fill_in 'note[note]', with: '* [x] Task item' + click_button 'Add Comment' + sleep 0.05 + end + end + + step 'I should not see task checkboxes in the comment' do + expect(page).not_to have_selector( + 'li.note div.timeline-content input[type="checkbox"]' + ) + end end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 141ff13b67d..1f238f8befd 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -292,6 +292,16 @@ module SharedPaths visit project_issue_path(issue.project, issue) end + step 'I visit issue page "Tasks-open"' do + issue = Issue.find_by(title: 'Tasks-open') + visit project_issue_path(issue.project, issue) + end + + step 'I visit issue page "Tasks-closed"' do + issue = Issue.find_by(title: 'Tasks-closed') + visit project_issue_path(issue.project, issue) + end + step 'I visit project "Shop" labels page' do project = Project.find_by(name: 'Shop') visit project_labels_path(project) @@ -322,6 +332,16 @@ module SharedPaths visit project_merge_request_path(mr.target_project, mr) end + step 'I visit merge request page "MR-task-open"' do + mr = MergeRequest.find_by(title: 'MR-task-open') + visit project_merge_request_path(mr.target_project, mr) + end + + step 'I visit merge request page "MR-task-closed"' do + mr = MergeRequest.find_by(title: 'MR-task-closed') + visit project_merge_request_path(mr.target_project, mr) + end + step 'I visit project "Shop" merge requests page' do visit project_merge_requests_path(project) end |