diff options
Diffstat (limited to 'spec/features/dashboard/issuables_counter_spec.rb')
-rw-r--r-- | spec/features/dashboard/issuables_counter_spec.rb | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/spec/features/dashboard/issuables_counter_spec.rb b/spec/features/dashboard/issuables_counter_spec.rb index 501405c5662..d34f8cb3e18 100644 --- a/spec/features/dashboard/issuables_counter_spec.rb +++ b/spec/features/dashboard/issuables_counter_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching, feature_category: :team_planning do - let(:user) { create(:user, :no_super_sidebar) } + let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace) } let(:issue) { create(:issue, project: project) } let(:merge_request) { create(:merge_request, source_project: project) } @@ -17,33 +17,29 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching, it 'reflects dashboard issues count', :js do visit issues_path - expect_counters('issues', '1', n_("%d assigned issue", "%d assigned issues", 1) % 1) + expect_issue_count(1) issue.update!(assignees: []) - Users::AssignedIssuesCountService.new(current_user: user).delete_cache + user.invalidate_cache_counts - travel_to(3.minutes.from_now) do - visit issues_path + visit issues_path - expect_counters('issues', '0', n_("%d assigned issue", "%d assigned issues", 0) % 0) - end + expect_issue_count(0) end it 'reflects dashboard merge requests count', :js do visit merge_requests_path - expect_counters('merge_requests', '1', n_("%d merge request", "%d merge requests", 1) % 1) + expect_merge_request_count(1) merge_request.update!(assignees: []) user.invalidate_cache_counts - travel_to(3.minutes.from_now) do - visit merge_requests_path + visit merge_requests_path - expect_counters('merge_requests', '0', n_("%d merge request", "%d merge requests", 0) % 0) - end + expect_merge_request_count(0) end def issues_path @@ -54,11 +50,21 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching, merge_requests_dashboard_path(assignee_username: user.username) end - def expect_counters(issuable_type, count, badge_label) + def expect_issue_count(count) dashboard_count = find('.gl-tabs-nav li a.active') + expect(dashboard_count).to have_content(count) + within_testid('super-sidebar') do + expect(page).to have_link("Issues #{count}") + end + end + + def expect_merge_request_count(count) + dashboard_count = find('.gl-tabs-nav li a.active') expect(dashboard_count).to have_content(count) - expect(page).to have_css(".dashboard-shortcuts-#{issuable_type}", visible: :all, text: count) - expect(page).to have_css("span[aria-label='#{badge_label}']", visible: :all, text: count) + + within_testid('super-sidebar') do + expect(page).to have_button("Merge requests #{count}") + end end end |