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 { ...@@ -351,6 +351,7 @@ export default {
:status-icon="sastStatusIcon" :status-icon="sastStatusIcon"
:popover-options="sastPopover" :popover-options="sastPopover"
class="js-sast-widget" class="js-sast-widget"
data-qa-selector="sast_scan_report"
/> />
<issues-list <issues-list
...@@ -369,6 +370,7 @@ export default { ...@@ -369,6 +370,7 @@ export default {
:status-icon="dependencyScanningStatusIcon" :status-icon="dependencyScanningStatusIcon"
:popover-options="dependencyScanningPopover" :popover-options="dependencyScanningPopover"
class="js-dependency-scanning-widget" class="js-dependency-scanning-widget"
data-qa-selector="dependency_scan_report"
/> />
<issues-list <issues-list
...@@ -386,6 +388,7 @@ export default { ...@@ -386,6 +388,7 @@ export default {
:status-icon="sastContainerStatusIcon" :status-icon="sastContainerStatusIcon"
:popover-options="sastContainerPopover" :popover-options="sastContainerPopover"
class="js-sast-container" class="js-sast-container"
data-qa-selector="container_scan_report"
/> />
<issues-list <issues-list
...@@ -403,6 +406,7 @@ export default { ...@@ -403,6 +406,7 @@ export default {
:status-icon="dastStatusIcon" :status-icon="dastStatusIcon"
:popover-options="dastPopover" :popover-options="dastPopover"
class="js-dast-widget" class="js-dast-widget"
data-qa-selector="dast_scan_report"
/> />
<issues-list <issues-list
......
...@@ -39,6 +39,10 @@ module QA ...@@ -39,6 +39,10 @@ module QA
view 'ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue' do view 'ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue' do
element :vulnerability_report_grouped element :vulnerability_report_grouped
element :sast_scan_report
element :dependency_scan_report
element :container_scan_report
element :dast_scan_report
end end
view 'app/assets/javascripts/reports/components/report_section.vue' do view 'app/assets/javascripts/reports/components/report_section.vue' do
...@@ -129,11 +133,28 @@ module QA ...@@ -129,11 +133,28 @@ module QA
finished_loading? finished_loading?
has_element?(:vulnerability_report_grouped, wait: 1) has_element?(:vulnerability_report_grouped, wait: 1)
end end
find_element(:vulnerability_report_grouped).has_no_content?("is loading")
end 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" # 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 end
def num_approvals_required def num_approvals_required
......
...@@ -6,6 +6,10 @@ module QA ...@@ -6,6 +6,10 @@ module QA
context 'Secure', :docker do context 'Secure', :docker do
describe 'Security Reports in a Merge Request' do describe 'Security Reports in a Merge Request' do
let(:total_vuln_count) { 49 } 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 after do
Service::Runner.new(@executor).remove! Service::Runner.new(@executor).remove!
...@@ -56,10 +60,17 @@ module QA ...@@ -56,10 +60,17 @@ module QA
merge_request.visit! merge_request.visit!
end 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| Page::MergeRequest::Show.perform do |mergerequest|
expect(mergerequest).to have_vulnerability_report(timeout: 60) 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
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