Commit 5cedcf5e authored by Nailia Iskhakova's avatar Nailia Iskhakova Committed by Savas Vedova

Disable SAST on project creation in QA spec during the experiment

parent 3ec0fd33
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
- e.try do - e.try do
.form-group .form-group
.form-check.gl-mb-3 .form-check.gl-mb-3
= check_box_tag 'project[initialize_with_sast]', '1', true, class: 'form-check-input', data: { track_experiment: e.name, track_label: track_label, track_action: 'activate_form_input', track_property: 'init_with_sast' } = 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 = label_tag 'project[initialize_with_sast]', class: 'form-check-label' do
= s_('ProjectsNew|Enable Static Application Security Testing (SAST)') = s_('ProjectsNew|Enable Static Application Security Testing (SAST)')
.form-text.text-muted .form-text.text-muted
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
- e.try(:free_indicator) do - e.try(:free_indicator) do
.form-group .form-group
.form-check.gl-mb-3 .form-check.gl-mb-3
= check_box_tag 'project[initialize_with_sast]', '1', true, class: 'form-check-input', data: { track_experiment: e.name, track_label: track_label, track_action: 'activate_form_input', track_property: 'init_with_sast' } = 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 = label_tag 'project[initialize_with_sast]', class: 'form-check-label' do
= s_('ProjectsNew|Enable Static Application Security Testing (SAST)') = s_('ProjectsNew|Enable Static Application Security Testing (SAST)')
%span.badge.badge-info.badge-pill.gl-badge.sm= _('Free') %span.badge.badge-info.badge-pill.gl-badge.sm= _('Free')
......
...@@ -13,6 +13,7 @@ module QA ...@@ -13,6 +13,7 @@ module QA
view 'app/views/projects/_new_project_fields.html.haml' do view 'app/views/projects/_new_project_fields.html.haml' do
element :initialize_with_readme_checkbox element :initialize_with_readme_checkbox
element :initialize_with_sast_checkbox
element :project_namespace_field, 'namespaces_options' # rubocop:disable QA/ElementWithPattern element :project_namespace_field, 'namespaces_options' # rubocop:disable QA/ElementWithPattern
element :project_name, 'text_field :name' # rubocop:disable QA/ElementWithPattern element :project_name, 'text_field :name' # rubocop:disable QA/ElementWithPattern
element :project_path, 'text_field :path' # rubocop:disable QA/ElementWithPattern element :project_path, 'text_field :path' # rubocop:disable QA/ElementWithPattern
...@@ -79,6 +80,13 @@ module QA ...@@ -79,6 +80,13 @@ module QA
choose visibility.capitalize choose visibility.capitalize
end end
# Disable experiment for SAST at project creation https://gitlab.com/gitlab-org/gitlab/-/issues/333196
def disable_initialize_with_sast
return unless has_element?(:initialize_with_sast_checkbox)
uncheck_element(:initialize_with_sast_checkbox)
end
def click_github_link def click_github_link
click_link 'GitHub' click_link 'GitHub'
end end
......
...@@ -93,6 +93,7 @@ module QA ...@@ -93,6 +93,7 @@ module QA
new_page.choose_name(@name) new_page.choose_name(@name)
new_page.add_description(@description) new_page.add_description(@description)
new_page.set_visibility(@visibility) new_page.set_visibility(@visibility)
new_page.disable_initialize_with_sast
new_page.disable_initialize_with_readme unless @initialize_with_readme new_page.disable_initialize_with_readme unless @initialize_with_readme
new_page.create_new_project new_page.create_new_project
end end
......
...@@ -5,13 +5,13 @@ module QA ...@@ -5,13 +5,13 @@ module QA
describe 'Project', :requires_admin do describe 'Project', :requires_admin do
shared_examples 'successful project creation' do shared_examples 'successful project creation' do
it 'creates a new project' do it 'creates a new project' do
Page::Project::Show.perform do |project| Page::Project::Show.perform do |project_page|
expect(project).to have_content(project_name) expect(project_page).to have_content(project_name)
expect(project).to have_content( expect(project_page).to have_content(
/Project \S?#{project_name}\S+ was successfully created/ /Project \S?#{project_name}\S+ was successfully created/
) )
expect(project).to have_content('create awesome project test') expect(project_page).to have_content('create awesome project test')
expect(project).to have_content('The repository for this project is empty') expect(project_page).to have_content('The repository for this project is empty')
end end
end end
end end
......
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