Commit d0b35fde authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'secure_report_spec_fix' into 'master'

Fix security_reports_spec test

Closes #213676

See merge request gitlab-org/gitlab!37820
parents a8f152d8 fd16c878
...@@ -90,6 +90,7 @@ export default { ...@@ -90,6 +90,7 @@ export default {
:fields="$options.fields" :fields="$options.fields"
:items="localDependencies" :items="localDependencies"
:busy="isLoading" :busy="isLoading"
data-qa-selector="dependencies_table_content"
details-td-class="pt-0" details-td-class="pt-0"
stacked="md" stacked="md"
thead-class="gl-text-gray-900" thead-class="gl-text-gray-900"
......
...@@ -23,16 +23,20 @@ module QA ...@@ -23,16 +23,20 @@ module QA
end end
def filter_report_type(report) def filter_report_type(report)
click_element(:filter_report_type_dropdown) click_element(:filter_scanner_dropdown)
within_element(:filter_dropdown_content) do within_element(:filter_dropdown_content) do
click_on report click_on report
end end
# Click the dropdown to close the modal and ensure it isn't open if this function is called again # 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) click_element(:filter_scanner_dropdown)
end end
def has_vulnerability?(name) def has_vulnerability?(name)
has_element?(:vulnerability, text: name)
end
def has_vulnerability_info_content?(name)
has_element?(:vulnerability_info_content, text: name) has_element?(:vulnerability_info_content, text: name)
end end
end end
......
...@@ -6,12 +6,15 @@ module QA ...@@ -6,12 +6,15 @@ module QA
module Project module Project
module Secure module Secure
class DependencyList < QA::Page::Base class DependencyList < QA::Page::Base
view 'ee/app/assets/javascripts/dependencies/components/app.vue' do view 'ee/app/assets/javascripts/dependencies/components/dependencies_table.vue' do
element :dependency_list_all_count, "dependency_list_${label.toLowerCase().replace(' ', '_')" # rubocop:disable QA/ElementWithPattern element :dependencies_table_content
end end
def has_dependency_count_of?(expected) def has_dependency_count_of?(expected)
find_element(:dependency_list_all_count).has_content?(expected) within_element(:dependencies_table_content) do
# expected rows plus header row
header_row = 1
all('tr').count.equal?(expected + header_row)
end
end end
end end
end end
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'pathname' require 'pathname'
module QA module QA
RSpec.describe 'Secure', :docker, :runner, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/213676', type: :investigating } do RSpec.describe 'Secure', :docker, :runner do
let(:number_of_dependencies_in_fixture) { 7 } let(:number_of_dependencies_in_fixture) { 9 }
let(:dependency_scan_example_vuln) { 'Prototype pollution attack in mixin-deep' } let(:dependency_scan_example_vuln) { 'Prototype pollution attack in mixin-deep' }
let(:container_scan_example_vuln) { 'CVE-2017-18269 in glibc' } let(:container_scan_example_vuln) { 'CVE-2017-18269 in glibc' }
let(:sast_scan_example_vuln) { 'Cipher with no integrity' } let(:sast_scan_example_vuln) { 'Cipher with no integrity' }
...@@ -57,19 +57,19 @@ module QA ...@@ -57,19 +57,19 @@ module QA
pipeline.click_on_security pipeline.click_on_security
filter_report_and_perform(pipeline, "Dependency Scanning") do filter_report_and_perform(pipeline, "Dependency Scanning") do
expect(pipeline).to have_vulnerability dependency_scan_example_vuln expect(pipeline).to have_vulnerability_info_content dependency_scan_example_vuln
end end
filter_report_and_perform(pipeline, "Container Scanning") do filter_report_and_perform(pipeline, "Container Scanning") do
expect(pipeline).to have_vulnerability container_scan_example_vuln expect(pipeline).to have_vulnerability_info_content container_scan_example_vuln
end end
filter_report_and_perform(pipeline, "SAST") do filter_report_and_perform(pipeline, "SAST") do
expect(pipeline).to have_vulnerability sast_scan_example_vuln expect(pipeline).to have_vulnerability_info_content sast_scan_example_vuln
end end
filter_report_and_perform(pipeline, "DAST") do filter_report_and_perform(pipeline, "DAST") do
expect(pipeline).to have_vulnerability dast_scan_example_vuln expect(pipeline).to have_vulnerability_info_content dast_scan_example_vuln
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