2017-02-03 08:07:09 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
RSpec.describe 'Dashboard Issues' do
|
2017-02-03 08:07:09 -05:00
|
|
|
let(:current_user) { create :user }
|
2017-06-21 19:44:10 -04:00
|
|
|
let(:user) { current_user } # Shared examples depend on this being available
|
2017-08-02 15:55:11 -04:00
|
|
|
let!(:public_project) { create(:project, :public) }
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:project_with_issues_disabled) { create(:project, :issues_disabled) }
|
2017-02-03 08:07:09 -05:00
|
|
|
let!(:authored_issue) { create :issue, author: current_user, project: project }
|
|
|
|
let!(:authored_issue_on_public_project) { create :issue, author: current_user, project: public_project }
|
2017-05-04 08:11:15 -04:00
|
|
|
let!(:assigned_issue) { create :issue, assignees: [current_user], project: project }
|
2017-02-03 08:07:09 -05:00
|
|
|
let!(:other_issue) { create :issue, project: project }
|
|
|
|
|
|
|
|
before do
|
2017-12-22 03:18:28 -05:00
|
|
|
[project, project_with_issues_disabled].each { |project| project.add_master(current_user) }
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(current_user)
|
2017-02-03 08:07:09 -05:00
|
|
|
visit issues_dashboard_path(assignee_id: current_user.id)
|
|
|
|
end
|
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
describe 'issues' do
|
|
|
|
it 'shows issues assigned to current user' do
|
|
|
|
expect(page).to have_content(assigned_issue.title)
|
|
|
|
expect(page).not_to have_content(authored_issue.title)
|
|
|
|
expect(page).not_to have_content(other_issue.title)
|
|
|
|
end
|
2017-02-03 08:07:09 -05:00
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
it 'shows checkmark when unassigned is selected for assignee', :js do
|
2017-05-30 00:35:49 -04:00
|
|
|
find('.js-assignee-search').click
|
|
|
|
find('li', text: 'Unassigned').click
|
|
|
|
find('.js-assignee-search').click
|
2017-05-17 11:26:52 -04:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
expect(find('li[data-user-id="0"] a.is-active')).to be_visible
|
|
|
|
end
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
it 'shows issues when current user is author', :js do
|
2017-10-12 18:44:53 -04:00
|
|
|
execute_script("document.querySelector('#assignee_id').value=''")
|
2017-05-30 00:35:49 -04:00
|
|
|
find('.js-author-search', match: :first).click
|
2017-05-17 11:26:52 -04:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
expect(find('li[data-user-id="null"] a.is-active')).to be_visible
|
2017-05-17 11:26:52 -04:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
find('.dropdown-menu-author li a', match: :first, text: current_user.to_reference).click
|
|
|
|
find('.js-author-search', match: :first).click
|
2017-05-17 11:26:52 -04:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
page.within '.dropdown-menu-user' do
|
|
|
|
expect(find('.dropdown-menu-author li a.is-active', match: :first, text: current_user.to_reference)).to be_visible
|
|
|
|
end
|
2017-05-04 08:11:15 -04:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
expect(page).to have_content(authored_issue.title)
|
|
|
|
expect(page).to have_content(authored_issue_on_public_project.title)
|
|
|
|
expect(page).not_to have_content(assigned_issue.title)
|
|
|
|
expect(page).not_to have_content(other_issue.title)
|
2017-05-04 08:11:15 -04:00
|
|
|
end
|
2017-02-03 08:07:09 -05:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
it 'shows all issues' do
|
|
|
|
click_link('Reset filters')
|
2017-02-03 08:07:09 -05:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
expect(page).to have_content(authored_issue.title)
|
|
|
|
expect(page).to have_content(authored_issue_on_public_project.title)
|
|
|
|
expect(page).to have_content(assigned_issue.title)
|
|
|
|
expect(page).to have_content(other_issue.title)
|
|
|
|
end
|
2017-02-03 08:07:09 -05:00
|
|
|
|
2017-06-21 15:45:50 -04:00
|
|
|
it 'state filter tabs work' do
|
|
|
|
find('#state-closed').click
|
2017-07-11 12:12:33 -04:00
|
|
|
expect(page).to have_current_path(issues_dashboard_url(assignee_id: current_user.id, state: 'closed'), url: true)
|
2017-06-21 15:45:50 -04:00
|
|
|
end
|
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
it_behaves_like "it has an RSS button with current_user's RSS token"
|
|
|
|
it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token"
|
2017-02-03 08:07:09 -05:00
|
|
|
end
|
2017-02-28 15:50:57 -05:00
|
|
|
|
2017-05-30 00:35:49 -04:00
|
|
|
describe 'new issue dropdown' do
|
2017-10-03 04:35:01 -04:00
|
|
|
it 'shows projects only with issues feature enabled', :js do
|
2017-06-17 02:08:27 -04:00
|
|
|
find('.new-project-item-select-button').click
|
2017-05-30 00:35:49 -04:00
|
|
|
|
|
|
|
page.within('.select2-results') do
|
|
|
|
expect(page).to have_content(project.name_with_namespace)
|
|
|
|
expect(page).not_to have_content(project_with_issues_disabled.name_with_namespace)
|
|
|
|
end
|
|
|
|
end
|
2017-07-25 08:14:28 -04:00
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
it 'shows the new issue page', :js do
|
2017-08-03 01:13:46 -04:00
|
|
|
find('.new-project-item-select-button').click
|
2017-08-07 16:55:50 -04:00
|
|
|
|
2017-07-25 08:14:28 -04:00
|
|
|
wait_for_requests
|
|
|
|
|
2017-08-07 16:55:50 -04:00
|
|
|
project_path = "/#{project.path_with_namespace}"
|
|
|
|
project_json = { name: project.name_with_namespace, url: project_path }.to_json
|
|
|
|
|
2017-10-16 13:37:52 -04:00
|
|
|
# simulate selection, and prevent overlap by dropdown menu
|
|
|
|
first('.project-item-select', visible: false)
|
2017-08-07 16:55:50 -04:00
|
|
|
execute_script("$('.project-item-select').val('#{project_json}').trigger('change');")
|
2017-10-16 13:37:52 -04:00
|
|
|
find('#select2-drop-mask', visible: false)
|
2017-08-07 16:55:50 -04:00
|
|
|
execute_script("$('#select2-drop-mask').remove();")
|
|
|
|
|
2017-08-09 18:57:52 -04:00
|
|
|
find('.new-project-item-link').click
|
2017-08-07 16:55:50 -04:00
|
|
|
|
|
|
|
expect(page).to have_current_path("#{project_path}/issues/new")
|
2017-07-25 08:14:28 -04:00
|
|
|
|
|
|
|
page.within('#content-body') do
|
|
|
|
expect(page).to have_selector('.issue-form')
|
|
|
|
end
|
|
|
|
end
|
2017-05-30 00:35:49 -04:00
|
|
|
end
|
2017-02-03 08:07:09 -05:00
|
|
|
end
|