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>2022-02-18 12:45:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 12:45:46 +0300
commita7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch)
tree7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/features/admin
parentee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff)
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/features/admin')
-rw-r--r--spec/features/admin/admin_groups_spec.rb17
-rw-r--r--spec/features/admin/admin_mode/logout_spec.rb2
-rw-r--r--spec/features/admin/admin_runners_spec.rb52
-rw-r--r--spec/features/admin/admin_sees_background_migrations_spec.rb6
-rw-r--r--spec/features/admin/admin_settings_spec.rb56
-rw-r--r--spec/features/admin/integrations/instance_integrations_spec.rb15
-rw-r--r--spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb15
-rw-r--r--spec/features/admin/users/users_spec.rb17
8 files changed, 150 insertions, 30 deletions
diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb
index 8d4e7a7442c..a0a41061d64 100644
--- a/spec/features/admin/admin_groups_spec.rb
+++ b/spec/features/admin/admin_groups_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe 'Admin Groups' do
include Select2Helper
include Spec::Support::Helpers::Features::MembersHelpers
include Spec::Support::Helpers::Features::InviteMembersModalHelper
+ include Spec::Support::Helpers::ModalHelpers
let(:internal) { Gitlab::VisibilityLevel::INTERNAL }
@@ -250,26 +251,26 @@ RSpec.describe 'Admin Groups' do
end
end
- describe 'admin remove themself from a group', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/222342' do
+ describe 'admin removes themself from a group', :js do
it 'removes admin from the group' do
- stub_feature_flags(bootstrap_confirmation_modals: false)
group.add_user(current_user, Gitlab::Access::DEVELOPER)
visit group_group_members_path(group)
- page.within '[data-qa-selector="members_list"]' do # rubocop:disable QA/SelectorUsage
+ page.within members_table do
expect(page).to have_content(current_user.name)
expect(page).to have_content('Developer')
end
- accept_confirm { find(:css, 'li', text: current_user.name).find(:css, 'a.btn-danger').click }
+ find_member_row(current_user).click_button(title: 'Leave')
+
+ accept_gl_confirm(button_text: 'Leave')
+
+ wait_for_all_requests
visit group_group_members_path(group)
- page.within '[data-qa-selector="members_list"]' do # rubocop:disable QA/SelectorUsage
- expect(page).not_to have_content(current_user.name)
- expect(page).not_to have_content('Developer')
- end
+ expect(members_table).not_to have_content(current_user.name)
end
end
diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb
index 58bea5c4b5f..f2f6e26fbee 100644
--- a/spec/features/admin/admin_mode/logout_spec.rb
+++ b/spec/features/admin/admin_mode/logout_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe 'Admin Mode Logout', :js do
it 'disable shows flash notice' do
gitlab_disable_admin_mode
- expect(page).to have_selector('.flash-notice')
+ expect(page).to have_selector('[data-testid="alert-info"]')
end
context 'on a read-only instance' do
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb
index ceb91b86876..25ff4022454 100644
--- a/spec/features/admin/admin_runners_spec.rb
+++ b/spec/features/admin/admin_runners_spec.rb
@@ -254,6 +254,18 @@ RSpec.describe "Admin Runners" do
expect(page).not_to have_content 'runner-group'
end
+ it 'show the same counts after selecting another tab' do
+ visit admin_runners_path
+
+ page.within('[data-testid="runner-type-tabs"]') do
+ click_on('Project')
+
+ expect(page).to have_link('All 2')
+ expect(page).to have_link('Group 1')
+ expect(page).to have_link('Project 1')
+ end
+ end
+
it 'shows no runner when type does not match' do
visit admin_runners_path
@@ -460,7 +472,7 @@ RSpec.describe "Admin Runners" do
click_on 'Reset registration token'
within_modal do
- click_button('OK', match: :first)
+ click_button('Reset token', match: :first)
end
wait_for_requests
@@ -476,6 +488,42 @@ RSpec.describe "Admin Runners" do
end
end
+ describe "Runner show page", :js do
+ let(:runner) do
+ create(
+ :ci_runner,
+ description: 'runner-foo',
+ version: '14.0',
+ ip_address: '127.0.0.1',
+ tag_list: ['tag1']
+ )
+ end
+
+ before do
+ visit admin_runner_path(runner)
+ end
+
+ describe 'runner show page breadcrumbs' do
+ it 'contains the current runner id and token' do
+ page.within '[data-testid="breadcrumb-links"]' do
+ expect(page.find('h2')).to have_link("##{runner.id} (#{runner.short_sha})")
+ end
+ end
+ end
+
+ it 'shows runner details' do
+ aggregate_failures do
+ expect(page).to have_content 'Description runner-foo'
+ expect(page).to have_content 'Last contact Never contacted'
+ expect(page).to have_content 'Version 14.0'
+ expect(page).to have_content 'IP Address 127.0.0.1'
+ expect(page).to have_content 'Configuration Runs untagged jobs'
+ expect(page).to have_content 'Maximum job timeout None'
+ expect(page).to have_content 'Tags tag1'
+ end
+ end
+ end
+
describe "Runner edit page" do
let(:runner) { create(:ci_runner) }
@@ -487,7 +535,7 @@ RSpec.describe "Admin Runners" do
wait_for_requests
end
- describe 'runner page breadcrumbs' do
+ describe 'runner edit page breadcrumbs' do
it 'contains the current runner id and token' do
page.within '[data-testid="breadcrumb-links"]' do
expect(page).to have_link("##{runner.id} (#{runner.short_sha})")
diff --git a/spec/features/admin/admin_sees_background_migrations_spec.rb b/spec/features/admin/admin_sees_background_migrations_spec.rb
index 94fb3a0314f..a3d0c7bdd4d 100644
--- a/spec/features/admin/admin_sees_background_migrations_spec.rb
+++ b/spec/features/admin/admin_sees_background_migrations_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe "Admin > Admin sees background migrations" do
let_it_be(:finished_migration) { create(:batched_background_migration, table_name: 'finished', status: :finished) }
before_all do
- create(:batched_background_migration_job, batched_migration: failed_migration, batch_size: 10, min_value: 6, max_value: 15, status: :failed, attempts: 3)
+ create(:batched_background_migration_job, :failed, batched_migration: failed_migration, batch_size: 10, min_value: 6, max_value: 15, attempts: 3)
end
before do
@@ -68,7 +68,7 @@ RSpec.describe "Admin > Admin sees background migrations" do
tab.click
expect(page).to have_current_path(admin_background_migrations_path(tab: 'failed'))
- expect(tab[:class]).to include('gl-tab-nav-item-active', 'gl-tab-nav-item-active-indigo')
+ expect(tab[:class]).to include('gl-tab-nav-item-active')
expect(page).to have_selector('tbody tr', count: 1)
@@ -93,7 +93,7 @@ RSpec.describe "Admin > Admin sees background migrations" do
tab.click
expect(page).to have_current_path(admin_background_migrations_path(tab: 'finished'))
- expect(tab[:class]).to include('gl-tab-nav-item-active', 'gl-tab-nav-item-active-indigo')
+ expect(tab[:class]).to include('gl-tab-nav-item-active')
expect(page).to have_selector('tbody tr', count: 1)
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index e136ab41966..ca452264c02 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -85,6 +85,8 @@ RSpec.describe 'Admin updates settings' do
select 'Are allowed', from: 'DSA SSH keys'
select 'Must be at least 384 bits', from: 'ECDSA SSH keys'
select 'Are forbidden', from: 'ED25519 SSH keys'
+ select 'Are forbidden', from: 'ECDSA_SK SSH keys'
+ select 'Are forbidden', from: 'ED25519_SK SSH keys'
click_on 'Save changes'
end
@@ -95,6 +97,8 @@ RSpec.describe 'Admin updates settings' do
expect(find_field('DSA SSH keys').value).to eq('0')
expect(find_field('ECDSA SSH keys').value).to eq('384')
expect(find_field('ED25519 SSH keys').value).to eq(forbidden)
+ expect(find_field('ECDSA_SK SSH keys').value).to eq(forbidden)
+ expect(find_field('ED25519_SK SSH keys').value).to eq(forbidden)
end
it 'change Account and Limit Settings' do
@@ -528,7 +532,7 @@ RSpec.describe 'Admin updates settings' do
expect(find_field('Allow access to members of the following group').value).to be_nil
end
- it 'loads usage ping payload on click', :js do
+ it 'loads togglable usage ping payload on click', :js do
stub_usage_data_connections
stub_database_flavor_check
@@ -544,6 +548,10 @@ RSpec.describe 'Admin updates settings' do
expect(page).to have_selector '.js-service-ping-payload'
expect(page).to have_button 'Hide payload'
expect(page).to have_content expected_payload_content
+
+ click_button('Hide payload')
+
+ expect(page).not_to have_content expected_payload_content
end
end
end
@@ -623,6 +631,20 @@ RSpec.describe 'Admin updates settings' do
expect(current_settings.issues_create_limit).to eq(0)
end
+ it 'changes Users API rate limits settings' do
+ visit network_admin_application_settings_path
+
+ page.within('.as-users-api-limits') do
+ fill_in 'Maximum requests per 10 minutes per user', with: 0
+ fill_in 'Users to exclude from the rate limit', with: 'someone, someone_else'
+ click_button 'Save changes'
+ end
+
+ expect(page).to have_content "Application settings saved successfully"
+ expect(current_settings.users_get_by_id_limit).to eq(0)
+ expect(current_settings.users_get_by_id_limit_allowlist).to eq(%w[someone someone_else])
+ end
+
shared_examples 'regular throttle rate limit settings' do
it 'changes rate limit settings' do
visit network_admin_application_settings_path
@@ -771,6 +793,38 @@ RSpec.describe 'Admin updates settings' do
end
end
end
+
+ context 'Service usage data page' do
+ before do
+ stub_usage_data_connections
+ stub_database_flavor_check
+
+ visit service_usage_data_admin_application_settings_path
+ end
+
+ it 'loads usage ping payload on click', :js do
+ expected_payload_content = /(?=.*"uuid")(?=.*"hostname")/m
+
+ expect(page).not_to have_content expected_payload_content
+
+ click_button('Preview payload')
+
+ wait_for_requests
+
+ expect(page).to have_button 'Hide payload'
+ expect(page).to have_content expected_payload_content
+ end
+
+ it 'generates usage ping payload on button click', :js do
+ expect_next_instance_of(Admin::ApplicationSettingsController) do |instance|
+ expect(instance).to receive(:usage_data).and_call_original
+ end
+
+ click_button('Download payload')
+
+ wait_for_requests
+ end
+ end
end
context 'application setting :admin_mode is disabled' do
diff --git a/spec/features/admin/integrations/instance_integrations_spec.rb b/spec/features/admin/integrations/instance_integrations_spec.rb
new file mode 100644
index 00000000000..7b326ec161c
--- /dev/null
+++ b/spec/features/admin/integrations/instance_integrations_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Instance integrations', :js do
+ include_context 'instance integration activation'
+
+ it_behaves_like 'integration settings form' do
+ let(:integrations) { Integration.find_or_initialize_all_non_project_specific(Integration.for_instance) }
+
+ def navigate_to_integration(integration)
+ visit_instance_integration(integration.title)
+ end
+ end
+end
diff --git a/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb b/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb
index 793a5bced00..22a27b33671 100644
--- a/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb
+++ b/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb
@@ -19,19 +19,4 @@ RSpec.describe 'User activates the instance-level Mattermost Slash Command integ
expect(page).to have_link('Settings', href: edit_path)
expect(page).to have_link('Projects using custom settings', href: overrides_path)
end
-
- it 'does not render integration form element' do
- expect(page).not_to have_selector('[data-testid="integration-form"]')
- end
-
- context 'when `vue_integration_form` feature flag is disabled' do
- before do
- stub_feature_flags(vue_integration_form: false)
- visit_instance_integration('Mattermost slash commands')
- end
-
- it 'renders integration form element' do
- expect(page).to have_selector('[data-testid="integration-form"]')
- end
- end
end
diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb
index 473f51370b3..5b0b6e085c9 100644
--- a/spec/features/admin/users/users_spec.rb
+++ b/spec/features/admin/users/users_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe 'Admin::Users' do
include Spec::Support::Helpers::Features::AdminUsersHelpers
+ include Spec::Support::Helpers::ModalHelpers
let_it_be(:user, reload: true) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') }
let_it_be(:current_user) { create(:admin) }
@@ -294,6 +295,22 @@ RSpec.describe 'Admin::Users' do
end
end
+ context 'when a user is locked', time_travel_to: '2020-02-25 10:30:45 -0700' do
+ let_it_be(:locked_user) { create(:user, locked_at: DateTime.parse('2020-02-25 10:30:00 -0700')) }
+
+ it "displays `Locked` badge next to user" do
+ expect(page).to have_content("#{locked_user.name} Locked")
+ end
+
+ it 'allows a user to be unlocked from the `User administration dropdown', :js do
+ accept_gl_confirm("Unlock user #{locked_user.name}?", button_text: 'Unlock') do
+ click_action_in_user_dropdown(locked_user.id, 'Unlock')
+ end
+
+ expect(page).not_to have_content("#{locked_user.name} (Locked)")
+ end
+ end
+
describe 'internal users' do
context 'when showing a `Ghost User`' do
let_it_be(:ghost_user) { create(:user, :ghost) }