summaryrefslogtreecommitdiff
path: root/spec/features/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/dashboard')
-rw-r--r--spec/features/dashboard/activity_spec.rb2
-rw-r--r--spec/features/dashboard/groups_list_spec.rb2
-rw-r--r--spec/features/dashboard/issuables_counter_spec.rb27
-rw-r--r--spec/features/dashboard/issues_spec.rb2
-rw-r--r--spec/features/dashboard/merge_requests_spec.rb4
-rw-r--r--spec/features/dashboard/milestones_spec.rb2
-rw-r--r--spec/features/dashboard/navbar_spec.rb16
-rw-r--r--spec/features/dashboard/projects_spec.rb2
-rw-r--r--spec/features/dashboard/snippets_spec.rb2
-rw-r--r--spec/features/dashboard/todos/todos_spec.rb55
-rw-r--r--spec/features/dashboard/user_filters_projects_spec.rb2
11 files changed, 72 insertions, 44 deletions
diff --git a/spec/features/dashboard/activity_spec.rb b/spec/features/dashboard/activity_spec.rb
index b1734cb353b..edb3dacc2cc 100644
--- a/spec/features/dashboard/activity_spec.rb
+++ b/spec/features/dashboard/activity_spec.rb
@@ -9,6 +9,8 @@ RSpec.describe 'Dashboard > Activity', feature_category: :users do
sign_in(user)
end
+ it_behaves_like 'a dashboard page with sidebar', :activity_dashboard_path, :activity
+
context 'tabs' do
it 'shows Your Projects' do
visit activity_dashboard_path
diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb
index b28e2ccf787..a45e0a58ed6 100644
--- a/spec/features/dashboard/groups_list_spec.rb
+++ b/spec/features/dashboard/groups_list_spec.rb
@@ -19,6 +19,8 @@ RSpec.describe 'Dashboard Groups page', :js, feature_category: :subgroups do
page.find("[data-testid='group-#{group.id}-dropdown-button'").click
end
+ it_behaves_like 'a dashboard page with sidebar', :dashboard_groups_path, :groups
+
it 'shows groups user is member of' do
group.add_owner(user)
nested_group.add_owner(user)
diff --git a/spec/features/dashboard/issuables_counter_spec.rb b/spec/features/dashboard/issuables_counter_spec.rb
index 5c7285f0491..5dc59cfa841 100644
--- a/spec/features/dashboard/issuables_counter_spec.rb
+++ b/spec/features/dashboard/issuables_counter_spec.rb
@@ -12,7 +12,6 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching,
issue.assignees = [user]
merge_request.update!(assignees: [user])
sign_in(user)
- stub_feature_flags(limit_assigned_issues_count: false)
end
it 'reflects dashboard issues count' do
@@ -20,9 +19,9 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching,
expect_counters('issues', '1', n_("%d assigned issue", "%d assigned issues", 1) % 1)
- issue.assignees = []
+ issue.update!(assignees: [])
- user.invalidate_cache_counts
+ Users::AssignedIssuesCountService.new(current_user: user).delete_cache
travel_to(3.minutes.from_now) do
visit issues_path
@@ -31,28 +30,6 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching,
end
end
- context 'when :limit_assigned_issues_count FF is used' do
- before do
- stub_feature_flags(limit_assigned_issues_count: true)
- end
-
- it 'reflects dashboard issues count' do
- visit issues_path
-
- expect_counters('issues', '1', n_("%d assigned issue", "%d assigned issues", 1) % 1)
-
- issue.update!(assignees: [])
-
- Users::AssignedIssuesCountService.new(current_user: user).delete_cache
-
- travel_to(3.minutes.from_now) do
- visit issues_path
-
- expect_counters('issues', '0', n_("%d assigned issue", "%d assigned issues", 0) % 0)
- end
- end
- end
-
it 'reflects dashboard merge requests count', :js do
visit merge_requests_path
diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb
index d74965f58fa..ae375bd3e13 100644
--- a/spec/features/dashboard/issues_spec.rb
+++ b/spec/features/dashboard/issues_spec.rb
@@ -21,6 +21,8 @@ RSpec.describe 'Dashboard Issues', feature_category: :team_planning do
visit issues_dashboard_path(assignee_username: current_user.username)
end
+ it_behaves_like 'a dashboard page with sidebar', :issues_dashboard_path, :issues
+
describe 'issues' do
it 'shows issues assigned to current user' do
expect(page).to have_content(assigned_issue.title)
diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb
index 56d7c45de5d..a146a6987bc 100644
--- a/spec/features/dashboard/merge_requests_spec.rb
+++ b/spec/features/dashboard/merge_requests_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'Dashboard Merge Requests', feature_category: :code_review do
+RSpec.describe 'Dashboard Merge Requests', feature_category: :code_review_workflow do
include Spec::Support::Helpers::Features::SortingHelpers
include FilteredSearchHelpers
include ProjectForksHelper
@@ -19,6 +19,8 @@ RSpec.describe 'Dashboard Merge Requests', feature_category: :code_review do
sign_in(current_user)
end
+ it_behaves_like 'a dashboard page with sidebar', :merge_requests_dashboard_path, :merge_requests
+
it 'disables target branch filter' do
visit merge_requests_dashboard_path
diff --git a/spec/features/dashboard/milestones_spec.rb b/spec/features/dashboard/milestones_spec.rb
index b4d0d9c5812..a9f23f90bb1 100644
--- a/spec/features/dashboard/milestones_spec.rb
+++ b/spec/features/dashboard/milestones_spec.rb
@@ -26,6 +26,8 @@ RSpec.describe 'Dashboard > Milestones', feature_category: :team_planning do
visit dashboard_milestones_path
end
+ it_behaves_like 'a dashboard page with sidebar', :dashboard_milestones_path, :milestones
+
it 'sees milestones' do
expect(page).to have_current_path dashboard_milestones_path, ignore_query: true
expect(page).to have_content(milestone.title)
diff --git a/spec/features/dashboard/navbar_spec.rb b/spec/features/dashboard/navbar_spec.rb
new file mode 100644
index 00000000000..ff0ff899fc2
--- /dev/null
+++ b/spec/features/dashboard/navbar_spec.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe '"Your work" navbar', feature_category: :navigation do
+ include_context 'dashboard navbar structure'
+
+ let_it_be(:user) { create(:user) }
+
+ it_behaves_like 'verified navigation bar' do
+ before do
+ sign_in(user)
+ visit root_path
+ end
+ end
+end
diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb
index 2b89f16bbff..779fbb48ddb 100644
--- a/spec/features/dashboard/projects_spec.rb
+++ b/spec/features/dashboard/projects_spec.rb
@@ -18,6 +18,8 @@ RSpec.describe 'Dashboard Projects', feature_category: :projects do
end
end
+ it_behaves_like "a dashboard page with sidebar", :dashboard_projects_path, :projects
+
context 'when user has access to the project' do
it 'shows role badge' do
visit dashboard_projects_path
diff --git a/spec/features/dashboard/snippets_spec.rb b/spec/features/dashboard/snippets_spec.rb
index ab2cfc0573e..ba40290d866 100644
--- a/spec/features/dashboard/snippets_spec.rb
+++ b/spec/features/dashboard/snippets_spec.rb
@@ -5,6 +5,8 @@ require 'spec_helper'
RSpec.describe 'Dashboard snippets', feature_category: :source_code_management do
let_it_be(:user) { create(:user) }
+ it_behaves_like 'a dashboard page with sidebar', :dashboard_snippets_path, :snippets
+
context 'when the project has snippets' do
let(:project) { create(:project, :public, creator: user) }
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.first_owner, project: project) }
diff --git a/spec/features/dashboard/todos/todos_spec.rb b/spec/features/dashboard/todos/todos_spec.rb
index 606bc82a7bb..59bb1a452c9 100644
--- a/spec/features/dashboard/todos/todos_spec.rb
+++ b/spec/features/dashboard/todos/todos_spec.rb
@@ -15,6 +15,8 @@ RSpec.describe 'Dashboard Todos', feature_category: :team_planning do
project.add_developer(user)
end
+ it_behaves_like 'a dashboard page with sidebar', :dashboard_todos_path, :todos
+
context 'User does not have todos' do
before do
sign_in(user)
@@ -152,6 +154,22 @@ RSpec.describe 'Dashboard Todos', feature_category: :team_planning do
it_behaves_like 'deleting the todo'
it_behaves_like 'deleting and restoring the todo'
end
+
+ context 'when todo has a note' do
+ let(:note) { create(:note, project: project, note: "Check out stuff", noteable: create(:issue, project: project)) }
+ let!(:todo) { create(:todo, :mentioned, user: user, project: project, author: author, note: note, target: note.noteable) }
+
+ before do
+ sign_in(user)
+ visit dashboard_todos_path
+ end
+
+ it 'shows note preview' do
+ expect(page).to have_no_content('mentioned you:')
+ expect(page).to have_no_content('"Check out stuff"')
+ expect(page).to have_content('Check out stuff')
+ end
+ end
end
context 'User created todos for themself' do
@@ -446,27 +464,30 @@ RSpec.describe 'Dashboard Todos', feature_category: :team_planning do
end
end
- context 'User has a todo for an access requested raised for group membership' do
- let_it_be(:group) { create(:group, :public) }
+ context 'User requested access' do
+ shared_examples 'has todo present with access request content' do
+ specify do
+ create(:todo, :member_access_requested,
+ user: user,
+ target: target,
+ author: author
+ )
+ target.add_owner(user)
- let_it_be(:todo) do
- create(:todo, :member_access_requested,
- user: user,
- target: group,
- author: author,
- group: group)
- end
-
- before do
- group.add_owner(user)
- sign_in(user)
+ sign_in(user)
+ visit dashboard_todos_path
- visit dashboard_todos_path
+ expect(page).to have_selector('.todos-list .todo', count: 1)
+ expect(page).to have_content "#{author.name} has requested access to #{target.class.name.downcase} #{target.name}"
+ end
end
- it 'has todo present with access request content' do
- expect(page).to have_selector('.todos-list .todo', count: 1)
- expect(page).to have_content "#{author.name} has requested access to group #{group.name}"
+ context 'when user requests access to project or group' do
+ %i[project group].each do |target_type|
+ it_behaves_like 'has todo present with access request content' do
+ let_it_be(:target) { create(target_type, :public) }
+ end
+ end
end
end
end
diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb
index 1168a6827fd..8ec9b98c3b3 100644
--- a/spec/features/dashboard/user_filters_projects_spec.rb
+++ b/spec/features/dashboard/user_filters_projects_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe 'Dashboard > User filters projects', feature_category: :projects
it 'returns message when starred projects fitler returns no results' do
fill_in 'project-filter-form-field', with: 'Beta\n'
- expect(page).to have_content('This user doesn\'t have any personal projects')
+ expect(page).to have_content('There are no projects available to be displayed here.')
expect(page).not_to have_content('You don\'t have starred projects yet')
end
end