Commit 1daa02f8 authored by Aleksandr Soborov's avatar Aleksandr Soborov Committed by Dan Davison

Break out the Secure report into a page object component

Additionally change page objects to use this new component.
parent 5fdb7ced
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
</script> </script>
<template> <template>
<div class="ci-table js-security-dashboard-table"> <div class="ci-table js-security-dashboard-table" data-qa-selector="security_report_content">
<div <div
class="gl-responsive-table-row table-row-header vulnerabilities-row-header px-2" class="gl-responsive-table-row table-row-header vulnerabilities-row-header px-2"
role="row" role="row"
......
...@@ -15,6 +15,7 @@ module QA ...@@ -15,6 +15,7 @@ module QA
module Component module Component
autoload :DesignManagement, 'qa/ee/page/component/design_management' autoload :DesignManagement, 'qa/ee/page/component/design_management'
autoload :LicenseManagement, 'qa/ee/page/component/license_management' autoload :LicenseManagement, 'qa/ee/page/component/license_management'
autoload :SecureReport, 'qa/ee/page/component/secure_report'
module IssueBoard module IssueBoard
autoload :Show, 'qa/ee/page/component/issue_board/show' autoload :Show, 'qa/ee/page/component/issue_board/show'
......
# frozen_string_literal: true
module QA
module EE
module Page
module Component
module SecureReport
def self.prepended(page)
page.module_eval do
view 'ee/app/assets/javascripts/security_dashboard/components/filter.vue' do
element :filter_dropdown, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern
element :filter_dropdown_content
end
view 'ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table_row.vue' do
element :vulnerability_info_content
end
end
end
def filter_report_type(report)
click_element(:filter_report_type_dropdown)
within_element(:filter_dropdown_content) do
click_on report
end
# Click the dropdown to close the modal and ensure it isn't open if this function is called again
click_element(:filter_report_type_dropdown)
end
def has_vulnerability?(name)
has_element?(:vulnerability_info_content, text: name)
end
end
end
end
end
end
...@@ -5,13 +5,10 @@ module QA ...@@ -5,13 +5,10 @@ module QA
module Page module Page
module Group::Secure module Group::Secure
class Show < QA::Page::Base class Show < QA::Page::Base
view 'ee/app/assets/javascripts/security_dashboard/components/filter.vue' do include Page::Component::SecureReport
element :filter_dropdown, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern
element :filter_dropdown_content
end
view 'ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table_row.vue' do view 'ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table.vue' do
element :vulnerability_info_content element :security_report_content, required: true
end end
def filter_project(project) def filter_project(project)
...@@ -20,19 +17,6 @@ module QA ...@@ -20,19 +17,6 @@ module QA
click_on project click_on project
end end
end end
def filter_report_type(report)
click_element(:filter_report_type_dropdown)
within_element(:filter_dropdown_content) do
click_on report
end
# Click the dropdown to close the modal and ensure it isn't open if this function is called again
click_element(:filter_report_type_dropdown)
end
def has_vulnerability?(name)
has_element?(:vulnerability_info_content, text: name)
end
end end
end end
end end
......
...@@ -5,6 +5,7 @@ module QA::EE ...@@ -5,6 +5,7 @@ module QA::EE
module Pipeline module Pipeline
module Show module Show
include Page::Component::LicenseManagement include Page::Component::LicenseManagement
include Page::Component::SecureReport
def self.prepended(page) def self.prepended(page)
page.module_eval do page.module_eval do
...@@ -13,19 +14,6 @@ module QA::EE ...@@ -13,19 +14,6 @@ module QA::EE
element :licenses_tab element :licenses_tab
element :licenses_counter element :licenses_counter
end end
view 'ee/app/assets/javascripts/security_dashboard/components/filter.vue' do
element :filter_dropdown, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern
element :filter_dropdown_content
end
view 'ee/app/views/projects/pipelines/_tabs_holder.html.haml' do
element :security_tab
end
view 'ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table_row.vue' do
element :vulnerability_info_content
end
end end
end end
...@@ -33,15 +21,6 @@ module QA::EE ...@@ -33,15 +21,6 @@ module QA::EE
click_element(:security_tab) click_element(:security_tab)
end end
def filter_report_type(report)
click_element(:filter_report_type_dropdown)
within_element(:filter_dropdown_content) do
click_on report
end
# Click the dropdown to close the modal and ensure it isn't open if this function is called again
click_element(:filter_report_type_dropdown)
end
def click_on_licenses def click_on_licenses
click_element(:licenses_tab) click_element(:licenses_tab)
end end
...@@ -49,10 +28,6 @@ module QA::EE ...@@ -49,10 +28,6 @@ module QA::EE
def has_license_count_of?(count) def has_license_count_of?(count)
find_element(:licenses_counter).has_content?(count) find_element(:licenses_counter).has_content?(count)
end end
def has_vulnerability?(name)
has_element?(:vulnerability_info_content, text: name)
end
end end
end end
end end
......
...@@ -5,26 +5,10 @@ module QA ...@@ -5,26 +5,10 @@ module QA
module Page module Page
module Project::Secure module Project::Secure
class Show < QA::Page::Base class Show < QA::Page::Base
view 'ee/app/assets/javascripts/security_dashboard/components/filter.vue' do include Page::Component::SecureReport
element :filter_dropdown, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern
element :filter_dropdown_content
end
view 'ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table_row.vue' do
element :vulnerability_info_content
end
def filter_report_type(report)
click_element(:filter_report_type_dropdown)
within_element(:filter_dropdown_content) do
click_on report
end
# Click the dropdown to close the modal and ensure it isn't open if this function is called again
click_element(:filter_report_type_dropdown)
end
def has_vulnerability?(name) view 'ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table.vue' do
has_element?(:vulnerability_info_content, text: name) element :security_report_content, required: true
end end
end end
end end
......
...@@ -6,6 +6,8 @@ module QA ...@@ -6,6 +6,8 @@ module QA
module Project module Project
module Settings module Settings
module MergeRequest module MergeRequest
include Page::Component::SecureReport
def self.prepended(page) def self.prepended(page)
page.module_eval do page.module_eval do
view 'ee/app/views/projects/_merge_pipelines_settings.html.haml' do view 'ee/app/views/projects/_merge_pipelines_settings.html.haml' do
......
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