Commit 4670a8d6 authored by Tiffany Rea's avatar Tiffany Rea

Separate Security Config page EE content

Add new module to qa.rb
Update EE class to module
Add new CE page object for secure configuration form
Refactor test accordingly
parent 3076d9f6
...@@ -423,6 +423,10 @@ module QA ...@@ -423,6 +423,10 @@ module QA
autoload :Show, 'qa/page/project/snippet/show' autoload :Show, 'qa/page/project/snippet/show'
autoload :Index, 'qa/page/project/snippet/index' autoload :Index, 'qa/page/project/snippet/index'
end end
module Secure
autoload :ConfigurationForm, 'qa/page/project/secure/configuration_form'
end
end end
module Profile module Profile
......
...@@ -5,16 +5,21 @@ module QA ...@@ -5,16 +5,21 @@ module QA
module Page module Page
module Project module Project
module Secure module Secure
class ConfigurationForm < QA::Page::Base module ConfigurationForm
include QA::Page::Component::Select2 extend QA::Page::PageConcern
include QA::Page::Settings::Common
view 'ee/app/assets/javascripts/security_configuration/sast/components/configuration_form.vue' do def self.prepended(base)
element :submit_button super
end
base.class_eval do
view 'ee/app/assets/javascripts/security_configuration/sast/components/configuration_form.vue' do
element :submit_button
end
view 'ee/app/assets/javascripts/security_configuration/sast/components/analyzer_configuration.vue' do view 'ee/app/assets/javascripts/security_configuration/sast/components/analyzer_configuration.vue' do
element :entity_checkbox, "`${entity.name}_checkbox`" # rubocop:disable QA/ElementWithPattern element :entity_checkbox, "`${entity.name}_checkbox`" # rubocop:disable QA/ElementWithPattern
end
end
end end
def click_expand_button def click_expand_button
...@@ -25,10 +30,6 @@ module QA ...@@ -25,10 +30,6 @@ module QA
click_element(:submit_button) click_element(:submit_button)
end end
def click_sast_enable_button
click_element('sast_enable_button')
end
def fill_dynamic_field(field_name, content) def fill_dynamic_field(field_name, content)
fill_element("#{field_name}_field", content) fill_element("#{field_name}_field", content)
end end
...@@ -36,12 +37,6 @@ module QA ...@@ -36,12 +37,6 @@ module QA
def unselect_dynamic_checkbox(checkbox_name) def unselect_dynamic_checkbox(checkbox_name)
uncheck_element("#{checkbox_name}_checkbox", true) uncheck_element("#{checkbox_name}_checkbox", true)
end end
def has_sast_status?(status_text)
within_element('sast_status') do
has_text?(status_text)
end
end
end end
end end
end end
......
# frozen_string_literal: true
module QA
module Page
module Project
module Secure
class ConfigurationForm < QA::Page::Base
include QA::Page::Component::Select2
include QA::Page::Settings::Common
view 'app/assets/javascripts/security_configuration/components/feature_card.vue' do
element :sast_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
element :sast_enable_button, "`${feature.type}_enable_button`" # rubocop:disable QA/ElementWithPattern
end
def click_sast_enable_button
click_element(:sast_enable_button)
end
def has_sast_status?(status_text)
within_element(:sast_status) do
has_text?(status_text)
end
end
end
end
end
end
end
QA::Page::Project::Secure::ConfigurationForm.prepend_mod_with('Page::Project::Secure::ConfigurationForm', namespace: QA)
...@@ -79,7 +79,7 @@ module QA ...@@ -79,7 +79,7 @@ module QA
end end
Page::Project::Menu.perform(&:click_on_security_configuration_link) Page::Project::Menu.perform(&:click_on_security_configuration_link)
EE::Page::Project::Secure::ConfigurationForm.perform do |config_form| Page::Project::Secure::ConfigurationForm.perform do |config_form|
expect(config_form).to have_sast_status('Not enabled') expect(config_form).to have_sast_status('Not enabled')
config_form.click_sast_enable_button config_form.click_sast_enable_button
...@@ -131,7 +131,7 @@ module QA ...@@ -131,7 +131,7 @@ module QA
Page::Project::Menu.perform(&:click_on_security_configuration_link) Page::Project::Menu.perform(&:click_on_security_configuration_link)
EE::Page::Project::Secure::ConfigurationForm.perform do |config_form| Page::Project::Secure::ConfigurationForm.perform do |config_form|
aggregate_failures "test SAST status is Enabled" do aggregate_failures "test SAST status is Enabled" do
expect(config_form).to have_sast_status('Enabled') expect(config_form).to have_sast_status('Enabled')
expect(config_form).not_to have_sast_status('Not enabled') expect(config_form).not_to have_sast_status('Not enabled')
......
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