Commit 93a20ea8 authored by Regis's avatar Regis

fix tasks list spec in rspec

parent b29f91b0
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
- if issue.assignee - if issue.assignee
%li %li
= link_to_member(@project, issue.assignee, name: false, title: "Assigned to :name") = link_to_member(@project, issue.assignee, name: false, title: "Assigned to :name")
- if issue.tasks?
 
%span.task-status
= issue.task_status
= render 'shared/issuable_meta_data', issuable: issue = render 'shared/issuable_meta_data', issuable: issue
...@@ -37,6 +41,10 @@ ...@@ -37,6 +41,10 @@
   
- issue.labels.each do |label| - issue.labels.each do |label|
= link_to_label(label, subject: issue.project, css_class: 'label-link') = link_to_label(label, subject: issue.project, css_class: 'label-link')
- if issue.tasks?
 
%span.task-status
= issue.task_status
.pull-right.issue-updated-at .pull-right.issue-updated-at
%span updated #{time_ago_with_tooltip(issue.updated_at, placement: 'bottom', html_class: 'issue_update_ago')} %span updated #{time_ago_with_tooltip(issue.updated_at, placement: 'bottom', html_class: 'issue_update_ago')}
...@@ -65,13 +65,12 @@ feature 'Task Lists', feature: true do ...@@ -65,13 +65,12 @@ feature 'Task Lists', feature: true do
describe 'for Issues', feature: true do describe 'for Issues', feature: true do
describe 'multiple tasks', js: true do describe 'multiple tasks', js: true do
include WaitForVueResource include WaitForVueResource
before { wait_for_vue_resource }
let!(:issue) { create(:issue, description: markdown, author: user, project: project) } let!(:issue) { create(:issue, description: markdown, author: user, project: project) }
it 'renders' do it 'renders' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 6) expect(page).to have_selector('li.task-list-item', count: 6)
...@@ -80,25 +79,24 @@ feature 'Task Lists', feature: true do ...@@ -80,25 +79,24 @@ feature 'Task Lists', feature: true do
it 'contains the required selectors' do it 'contains the required selectors' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
container = '.detail-page-description .description.js-task-list-container' expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox")
expect(page).to have_selector(container)
expect(page).to have_selector("#{container} .wiki .task-list .task-list-item .task-list-item-checkbox")
expect(page).to have_selector("#{container} .js-task-list-field")
expect(page).to have_selector('form.js-issuable-update')
expect(page).to have_selector('a.btn-close') expect(page).to have_selector('a.btn-close')
end end
it 'is only editable by author' do it 'is only editable by author' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('.js-task-list-container') expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox")
logout(:user) logout(:user)
login_as(user2) login_as(user2)
visit current_path visit current_path
expect(page).not_to have_selector('.js-task-list-container') wait_for_vue_resource
expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox")
end end
it 'provides a summary on Issues#index' do it 'provides a summary on Issues#index' do
...@@ -112,10 +110,9 @@ feature 'Task Lists', feature: true do ...@@ -112,10 +110,9 @@ feature 'Task Lists', feature: true do
let!(:issue) { create(:issue, description: singleIncompleteMarkdown, author: user, project: project) } let!(:issue) { create(:issue, description: singleIncompleteMarkdown, author: user, project: project) }
before { wait_for_vue_resource }
it 'renders' do it 'renders' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 1) expect(page).to have_selector('li.task-list-item', count: 1)
...@@ -124,15 +121,18 @@ feature 'Task Lists', feature: true do ...@@ -124,15 +121,18 @@ feature 'Task Lists', feature: true do
it 'provides a summary on Issues#index' do it 'provides a summary on Issues#index' do
visit namespace_project_issues_path(project.namespace, project) visit namespace_project_issues_path(project.namespace, project)
expect(page).to have_content("0 of 1 task completed") expect(page).to have_content("0 of 1 task completed")
end end
end end
describe 'single complete task' do describe 'single complete task', js: true do
include WaitForVueResource
let!(:issue) { create(:issue, description: singleCompleteMarkdown, author: user, project: project) } let!(:issue) { create(:issue, description: singleCompleteMarkdown, author: user, project: project) }
it 'renders' do it 'renders' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 1) expect(page).to have_selector('li.task-list-item', count: 1)
...@@ -141,6 +141,7 @@ feature 'Task Lists', feature: true do ...@@ -141,6 +141,7 @@ feature 'Task Lists', feature: true do
it 'provides a summary on Issues#index' do it 'provides a summary on Issues#index' do
visit namespace_project_issues_path(project.namespace, project) visit namespace_project_issues_path(project.namespace, project)
expect(page).to have_content("1 of 1 task completed") expect(page).to have_content("1 of 1 task completed")
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment