Commit 10939212 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch '9192-secure-e2e-tests-group-dashboard' into 'master'

Added E2E test for Secure group security dashboard

Closes #9192

See merge request gitlab-org/gitlab-ee!14874
parents e6279785 4a5c08e8
...@@ -36,6 +36,9 @@ export default { ...@@ -36,6 +36,9 @@ export default {
option.name.toLowerCase().includes(this.filterTerm.toLowerCase()), option.name.toLowerCase().includes(this.filterTerm.toLowerCase()),
); );
}, },
qaSelector() {
return `filter_${this.filter.name.toLowerCase().replace(' ', '_')}_dropdown`;
},
}, },
methods: { methods: {
...mapActions('filters', ['setFilter']), ...mapActions('filters', ['setFilter']),
...@@ -60,7 +63,7 @@ export default { ...@@ -60,7 +63,7 @@ export default {
<strong class="js-name">{{ filter.name }}</strong> <strong class="js-name">{{ filter.name }}</strong>
<gl-dropdown ref="dropdown" class="d-block mt-1" menu-class="dropdown-extended-height"> <gl-dropdown ref="dropdown" class="d-block mt-1" menu-class="dropdown-extended-height">
<template slot="button-content"> <template slot="button-content">
<span class="text-truncate"> <span class="text-truncate" :data-qa-selector="qaSelector">
{{ selectedOptionText.firstOption }} {{ selectedOptionText.firstOption }}
</span> </span>
<span v-if="selectedOptionText.extraOptionCount" class="flex-grow-1 ml-1"> <span v-if="selectedOptionText.extraOptionCount" class="flex-grow-1 ml-1">
...@@ -91,7 +94,10 @@ export default { ...@@ -91,7 +94,10 @@ export default {
:placeholder="__('Filter...')" :placeholder="__('Filter...')"
/> />
<div :class="{ 'dropdown-content': filterId === 'project_id' }"> <div
data-qa-selector="filter_dropdown_content"
:class="{ 'dropdown-content': filterId === 'project_id' }"
>
<button <button
v-for="option in filteredOptions" v-for="option in filteredOptions"
:key="option.id" :key="option.id"
......
- if @group.feature_available?(:security_dashboard) - if @group.feature_available?(:security_dashboard)
= nav_link(path: 'groups/security/dashboard#show') do = nav_link(path: 'groups/security/dashboard#show') do
= link_to group_security_dashboard_path(@group), title: _('Security') do = link_to group_security_dashboard_path(@group), title: _('Security'), data: { qa_selector: 'security_dashboard_link' } do
.nav-icon-container .nav-icon-container
= sprite_icon('shield') = sprite_icon('shield')
%span.nav-item-name %span.nav-item-name
......
...@@ -106,6 +106,10 @@ module QA ...@@ -106,6 +106,10 @@ module QA
autoload :Show, 'qa/ee/page/group/epic/show' autoload :Show, 'qa/ee/page/group/epic/show'
autoload :Edit, 'qa/ee/page/group/epic/edit' autoload :Edit, 'qa/ee/page/group/epic/edit'
end end
module Secure
autoload :Show, 'qa/ee/page/group/secure/show'
end
end end
end end
......
...@@ -21,6 +21,10 @@ module QA ...@@ -21,6 +21,10 @@ module QA
element :group_epics_link element :group_epics_link
end end
view 'ee/app/views/layouts/nav/ee/_security_link.html.haml' do
element :security_dashboard_link
end
def go_to_saml_sso_group_settings def go_to_saml_sso_group_settings
hover_settings do hover_settings do
within_submenu do within_submenu do
...@@ -49,6 +53,12 @@ module QA ...@@ -49,6 +53,12 @@ module QA
end end
end end
def click_group_security_link
within_sidebar do
click_element(:security_dashboard_link)
end
end
private private
def hover_settings def hover_settings
......
# frozen_string_literal: true
module QA
module EE
module Page
module Group::Secure
class Show < QA::Page::Base
view 'ee/app/assets/javascripts/security_dashboard/components/vulnerability_count.vue' do
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_project(project)
find_element(:filter_project_dropdown).click
within_element(:filter_dropdown_content) do
click_on project
end
end
def has_low_vulnerability_count_of?(expected)
find_element(:vulnerability_count_low).has_content?(expected)
end
end
end
end
end
end
...@@ -9,7 +9,7 @@ module QA ...@@ -9,7 +9,7 @@ module QA
Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Login.perform(&:sign_in_using_credentials)
end end
describe 'Security Reports in project security dashboard' do describe 'Security Reports' do
after do after do
Service::Runner.new(@executor).remove! Service::Runner.new(@executor).remove!
end end
...@@ -71,6 +71,17 @@ module QA ...@@ -71,6 +71,17 @@ module QA
expect(dashboard).to have_low_vulnerability_count_of "1" expect(dashboard).to have_low_vulnerability_count_of "1"
end end
end end
it 'displays the Dependency Scanning report in the group security dashboard' do
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"
end
end
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