Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dashboard_spec.rb « admin « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: baca60134b9157f3ae6c2c8796aed00a7af37038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'admin visits dashboard' do
  include ProjectForksHelper

  before do
    admin = create(:admin)
    sign_in(admin)
    gitlab_enable_admin_mode_sign_in(admin)
  end

  context 'counting forks', :js, feature_category: :source_code_management do
    it 'correctly counts 2 forks of a project' do
      project = create(:project)
      project_fork = fork_project(project)
      fork_project(project_fork)

      # Make sure the fork_networks & fork_networks reltuples have been updated
      # to get a correct count on postgresql
      ForkNetwork.connection.execute('ANALYZE fork_networks')
      ForkNetwork.connection.execute('ANALYZE fork_network_members')

      visit admin_root_path

      expect(page).to have_content('Forks 2')
    end
  end

  describe 'Users statistic', feature_category: :user_management do
    let_it_be(:users_statistics) { create(:users_statistics) }

    it 'shows correct amounts of users', :aggregate_failures do
      visit admin_dashboard_stats_path

      expect(page).to have_content('Users without a Group and Project 23')
      expect(page).to have_content('Users with highest role Guest 5')
      expect(page).to have_content('Users with highest role Reporter 9')
      expect(page).to have_content('Users with highest role Developer 21')
      expect(page).to have_content('Users with highest role Maintainer 6')
      expect(page).to have_content('Users with highest role Owner 5')
      expect(page).to have_content('Bots 2')

      if Gitlab.ee?
        expect(page).to have_content('Billable users 69')
      else
        expect(page).not_to have_content('Billable users 69')
      end

      expect(page).to have_content('Blocked users 7')
      expect(page).to have_content('Total users 78')
      expect(page).to have_content('Active users 71')
    end
  end

  describe 'Version check', :js, feature_category: :deployment_management do
    it 'shows badge on CE' do
      visit admin_root_path

      page.within('.admin-dashboard') do
        expect(find('.badge')).to have_content('Up to date')
      end
    end
  end
end