Commit 0df11843 authored by Martin Wortschack's avatar Martin Wortschack

Groups test cases by context

parent a7071ded
...@@ -11,9 +11,12 @@ describe 'Admin updates settings' do ...@@ -11,9 +11,12 @@ describe 'Admin updates settings' do
sign_in(admin) sign_in(admin)
end end
it 'Change visibility settings' do context 'General page' do
before do
visit admin_application_settings_path visit admin_application_settings_path
end
it 'Change visibility settings' do
page.within('.as-visibility-access') do page.within('.as-visibility-access') do
choose "application_setting_default_project_visibility_20" choose "application_setting_default_project_visibility_20"
click_button 'Save changes' click_button 'Save changes'
...@@ -23,8 +26,6 @@ describe 'Admin updates settings' do ...@@ -23,8 +26,6 @@ describe 'Admin updates settings' do
end end
it 'Uncheck all restricted visibility levels' do it 'Uncheck all restricted visibility levels' do
visit admin_application_settings_path
page.within('.as-visibility-access') do page.within('.as-visibility-access') do
find('#application_setting_visibility_level_0').set(false) find('#application_setting_visibility_level_0').set(false)
find('#application_setting_visibility_level_10').set(false) find('#application_setting_visibility_level_10').set(false)
...@@ -39,8 +40,6 @@ describe 'Admin updates settings' do ...@@ -39,8 +40,6 @@ describe 'Admin updates settings' do
end end
it 'Modify import sources' do it 'Modify import sources' do
visit admin_application_settings_path
expect(Gitlab::CurrentSettings.import_sources).not_to be_empty expect(Gitlab::CurrentSettings.import_sources).not_to be_empty
page.within('.as-visibility-access') do page.within('.as-visibility-access') do
...@@ -64,8 +63,6 @@ describe 'Admin updates settings' do ...@@ -64,8 +63,6 @@ describe 'Admin updates settings' do
end end
it 'Change Visibility and Access Controls' do it 'Change Visibility and Access Controls' do
visit admin_application_settings_path
page.within('.as-visibility-access') do page.within('.as-visibility-access') do
uncheck 'Project export enabled' uncheck 'Project export enabled'
click_button 'Save changes' click_button 'Save changes'
...@@ -75,9 +72,25 @@ describe 'Admin updates settings' do ...@@ -75,9 +72,25 @@ describe 'Admin updates settings' do
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
end end
it 'Change Account and Limit Settings' do it 'Change Keys settings' do
visit admin_application_settings_path page.within('.as-visibility-access') 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'
select 'Are forbidden', from: 'ED25519 SSH keys'
click_on 'Save changes'
end
forbidden = ApplicationSetting::FORBIDDEN_KEY_VALUE.to_s
expect(page).to have_content 'Application settings saved successfully'
expect(find_field('RSA SSH keys').value).to eq(forbidden)
expect(find_field('DSA SSH keys').value).to eq('0')
expect(find_field('ECDSA SSH keys').value).to eq('384')
expect(find_field('ED25519 SSH keys').value).to eq(forbidden)
end
it 'Change Account and Limit Settings' do
page.within('.as-account-limit') do page.within('.as-account-limit') do
uncheck 'Gravatar enabled' uncheck 'Gravatar enabled'
click_button 'Save changes' click_button 'Save changes'
...@@ -88,8 +101,6 @@ describe 'Admin updates settings' do ...@@ -88,8 +101,6 @@ describe 'Admin updates settings' do
end end
it 'Change New users set to external', :js do it 'Change New users set to external', :js do
visit admin_application_settings_path
user_internal_regex = find('#application_setting_user_default_internal_regex', visible: :all) user_internal_regex = find('#application_setting_user_default_internal_regex', visible: :all)
expect(user_internal_regex).to be_readonly expect(user_internal_regex).to be_readonly
...@@ -102,8 +113,6 @@ describe 'Admin updates settings' do ...@@ -102,8 +113,6 @@ describe 'Admin updates settings' do
end end
it 'Change Sign-in restrictions' do it 'Change Sign-in restrictions' do
visit admin_application_settings_path
page.within('.as-signin') do page.within('.as-signin') do
fill_in 'Home page URL', with: 'https://about.gitlab.com/' fill_in 'Home page URL', with: 'https://about.gitlab.com/'
click_button 'Save changes' click_button 'Save changes'
...@@ -114,8 +123,6 @@ describe 'Admin updates settings' do ...@@ -114,8 +123,6 @@ describe 'Admin updates settings' do
end end
it 'Terms of Service' do it 'Terms of Service' do
visit admin_application_settings_path
# Already have the admin accept terms, so they don't need to accept in this spec. # Already have the admin accept terms, so they don't need to accept in this spec.
_existing_terms = create(:term) _existing_terms = create(:term)
accept_terms(admin) accept_terms(admin)
...@@ -132,8 +139,6 @@ describe 'Admin updates settings' do ...@@ -132,8 +139,6 @@ describe 'Admin updates settings' do
end end
it 'Modify oauth providers' do it 'Modify oauth providers' do
visit admin_application_settings_path
expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty
page.within('.as-signin') do page.within('.as-signin') do
...@@ -154,8 +159,6 @@ describe 'Admin updates settings' do ...@@ -154,8 +159,6 @@ describe 'Admin updates settings' do
end end
it 'Oauth providers do not raise validation errors when saving unrelated changes' do it 'Oauth providers do not raise validation errors when saving unrelated changes' do
visit admin_application_settings_path
expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty
page.within('.as-signin') do page.within('.as-signin') do
...@@ -178,36 +181,58 @@ describe 'Admin updates settings' do ...@@ -178,36 +181,58 @@ describe 'Admin updates settings' do
expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2')
end end
it 'Change Help page' do it 'Configure web terminal' do
visit preferences_admin_application_settings_path page.within('.as-terminal') do
fill_in 'Max session time', with: 15
page.within('.as-help-page') do
fill_in 'Help page text', with: 'Example text'
check 'Hide marketing-related entries from help'
fill_in 'Support page URL', with: 'http://example.com/help'
click_button 'Save changes' click_button 'Save changes'
end end
expect(Gitlab::CurrentSettings.help_page_text).to eq "Example text"
expect(Gitlab::CurrentSettings.help_page_hide_commercial_content).to be_truthy
expect(Gitlab::CurrentSettings.help_page_support_url).to eq "http://example.com/help"
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.terminal_max_session_time).to eq(15)
end
end end
it 'Change Pages settings' do context 'Integrations page' do
visit preferences_admin_application_settings_path before do
visit integrations_admin_application_settings_path
end
page.within('.as-pages') do it 'Enable hiding third party offers' do
fill_in 'Maximum size of pages (MB)', with: 15 page.within('.as-third-party-offers') do
check 'Require users to prove ownership of custom domains' check 'Do not display offers from third parties within GitLab'
click_button 'Save changes' click_button 'Save changes'
end end
expect(Gitlab::CurrentSettings.max_pages_size).to eq 15
expect(Gitlab::CurrentSettings.pages_domain_verification_enabled?).to be_truthy
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true
end
it 'Change Slack Notifications Service template settings' do
first(:link, 'Service Templates').click
click_link 'Slack notifications'
fill_in 'Webhook', with: 'http://localhost'
fill_in 'Username', with: 'test_user'
fill_in 'service_push_channel', with: '#test_channel'
page.check('Notify only broken pipelines')
page.check('Notify only default branch')
check_all_events
click_on 'Save'
expect(page).to have_content 'Application settings saved successfully'
click_link 'Slack notifications'
page.all('input[type=checkbox]').each do |checkbox|
expect(checkbox).to be_checked
end
expect(find_field('Webhook').value).to eq 'http://localhost'
expect(find_field('Username').value).to eq 'test_user'
expect(find('#service_push_channel').value).to eq '#test_channel'
end
end end
context 'CI/CD page' do
it 'Change CI/CD settings' do it 'Change CI/CD settings' do
visit ci_cd_admin_application_settings_path visit ci_cd_admin_application_settings_path
...@@ -221,10 +246,32 @@ describe 'Admin updates settings' do ...@@ -221,10 +246,32 @@ describe 'Admin updates settings' do
expect(Gitlab::CurrentSettings.auto_devops_domain).to eq('domain.com') expect(Gitlab::CurrentSettings.auto_devops_domain).to eq('domain.com')
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
end end
end
it 'Change Influx settings' do context 'Reporting page' do
it 'Change Spam settings' do
visit reporting_admin_application_settings_path
page.within('.as-spam') do
check 'Enable reCAPTCHA'
fill_in 'reCAPTCHA Site Key', with: 'key'
fill_in 'reCAPTCHA Private Key', with: 'key'
fill_in 'IPs per user', with: 15
click_button 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.recaptcha_enabled).to be true
expect(Gitlab::CurrentSettings.unique_ips_limit_per_user).to eq(15)
end
end
context 'Metrics and profiling page' do
before do
visit metrics_and_profiling_admin_application_settings_path visit metrics_and_profiling_admin_application_settings_path
end
it 'Change Influx settings' do
page.within('.as-influx') do page.within('.as-influx') do
check 'Enable InfluxDB Metrics' check 'Enable InfluxDB Metrics'
click_button 'Save changes' click_button 'Save changes'
...@@ -235,8 +282,6 @@ describe 'Admin updates settings' do ...@@ -235,8 +282,6 @@ describe 'Admin updates settings' do
end end
it 'Change Prometheus settings' do it 'Change Prometheus settings' do
visit metrics_and_profiling_admin_application_settings_path
page.within('.as-prometheus') do page.within('.as-prometheus') do
check 'Enable Prometheus Metrics' check 'Enable Prometheus Metrics'
click_button 'Save changes' click_button 'Save changes'
...@@ -247,8 +292,6 @@ describe 'Admin updates settings' do ...@@ -247,8 +292,6 @@ describe 'Admin updates settings' do
end end
it 'Change Performance bar settings' do it 'Change Performance bar settings' do
visit metrics_and_profiling_admin_application_settings_path
group = create(:group) group = create(:group)
page.within('.as-performance-bar') do page.within('.as-performance-bar') do
...@@ -271,46 +314,17 @@ describe 'Admin updates settings' do ...@@ -271,46 +314,17 @@ describe 'Admin updates settings' do
expect(find_field('Allowed group').value).to be_nil expect(find_field('Allowed group').value).to be_nil
end end
it 'Change Background jobs settings' do it 'loads usage ping payload on click', :js do
visit preferences_admin_application_settings_path expect(page).to have_button 'Preview payload'
page.within('.as-background') do
fill_in 'Throttling Factor', with: 1
click_button 'Save changes'
end
expect(Gitlab::CurrentSettings.sidekiq_throttling_factor).to eq(1)
expect(page).to have_content "Application settings saved successfully"
end
it 'Change Spam settings' do
visit reporting_admin_application_settings_path
page.within('.as-spam') do
check 'Enable reCAPTCHA'
fill_in 'reCAPTCHA Site Key', with: 'key'
fill_in 'reCAPTCHA Private Key', with: 'key'
fill_in 'IPs per user', with: 15
click_button 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.recaptcha_enabled).to be true
expect(Gitlab::CurrentSettings.unique_ips_limit_per_user).to eq(15)
end
it 'Configure web terminal' do find('.js-usage-ping-payload-trigger').click
visit admin_application_settings_path
page.within('.as-terminal') do expect(page).to have_selector '.js-usage-ping-payload'
fill_in 'Max session time', with: 15 expect(page).to have_button 'Hide payload'
click_button 'Save changes'
end end
expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.terminal_max_session_time).to eq(15)
end end
context 'Network page' do
it 'Enable outbound requests' do it 'Enable outbound requests' do
visit network_admin_application_settings_path visit network_admin_application_settings_path
...@@ -322,74 +336,48 @@ describe 'Admin updates settings' do ...@@ -322,74 +336,48 @@ describe 'Admin updates settings' do
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true
end end
end
it 'Enable hiding third party offers' do context 'Preferences page' do
visit integrations_admin_application_settings_path before do
visit preferences_admin_application_settings_path
end
page.within('.as-third-party-offers') do it 'Change Help page' do
check 'Do not display offers from third parties within GitLab' page.within('.as-help-page') do
fill_in 'Help page text', with: 'Example text'
check 'Hide marketing-related entries from help'
fill_in 'Support page URL', with: 'http://example.com/help'
click_button 'Save changes' click_button 'Save changes'
end end
expect(Gitlab::CurrentSettings.help_page_text).to eq "Example text"
expect(Gitlab::CurrentSettings.help_page_hide_commercial_content).to be_truthy
expect(Gitlab::CurrentSettings.help_page_support_url).to eq "http://example.com/help"
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true
end end
it 'Change Slack Notifications Service template settings' do it 'Change Pages settings' do
visit integrations_admin_application_settings_path page.within('.as-pages') do
fill_in 'Maximum size of pages (MB)', with: 15
first(:link, 'Service Templates').click check 'Require users to prove ownership of custom domains'
click_link 'Slack notifications' click_button 'Save changes'
fill_in 'Webhook', with: 'http://localhost'
fill_in 'Username', with: 'test_user'
fill_in 'service_push_channel', with: '#test_channel'
page.check('Notify only broken pipelines')
page.check('Notify only default branch')
check_all_events
click_on 'Save'
expect(page).to have_content 'Application settings saved successfully'
click_link 'Slack notifications'
page.all('input[type=checkbox]').each do |checkbox|
expect(checkbox).to be_checked
end
expect(find_field('Webhook').value).to eq 'http://localhost'
expect(find_field('Username').value).to eq 'test_user'
expect(find('#service_push_channel').value).to eq '#test_channel'
end end
it 'Change Keys settings' do expect(Gitlab::CurrentSettings.max_pages_size).to eq 15
visit admin_application_settings_path expect(Gitlab::CurrentSettings.pages_domain_verification_enabled?).to be_truthy
expect(page).to have_content "Application settings saved successfully"
page.within('.as-visibility-access') 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'
select 'Are forbidden', from: 'ED25519 SSH keys'
click_on 'Save changes'
end end
forbidden = ApplicationSetting::FORBIDDEN_KEY_VALUE.to_s it 'Change Background jobs settings' do
page.within('.as-background') do
expect(page).to have_content 'Application settings saved successfully' fill_in 'Throttling Factor', with: 1
expect(find_field('RSA SSH keys').value).to eq(forbidden) click_button 'Save changes'
expect(find_field('DSA SSH keys').value).to eq('0')
expect(find_field('ECDSA SSH keys').value).to eq('384')
expect(find_field('ED25519 SSH keys').value).to eq(forbidden)
end end
it 'loads usage ping payload on click', :js do expect(Gitlab::CurrentSettings.sidekiq_throttling_factor).to eq(1)
visit metrics_and_profiling_admin_application_settings_path expect(page).to have_content "Application settings saved successfully"
end
expect(page).to have_button 'Preview payload'
find('.js-usage-ping-payload-trigger').click
expect(page).to have_selector '.js-usage-ping-payload'
expect(page).to have_button 'Hide payload'
end end
def check_all_events def check_all_events
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment