Commit bbef7363 authored by Aleksandr Soborov's avatar Aleksandr Soborov Committed by Sanad Liaquat

Added a Secure E2E test for auto-remediation

Updated selectors where necessary.

Updated fixture and tests that have changed results.
parent 673ab5b2
...@@ -102,6 +102,7 @@ export default { ...@@ -102,6 +102,7 @@ export default {
v-if="actionButtons.length > 1" v-if="actionButtons.length > 1"
:buttons="actionButtons" :buttons="actionButtons"
class="js-split-button" class="js-split-button"
data-qa-selector="resolve_split_button"
@createMergeRequest="$emit('createMergeRequest')" @createMergeRequest="$emit('createMergeRequest')"
@createNewIssue="$emit('createNewIssue')" @createNewIssue="$emit('createNewIssue')"
@downloadPatch="$emit('downloadPatch')" @downloadPatch="$emit('downloadPatch')"
......
This diff is collapsed.
...@@ -41,6 +41,14 @@ module QA ...@@ -41,6 +41,14 @@ module QA
element :vulnerability_report_grouped element :vulnerability_report_grouped
end end
view 'app/assets/javascripts/reports/components/report_section.vue' do
element :expand_report_button
end
view 'ee/app/assets/javascripts/vue_shared/security_reports/components/modal_footer.vue' do
element :resolve_split_button
end
def start_review def start_review
click_element :start_review click_element :start_review
end end
...@@ -78,6 +86,22 @@ module QA ...@@ -78,6 +86,22 @@ module QA
end end
end end
def expand_vulnerability_report
click_element :expand_report_button
end
def click_vulnerability(name)
within_element :vulnerability_report_grouped do
click_on name
end
end
def resolve_vulnerability_with_mr(name)
expand_vulnerability_report
click_vulnerability(name)
click_element :resolve_split_button
end
def has_vulnerability_report?(timeout: 60) def has_vulnerability_report?(timeout: 60)
wait(reload: true, max: timeout, interval: 1) do wait(reload: true, max: timeout, interval: 1) do
finished_loading? finished_loading?
......
...@@ -51,7 +51,17 @@ module QA ...@@ -51,7 +51,17 @@ module QA
it 'displays the Security report in the merge request' do it 'displays the Security report 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 "2" expect(mergerequest).to have_detected_vulnerability_count_of "4"
end
end
it 'can create an auto-remediation MR' do
Page::MergeRequest::Show.perform do |mergerequest|
vuln_name = "Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js"
expect(mergerequest).to have_vulnerability_report(timeout: 60)
mergerequest.resolve_vulnerability_with_mr vuln_name
expect(mergerequest).to have_title vuln_name
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
require 'pathname' require 'pathname'
NUMBER_OF_DEPENDENCIES_IN_FIXTURE = 1309
module QA module QA
context 'Secure', :docker do context 'Secure', :docker do
...@@ -57,7 +58,7 @@ module QA ...@@ -57,7 +58,7 @@ module QA
Page::Project::Pipeline::Show.perform do |pipeline| Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_on_security pipeline.click_on_security
expect(pipeline).to have_dependency_report expect(pipeline).to have_dependency_report
expect(pipeline).to have_content("Dependency scanning detected 2") expect(pipeline).to have_content("Dependency scanning detected 4")
pipeline.expand_dependency_report pipeline.expand_dependency_report
expect(pipeline).to have_content("jQuery before 3.4.0") expect(pipeline).to have_content("jQuery before 3.4.0")
end end
...@@ -87,7 +88,7 @@ module QA ...@@ -87,7 +88,7 @@ module QA
Page::Project::Menu.perform(&:click_on_dependency_list) Page::Project::Menu.perform(&:click_on_dependency_list)
EE::Page::Project::Secure::DependencyList.perform do |page| EE::Page::Project::Secure::DependencyList.perform do |page|
expect(page).to have_dependency_count_of "1293" expect(page).to have_dependency_count_of NUMBER_OF_DEPENDENCIES_IN_FIXTURE
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