diff options
Diffstat (limited to 'spec/features/projects/settings')
5 files changed, 114 insertions, 11 deletions
diff --git a/spec/features/projects/settings/operations_settings_spec.rb b/spec/features/projects/settings/operations_settings_spec.rb index dfbb6342173..878794bd897 100644 --- a/spec/features/projects/settings/operations_settings_spec.rb +++ b/spec/features/projects/settings/operations_settings_spec.rb @@ -45,15 +45,12 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do it 'updates form values' do check(create_issue) - template_select = find_field('Issue template') - template_select.find(:xpath, 'option[2]').select_option uncheck(send_email) save_form click_expand_incident_management_button expect(find_field(create_issue)).to be_checked - expect(page).to have_select('Issue template', selected: 'bug') expect(find_field(send_email)).not_to be_checked end @@ -64,7 +61,7 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do end def save_form - page.within "#edit_project_#{project.id}" do + page.within ".qa-incident-management-settings" do click_on 'Save changes' end end diff --git a/spec/features/projects/settings/registry_settings_spec.rb b/spec/features/projects/settings/registry_settings_spec.rb index 3dcb7ca54a1..8e2f97fd6a0 100644 --- a/spec/features/projects/settings/registry_settings_spec.rb +++ b/spec/features/projects/settings/registry_settings_spec.rb @@ -20,10 +20,10 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p it 'shows available section' do settings_block = find('#js-registry-policies') - expect(settings_block).to have_text 'Container Registry tag expiration policy' + expect(settings_block).to have_text 'Cleanup policy for tags' end - it 'saves expiration policy submit the form' do + it 'saves cleanup policy submit the form' do within '#js-registry-policies' do within '.card-body' do select('7 days until tags are automatically removed', from: 'Expiration interval:') @@ -36,10 +36,10 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p submit_button.click end toast = find('.gl-toast') - expect(toast).to have_content('Expiration policy successfully saved.') + expect(toast).to have_content('Cleanup policy successfully saved.') end - it 'does not save expiration policy submit form with invalid regex' do + it 'does not save cleanup policy submit form with invalid regex' do within '#js-registry-policies' do within '.card-body' do fill_in('Tags with names matching this regex pattern will expire:', with: '*-production') @@ -49,7 +49,7 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p submit_button.click end toast = find('.gl-toast') - expect(toast).to have_content('Something went wrong while updating the expiration policy.') + expect(toast).to have_content('Something went wrong while updating the cleanup policy.') end end diff --git a/spec/features/projects/settings/service_desk_setting_spec.rb b/spec/features/projects/settings/service_desk_setting_spec.rb new file mode 100644 index 00000000000..7856ab1fb4e --- /dev/null +++ b/spec/features/projects/settings/service_desk_setting_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Service Desk Setting', :js do + let(:project) { create(:project_empty_repo, :private, service_desk_enabled: false) } + let(:presenter) { project.present(current_user: user) } + let(:user) { create(:user) } + + before do + project.add_maintainer(user) + sign_in(user) + + allow_any_instance_of(Project).to receive(:present).with(current_user: user).and_return(presenter) + allow(::Gitlab::IncomingEmail).to receive(:enabled?) { true } + allow(::Gitlab::IncomingEmail).to receive(:supports_wildcard?) { true } + + visit edit_project_path(project) + end + + it 'shows activation checkbox' do + expect(page).to have_selector("#service-desk-checkbox") + end + + it 'shows incoming email after activating' do + find("#service-desk-checkbox").click + wait_for_requests + project.reload + expect(project.service_desk_enabled).to be_truthy + expect(project.service_desk_address).to be_present + expect(find('.incoming-email').value).to eq(project.service_desk_address) + end +end diff --git a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb index 3fc1f47d98a..e97e4a2030a 100644 --- a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb +++ b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb @@ -28,6 +28,22 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do end end + it 'shows Squash commit options', :aggregate_failures do + page.within '#js-merge-request-settings' do + expect(page).to have_content 'Do not allow' + expect(page).to have_content 'Squashing is never performed and the checkbox is hidden.' + + expect(page).to have_content 'Allow' + expect(page).to have_content 'Checkbox is visible and unselected by default.' + + expect(page).to have_content 'Encourage' + expect(page).to have_content 'Checkbox is visible and selected by default.' + + expect(page).to have_content 'Require' + expect(page).to have_content 'Squashing is always performed. Checkbox is visible and selected, and users cannot change it.' + end + end + context 'when Merge Request and Pipelines are initially enabled', :js do context 'when Pipelines are initially enabled' do it 'shows the Merge Requests settings' do @@ -130,4 +146,56 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do expect(project.remove_source_branch_after_merge).to be(false) end end + + describe 'Squash commits when merging', :js do + it 'initially has :squash_option set to :default_off' do + radio = find_field('project_project_setting_attributes_squash_option_default_off') + expect(radio).to be_checked + end + + it 'allows :squash_option to be set to :default_on' do + choose('project_project_setting_attributes_squash_option_default_on') + + within('.merge-request-settings-form') do + find('.qa-save-merge-request-changes') + click_on('Save changes') + end + + find('.flash-notice') + radio = find_field('project_project_setting_attributes_squash_option_default_on') + + expect(radio).to be_checked + expect(project.reload.project_setting.squash_option).to eq('default_on') + end + + it 'allows :squash_option to be set to :always' do + choose('project_project_setting_attributes_squash_option_always') + + within('.merge-request-settings-form') do + find('.qa-save-merge-request-changes') + click_on('Save changes') + end + + find('.flash-notice') + radio = find_field('project_project_setting_attributes_squash_option_always') + + expect(radio).to be_checked + expect(project.reload.project_setting.squash_option).to eq('always') + end + + it 'allows :squash_option to be set to :never' do + choose('project_project_setting_attributes_squash_option_never') + + within('.merge-request-settings-form') do + find('.qa-save-merge-request-changes') + click_on('Save changes') + end + + find('.flash-notice') + radio = find_field('project_project_setting_attributes_squash_option_never') + + expect(radio).to be_checked + expect(project.reload.project_setting.squash_option).to eq('never') + end + end end diff --git a/spec/features/projects/settings/user_manages_project_members_spec.rb b/spec/features/projects/settings/user_manages_project_members_spec.rb index d32f4cb8ec7..3836b95a28a 100644 --- a/spec/features/projects/settings/user_manages_project_members_spec.rb +++ b/spec/features/projects/settings/user_manages_project_members_spec.rb @@ -16,15 +16,20 @@ RSpec.describe 'Projects > Settings > User manages project members' do sign_in(user) end - it 'cancels a team member' do + it 'cancels a team member', :js do visit(project_project_members_path(project)) project_member = project.project_members.find_by(user_id: user_dmitriy.id) page.within("#project_member_#{project_member.id}") do - click_link('Remove user from project') + # Open modal + click_on('Remove user from project') end + expect(page).to have_unchecked_field 'Also unassign this user from related issues and merge requests' + + click_on('Remove member') + visit(project_project_members_path(project)) expect(page).not_to have_content(user_dmitriy.name) |