2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Dashboard Issues', feature_category: :team_planning do
|
2019-02-15 15:39:39 +05:30
|
|
|
include FilteredSearchHelpers
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
let_it_be(:current_user) { create :user }
|
|
|
|
let_it_be(:user) { current_user } # Shared examples depend on this being available
|
|
|
|
let_it_be(:public_project) { create(:project, :public) }
|
|
|
|
let_it_be(:project) { create(:project) }
|
|
|
|
let_it_be(:project_with_issues_disabled) { create(:project, :issues_disabled) }
|
|
|
|
let_it_be(:authored_issue) { create :issue, author: current_user, project: project }
|
|
|
|
let_it_be(:authored_issue_on_public_project) { create :issue, author: current_user, project: public_project }
|
|
|
|
let_it_be(:assigned_issue) { create :issue, assignees: [current_user], project: project }
|
|
|
|
let_it_be(:other_issue) { create :issue, project: project }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
[project, project_with_issues_disabled].each { |project| project.add_maintainer(current_user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(current_user)
|
2019-02-15 15:39:39 +05:30
|
|
|
visit issues_dashboard_path(assignee_username: current_user.username)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :issues_dashboard_path, :issues
|
2023-03-17 16:20:25 +05:30
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
describe 'issues', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
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-08-17 22:00:37 +05:30
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
it 'shows issues when current user is author' do
|
|
|
|
click_button 'Clear'
|
|
|
|
select_tokens 'Author', '=', current_user.to_reference, submit: true
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
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-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
it 'state filter tabs work' do
|
2023-07-09 08:55:56 +05:30
|
|
|
click_link 'Closed'
|
|
|
|
|
|
|
|
expect(page).not_to have_content(assigned_issue.title)
|
|
|
|
expect(page).not_to have_content(authored_issue.title)
|
|
|
|
expect(page).not_to have_content(other_issue.title)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
describe 'RSS link' do
|
|
|
|
before do
|
|
|
|
click_button 'Actions'
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like "it has an RSS link with current_user's feed token"
|
|
|
|
it_behaves_like "an autodiscoverable RSS feed with current_user's feed token"
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe 'new issue dropdown' do
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'shows projects only with issues feature enabled', :js do
|
2023-04-23 21:23:45 +05:30
|
|
|
click_button _('Select project to create issue')
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
page.within('[data-testid="new-resource-dropdown"] [role="menu"]') do
|
2018-03-27 19:54:05 +05:30
|
|
|
expect(page).to have_content(project.full_name)
|
|
|
|
expect(page).not_to have_content(project_with_issues_disabled.full_name)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'shows the new issue page', :js do
|
2023-04-23 21:23:45 +05:30
|
|
|
click_button _('Select project to create issue')
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
project_path = "/#{project.full_path}"
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
page.within('[data-testid="new-resource-dropdown"]') do
|
|
|
|
find_button(project.full_name).click
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
click_link format(_('New issue in %{project}'), project: project.name)
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
expect(page).to have_current_path("#{project_path}/-/issues/new")
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
page.within('#content-body') do
|
|
|
|
expect(page).to have_selector('.issue-form')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|