Commit 3b78614f authored by Tanya Pazitny's avatar Tanya Pazitny

Merge branch 'qa-fix-secure-e2e-tests' into 'master'

Fix and unquarantine Secure E2E tests

Closes gitlab-org/quality/staging#70

See merge request gitlab-org/gitlab-ee!16137
parents 8239bfd4 179473ff
......@@ -289,7 +289,8 @@ export default {
:unresolved-issues="dependencyScanning.newIssues"
:has-issues="dependencyScanning.newIssues.length > 0"
: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
......
......@@ -3,9 +3,9 @@
- if pipeline.expose_security_dashboard?
%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")
%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?
%li.js-licenses-tab-link
......
......@@ -21,6 +21,13 @@ module QA
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)
find_element(:vulnerability_count_low).has_content?(expected)
end
......
......@@ -7,14 +7,12 @@ module QA::EE::Page
page.module_eval do
view 'ee/app/views/projects/pipelines/_tabs_holder.html.haml' do
element :security_tab
element :security_counter
end
view 'ee/app/assets/javascripts/vue_shared/security_reports/split_security_reports_app.vue' do
element :dependency_scanning_report
end
view 'app/assets/javascripts/reports/components/report_section.vue' do
element :expand_report_button
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
end
end
......@@ -23,13 +21,14 @@ module QA::EE::Page
click_element(:security_tab)
end
def has_dependency_report?
find_element(:dependency_scanning_report)
def has_vulnerability_count_of?(count)
find_element(:security_counter).has_content?(count)
end
def expand_dependency_report
within_element(:dependency_scanning_report) do
click_element(:expand_report_button)
def filter_report_type(report)
find_element(:filter_report_type_dropdown).click
within_element(:filter_dropdown_content) do
click_on report
end
end
end
......
......@@ -9,6 +9,18 @@ module QA
element :vulnerability_count, ':data-qa-selector="qaSelector"' # rubocop:disable QA/ElementWithPattern
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)
find_element(:vulnerability_count_low).has_content?(expected)
end
......
# frozen_string_literal: true
require 'pathname'
NUMBER_OF_DEPENDENCIES_IN_FIXTURE = 1309
module QA
context 'Secure', :docker do
let(:number_of_dependencies_in_fixture) { 1309 }
let(:dependency_scan_example_vuln) { 'jQuery before 3.4.0' }
def login
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
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
after do
Service::Runner.new(@executor).remove!
......@@ -42,56 +53,55 @@ module QA
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
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
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::Pipeline::Index.perform(&:click_on_latest_pipeline)
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_on_security
expect(pipeline).to have_dependency_report
expect(pipeline).to have_content("Dependency scanning detected 4")
pipeline.expand_dependency_report
expect(pipeline).to have_content("jQuery before 3.4.0")
pipeline.filter_report_type "Dependency Scanning"
expect(pipeline).to have_vulnerability_count_of 4
expect(pipeline).to have_content(dependency_scan_example_vuln)
end
end
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/70
it 'displays the Dependency Scanning report in the project security dashboard', :quarantine do
it 'displays the Dependency Scanning report in the project security dashboard' do
wait_for_job "dependency_scanning"
Page::Project::Menu.perform(&:click_project)
Page::Project::Menu.perform(&:click_on_security_dashboard)
EE::Page::Project::Secure::Show.perform do |dashboard|
dashboard.filter_report_type "Dependency Scanning"
expect(dashboard).to have_low_vulnerability_count_of "1"
end
end
# Failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/130
it 'displays the Dependency Scanning report in the group security dashboard', :quarantine do
it 'displays the Dependency Scanning report in the group security dashboard' do
wait_for_job "dependency_scanning"
Page::Main::Menu.perform { |page| page.go_to_groups }
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::Secure::Show.perform do |dashboard|
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
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/70
it 'displays the Dependency List', :quarantine do
it 'displays the Dependency List' do
wait_for_job "dependency_scanning"
Page::Project::Menu.perform(&:click_on_dependency_list)
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
......
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