2018-09-10 17:57:03 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Group CI/CD settings' do
|
2018-09-10 17:57:03 -04:00
|
|
|
include WaitForRequests
|
|
|
|
|
2022-04-12 20:10:42 -04:00
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:group, reload: true) { create(:group) }
|
2018-09-10 17:57:03 -04:00
|
|
|
|
2022-04-12 20:10:42 -04:00
|
|
|
before_all do
|
2018-09-10 17:57:03 -04:00
|
|
|
group.add_owner(user)
|
2022-04-12 20:10:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
2018-09-10 17:57:03 -04:00
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2022-04-12 20:10:42 -04:00
|
|
|
describe 'Runners section' do
|
2022-05-04 11:09:12 -04:00
|
|
|
let(:shared_runners_toggle) { page.find('[data-testid="shared-runners-toggle"]') }
|
2022-03-08 07:20:17 -05:00
|
|
|
|
2022-04-22 14:09:22 -04:00
|
|
|
before do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
2022-03-08 07:20:17 -05:00
|
|
|
end
|
|
|
|
|
2022-04-22 14:09:22 -04:00
|
|
|
it 'displays the new group runners view banner' do
|
|
|
|
expect(page).to have_content(s_('Runners|New group runners view'))
|
|
|
|
expect(page).to have_link(href: group_runners_path(group))
|
|
|
|
end
|
2018-09-10 17:57:03 -04:00
|
|
|
|
2022-04-22 14:09:22 -04:00
|
|
|
it 'has "Enable shared runners for this group" toggle', :js do
|
|
|
|
expect(shared_runners_toggle).to have_content(_('Enable shared runners for this group'))
|
2018-09-10 17:57:03 -04:00
|
|
|
end
|
2022-05-04 11:09:12 -04:00
|
|
|
|
|
|
|
it 'clicks on toggle to enable setting', :js do
|
|
|
|
expect(group.shared_runners_setting).to be(Namespace::SR_ENABLED)
|
|
|
|
|
|
|
|
shared_runners_toggle.find('button').click
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
group.reload
|
|
|
|
expect(group.shared_runners_setting).to be(Namespace::SR_DISABLED_AND_UNOVERRIDABLE)
|
|
|
|
end
|
2018-09-10 17:57:03 -04:00
|
|
|
end
|
2019-03-12 06:15:33 -04:00
|
|
|
|
|
|
|
describe 'Auto DevOps form' do
|
|
|
|
before do
|
|
|
|
stub_application_setting(auto_devops_enabled: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'as owner first visiting group settings' do
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'sees instance enabled badge' do
|
2019-03-12 06:15:33 -04:00
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
page.within '#auto-devops-settings' do
|
|
|
|
expect(page).to have_content('instance enabled')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when Auto DevOps group has been enabled' do
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'sees group enabled badge' do
|
2019-03-12 06:15:33 -04:00
|
|
|
group.update!(auto_devops_enabled: true)
|
|
|
|
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
page.within '#auto-devops-settings' do
|
|
|
|
expect(page).to have_content('group enabled')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when Auto DevOps group has been disabled' do
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'does not see a badge' do
|
2019-03-12 06:15:33 -04:00
|
|
|
group.update!(auto_devops_enabled: false)
|
|
|
|
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
page.within '#auto-devops-settings' do
|
|
|
|
expect(page).not_to have_content('instance enabled')
|
|
|
|
expect(page).not_to have_content('group enabled')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-09-10 17:57:03 -04:00
|
|
|
end
|