2016-04-26 11:22:52 +00:00
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
2017-06-29 04:13:10 +00:00
|
|
|
|
feature 'Milestone' do
|
2017-07-07 15:08:49 +00:00
|
|
|
|
let(:group) { create(:group, :public) }
|
2017-08-02 19:55:11 +00:00
|
|
|
|
let(:project) { create(:project, :public, namespace: group) }
|
2016-04-26 11:22:52 +00:00
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
|
|
before do
|
2017-07-07 15:08:49 +00:00
|
|
|
|
create(:group_member, group: group, user: user)
|
2017-12-22 08:18:28 +00:00
|
|
|
|
project.add_master(user)
|
2017-06-21 23:44:10 +00:00
|
|
|
|
sign_in(user)
|
2016-04-26 11:22:52 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
feature 'Create a milestone' do
|
2016-09-12 19:14:26 +00:00
|
|
|
|
scenario 'shows an informative message for a new milestone' do
|
2017-07-06 16:20:50 +00:00
|
|
|
|
visit new_project_milestone_path(project)
|
2016-11-15 17:48:30 +00:00
|
|
|
|
|
2016-04-26 11:22:52 +00:00
|
|
|
|
page.within '.milestone-form' do
|
|
|
|
|
fill_in "milestone_title", with: '8.7'
|
2016-11-15 17:48:30 +00:00
|
|
|
|
fill_in "milestone_start_date", with: '2016-11-16'
|
|
|
|
|
fill_in "milestone_due_date", with: '2016-12-16'
|
2016-04-26 11:22:52 +00:00
|
|
|
|
end
|
2016-11-15 17:48:30 +00:00
|
|
|
|
|
2016-04-26 11:22:52 +00:00
|
|
|
|
find('input[name="commit"]').click
|
|
|
|
|
|
|
|
|
|
expect(find('.alert-success')).to have_content('Assign some issues to this milestone.')
|
2017-02-24 17:07:29 +00:00
|
|
|
|
expect(page).to have_content('Nov 16, 2016–Dec 16, 2016')
|
2016-04-26 11:22:52 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
feature 'Open a milestone with closed issues' do
|
2016-07-25 18:16:19 +00:00
|
|
|
|
scenario 'shows an informative message' do
|
2016-09-12 19:14:26 +00:00
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
|
2016-04-26 11:22:52 +00:00
|
|
|
|
create(:issue, title: "Bugfix1", project: project, milestone: milestone, state: "closed")
|
2017-07-06 16:20:50 +00:00
|
|
|
|
visit project_milestone_path(project, milestone)
|
2016-04-26 11:22:52 +00:00
|
|
|
|
|
|
|
|
|
expect(find('.alert-success')).to have_content('All issues for this milestone are closed. You may close this milestone now.')
|
|
|
|
|
end
|
|
|
|
|
end
|
2016-09-12 19:14:26 +00:00
|
|
|
|
|
2017-07-07 15:08:49 +00:00
|
|
|
|
feature 'Open a project milestone with an existing title' do
|
|
|
|
|
scenario 'displays validation message when there is a project milestone with same title' do
|
2016-09-12 19:14:26 +00:00
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
|
2017-07-06 16:20:50 +00:00
|
|
|
|
visit new_project_milestone_path(project)
|
2016-09-12 19:14:26 +00:00
|
|
|
|
page.within '.milestone-form' do
|
|
|
|
|
fill_in "milestone_title", with: milestone.title
|
|
|
|
|
end
|
|
|
|
|
find('input[name="commit"]').click
|
|
|
|
|
|
2017-07-07 15:08:49 +00:00
|
|
|
|
expect(find('.alert-danger')).to have_content('already being used for another group or project milestone.')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'displays validation message when there is a group milestone with same title' do
|
|
|
|
|
milestone = create(:milestone, project_id: nil, group: project.group, title: 8.7)
|
|
|
|
|
|
|
|
|
|
visit new_group_milestone_path(project.group)
|
|
|
|
|
|
|
|
|
|
page.within '.milestone-form' do
|
|
|
|
|
fill_in "milestone_title", with: milestone.title
|
|
|
|
|
end
|
|
|
|
|
find('input[name="commit"]').click
|
|
|
|
|
|
|
|
|
|
expect(find('.alert-danger')).to have_content('already being used for another group or project milestone.')
|
2016-09-12 19:14:26 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
2017-11-07 19:49:41 +00:00
|
|
|
|
|
2018-02-21 17:20:56 +00:00
|
|
|
|
feature 'Open a milestone', :js do
|
2017-11-07 19:49:41 +00:00
|
|
|
|
scenario 'shows total issue time spent correctly when no time has been logged' do
|
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
|
|
|
|
|
visit project_milestone_path(project, milestone)
|
|
|
|
|
|
2018-02-21 17:20:56 +00:00
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
|
|
page.within('.time-tracking-no-tracking-pane') do
|
|
|
|
|
expect(page).to have_content 'No estimate or time spent'
|
2017-11-07 19:49:41 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'shows total issue time spent' do
|
|
|
|
|
milestone = create(:milestone, project: project, title: 8.7)
|
|
|
|
|
issue1 = create(:issue, project: project, milestone: milestone)
|
|
|
|
|
issue2 = create(:issue, project: project, milestone: milestone)
|
2017-12-14 19:32:55 +00:00
|
|
|
|
issue1.spend_time(duration: 3600, user_id: user.id)
|
2017-11-07 19:49:41 +00:00
|
|
|
|
issue1.save!
|
2017-12-14 19:32:55 +00:00
|
|
|
|
issue2.spend_time(duration: 7200, user_id: user.id)
|
2017-11-07 19:49:41 +00:00
|
|
|
|
issue2.save!
|
|
|
|
|
|
|
|
|
|
visit project_milestone_path(project, milestone)
|
|
|
|
|
|
2018-02-21 17:20:56 +00:00
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
|
|
page.within('.time-tracking-spend-only-pane') do
|
|
|
|
|
expect(page).to have_content 'Spent: 3h'
|
2017-11-07 19:49:41 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2018-03-01 23:20:06 +00:00
|
|
|
|
|
|
|
|
|
feature 'Deleting a milestone' do
|
|
|
|
|
scenario "The delete milestone button does not show for unauthorized users" do
|
|
|
|
|
create(:milestone, project: project, title: 8.7)
|
|
|
|
|
sign_out(user)
|
|
|
|
|
|
|
|
|
|
visit group_milestones_path(group)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_selector('.js-delete-milestone-button', count: 0)
|
|
|
|
|
end
|
|
|
|
|
end
|
2018-03-23 19:14:09 +00:00
|
|
|
|
|
|
|
|
|
feature 'deprecation popover', :js do
|
|
|
|
|
it 'opens deprecation popover' do
|
|
|
|
|
milestone = create(:milestone, project: project)
|
|
|
|
|
|
|
|
|
|
visit group_milestone_path(group, milestone, title: milestone.title)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_selector('.milestone-deprecation-message')
|
|
|
|
|
|
2018-04-02 23:21:43 +00:00
|
|
|
|
find('.milestone-deprecation-message .js-popover-link').click
|
2018-03-23 19:14:09 +00:00
|
|
|
|
|
2018-04-24 15:35:36 +00:00
|
|
|
|
expect(page).to have_selector('.popover')
|
2018-03-23 19:14:09 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
2016-04-26 11:22:52 +00:00
|
|
|
|
end
|