2016-12-20 14:44:24 +00:00
|
|
|
shared_examples 'issuable time tracker' do
|
|
|
|
it 'renders the sidebar component empty state' do
|
|
|
|
page.within '.time-tracking-no-tracking-pane' do
|
|
|
|
expect(page).to have_content 'No estimate or time spent'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates the sidebar component when estimate is added' do
|
|
|
|
submit_time('/estimate 3w 1d 1h')
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-12-20 14:44:24 +00:00
|
|
|
page.within '.time-tracking-estimate-only-pane' do
|
|
|
|
expect(page).to have_content '3w 1d 1h'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates the sidebar component when spent is added' do
|
|
|
|
submit_time('/spend 3w 1d 1h')
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-12-20 14:44:24 +00:00
|
|
|
page.within '.time-tracking-spend-only-pane' do
|
|
|
|
expect(page).to have_content '3w 1d 1h'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the comparison when estimate and spent are added' do
|
|
|
|
submit_time('/estimate 3w 1d 1h')
|
|
|
|
submit_time('/spend 3w 1d 1h')
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-12-20 14:44:24 +00:00
|
|
|
page.within '.time-tracking-comparison-pane' do
|
|
|
|
expect(page).to have_content '3w 1d 1h'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates the sidebar component when estimate is removed' do
|
|
|
|
submit_time('/estimate 3w 1d 1h')
|
|
|
|
submit_time('/remove_estimate')
|
|
|
|
|
2017-05-04 12:11:15 +00:00
|
|
|
page.within '.time-tracking-component-wrap' do
|
2016-12-20 14:44:24 +00:00
|
|
|
expect(page).to have_content 'No estimate or time spent'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates the sidebar component when spent is removed' do
|
|
|
|
submit_time('/spend 3w 1d 1h')
|
|
|
|
submit_time('/remove_time_spent')
|
|
|
|
|
2017-05-04 12:11:15 +00:00
|
|
|
page.within '.time-tracking-component-wrap' do
|
2016-12-20 14:44:24 +00:00
|
|
|
expect(page).to have_content 'No estimate or time spent'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the help state when icon is clicked' do
|
2017-05-04 12:11:15 +00:00
|
|
|
page.within '.time-tracking-component-wrap' do
|
2016-12-20 14:44:24 +00:00
|
|
|
find('.help-button').click
|
2017-05-31 05:50:53 +00:00
|
|
|
expect(page).to have_content 'Track time with quick actions'
|
2016-12-20 14:44:24 +00:00
|
|
|
expect(page).to have_content 'Learn more'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'hides the help state when close icon is clicked' do
|
2017-05-04 12:11:15 +00:00
|
|
|
page.within '.time-tracking-component-wrap' do
|
2016-12-20 14:44:24 +00:00
|
|
|
find('.help-button').click
|
|
|
|
find('.close-help-button').click
|
|
|
|
|
2017-05-31 05:50:53 +00:00
|
|
|
expect(page).not_to have_content 'Track time with quick actions'
|
2016-12-20 14:44:24 +00:00
|
|
|
expect(page).not_to have_content 'Learn more'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays the correct help url' do
|
2017-05-04 12:11:15 +00:00
|
|
|
page.within '.time-tracking-component-wrap' do
|
2016-12-20 14:44:24 +00:00
|
|
|
find('.help-button').click
|
|
|
|
|
|
|
|
expect(find_link('Learn more')[:href]).to have_content('/help/workflow/time_tracking.md')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-31 05:50:53 +00:00
|
|
|
def submit_time(quick_action)
|
|
|
|
fill_in 'note[note]', with: quick_action
|
2017-06-17 06:08:27 +00:00
|
|
|
find('.js-comment-submit-button').click
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-12-20 14:44:24 +00:00
|
|
|
end
|