Commit 53875199 authored by Aleksandr Soborov's avatar Aleksandr Soborov Committed by Ramya Authappan

Added a Secure E2E test for Dependency List

Added an end to end test verifying the Dependency List

 and all necessary QA selectors and page objects for it.
parent 502f2c56
...@@ -140,7 +140,9 @@ export default { ...@@ -140,7 +140,9 @@ export default {
<div class="d-sm-flex justify-content-between align-items-baseline my-2"> <div class="d-sm-flex justify-content-between align-items-baseline my-2">
<h3 class="h5"> <h3 class="h5">
{{ __('Dependencies') }} {{ __('Dependencies') }}
<gl-badge v-if="pageInfo.total" pill>{{ pageInfo.total }}</gl-badge> <gl-badge v-if="pageInfo.total" pill data-qa-selector="dependency_list_total_content">{{
pageInfo.total
}}</gl-badge>
</h3> </h3>
<dependencies-actions :namespace="currentList" /> <dependencies-actions :namespace="currentList" />
......
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
- if @project.feature_available?(:dependency_list) - if @project.feature_available?(:dependency_list)
= nav_link(path: 'projects/dependencies#show') do = nav_link(path: 'projects/dependencies#show') do
= link_to project_dependencies_path(@project), title: _('Dependency List') do = link_to project_dependencies_path(@project), title: _('Dependency List'), data: { qa_selector: 'dependency_list_link' } do
%span= _('Dependency List') %span= _('Dependency List')
...@@ -16,6 +16,7 @@ exports[`DependenciesApp component on creation given a dependency list which is ...@@ -16,6 +16,7 @@ exports[`DependenciesApp component on creation given a dependency list which is
Dependencies Dependencies
<glbadge-stub <glbadge-stub
data-qa-selector="dependency_list_total_content"
pill="" pill=""
> >
100 100
...@@ -78,6 +79,7 @@ exports[`DependenciesApp component on creation given a list of dependencies and ...@@ -78,6 +79,7 @@ exports[`DependenciesApp component on creation given a list of dependencies and
Dependencies Dependencies
<glbadge-stub <glbadge-stub
data-qa-selector="dependency_list_total_content"
pill="" pill=""
> >
100 100
......
...@@ -93,6 +93,7 @@ module QA ...@@ -93,6 +93,7 @@ module QA
module Secure module Secure
autoload :Show, 'qa/ee/page/project/secure/show' autoload :Show, 'qa/ee/page/project/secure/show'
autoload :DependencyList, 'qa/ee/page/project/secure/dependency_list'
end end
end end
......
# frozen_string_literal: true
module QA
module EE
module Page
module Project::Secure
class DependencyList < QA::Page::Base
view 'ee/app/assets/javascripts/dependencies/components/app.vue' do
element :dependency_list_total_content
end
def has_dependency_count_of?(expected)
find_element(:dependency_list_total_content).has_content?(expected)
end
end
end
end
end
end
...@@ -12,6 +12,7 @@ module QA ...@@ -12,6 +12,7 @@ module QA
page.class_eval do page.class_eval do
view 'ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml' do view 'ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml' do
element :link_security_dashboard element :link_security_dashboard
element :dependency_list_link
end end
end end
end end
...@@ -21,6 +22,22 @@ module QA ...@@ -21,6 +22,22 @@ module QA
click_element :link_security_dashboard click_element :link_security_dashboard
end end
end end
def click_on_dependency_list
hover_security_compliance do
within_submenu do
click_element(:dependency_list_link)
end
end
end
def hover_security_compliance
within_sidebar do
find_element(:link_security_dashboard).hover
yield
end
end
end end
end end
end end
......
...@@ -57,7 +57,7 @@ module QA ...@@ -57,7 +57,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 1") expect(pipeline).to have_content("Dependency scanning detected 2")
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
...@@ -80,6 +80,12 @@ module QA ...@@ -80,6 +80,12 @@ module QA
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" expect(dashboard).to have_low_vulnerability_count_of "1"
it 'displays the Dependency List' do
Page::Project::Menu.perform(&:click_on_dependency_list)
EE::Page::Project::Secure::DependencyList.perform do |page|
expect(page).to have_dependency_count_of "1293"
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