2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'admin visits dashboard' do
|
2018-12-13 13:39:08 +05:30
|
|
|
include ProjectForksHelper
|
|
|
|
|
|
|
|
before do
|
2021-02-22 17:27:13 +05:30
|
|
|
admin = create(:admin)
|
|
|
|
sign_in(admin)
|
|
|
|
gitlab_enable_admin_mode_sign_in(admin)
|
2018-12-13 13:39:08 +05:30
|
|
|
end
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
context 'counting forks', :js, feature_category: :source_code_management do
|
2018-12-13 13:39:08 +05:30
|
|
|
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
|
2021-10-27 15:23:28 +05:30
|
|
|
ForkNetwork.connection.execute('ANALYZE fork_networks')
|
|
|
|
ForkNetwork.connection.execute('ANALYZE fork_network_members')
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
visit admin_root_path
|
|
|
|
|
|
|
|
expect(page).to have_content('Forks 2')
|
|
|
|
end
|
|
|
|
end
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
describe 'Users statistic', feature_category: :user_management do
|
2020-04-22 19:07:51 +05:30
|
|
|
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')
|
2021-04-17 20:07:23 +05:30
|
|
|
|
|
|
|
if Gitlab.ee?
|
|
|
|
expect(page).to have_content('Billable users 69')
|
|
|
|
else
|
|
|
|
expect(page).not_to have_content('Billable users 69')
|
|
|
|
end
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
expect(page).to have_content('Blocked users 7')
|
|
|
|
expect(page).to have_content('Total users 78')
|
2021-04-17 20:07:23 +05:30
|
|
|
expect(page).to have_content('Active users 71')
|
2020-04-22 19:07:51 +05:30
|
|
|
end
|
|
|
|
end
|
2022-03-02 08:16:31 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
describe 'Version check', :js, feature_category: :deployment_management do
|
2022-03-02 08:16:31 +05:30
|
|
|
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
|
2018-12-13 13:39:08 +05:30
|
|
|
end
|