diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/features/projects/settings | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/features/projects/settings')
11 files changed, 75 insertions, 28 deletions
diff --git a/spec/features/projects/settings/access_tokens_spec.rb b/spec/features/projects/settings/access_tokens_spec.rb index 12e14f5193f..a38c10c6bab 100644 --- a/spec/features/projects/settings/access_tokens_spec.rb +++ b/spec/features/projects/settings/access_tokens_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Project > Settings > Access Tokens', :js, feature_category: :credential_management do +RSpec.describe 'Project > Settings > Access Tokens', :js, feature_category: :user_management do include Spec::Support::Helpers::ModalHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/settings/branch_rules_settings_spec.rb b/spec/features/projects/settings/branch_rules_settings_spec.rb index 71d9c559b77..59609fecd93 100644 --- a/spec/features/projects/settings/branch_rules_settings_spec.rb +++ b/spec/features/projects/settings/branch_rules_settings_spec.rb @@ -28,6 +28,17 @@ RSpec.describe 'Projects > Settings > Repository > Branch rules settings', featu let(:role) { :maintainer } context 'Branch rules', :js do + it 'renders breadcrumbs' do + request + + page.within '.breadcrumbs' do + expect(page).to have_link('Repository Settings', href: project_settings_repository_path(project)) + expect(page).to have_link('Branch rules', + href: project_settings_repository_path(project, anchor: 'branch-rules')) + expect(page).to have_link('Details', href: '#') + end + end + it 'renders branch rules page' do request diff --git a/spec/features/projects/settings/forked_project_settings_spec.rb b/spec/features/projects/settings/forked_project_settings_spec.rb index 28d5c080db9..6b646bcf7d3 100644 --- a/spec/features/projects/settings/forked_project_settings_spec.rb +++ b/spec/features/projects/settings/forked_project_settings_spec.rb @@ -22,7 +22,7 @@ RSpec.describe 'Projects > Settings > For a forked project', :js, feature_catego wait_for_requests - fill_in('confirm_name_input', with: forked_project.name) + fill_in('confirm_name_input', with: forked_project.path) click_button('Confirm') wait_for_requests diff --git a/spec/features/projects/settings/monitor_settings_spec.rb b/spec/features/projects/settings/monitor_settings_spec.rb index 4b553b57331..1367ffb0009 100644 --- a/spec/features/projects/settings/monitor_settings_spec.rb +++ b/spec/features/projects/settings/monitor_settings_spec.rb @@ -3,12 +3,15 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > For a forked project', :js, feature_category: :projects do + include ListboxHelpers + let_it_be(:project) { create(:project, :repository, create_templates: :issue) } let(:user) { project.first_owner } before do sign_in(user) + stub_feature_flags(remove_monitor_metrics: false) end describe 'Sidebar > Monitor' do @@ -47,7 +50,7 @@ RSpec.describe 'Projects > Settings > For a forked project', :js, feature_catego check(create_issue) uncheck(send_email) click_on('No template selected') - click_on('bug') + select_listbox_item('bug') save_form click_settings_tab diff --git a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb index d4c1fe4d43e..bdfe6a06dd1 100644 --- a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb +++ b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb @@ -32,10 +32,19 @@ feature_category: :projects do it 'shows available section' do subject - expect(find('.breadcrumbs')).to have_content('Clean up image tags') + expect(find('.breadcrumbs')).to have_content('Cleanup policies') section = find('[data-testid="container-expiration-policy-project-settings"]') - expect(section).to have_text 'Clean up image tags' + expect(section).to have_text 'Cleanup policies' + end + + it 'passes axe automated accessibility testing' do + subject + + wait_for_requests + + expect(page).to be_axe_clean.within('[data-testid="container-expiration-policy-project-settings"]') + .skipping :'link-in-text-block' end it 'saves cleanup policy submit the form' do diff --git a/spec/features/projects/settings/registry_settings_spec.rb b/spec/features/projects/settings/registry_settings_spec.rb index 072b5f7f3b0..68e9b0225ea 100644 --- a/spec/features/projects/settings/registry_settings_spec.rb +++ b/spec/features/projects/settings/registry_settings_spec.rb @@ -21,6 +21,15 @@ feature_category: :projects do end context 'as owner', :js do + it 'passes axe automated accessibility testing' do + subject + + wait_for_requests + + expect(page).to be_axe_clean.within('[data-testid="packages-and-registries-project-settings"]') + .skipping :'link-in-text-block' + end + it 'shows active tab on sidebar' do subject @@ -33,10 +42,10 @@ feature_category: :projects do subject settings_block = find('[data-testid="container-expiration-policy-project-settings"]') - expect(settings_block).to have_text 'Clean up image tags' + expect(settings_block).to have_text 'Cleanup policies' end - it 'contains link to clean up image tags page' do + it 'contains link to cleanup policies page' do subject expect(page).to have_link('Edit cleanup rules', href: cleanup_image_tags_project_settings_packages_and_registries_path(project)) diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index a0625c93b1a..08abade7d18 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > Repository settings', feature_category: :projects do + include Features::MirroringHelpers + let(:project) { create(:project_empty_repo) } let(:user) { create(:user) } let(:role) { :developer } @@ -61,6 +63,10 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :p let(:new_ssh_key) { attributes_for(:key)[:key] } + around do |example| + travel_to Time.zone.local(2022, 3, 1, 1, 0, 0) { example.run } + end + it 'get list of keys' do project.deploy_keys << private_deploy_key project.deploy_keys << public_deploy_key @@ -83,6 +89,21 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :p expect(page).to have_content('Grant write permissions to this key') end + it 'add a new deploy key with expiration' do + one_month = Time.zone.local(2022, 4, 1, 1, 0, 0) + visit project_settings_repository_path(project) + + fill_in 'deploy_key_title', with: 'new_deploy_key_with_expiry' + fill_in 'deploy_key_key', with: new_ssh_key + fill_in 'deploy_key_expires_at', with: one_month.to_s + check 'deploy_key_deploy_keys_projects_attributes_0_can_push' + click_button 'Add key' + + expect(page).to have_content('new_deploy_key_with_expiry') + expect(page).to have_content('in 1 month') + expect(page).to have_content('Grant write permissions to this key') + end + it 'edit an existing deploy key' do project.deploy_keys << private_deploy_key visit project_settings_repository_path(project) @@ -152,10 +173,8 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :p end it 'creates a push mirror that mirrors all branches', :js do - expect(page).to have_css('.js-mirror-protected-hidden[value="0"]', visible: false) - - fill_in 'url', with: ssh_url - expect(page).to have_css(".js-mirror-url-hidden[value=\"#{ssh_url}\"]", visible: false) + wait_for_mirror_field_javascript('protected', '0') + fill_and_wait_for_mirror_url_javascript('url', ssh_url) select 'SSH public key', from: 'Authentication method' select_direction @@ -172,10 +191,8 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :p it 'creates a push mirror that only mirrors protected branches', :js do find('#only_protected_branches').click - expect(page).to have_css('.js-mirror-protected-hidden[value="1"]', visible: false) - - fill_in 'url', with: ssh_url - expect(page).to have_css(".js-mirror-url-hidden[value=\"#{ssh_url}\"]", visible: false) + wait_for_mirror_field_javascript('protected', '1') + fill_and_wait_for_mirror_url_javascript('url', ssh_url) select 'SSH public key', from: 'Authentication method' select_direction @@ -192,8 +209,7 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :p it 'creates a push mirror that keeps divergent refs', :js do select_direction - fill_in 'url', with: ssh_url - expect(page).to have_css(".js-mirror-url-hidden[value=\"#{ssh_url}\"]", visible: false) + fill_and_wait_for_mirror_url_javascript('url', ssh_url) fill_in 'Password', with: 'password' check 'Keep divergent refs' @@ -212,8 +228,7 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :p end it 'generates an SSH public key on submission', :js do - fill_in 'url', with: ssh_url - expect(page).to have_css(".js-mirror-url-hidden[value=\"#{ssh_url}\"]", visible: false) + fill_and_wait_for_mirror_url_javascript('url', ssh_url) select 'SSH public key', from: 'Authentication method' diff --git a/spec/features/projects/settings/service_desk_setting_spec.rb b/spec/features/projects/settings/service_desk_setting_spec.rb index 859c738731b..74139aa0d7f 100644 --- a/spec/features/projects/settings/service_desk_setting_spec.rb +++ b/spec/features/projects/settings/service_desk_setting_spec.rb @@ -12,8 +12,8 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache, feature_c sign_in(user) allow_any_instance_of(Project).to receive(:present).with(current_user: user).and_return(presenter) - allow(::Gitlab::IncomingEmail).to receive(:enabled?) { true } - allow(::Gitlab::IncomingEmail).to receive(:supports_wildcard?) { true } + allow(::Gitlab::Email::IncomingEmail).to receive(:enabled?) { true } + allow(::Gitlab::Email::IncomingEmail).to receive(:supports_wildcard?) { true } end it 'shows activation checkbox' do @@ -24,7 +24,7 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache, feature_c context 'when service_desk_email is disabled' do before do - allow(::Gitlab::ServiceDeskEmail).to receive(:enabled?).and_return(false) + allow(::Gitlab::Email::ServiceDeskEmail).to receive(:enabled?).and_return(false) visit edit_project_path(project) end @@ -43,8 +43,8 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache, feature_c context 'when service_desk_email is enabled' do before do - allow(::Gitlab::ServiceDeskEmail).to receive(:enabled?) { true } - allow(::Gitlab::ServiceDeskEmail).to receive(:address_for_key) { 'address-suffix@example.com' } + allow(::Gitlab::Email::ServiceDeskEmail).to receive(:enabled?) { true } + allow(::Gitlab::Email::ServiceDeskEmail).to receive(:address_for_key) { 'address-suffix@example.com' } visit edit_project_path(project) end diff --git a/spec/features/projects/settings/user_manages_project_members_spec.rb b/spec/features/projects/settings/user_manages_project_members_spec.rb index 159a83a261d..b7463537fb2 100644 --- a/spec/features/projects/settings/user_manages_project_members_spec.rb +++ b/spec/features/projects/settings/user_manages_project_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > User manages project members', feature_category: :projects do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers include Spec::Support::Helpers::ModalHelpers include ListboxHelpers diff --git a/spec/features/projects/settings/user_renames_a_project_spec.rb b/spec/features/projects/settings/user_renames_a_project_spec.rb index 2da6e760fbf..a6b72e7a297 100644 --- a/spec/features/projects/settings/user_renames_a_project_spec.rb +++ b/spec/features/projects/settings/user_renames_a_project_spec.rb @@ -37,7 +37,7 @@ RSpec.describe 'Projects > Settings > User renames a project', feature_category: it 'shows errors for invalid project path' do change_path(project, 'foo&bar') - expect(page).to have_field 'Path', with: 'gitlab' + expect(page).to have_field 'Path', with: project.path expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'" end end @@ -67,7 +67,7 @@ RSpec.describe 'Projects > Settings > User renames a project', feature_category: end context 'when changing project path' do - let(:project) { create(:project, :repository, namespace: user.namespace, name: 'gitlabhq') } + let(:project) { create(:project, :repository, namespace: user.namespace, path: 'gitlabhq') } before(:context) do TestEnv.clean_test_path diff --git a/spec/features/projects/settings/webhooks_settings_spec.rb b/spec/features/projects/settings/webhooks_settings_spec.rb index 3b8b982b621..e527d0c9c74 100644 --- a/spec/features/projects/settings/webhooks_settings_spec.rb +++ b/spec/features/projects/settings/webhooks_settings_spec.rb @@ -83,7 +83,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings', feature_category: :proj visit webhooks_path click_button 'Test' - click_button 'Push events' + click_link 'Push events' expect(page).to have_current_path(webhooks_path, ignore_query: true) end |