Commit 179473ff authored by Aleksandr Soborov's avatar Aleksandr Soborov Committed by Tanya Pazitny

Fix and unquarantine Secure E2E tests

Fixes for UI changes. Adds new selectors where necessary.
parent 8239bfd4
...@@ -289,7 +289,8 @@ export default { ...@@ -289,7 +289,8 @@ export default {
:unresolved-issues="dependencyScanning.newIssues" :unresolved-issues="dependencyScanning.newIssues"
:has-issues="dependencyScanning.newIssues.length > 0" :has-issues="dependencyScanning.newIssues.length > 0"
:popover-options="dependencyScanningPopover" :popover-options="dependencyScanningPopover"
class="js-dss-widget split-report-section qa-dependency-scanning-report" class="js-dss-widget split-report-section"
data-qa-selector="dependency_scanning_report"
/> />
<report-section <report-section
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
- if pipeline.expose_security_dashboard? - if pipeline.expose_security_dashboard?
%li.js-security-tab-link %li.js-security-tab-link
= link_to security_project_pipeline_path(project, pipeline), data: { target: '#js-tab-security', action: 'security', toggle: 'tab' }, class: 'security-tab qa-security-tab' do = link_to security_project_pipeline_path(project, pipeline), data: { target: '#js-tab-security', action: 'security', toggle: 'tab' }, class: 'security-tab', 'data-qa-selector': 'security_tab' do
= _("Security") = _("Security")
%span.badge.badge-pill.js-security-counter.hidden %span.badge.badge-pill.js-security-counter.hidden{ 'data-qa-selector': 'security_counter' }
- if pipeline.expose_license_management_data? - if pipeline.expose_license_management_data?
%li.js-licenses-tab-link %li.js-licenses-tab-link
......
...@@ -21,6 +21,13 @@ module QA ...@@ -21,6 +21,13 @@ module QA
end end
end end
def filter_report_type(report)
find_element(:filter_report_type_dropdown).click
within_element(:filter_dropdown_content) do
click_on report
end
end
def has_low_vulnerability_count_of?(expected) def has_low_vulnerability_count_of?(expected)
find_element(:vulnerability_count_low).has_content?(expected) find_element(:vulnerability_count_low).has_content?(expected)
end end
......
...@@ -7,14 +7,12 @@ module QA::EE::Page ...@@ -7,14 +7,12 @@ module QA::EE::Page
page.module_eval do page.module_eval do
view 'ee/app/views/projects/pipelines/_tabs_holder.html.haml' do view 'ee/app/views/projects/pipelines/_tabs_holder.html.haml' do
element :security_tab element :security_tab
element :security_counter
end end
view 'ee/app/assets/javascripts/vue_shared/security_reports/split_security_reports_app.vue' do view 'ee/app/assets/javascripts/security_dashboard/components/filter.vue' do
element :dependency_scanning_report element :filter_dropdown, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern
end element :filter_dropdown_content
view 'app/assets/javascripts/reports/components/report_section.vue' do
element :expand_report_button
end end
end end
end end
...@@ -23,13 +21,14 @@ module QA::EE::Page ...@@ -23,13 +21,14 @@ module QA::EE::Page
click_element(:security_tab) click_element(:security_tab)
end end
def has_dependency_report? def has_vulnerability_count_of?(count)
find_element(:dependency_scanning_report) find_element(:security_counter).has_content?(count)
end end
def expand_dependency_report def filter_report_type(report)
within_element(:dependency_scanning_report) do find_element(:filter_report_type_dropdown).click
click_element(:expand_report_button) within_element(:filter_dropdown_content) do
click_on report
end end
end end
end end
......
...@@ -9,6 +9,18 @@ module QA ...@@ -9,6 +9,18 @@ module QA
element :vulnerability_count, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern element :vulnerability_count, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern
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
def filter_report_type(report)
find_element(:filter_report_type_dropdown).click
within_element(:filter_dropdown_content) do
click_on report
end
end
def has_low_vulnerability_count_of?(expected) def has_low_vulnerability_count_of?(expected)
find_element(:vulnerability_count_low).has_content?(expected) find_element(:vulnerability_count_low).has_content?(expected)
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
let(:number_of_dependencies_in_fixture) { 1309 }
let(:dependency_scan_example_vuln) { 'jQuery before 3.4.0' }
def login def login
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Login.perform(&:sign_in_using_credentials)
end end
def wait_for_job(job_name)
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job(job_name)
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
end
end
describe 'Security Reports' do describe 'Security Reports' do
after do after do
Service::Runner.new(@executor).remove! Service::Runner.new(@executor).remove!
...@@ -42,56 +53,55 @@ module QA ...@@ -42,56 +53,55 @@ module QA
Page::Project::Menu.perform(&:click_ci_cd_pipelines) Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('dependency_scanning')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
end
end end
it 'displays the Dependency Scanning report in the pipeline' do it 'displays the Dependency Scanning report in the pipeline' do
wait_for_job "dependency_scanning"
Page::Project::Menu.perform(&:click_ci_cd_pipelines) Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
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 pipeline.filter_report_type "Dependency Scanning"
expect(pipeline).to have_content("Dependency scanning detected 4") expect(pipeline).to have_vulnerability_count_of 4
pipeline.expand_dependency_report expect(pipeline).to have_content(dependency_scan_example_vuln)
expect(pipeline).to have_content("jQuery before 3.4.0")
end end
end end
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/70 it 'displays the Dependency Scanning report in the project security dashboard' do
it 'displays the Dependency Scanning report in the project security dashboard', :quarantine do wait_for_job "dependency_scanning"
Page::Project::Menu.perform(&:click_project) Page::Project::Menu.perform(&:click_project)
Page::Project::Menu.perform(&:click_on_security_dashboard) Page::Project::Menu.perform(&:click_on_security_dashboard)
EE::Page::Project::Secure::Show.perform do |dashboard| EE::Page::Project::Secure::Show.perform do |dashboard|
dashboard.filter_report_type "Dependency Scanning"
expect(dashboard).to have_low_vulnerability_count_of "1" expect(dashboard).to have_low_vulnerability_count_of "1"
end end
end end
# Failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/130 it 'displays the Dependency Scanning report in the group security dashboard' do
it 'displays the Dependency Scanning report in the group security dashboard', :quarantine do wait_for_job "dependency_scanning"
Page::Main::Menu.perform { |page| page.go_to_groups } Page::Main::Menu.perform { |page| page.go_to_groups }
Page::Dashboard::Groups.perform { |page| page.click_group(@project.group.path) } Page::Dashboard::Groups.perform { |page| page.click_group(@project.group.path) }
EE::Page::Group::Menu.perform { |page| page.click_group_security_link } EE::Page::Group::Menu.perform { |page| page.click_group_security_link }
EE::Page::Group::Secure::Show.perform do |dashboard| EE::Page::Group::Secure::Show.perform do |dashboard|
dashboard.filter_project(@project.name) dashboard.filter_project(@project.name)
expect(dashboard).to have_low_vulnerability_count_of "1" dashboard.filter_report_type "Dependency Scanning"
expect(dashboard).to have_content dependency_scan_example_vuln
end end
end end
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/70 it 'displays the Dependency List' do
it 'displays the Dependency List', :quarantine do wait_for_job "dependency_scanning"
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 NUMBER_OF_DEPENDENCIES_IN_FIXTURE 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