diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-02 03:12:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-02 03:12:29 +0300 |
commit | 88ce9b624561a2a5836c623bdd07a81ffc611da7 (patch) | |
tree | 01288a1f7b54888b677548173697e8c20a344cb0 /spec/features | |
parent | d170c7eeef81debb74afa518c256358ccb7e231c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 21 | ||||
-rw-r--r-- | spec/features/projects/show/clone_button_spec.rb | 43 |
2 files changed, 58 insertions, 6 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index d8929e1edfb..6642bd7ac61 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -155,18 +155,27 @@ RSpec.describe 'Admin updates settings', feature_category: :not_owned do context 'when Gitlab.com' do let(:dot_com?) { true } - it 'does not expose the setting' do - expect(page).to have_no_selector('#application_setting_deactivate_dormant_users') - end - - it 'does not expose the setting' do - expect(page).to have_no_selector('#application_setting_deactivate_dormant_users_period') + it 'does not expose the setting section' do + # NOTE: not_to have_content may have false positives for content + # that might not load instantly, so before checking that + # `Dormant users` subsection has _not_ loaded, we check that the + # `Account and limit` section _was_ loaded + expect(page).to have_content('Account and limit') + expect(page).not_to have_content('Dormant users') + expect(page).not_to have_field('Deactivate dormant users after a period of inactivity') + expect(page).not_to have_field('Days of inactivity before deactivation') end end context 'when not Gitlab.com' do let(:dot_com?) { false } + it 'exposes the setting section' do + expect(page).to have_content('Dormant users') + expect(page).to have_field('Deactivate dormant users after a period of inactivity') + expect(page).to have_field('Days of inactivity before deactivation') + end + it 'changes dormant users' do expect(page).to have_unchecked_field('Deactivate dormant users after a period of inactivity') expect(current_settings.deactivate_dormant_users).to be_falsey diff --git a/spec/features/projects/show/clone_button_spec.rb b/spec/features/projects/show/clone_button_spec.rb new file mode 100644 index 00000000000..48af4bf8277 --- /dev/null +++ b/spec/features/projects/show/clone_button_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Projects > Show > Clone button', feature_category: :projects do + let_it_be(:admin) { create(:admin) } + let_it_be(:guest) { create(:user) } + let_it_be(:project) { create(:project, :private, :in_group, :repository) } + + describe 'when checking project main page user' do + context 'with an admin role' do + before do + project.add_owner(admin) + sign_in(admin) + visit project_path(project) + end + + it 'is able to access project page' do + expect(page).to have_content project.name + end + + it 'sees clone button' do + expect(page).to have_content _('Clone') + end + end + + context 'with a guest role and no download_code access' do + before do + project.add_guest(guest) + sign_in(guest) + visit project_path(project) + end + + it 'is able to access project page' do + expect(page).to have_content project.name + end + + it 'does not see clone button' do + expect(page).not_to have_content _('Clone') + end + end + end +end |