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>2023-11-03 03:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-03 03:09:13 +0300
commit7cf5520071ef2f89a96167a60ce0693bd694fad3 (patch)
tree67a8a1513d908ddb02c2d903add040a2e49d009b /spec/features/admin
parentfecb8ece925c48cf64969f1ecced12e4c4497706 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/admin')
-rw-r--r--spec/features/admin/admin_deploy_keys_spec.rb10
-rw-r--r--spec/features/admin/admin_dev_ops_reports_spec.rb4
-rw-r--r--spec/features/admin/admin_groups_spec.rb2
-rw-r--r--spec/features/admin/admin_projects_spec.rb2
-rw-r--r--spec/features/admin/admin_runners_spec.rb66
-rw-r--r--spec/features/admin/admin_settings_spec.rb32
-rw-r--r--spec/features/admin/admin_uses_repository_checks_spec.rb2
-rw-r--r--spec/features/admin/broadcast_messages_spec.rb8
-rw-r--r--spec/features/admin/users/user_spec.rb4
-rw-r--r--spec/features/admin/users/users_spec.rb12
10 files changed, 74 insertions, 68 deletions
diff --git a/spec/features/admin/admin_deploy_keys_spec.rb b/spec/features/admin/admin_deploy_keys_spec.rb
index f59b4db5cc2..f9510ef296a 100644
--- a/spec/features/admin/admin_deploy_keys_spec.rb
+++ b/spec/features/admin/admin_deploy_keys_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe 'admin deploy keys', :js, feature_category: :system_access do
it 'show all public deploy keys' do
visit admin_deploy_keys_path
- page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
+ within_testid('deploy-keys-list', match: :first) do
expect(page).to have_content(deploy_key.title)
expect(page).to have_content(another_deploy_key.title)
end
@@ -29,7 +29,7 @@ RSpec.describe 'admin deploy keys', :js, feature_category: :system_access do
visit admin_deploy_keys_path
- page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
+ within_testid('deploy-keys-list', match: :first) do
expect(page).to have_content(write_key.project.full_name)
end
end
@@ -49,7 +49,7 @@ RSpec.describe 'admin deploy keys', :js, feature_category: :system_access do
expect(page).to have_current_path admin_deploy_keys_path, ignore_query: true
- page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
+ within_testid('deploy-keys-list', match: :first) do
expect(page).to have_content('laptop')
end
end
@@ -69,7 +69,7 @@ RSpec.describe 'admin deploy keys', :js, feature_category: :system_access do
expect(page).to have_current_path admin_deploy_keys_path, ignore_query: true
- page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
+ within_testid('deploy-keys-list', match: :first) do
expect(page).to have_content('new-title')
end
end
@@ -88,7 +88,7 @@ RSpec.describe 'admin deploy keys', :js, feature_category: :system_access do
end
expect(page).to have_current_path admin_deploy_keys_path, ignore_query: true
- page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
+ within_testid('deploy-keys-list', match: :first) do
expect(page).not_to have_content(deploy_key.title)
end
end
diff --git a/spec/features/admin/admin_dev_ops_reports_spec.rb b/spec/features/admin/admin_dev_ops_reports_spec.rb
index f290464b043..99d43e6b0da 100644
--- a/spec/features/admin/admin_dev_ops_reports_spec.rb
+++ b/spec/features/admin/admin_dev_ops_reports_spec.rb
@@ -19,8 +19,8 @@ RSpec.describe 'DevOps Report page', :js, feature_category: :devops_reports do
expect(page).to have_content 'Introducing Your DevOps Report'
- page.within(find('[data-testid="devops-score-container"]')) do
- find('[data-testid="close-icon"]').click
+ within_testid('devops-score-container') do
+ find_by_testid('close-icon').click
end
expect(page).not_to have_content 'Introducing Your DevOps Report'
diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb
index 1e3dbd7fea4..f071da1835a 100644
--- a/spec/features/admin/admin_groups_spec.rb
+++ b/spec/features/admin/admin_groups_spec.rb
@@ -138,7 +138,7 @@ RSpec.describe 'Admin Groups', feature_category: :groups_and_projects do
it 'shows access requests with link to manage access' do
visit admin_group_path(group)
- page.within '[data-testid="access-requests"]' do
+ within_testid('access-requests') do
expect(page).to have_content access_request.user.name
expect(page).to have_link 'Manage access', href: group_group_members_path(group, tab: 'access_requests')
end
diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb
index 3454b7af962..b793299e253 100644
--- a/spec/features/admin/admin_projects_spec.rb
+++ b/spec/features/admin/admin_projects_spec.rb
@@ -95,7 +95,7 @@ RSpec.describe "Admin::Projects", feature_category: :groups_and_projects do
context 'when project has open access requests' do
it 'shows access requests with link to manage access' do
- page.within '[data-testid="access-requests"]' do
+ within_testid('access-requests') do
expect(page).to have_content access_request.user.name
expect(page).to have_link 'Manage access', href: project_project_members_path(project, tab: 'access_requests')
end
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb
index 676e5e7ad0e..1416124497a 100644
--- a/spec/features/admin/admin_runners_spec.rb
+++ b/spec/features/admin/admin_runners_spec.rb
@@ -100,7 +100,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
visit admin_runners_path
within_runner_row(runner.id) do
- expect(find("[data-testid='job-count']")).to have_content '2'
+ expect(find_by_testid('job-count')).to have_content '2'
end
end
@@ -116,8 +116,8 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
expect(current_url).to match(admin_runner_path(runner))
- expect(find("[data-testid='td-status']")).to have_content "Running"
- expect(find("[data-testid='td-job']")).to have_content "##{job.id}"
+ expect(find_by_testid('td-status')).to have_content "Running"
+ expect(find_by_testid('td-job')).to have_content "##{job.id}"
end
describe 'search' do
@@ -291,7 +291,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
expect(page).to have_link('Group 1')
expect(page).to have_link('Project 1')
- page.within('[data-testid="runner-type-tabs"]') do
+ within_testid('runner-type-tabs') do
expect(page).to have_link('All', class: 'active')
end
end
@@ -302,7 +302,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
expect(page).to have_content 'runner-project'
expect(page).to have_content 'runner-group'
- page.within('[data-testid="runner-type-tabs"]') do
+ within_testid('runner-type-tabs') do
click_on('Project')
expect(page).to have_link('Project', class: 'active')
@@ -315,7 +315,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
it 'show the same counts after selecting another tab' do
visit admin_runners_path
- page.within('[data-testid="runner-type-tabs"]') do
+ within_testid('runner-type-tabs') do
click_on('Project')
expect(page).to have_link('All 2')
@@ -329,7 +329,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
visit admin_runners_path
- page.within('[data-testid="runner-type-tabs"]') do
+ within_testid('runner-type-tabs') do
click_on 'Project'
end
@@ -355,7 +355,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
expect(page).to have_content 'runner-group'
expect(page).not_to have_content 'runner-paused-project'
- page.within('[data-testid="runner-type-tabs"]') do
+ within_testid('runner-type-tabs') do
click_on 'Project'
end
@@ -367,7 +367,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
context 'when type does not match' do
before do
visit admin_runners_path
- page.within('[data-testid="runner-type-tabs"]') do
+ within_testid('runner-type-tabs') do
click_on 'Instance'
end
end
@@ -440,24 +440,28 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
visit admin_runners_path
- within '[data-testid="runner-list"] tbody tr:nth-child(1)' do
- expect(page).to have_content 'runner-2'
- end
+ within_testid('runner-list') do
+ within('tbody tr:nth-child(1)') do
+ expect(page).to have_content 'runner-2'
+ end
- within '[data-testid="runner-list"] tbody tr:nth-child(2)' do
- expect(page).to have_content 'runner-1'
+ within('tbody tr:nth-child(2)') do
+ expect(page).to have_content 'runner-1'
+ end
end
click_on 'Created date' # Open "sort by" dropdown
click_on 'Last contact'
click_on 'Sort direction: Descending'
- within '[data-testid="runner-list"] tbody tr:nth-child(1)' do
- expect(page).to have_content 'runner-1'
- end
+ within_testid('runner-list') do
+ within('tbody tr:nth-child(1)') do
+ expect(page).to have_content 'runner-1'
+ end
- within '[data-testid="runner-list"] tbody tr:nth-child(2)' do
- expect(page).to have_content 'runner-2'
+ within('tbody tr:nth-child(2)') do
+ expect(page).to have_content 'runner-2'
+ end
end
end
end
@@ -522,8 +526,8 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
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('[data-testid="breadcrumb-current-link"]')).to have_link(
+ within_testid('breadcrumb-links') do
+ expect(find_by_testid('breadcrumb-current-link')).to have_link(
"##{runner.id} (#{runner.short_sha})"
)
end
@@ -555,7 +559,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
end
it 'deletes runner and redirects to runner list' do
- expect(page.find('[data-testid="alert-success"]')).to have_content('deleted')
+ expect(find_by_testid('alert-success')).to have_content('deleted')
expect(current_url).to match(admin_runners_path)
end
end
@@ -581,9 +585,9 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
describe 'breadcrumbs' do
it 'contains the current runner id and token' do
- page.within '[data-testid="breadcrumb-links"]' do
+ within_testid('breadcrumb-links') do
expect(page).to have_link("##{project_runner.id} (#{project_runner.short_sha})")
- expect(page.find('[data-testid="breadcrumb-current-link"]')).to have_content("Edit")
+ expect(find_by_testid('breadcrumb-current-link')).to have_content("Edit")
end
end
end
@@ -604,7 +608,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
it 'show success alert and redirects to runner page' do
expect(current_url).to match(admin_runner_path(project_runner))
- expect(page.find('[data-testid="alert-success"]')).to have_content('saved')
+ expect(find_by_testid('alert-success')).to have_content('saved')
end
end
@@ -631,11 +635,13 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
describe 'enable/create' do
shared_examples 'assignable runner' do
it 'enables a runner for a project' do
- within find('[data-testid="unassigned-projects"] tr', text: project2.full_name) do
- click_on 'Enable'
+ within_testid('unassigned-projects') do
+ within('tr', text: project2.full_name) do
+ click_on 'Enable'
+ end
end
- assigned_project = page.find('[data-testid="assigned-projects"]')
+ assigned_project = find_by_testid('assigned-projects')
expect(page).to have_content('Runner assigned to project.')
expect(assigned_project).to have_content(project2.name)
@@ -671,11 +677,11 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do
end
it 'removed project runner from project' do
- within '[data-testid="assigned-projects"]' do
+ within_testid('assigned-projects') do
click_on 'Disable'
end
- new_runner_project = page.find('[data-testid="unassigned-projects"]')
+ new_runner_project = find_by_testid('unassigned-projects')
expect(page).to have_content('Runner unassigned from project.')
expect(new_runner_project).to have_content(project1.name)
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index dbdc0a03404..4e0198b1f2b 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
it 'change visibility settings' do
- page.within('[data-testid="admin-visibility-access-settings"]') do
+ within_testid('admin-visibility-access-settings') do
choose "application_setting_default_project_visibility_20"
click_button 'Save changes'
end
@@ -31,19 +31,19 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
it 'uncheck all restricted visibility levels' do
- page.within('[data-testid="restricted-visibility-levels"]') do
+ within_testid('restricted-visibility-levels') do
uncheck s_('VisibilityLevel|Public')
uncheck s_('VisibilityLevel|Internal')
uncheck s_('VisibilityLevel|Private')
end
- page.within('[data-testid="admin-visibility-access-settings"]') do
+ within_testid('admin-visibility-access-settings') do
click_button 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
- page.within('[data-testid="restricted-visibility-levels"]') do
+ within_testid('restricted-visibility-levels') do
expect(find_field(s_('VisibilityLevel|Public'))).not_to be_checked
expect(find_field(s_('VisibilityLevel|Internal'))).not_to be_checked
expect(find_field(s_('VisibilityLevel|Private'))).not_to be_checked
@@ -53,7 +53,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
it 'modify import sources' do
expect(current_settings.import_sources).to be_empty
- page.within('[data-testid="admin-import-export-settings"]') do
+ within_testid('admin-import-export-settings') do
check "Repository by URL"
click_button 'Save changes'
end
@@ -63,12 +63,12 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
it 'change Visibility and Access Controls' do
- page.within('[data-testid="admin-import-export-settings"]') do
- page.within('[data-testid="project-export"]') do
+ within_testid('admin-import-export-settings') do
+ within_testid('project-export') do
uncheck 'Enabled'
end
- page.within('[data-testid="bulk-import"]') do
+ within_testid('bulk-import') do
check 'Enabled'
end
@@ -81,7 +81,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
it 'change Keys settings' do
- page.within('[data-testid="admin-visibility-access-settings"]') do
+ within_testid('admin-visibility-access-settings') do
select 'Are forbidden', from: 'RSA SSH keys'
select 'Are allowed', from: 'DSA SSH keys'
select 'Must be at least 384 bits', from: 'ECDSA SSH keys'
@@ -103,7 +103,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
it 'change Account and Limit Settings' do
- page.within(find('[data-testid="account-and-limit-settings-content"]')) do
+ within_testid('account-and-limit-settings-content') do
uncheck 'Gravatar enabled'
click_button 'Save changes'
end
@@ -113,7 +113,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
it 'change Maximum export size' do
- page.within(find('[data-testid="admin-import-export-settings"]')) do
+ within_testid('admin-import-export-settings') do
fill_in 'Maximum export size (MiB)', with: 25
click_button 'Save changes'
end
@@ -123,7 +123,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
it 'change Maximum import size' do
- page.within(find('[data-testid="admin-import-export-settings"]')) do
+ within_testid('admin-import-export-settings') do
fill_in 'Maximum import size (MiB)', with: 15
click_button 'Save changes'
end
@@ -169,7 +169,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
expect(page).to have_unchecked_field(_('Deactivate dormant users after a period of inactivity'))
expect(current_settings.deactivate_dormant_users).to be_falsey
- page.within(find('[data-testid="account-and-limit-settings-content"]')) do
+ within_testid('account-and-limit-settings-content') do
check _('Deactivate dormant users after a period of inactivity')
click_button _('Save changes')
end
@@ -185,7 +185,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
it 'change dormant users period', :js do
expect(page).to have_field(_('Days of inactivity before deactivation'), disabled: true)
- page.within(find('[data-testid="account-and-limit-settings-content"]')) do
+ within_testid('account-and-limit-settings-content') do
check _('Deactivate dormant users after a period of inactivity')
fill_in _('Days of inactivity before deactivation'), with: '180'
click_button _('Save changes')
@@ -202,7 +202,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
selector = '#application_setting_deactivate_dormant_users_period_error'
expect(page).not_to have_selector(selector, visible: :visible)
- page.within(find('[data-testid="account-and-limit-settings-content"]')) do
+ within_testid('account-and-limit-settings-content') do
check 'application_setting_deactivate_dormant_users'
fill_in _('application_setting_deactivate_dormant_users_period'), with: '30'
click_button 'Save changes'
@@ -818,7 +818,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
it 'changes gitlab shell operation limits settings' do
visit network_admin_application_settings_path
- page.within('[data-testid="gitlab-shell-operation-limits"]') do
+ within_testid('gitlab-shell-operation-limits') do
fill_in 'Maximum number of Git operations per minute', with: 100
click_button 'Save changes'
end
diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb
index d9d36ec3bae..05232de35e5 100644
--- a/spec/features/admin/admin_uses_repository_checks_spec.rb
+++ b/spec/features/admin/admin_uses_repository_checks_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe 'Admin uses repository checks', :request_store, feature_category:
)
visit_admin_project_page(project)
- page.within('[data-testid="last-repository-check-failed-alert"]') do
+ within_testid('last-repository-check-failed-alert') do
expect(page.text).to match(/Last repository check \(just now\) failed/)
end
end
diff --git a/spec/features/admin/broadcast_messages_spec.rb b/spec/features/admin/broadcast_messages_spec.rb
index b89ebc34d6a..e4a2e31ee1c 100644
--- a/spec/features/admin/broadcast_messages_spec.rb
+++ b/spec/features/admin/broadcast_messages_spec.rb
@@ -36,12 +36,12 @@ RSpec.describe 'Admin Broadcast Messages', :js, feature_category: :onboarding do
# edit
page.within(first_message_container) do
- find('[data-testid="edit-message"]').click
+ find_by_testid('edit-message').click
end
wait_for_requests
- expect(find('[data-testid="message-input"]').value).to eq('test message')
+ expect(find_by_testid('message-input').value).to eq('test message')
fill_in 'Message', with: 'changed test message'
@@ -61,11 +61,11 @@ RSpec.describe 'Admin Broadcast Messages', :js, feature_category: :onboarding do
end
def preview_container
- find('[data-testid="preview-broadcast-message"]')
+ find_by_testid('preview-broadcast-message')
end
def first_message_container
- find('[data-testid="message-row"]', match: :first)
+ find_by_testid('message-row', match: :first)
end
end
end
diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb
index fbf11063f7c..b8dc725c17f 100644
--- a/spec/features/admin/users/user_spec.rb
+++ b/spec/features/admin/users/user_spec.rb
@@ -156,7 +156,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do
it 'disables impersonate button' do
subject
- impersonate_btn = find('[data-testid="impersonate-user-link"]')
+ impersonate_btn = find_by_testid('impersonate-user-link')
expect(impersonate_btn).not_to be_nil
expect(impersonate_btn['disabled']).not_to be_nil
@@ -174,7 +174,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do
subject
expect(page).to have_content('Impersonate')
- impersonate_btn = find('[data-testid="impersonate-user-link"]')
+ impersonate_btn = find_by_testid('impersonate-user-link')
expect(impersonate_btn['disabled']).to be_nil
end
end
diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb
index 8ee30c50a7d..4e988674858 100644
--- a/spec/features/admin/users/users_spec.rb
+++ b/spec/features/admin/users/users_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do
end
it 'clicking edit user takes us to edit page', :aggregate_failures do
- page.within("[data-testid='user-actions-#{user.id}']") do
+ within_testid("user-actions-#{user.id}") do
click_link 'Edit'
end
@@ -71,7 +71,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do
it 'displays count of users projects' do
visit admin_users_path
- expect(page.find("[data-testid='user-project-count-#{current_user.id}']").text).to eq("1")
+ expect(find_by_testid("user-project-count-#{current_user.id}").text).to eq("1")
end
end
@@ -321,7 +321,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do
click_user_dropdown_toggle(user.id)
- find('[data-testid="approve"]').click
+ find_by_testid('approve').click
expect(page).to have_content("Approve user #{user.name}?")
@@ -378,7 +378,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do
wait_for_requests
- expect(page.find("[data-testid='user-group-count-#{current_user.id}']").text).to eq("2")
+ expect(find_by_testid("user-group-count-#{current_user.id}").text).to eq("2")
end
end
end
@@ -542,7 +542,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do
it 'allows group membership to be revoked', :js do
page.within(first('.group_member')) do
- find('.btn[data-testid="remove-user"]').click
+ find_by_testid('remove-user').click
end
accept_gl_confirm(button_text: 'Remove')
@@ -587,7 +587,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do
end
def check_breadcrumb(content)
- expect(find('[data-testid="breadcrumb-current-link"]')).to have_content(content)
+ expect(find_by_testid('breadcrumb-current-link')).to have_content(content)
end
end