diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/features/admin/admin_users_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/features/admin/admin_users_spec.rb')
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb new file mode 100644 index 00000000000..4fc60d17886 --- /dev/null +++ b/spec/features/admin/admin_users_spec.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe "Admin::Users" do + let(:current_user) { create(:admin) } + + before do + sign_in(current_user) + gitlab_enable_admin_mode_sign_in(current_user) + end + + describe 'Tabs', :js do + let(:tabs_selector) { '.js-users-tabs' } + let(:active_tab_selector) { '.nav-link.active' } + + it 'does not add the tab param when the Users tab is selected' do + visit admin_users_path + + within tabs_selector do + click_link 'Users' + end + + expect(page).to have_current_path(admin_users_path) + end + + it 'adds the ?tab=cohorts param when the Cohorts tab is selected' do + visit admin_users_path + + within tabs_selector do + click_link 'Cohorts' + end + + expect(page).to have_current_path(admin_users_path(tab: 'cohorts')) + end + + it 'shows the cohorts tab when the tab param is set' do + visit admin_users_path(tab: 'cohorts') + + within tabs_selector do + expect(page).to have_selector active_tab_selector, text: 'Cohorts' + end + end + end + + describe 'Cohorts tab content' do + context 'with usage ping enabled' do + it 'shows users count per month' do + stub_application_setting(usage_ping_enabled: true) + + create_list(:user, 2) + + visit admin_users_path(tab: 'cohorts') + + expect(page).to have_content("#{Time.now.strftime('%b %Y')} 3 0") + end + end + + context 'with usage ping disabled' do + it 'shows empty state', :js do + stub_application_setting(usage_ping_enabled: false) + + visit admin_users_path(tab: 'cohorts') + + expect(page).to have_selector(".js-empty-state") + expect(page).to have_content("Activate user activity analysis") + end + end + end +end |