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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b4bd344e
Commit
b4bd344e
authored
Dec 07, 2021
by
jejacks0n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new unchecked variant to test interactions
parent
3d8cd03b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
13 deletions
+41
-13
app/experiments/new_project_sast_enabled_experiment.rb
app/experiments/new_project_sast_enabled_experiment.rb
+3
-0
app/views/projects/_new_project_fields.html.haml
app/views/projects/_new_project_fields.html.haml
+12
-12
spec/experiments/new_project_sast_enabled_experiment_spec.rb
spec/experiments/new_project_sast_enabled_experiment_spec.rb
+1
-1
spec/features/projects/user_creates_project_spec.rb
spec/features/projects/user_creates_project_spec.rb
+25
-0
No files found.
app/experiments/new_project_sast_enabled_experiment.rb
View file @
b4bd344e
...
...
@@ -12,4 +12,7 @@ class NewProjectSastEnabledExperiment < ApplicationExperiment # rubocop:disable
def
free_indicator_behavior
end
def
unchecked_candidate_behavior
end
end
app/views/projects/_new_project_fields.html.haml
View file @
b4bd344e
...
...
@@ -74,25 +74,25 @@
=
s_
(
'ProjectsNew|Allows you to immediately clone this project’s repository. Skip this if you plan to push up an existing repository.'
)
-
experiment
(
:new_project_sast_enabled
,
user:
current_user
)
do
|
e
|
-
e
.
try
do
.form-
group
.form-check.gl-mb-3
.form-group
.form-
check.gl-mb-3
-
e
.
try
(
:candidate
)
do
=
check_box_tag
'project[initialize_with_sast]'
,
'1'
,
true
,
class:
'form-check-input'
,
data:
{
qa_selector:
'initialize_with_sast_checkbox'
,
track_experiment:
e
.
name
,
track_label:
track_label
,
track_action:
'activate_form_input'
,
track_property:
'init_with_sast'
}
=
label_tag
'project[initialize_with_sast]'
,
class:
'form-check-label'
do
=
s_
(
'ProjectsNew|Enable Static Application Security Testing (SAST)'
)
.form-text.text-muted
=
s_
(
'ProjectsNew|Analyze your source code for known security vulnerabilities.'
)
=
link_to
_
(
'Learn more.'
),
help_page_path
(
'user/application_security/sast/index'
),
target:
'_blank'
,
rel:
'noopener noreferrer'
,
data:
{
track_action:
'followed'
,
track_experiment:
e
.
name
}
-
e
.
try
(
:free_indicator
)
do
.form-group
.form-check.gl-mb-3
-
e
.
try
(
:free_indicator
)
do
=
check_box_tag
'project[initialize_with_sast]'
,
'1'
,
true
,
class:
'form-check-input'
,
data:
{
qa_selector:
'initialize_with_sast_checkbox'
,
track_experiment:
e
.
name
,
track_label:
track_label
,
track_action:
'activate_form_input'
,
track_property:
'init_with_sast'
}
=
label_tag
'project[initialize_with_sast]'
,
class:
'form-check-label'
do
=
s_
(
'ProjectsNew|Enable Static Application Security Testing (SAST)'
)
%span
.badge.badge-info.badge-pill.gl-badge.sm
=
_
(
'Free'
)
.form-text.text-muted
=
s_
(
'ProjectsNew|Analyze your source code for known security vulnerabilities.'
)
=
link_to
_
(
'Learn more.'
),
help_page_path
(
'user/application_security/sast/index'
),
target:
'_blank'
,
rel:
'noopener noreferrer'
,
data:
{
track_action:
'followed'
,
track_experiment:
e
.
name
}
-
e
.
try
(
:unchecked_candidate
)
do
=
check_box_tag
'project[initialize_with_sast]'
,
'1'
,
false
,
class:
'form-check-input'
,
data:
{
qa_selector:
'initialize_with_sast_checkbox'
,
track_experiment:
e
.
name
,
track_label:
track_label
,
track_action:
'activate_form_input'
,
track_property:
'init_with_sast'
}
=
label_tag
'project[initialize_with_sast]'
,
class:
'form-check-label'
do
=
s_
(
'ProjectsNew|Enable Static Application Security Testing (SAST)'
)
.form-text.text-muted
=
s_
(
'ProjectsNew|Analyze your source code for known security vulnerabilities.'
)
=
link_to
_
(
'Learn more.'
),
help_page_path
(
'user/application_security/sast/index'
),
target:
'_blank'
,
rel:
'noopener noreferrer'
,
data:
{
track_action:
'followed'
,
track_experiment:
e
.
name
}
=
f
.
submit
_
(
'Create project'
),
class:
"btn gl-button btn-confirm"
,
data:
{
track_label:
"
#{
track_label
}
"
,
track_action:
"click_button"
,
track_property:
"create_project"
,
track_value:
""
}
=
link_to
_
(
'Cancel'
),
dashboard_projects_path
,
class:
'btn gl-button btn-default btn-cancel'
,
data:
{
track_label:
"
#{
track_label
}
"
,
track_action:
"click_button"
,
track_property:
"cancel"
,
track_value:
""
}
spec/experiments/new_project_sast_enabled_experiment_spec.rb
View file @
b4bd344e
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec
.
describe
NewProjectSastEnabledExperiment
do
it
"defines the expected behaviors and variants"
do
expect
(
subject
.
behaviors
.
keys
).
to
match_array
(
%w[control candidate free_indicator]
)
expect
(
subject
.
behaviors
.
keys
).
to
match_array
(
%w[control candidate free_indicator
unchecked_candidate
]
)
end
it
"publishes to the database"
do
...
...
spec/features/projects/user_creates_project_spec.rb
View file @
b4bd344e
...
...
@@ -56,6 +56,31 @@ RSpec.describe 'User creates a project', :js do
expect
(
page
).
to
have_content
(
'README.md Initial commit'
)
end
it
'allows creating a new project when the new_project_sast_enabled is assigned the unchecked candidate'
do
stub_experiments
(
new_project_sast_enabled:
'unchecked_candidate'
)
visit
(
new_project_path
)
click_link
'Create blank project'
fill_in
(
:project_name
,
with:
'With initial commits'
)
expect
(
page
).
to
have_checked_field
'Initialize repository with a README'
expect
(
page
).
to
have_unchecked_field
'Enable Static Application Security Testing (SAST)'
check
'Enable Static Application Security Testing (SAST)'
page
.
within
(
'#content-body'
)
do
click_button
(
'Create project'
)
end
project
=
Project
.
last
expect
(
current_path
).
to
eq
(
project_path
(
project
))
expect
(
page
).
to
have_content
(
'With initial commits'
)
expect
(
page
).
to
have_content
(
'Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist'
)
expect
(
page
).
to
have_content
(
'README.md Initial commit'
)
end
context
'in a subgroup they do not own'
do
let
(
:parent
)
{
create
(
:group
)
}
let!
(
:subgroup
)
{
create
(
:group
,
parent:
parent
)
}
...
...
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