Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
0df11843
Commit
0df11843
authored
Sep 18, 2018
by
Martin Wortschack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Groups test cases by context
parent
a7071ded
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
266 additions
and
278 deletions
+266
-278
spec/features/admin/admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+266
-278
No files found.
spec/features/admin/admin_settings_spec.rb
View file @
0df11843
...
...
@@ -11,9 +11,12 @@ describe 'Admin updates settings' do
sign_in
(
admin
)
end
it
'Change visibility settings'
do
context
'General page'
do
before
do
visit
admin_application_settings_path
end
it
'Change visibility settings'
do
page
.
within
(
'.as-visibility-access'
)
do
choose
"application_setting_default_project_visibility_20"
click_button
'Save changes'
...
...
@@ -23,8 +26,6 @@ describe 'Admin updates settings' do
end
it
'Uncheck all restricted visibility levels'
do
visit
admin_application_settings_path
page
.
within
(
'.as-visibility-access'
)
do
find
(
'#application_setting_visibility_level_0'
).
set
(
false
)
find
(
'#application_setting_visibility_level_10'
).
set
(
false
)
...
...
@@ -39,8 +40,6 @@ describe 'Admin updates settings' do
end
it
'Modify import sources'
do
visit
admin_application_settings_path
expect
(
Gitlab
::
CurrentSettings
.
import_sources
).
not_to
be_empty
page
.
within
(
'.as-visibility-access'
)
do
...
...
@@ -64,8 +63,6 @@ describe 'Admin updates settings' do
end
it
'Change Visibility and Access Controls'
do
visit
admin_application_settings_path
page
.
within
(
'.as-visibility-access'
)
do
uncheck
'Project export enabled'
click_button
'Save changes'
...
...
@@ -75,9 +72,25 @@ describe 'Admin updates settings' do
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
it
'Change Account and Limit Settings'
do
visit
admin_application_settings_path
it
'Change Keys settings'
do
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
uncheck
'Gravatar enabled'
click_button
'Save changes'
...
...
@@ -88,8 +101,6 @@ describe 'Admin updates settings' do
end
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
)
expect
(
user_internal_regex
).
to
be_readonly
...
...
@@ -102,8 +113,6 @@ describe 'Admin updates settings' do
end
it
'Change Sign-in restrictions'
do
visit
admin_application_settings_path
page
.
within
(
'.as-signin'
)
do
fill_in
'Home page URL'
,
with:
'https://about.gitlab.com/'
click_button
'Save changes'
...
...
@@ -114,8 +123,6 @@ describe 'Admin updates settings' do
end
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.
_existing_terms
=
create
(
:term
)
accept_terms
(
admin
)
...
...
@@ -132,8 +139,6 @@ describe 'Admin updates settings' do
end
it
'Modify oauth providers'
do
visit
admin_application_settings_path
expect
(
Gitlab
::
CurrentSettings
.
disabled_oauth_sign_in_sources
).
to
be_empty
page
.
within
(
'.as-signin'
)
do
...
...
@@ -154,8 +159,6 @@ describe 'Admin updates settings' do
end
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
page
.
within
(
'.as-signin'
)
do
...
...
@@ -178,36 +181,58 @@ describe 'Admin updates settings' do
expect
(
Gitlab
::
CurrentSettings
.
disabled_oauth_sign_in_sources
).
to
include
(
'google_oauth2'
)
end
it
'Change Help page'
do
visit
preferences_admin_application_settings_path
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'
it
'Configure web terminal'
do
page
.
within
(
'.as-terminal'
)
do
fill_in
'Max session time'
,
with:
15
click_button
'Save changes'
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
(
Gitlab
::
CurrentSettings
.
terminal_max_session_time
).
to
eq
(
15
)
end
end
it
'Change Pages settings'
do
visit
preferences_admin_application_settings_path
context
'Integrations page'
do
before
do
visit
integrations_admin_application_settings_path
end
page
.
within
(
'.as-pages'
)
do
fill_in
'Maximum size of pages (MB)'
,
with:
15
check
'Require users to prove ownership of custom domains
'
it
'Enable hiding third party offers'
do
page
.
within
(
'.as-third-party-offers'
)
do
check
'Do not display offers from third parties within GitLab
'
click_button
'Save changes'
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
(
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
context
'CI/CD page'
do
it
'Change CI/CD settings'
do
visit
ci_cd_admin_application_settings_path
...
...
@@ -221,10 +246,32 @@ describe 'Admin updates settings' do
expect
(
Gitlab
::
CurrentSettings
.
auto_devops_domain
).
to
eq
(
'domain.com'
)
expect
(
page
).
to
have_content
"Application settings saved successfully"
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
end
it
'Change Influx settings'
do
page
.
within
(
'.as-influx'
)
do
check
'Enable InfluxDB Metrics'
click_button
'Save changes'
...
...
@@ -235,8 +282,6 @@ describe 'Admin updates settings' do
end
it
'Change Prometheus settings'
do
visit
metrics_and_profiling_admin_application_settings_path
page
.
within
(
'.as-prometheus'
)
do
check
'Enable Prometheus Metrics'
click_button
'Save changes'
...
...
@@ -247,8 +292,6 @@ describe 'Admin updates settings' do
end
it
'Change Performance bar settings'
do
visit
metrics_and_profiling_admin_application_settings_path
group
=
create
(
:group
)
page
.
within
(
'.as-performance-bar'
)
do
...
...
@@ -271,46 +314,17 @@ describe 'Admin updates settings' do
expect
(
find_field
(
'Allowed group'
).
value
).
to
be_nil
end
it
'Change Background jobs settings'
do
visit
preferences_admin_application_settings_path
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
'loads usage ping payload on click'
,
:js
do
expect
(
page
).
to
have_button
'Preview payload'
it
'Configure web terminal'
do
visit
admin_application_settings_path
find
(
'.js-usage-ping-payload-trigger'
).
click
page
.
within
(
'.as-terminal'
)
do
fill_in
'Max session time'
,
with:
15
click_button
'Save changes'
expect
(
page
).
to
have_selector
'.js-usage-ping-payload'
expect
(
page
).
to
have_button
'Hide payload'
end
expect
(
page
).
to
have_content
"Application settings saved successfully"
expect
(
Gitlab
::
CurrentSettings
.
terminal_max_session_time
).
to
eq
(
15
)
end
context
'Network page'
do
it
'Enable outbound requests'
do
visit
network_admin_application_settings_path
...
...
@@ -322,74 +336,48 @@ describe 'Admin updates settings' do
expect
(
page
).
to
have_content
"Application settings saved successfully"
expect
(
Gitlab
::
CurrentSettings
.
allow_local_requests_from_hooks_and_services
).
to
be
true
end
end
it
'Enable hiding third party offers'
do
visit
integrations_admin_application_settings_path
context
'Preferences page'
do
before
do
visit
preferences_admin_application_settings_path
end
page
.
within
(
'.as-third-party-offers'
)
do
check
'Do not display offers from third parties within GitLab'
it
'Change Help page'
do
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'
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
(
Gitlab
::
CurrentSettings
.
hide_third_party_offers
).
to
be
true
end
it
'Change Slack Notifications Service template settings'
do
visit
integrations_admin_application_settings_path
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'
it
'Change Pages settings'
do
page
.
within
(
'.as-pages'
)
do
fill_in
'Maximum size of pages (MB)'
,
with:
15
check
'Require users to prove ownership of custom domains'
click_button
'Save changes'
end
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'
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"
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
)
it
'Change Background jobs settings'
do
page
.
within
(
'.as-background'
)
do
fill_in
'Throttling Factor'
,
with:
1
click_button
'Save changes'
end
it
'loads usage ping payload on click'
,
:js
do
visit
metrics_and_profiling_admin_application_settings_path
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'
expect
(
Gitlab
::
CurrentSettings
.
sidekiq_throttling_factor
).
to
eq
(
1
)
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
end
def
check_all_events
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment