Commit d7b32ec1 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-e2e-secure-merge-request-reports' into 'master'

Added E2E test for all Secure reports in MRs

Closes gitlab-org/quality/testcases#127, gitlab-org/quality/testcases#128, and gitlab-org/quality/testcases#129

See merge request gitlab-org/gitlab!17014
parents 5f2b202a e6673393
......@@ -351,6 +351,7 @@ export default {
:status-icon="sastStatusIcon"
:popover-options="sastPopover"
class="js-sast-widget"
data-qa-selector="sast_scan_report"
/>
<issues-list
......@@ -369,6 +370,7 @@ export default {
:status-icon="dependencyScanningStatusIcon"
:popover-options="dependencyScanningPopover"
class="js-dependency-scanning-widget"
data-qa-selector="dependency_scan_report"
/>
<issues-list
......@@ -386,6 +388,7 @@ export default {
:status-icon="sastContainerStatusIcon"
:popover-options="sastContainerPopover"
class="js-sast-container"
data-qa-selector="container_scan_report"
/>
<issues-list
......@@ -403,6 +406,7 @@ export default {
:status-icon="dastStatusIcon"
:popover-options="dastPopover"
class="js-dast-widget"
data-qa-selector="dast_scan_report"
/>
<issues-list
......
......@@ -39,6 +39,10 @@ module QA
view 'ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue' do
element :vulnerability_report_grouped
element :sast_scan_report
element :dependency_scan_report
element :container_scan_report
element :dast_scan_report
end
view 'app/assets/javascripts/reports/components/report_section.vue' do
......@@ -129,11 +133,28 @@ module QA
finished_loading?
has_element?(:vulnerability_report_grouped, wait: 1)
end
find_element(:vulnerability_report_grouped).has_no_content?("is loading")
end
def has_detected_vulnerability_count_of?(expected)
def has_total_vulnerability_count_of?(expected)
# Match text cut off in order to find both "1 vulnerability" and "X vulnerabilities"
find_element(:vulnerability_report_grouped).has_content?("detected #{expected} vulnerabilit")
find_element(:vulnerability_report_grouped).has_content?("Security scanning detected #{expected} vulnerabilit")
end
def has_sast_vulnerability_count_of?(expected)
find_element(:sast_scan_report).has_content?("SAST detected #{expected} vulnerabilit")
end
def has_dependency_vulnerability_count_of?(expected)
find_element(:dependency_scan_report).has_content?("Dependency scanning detected #{expected} vulnerabilit")
end
def has_container_vulnerability_count_of?(expected)
find_element(:container_scan_report).has_content?("Container scanning detected #{expected} vulnerabilit")
end
def has_dast_vulnerability_count_of?(expected)
find_element(:dast_scan_report).has_content?("DAST detected #{expected} vulnerabilit")
end
def num_approvals_required
......
......@@ -6,6 +6,10 @@ module QA
context 'Secure', :docker do
describe 'Security Reports in a Merge Request' do
let(:total_vuln_count) { 49 }
let(:sast_vuln_count) { 33 }
let(:dependency_scan_vuln_count) { 4 }
let(:container_scan_vuln_count) { 8 }
let(:dast_vuln_count) { 4 }
after do
Service::Runner.new(@executor).remove!
......@@ -56,10 +60,17 @@ module QA
merge_request.visit!
end
it 'displays the Security report in the merge request' do
it 'displays the Security reports in the merge request' do
Page::MergeRequest::Show.perform do |mergerequest|
expect(mergerequest).to have_vulnerability_report(timeout: 60)
expect(mergerequest).to have_detected_vulnerability_count_of total_vuln_count
expect(mergerequest).to have_total_vulnerability_count_of(total_vuln_count)
mergerequest.expand_vulnerability_report
expect(mergerequest).to have_sast_vulnerability_count_of(sast_vuln_count)
expect(mergerequest).to have_dependency_vulnerability_count_of(dependency_scan_vuln_count)
expect(mergerequest).to have_container_vulnerability_count_of(container_scan_vuln_count)
expect(mergerequest).to have_dast_vulnerability_count_of(dast_vuln_count)
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