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 })
|
|
|
|
|
|
|
|
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
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
it 'displays the packages access level setting' do
|
|
|
|
expect(page).to have_selector('[data-testid="package-registry-access-level"] > label', text: 'Package registry')
|
|
|
|
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)
|
|
|
|
expect(page).to have_selector(
|
|
|
|
'input[name="project[project_feature_attributes][package_registry_access_level]"]',
|
|
|
|
visible: false
|
|
|
|
)
|
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 }
|
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
|