2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-08-31 13:16:34 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-04-08 05:09:43 -04:00
|
|
|
describe 'admin visits dashboard' do
|
2018-08-31 13:16:34 -04:00
|
|
|
include ProjectForksHelper
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(create(:admin))
|
|
|
|
end
|
|
|
|
|
2020-04-08 05:09:43 -04:00
|
|
|
context 'counting forks', :js do
|
2018-08-31 13:16:34 -04:00
|
|
|
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
|
2019-07-24 09:59:55 -04:00
|
|
|
ActiveRecord::Base.connection.execute('ANALYZE fork_networks')
|
|
|
|
ActiveRecord::Base.connection.execute('ANALYZE fork_network_members')
|
2018-08-31 13:16:34 -04:00
|
|
|
|
|
|
|
visit admin_root_path
|
|
|
|
|
|
|
|
expect(page).to have_content('Forks 2')
|
|
|
|
end
|
|
|
|
end
|
2020-04-08 05:09:43 -04:00
|
|
|
|
|
|
|
describe 'Users statistic' do
|
|
|
|
let_it_be(:users_statistics) { create(:users_statistics) }
|
|
|
|
|
|
|
|
it 'shows correct amounts of users', :aggregate_failures do
|
|
|
|
expected_active_users_text = Gitlab.ee? ? 'Active users (Billable users) 71' : 'Active users 71'
|
|
|
|
|
|
|
|
sign_in(create(:admin))
|
|
|
|
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')
|
|
|
|
expect(page).to have_content(expected_active_users_text)
|
|
|
|
expect(page).to have_content('Blocked users 7')
|
|
|
|
expect(page).to have_content('Total users 78')
|
|
|
|
end
|
|
|
|
end
|
2018-08-31 13:16:34 -04:00
|
|
|
end
|