debian-mirror-gitlab/spec/features/projects/settings/packages_settings_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
2 KiB
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Projects > Settings > Packages', :js, feature_category: :projects do
2021-06-08 01:23:25 +05:30
let_it_be(:project) { create(:project) }
2022-04-04 11:22:00 +05:30
let(:user) { project.first_owner }
2020-10-24 23:57:45 +05:30
before do
sign_in(user)
2021-06-08 01:23:25 +05:30
stub_config(packages: { enabled: packages_enabled })
2022-07-23 23:45:48 +05:30
stub_feature_flags(package_registry_access_level: package_registry_access_level)
2021-06-08 01:23:25 +05:30
visit edit_project_path(project)
2020-10-24 23:57:45 +05:30
end
context 'Packages enabled in config' do
2021-06-08 01:23:25 +05:30
let(:packages_enabled) { true }
2020-10-24 23:57:45 +05:30
2022-07-23 23:45:48 +05:30
context 'with feature flag disabled' do
let(:package_registry_access_level) { false }
it 'displays the packages toggle button' do
expect(page).to have_selector('[data-testid="toggle-label"]', text: 'Packages')
expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true)
end
end
context 'with feature flag enabled' do
let(:package_registry_access_level) { true }
it 'displays the packages access level setting' do
expect(page).to have_selector('[data-testid="package-registry-access-level"] > label', text: 'Package registry')
2023-03-04 22:38:38 +05:30
expect(page).to have_selector('input[name="package_registry_enabled"]', visible: false)
expect(page).to have_selector('input[name="package_registry_enabled"] + button', visible: true)
expect(page).to have_selector('input[name="package_registry_api_for_everyone_enabled"]', visible: false)
expect(page).to have_selector('input[name="package_registry_api_for_everyone_enabled"] + button', visible: true)
2022-07-23 23:45:48 +05:30
expect(page).to have_selector(
'input[name="project[project_feature_attributes][package_registry_access_level]"]',
visible: false
)
end
2020-10-24 23:57:45 +05:30
end
end
context 'Packages disabled in config' do
2021-06-08 01:23:25 +05:30
let(:packages_enabled) { false }
2022-07-23 23:45:48 +05:30
let(:package_registry_access_level) { false }
2020-10-24 23:57:45 +05:30
it 'does not show up in UI' do
2021-12-11 22:18:48 +05:30
expect(page).not_to have_selector('[data-testid="toggle-label"]', text: 'Packages')
2020-10-24 23:57:45 +05:30
end
end
end