Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 02:50:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 02:50:22 +0300
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/features/projects/settings
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/features/projects/settings')
-rw-r--r--spec/features/projects/settings/access_tokens_spec.rb106
-rw-r--r--spec/features/projects/settings/forked_project_settings_spec.rb5
-rw-r--r--spec/features/projects/settings/operations_settings_spec.rb2
-rw-r--r--spec/features/projects/settings/registry_settings_spec.rb4
-rw-r--r--spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb34
-rw-r--r--spec/features/projects/settings/user_searches_in_settings_spec.rb44
-rw-r--r--spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb8
7 files changed, 185 insertions, 18 deletions
diff --git a/spec/features/projects/settings/access_tokens_spec.rb b/spec/features/projects/settings/access_tokens_spec.rb
index 45fe19deb8e..8083c851bb7 100644
--- a/spec/features/projects/settings/access_tokens_spec.rb
+++ b/spec/features/projects/settings/access_tokens_spec.rb
@@ -5,7 +5,8 @@ require 'spec_helper'
RSpec.describe 'Project > Settings > Access Tokens', :js do
let_it_be(:user) { create(:user) }
let_it_be(:bot_user) { create(:user, :project_bot) }
- let_it_be(:project) { create(:project) }
+ let_it_be(:group) { create(:group) }
+ let_it_be(:project) { create(:project, group: group) }
before_all do
project.add_maintainer(user)
@@ -33,6 +34,18 @@ RSpec.describe 'Project > Settings > Access Tokens', :js do
find('#created-personal-access-token').value
end
+ context 'when user is not a project maintainer' do
+ before do
+ project.add_developer(user)
+ end
+
+ it 'does not show project access token page' do
+ visit project_settings_access_tokens_path(project)
+
+ expect(page).to have_content("Page Not Found")
+ end
+ end
+
describe 'token creation' do
it 'allows creation of a project access token' do
name = 'My project access token'
@@ -57,6 +70,81 @@ RSpec.describe 'Project > Settings > Access Tokens', :js do
expect(active_project_access_tokens).to have_text('read_api')
expect(created_project_access_token).not_to be_empty
end
+
+ context 'when token creation is not allowed' do
+ before do
+ group.namespace_settings.update_column(:resource_access_token_creation_allowed, false)
+ end
+
+ it 'does not show project access token creation form' do
+ visit project_settings_access_tokens_path(project)
+
+ expect(page).not_to have_selector('#new_project_access_token')
+ end
+
+ it 'shows project access token creation disabled text' do
+ visit project_settings_access_tokens_path(project)
+
+ expect(page).to have_text('Project access token creation is disabled in this group. You can still use and manage existing tokens.')
+ end
+
+ context 'with a project in a personal namespace' do
+ let(:personal_project) { create(:project) }
+
+ before do
+ personal_project.add_maintainer(user)
+ end
+
+ it 'shows project access token creation form and text' do
+ visit project_settings_access_tokens_path(personal_project)
+
+ expect(page).to have_selector('#new_project_access_token')
+ expect(page).to have_text('You can generate an access token scoped to this project for each application to use the GitLab API.')
+ end
+ end
+
+ context 'group settings link' do
+ context 'when user is not a group owner' do
+ before do
+ group.add_developer(user)
+ end
+
+ it 'does not show group settings link' do
+ visit project_settings_access_tokens_path(project)
+
+ expect(page).not_to have_link('group settings', href: edit_group_path(group))
+ end
+ end
+
+ context 'with nested groups' do
+ let(:subgroup) { create(:group, parent: group) }
+
+ context 'when user is not a top level group owner' do
+ before do
+ subgroup.add_owner(user)
+ end
+
+ it 'does not show group settings link' do
+ visit project_settings_access_tokens_path(project)
+
+ expect(page).not_to have_link('group settings', href: edit_group_path(group))
+ end
+ end
+ end
+
+ context 'when user is a group owner' do
+ before do
+ group.add_owner(user)
+ end
+
+ it 'shows group settings link' do
+ visit project_settings_access_tokens_path(project)
+
+ expect(page).to have_link('group settings', href: edit_group_path(group))
+ end
+ end
+ end
+ end
end
describe 'active tokens' do
@@ -83,11 +171,25 @@ RSpec.describe 'Project > Settings > Access Tokens', :js do
end
it 'removes expired tokens from active section' do
- project_access_token.update(expires_at: 5.days.ago)
+ project_access_token.update!(expires_at: 5.days.ago)
visit project_settings_access_tokens_path(project)
expect(page).to have_selector('.settings-message')
expect(no_project_access_tokens_message).to have_text(no_active_tokens_text)
end
+
+ context 'when resource access token creation is not allowed' do
+ before do
+ group.namespace_settings.update_column(:resource_access_token_creation_allowed, false)
+ end
+
+ it 'allows revocation of an active token' do
+ visit project_settings_access_tokens_path(project)
+ accept_confirm { click_on 'Revoke' }
+
+ expect(page).to have_selector('.settings-message')
+ expect(no_project_access_tokens_message).to have_text(no_active_tokens_text)
+ end
+ end
end
end
diff --git a/spec/features/projects/settings/forked_project_settings_spec.rb b/spec/features/projects/settings/forked_project_settings_spec.rb
index f6c25d483ad..a84516e19f9 100644
--- a/spec/features/projects/settings/forked_project_settings_spec.rb
+++ b/spec/features/projects/settings/forked_project_settings_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do
end
shared_examples 'project settings for a forked projects' do
- it 'allows deleting the link to the forked project' do
+ it 'allows deleting the link to the forked project', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/327817' do
visit edit_project_path(forked_project)
click_button 'Remove fork relationship'
@@ -25,7 +25,8 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do
fill_in('confirm_name_input', with: forked_project.name)
click_button('Confirm')
- expect(page).to have_content('The fork relationship has been removed.')
+ wait_for_requests
+
expect(forked_project.reload.forked?).to be_falsy
end
end
diff --git a/spec/features/projects/settings/operations_settings_spec.rb b/spec/features/projects/settings/operations_settings_spec.rb
index fe0ee52e4fa..ca976997142 100644
--- a/spec/features/projects/settings/operations_settings_spec.rb
+++ b/spec/features/projects/settings/operations_settings_spec.rb
@@ -146,7 +146,7 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do
click_button('Connect')
- assert_text('Connection has failed. Re-check Auth Token and try again.')
+ assert_text('Connection failed. Check Auth Token and try again.')
end
end
end
diff --git a/spec/features/projects/settings/registry_settings_spec.rb b/spec/features/projects/settings/registry_settings_spec.rb
index 6e4082d1391..bc60cdd2f8e 100644
--- a/spec/features/projects/settings/registry_settings_spec.rb
+++ b/spec/features/projects/settings/registry_settings_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
select('7 days', from: 'Remove tags older than:')
fill_in('Remove tags matching:', with: '.*-production')
- submit_button = find('.btn.gl-button.btn-success')
+ submit_button = find('[data-testid="save-button"')
expect(submit_button).not_to be_disabled
submit_button.click
end
@@ -53,7 +53,7 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
within '#js-registry-policies' do
fill_in('Remove tags matching:', with: '*-production')
- submit_button = find('.btn.gl-button.btn-success')
+ submit_button = find('[data-testid="save-button"')
expect(submit_button).not_to be_disabled
submit_button.click
end
diff --git a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
index 397c334a2b8..ebda5c9ff59 100644
--- a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
+++ b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
@@ -2,6 +2,8 @@
require 'spec_helper'
RSpec.describe 'Projects > Settings > User manages merge request settings' do
+ include ProjectForksHelper
+
let(:user) { create(:user) }
let(:project) { create(:project, :public, namespace: user.namespace, path: 'gitlab', name: 'sample') }
@@ -198,4 +200,36 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
expect(project.reload.project_setting.squash_option).to eq('never')
end
end
+
+ describe 'target project settings' do
+ context 'when project is a fork' do
+ let_it_be(:upstream) { create(:project, :public) }
+
+ let(:project) { fork_project(upstream, user) }
+
+ it 'allows to change merge request target project behavior' do
+ expect(page).to have_content 'The default target project for merge requests'
+
+ radio = find_field('project_project_setting_attributes_mr_default_target_self_false')
+ expect(radio).to be_checked
+
+ choose('project_project_setting_attributes_mr_default_target_self_true')
+
+ within('.merge-request-settings-form') do
+ find('.rspec-save-merge-request-changes')
+ click_on('Save changes')
+ end
+
+ find('.flash-notice')
+ radio = find_field('project_project_setting_attributes_mr_default_target_self_true')
+
+ expect(radio).to be_checked
+ expect(project.reload.project_setting.mr_default_target_self).to be_truthy
+ end
+ end
+
+ it 'does not show target project section' do
+ expect(page).not_to have_content 'The default target project for merge requests'
+ end
+ end
end
diff --git a/spec/features/projects/settings/user_searches_in_settings_spec.rb b/spec/features/projects/settings/user_searches_in_settings_spec.rb
index 4c5b39d5282..9b09958bae5 100644
--- a/spec/features/projects/settings/user_searches_in_settings_spec.rb
+++ b/spec/features/projects/settings/user_searches_in_settings_spec.rb
@@ -4,16 +4,42 @@ require 'spec_helper'
RSpec.describe 'User searches project settings', :js do
let_it_be(:user) { create(:user) }
- let_it_be(:project) { create(:project, :repository, namespace: user.namespace) }
+ let_it_be(:project) { create(:project, :repository, namespace: user.namespace, pages_https_only: false) }
before do
sign_in(user)
end
context 'in general settings page' do
- let(:visit_path) { edit_project_path(project) }
+ before do
+ visit edit_project_path(project)
+ end
+
+ it_behaves_like 'can search settings', 'Naming', 'Visibility'
+ end
+
+ context 'in Integrations page' do
+ before do
+ visit project_settings_integrations_path(project)
+ end
+
+ it_behaves_like 'can highlight results', 'third-party applications'
+ end
+
+ context 'in Webhooks page' do
+ before do
+ visit project_hooks_path(project)
+ end
- it_behaves_like 'can search settings with feature flag check', 'Naming', 'Visibility'
+ it_behaves_like 'can highlight results', 'Secret token'
+ end
+
+ context 'in Access Tokens page' do
+ before do
+ visit project_settings_access_tokens_path(project)
+ end
+
+ it_behaves_like 'can highlight results', 'Expires at'
end
context 'in Repository page' do
@@ -37,6 +63,16 @@ RSpec.describe 'User searches project settings', :js do
visit project_settings_operations_path(project)
end
- it_behaves_like 'can search settings', 'Alerts', 'Error tracking'
+ it_behaves_like 'can search settings', 'Alert integrations', 'Error tracking'
+ end
+
+ context 'in Pages page' do
+ before do
+ allow(Gitlab.config.pages).to receive(:enabled).and_return(true)
+
+ visit project_pages_path(project)
+ end
+
+ it_behaves_like 'can highlight results', 'static website'
end
end
diff --git a/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb b/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb
index d0f297d2067..eed3494ef5b 100644
--- a/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb
+++ b/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb
@@ -13,16 +13,10 @@ RSpec.describe 'Repository Settings > User sees revoke deploy token modal', :js
sign_in(user)
stub_feature_flags(ajax_new_deploy_token: project)
visit(project_settings_repository_path(project))
- click_link('Revoke')
+ click_button('Revoke')
end
it 'shows the revoke deploy token modal' do
expect(page).to have_content('You are about to revoke')
end
-
- it 'closes the revoke deploy token modal with escape keypress' do
- find('.modal.show').send_keys(:escape)
-
- expect(page).not_to have_content('You are about to revoke')
- end
end