Commit 7ff8ef38 authored by Will Meek's avatar Will Meek Committed by Ramya Authappan

Add e2e tests for empty state of License Compliance and Dependency List

parent fcc7d5c0
......@@ -122,6 +122,7 @@ export default {
v-else-if="showEmptyState"
:title="emptyStateOptions.title"
:svg-path="emptyStateSvgPath"
data-qa-selector="dependency_list_empty_state_description_content"
>
<template #description>
{{ emptyStateOptions.description }}
......
......@@ -97,6 +97,7 @@ export default {
v-else-if="hasEmptyState"
:title="s__('Licenses|View license details for your project')"
:svg-path="emptyStateSvgPath"
data-qa-selector="license_compliance_empty_state_description_content"
>
<template #description>
{{
......
......@@ -9,6 +9,11 @@ module QA
view 'ee/app/assets/javascripts/dependencies/components/dependencies_table.vue' do
element :dependencies_table_content
end
view 'ee/app/assets/javascripts/dependencies/components/app.vue' do
element :dependency_list_empty_state_description_content
end
def has_dependency_count_of?(expected)
within_element(:dependencies_table_content) do
# expected rows plus header row
......@@ -16,6 +21,12 @@ module QA
all('tr').count.equal?(expected + header_row)
end
end
def has_empty_state_description?(text)
within_element(:dependency_list_empty_state_description_content) do
has_text?(text)
end
end
end
end
end
......
......@@ -9,6 +9,7 @@ module QA
include QA::Page::Component::Select2
view 'ee/app/assets/javascripts/license_compliance/components/app.vue' do
element :license_compliance_empty_state_description_content
element :policies_tab
end
......@@ -24,6 +25,12 @@ module QA
element :admin_license_compliance_container
end
def has_empty_state_description?(text)
within_element(:license_compliance_empty_state_description_content) do
has_text?(text)
end
end
def approve_license(license)
click_element(:license_add_button)
expand_select_list
......
......@@ -7,16 +7,8 @@ module QA
let(:approved_license_name) { "MIT License" }
let(:denied_license_name) { "Apache License 2.0" }
describe 'License Compliance page' do
after(:all) do
@runner.remove_via_api!
end
before(:all) do
@executor = "qa-runner-#{Time.now.to_i}"
Flow::Login.sign_in
context 'License Compliance page' do
before(:context) do
@project = Resource::Project.fabricate_via_api! do |project|
project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
project.description = 'Project with Secure'
......@@ -24,9 +16,32 @@ module QA
@runner = Resource::Runner.fabricate! do |runner|
runner.project = @project
runner.name = @executor
runner.name = "runner-for-#{@project.name}"
runner.tags = %w[qa test]
end
end
after(:context) do
@runner&.remove_via_api! if @runner
@project&.remove_via_api! if @project
end
before do
Flow::Login.sign_in_unless_signed_in
@project.visit!
Page::Project::Menu.perform(&:click_on_license_compliance)
end
it 'has empty state', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1128' do
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
expect(license_compliance).to have_empty_state_description('The license list details information about the licenses used within your project.')
expect(license_compliance).to have_link('More Information', href: %r{\/help\/user\/compliance\/license_compliance\/index})
end
end
describe 'approve or deny licenses' do
before(:context) do
Flow::Login.sign_in_unless_signed_in
# Push fixture to generate Secure reports
Resource::Repository::ProjectPush.fabricate! do |project_push|
......@@ -40,14 +55,7 @@ module QA
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end
before do
Flow::Login.sign_in_unless_signed_in
end
it 'can approve a license in the license compliance page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/964' do
@project.visit!
Page::Project::Menu.perform(&:click_on_license_compliance)
it 'can approve a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/964' do
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
license_compliance.approve_license approved_license_name
......@@ -57,9 +65,6 @@ module QA
end
it 'can deny a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/963' do
@project.visit!
Page::Project::Menu.perform(&:click_on_license_compliance)
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
license_compliance.deny_license denied_license_name
......@@ -68,44 +73,45 @@ module QA
end
end
end
describe 'License Compliance pipeline reports', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/241448', type: :bug } do
let(:executor) {"qa-runner-#{Time.now.to_i}"}
after do
@runner.remove_via_api!
end
before do
@executor = "qa-runner-#{Time.now.to_i}"
Flow::Login.sign_in
@project = Resource::Project.fabricate_via_api! do |project|
context 'License Compliance pipeline reports', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284658', type: :bug } do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
project.description = 'Project with Secure'
end
end
@runner = Resource::Runner.fabricate! do |runner|
runner.project = @project
runner.name = executor
let(:runner) do
Resource::Runner.fabricate! do |runner|
runner.project = project
runner.name = "runner-for-#{project.name}"
runner.tags = %w[qa test]
end
end
before(:context) do
Flow::Login.sign_in_unless_signed_in
# Push fixture to generate Secure reports
Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project
project_push.project = project
project_push.directory = Pathname
.new(__dir__)
.join('../../../../../ee/fixtures/secure_premade_reports')
project_push.commit_message = 'Create Secure compatible application to serve premade reports'
end
end.project.visit!
@project.visit!
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
Page::Project::Menu.perform(&:click_on_license_compliance)
end
after do
runner&.remove_via_api! if runner
project&.remove_via_api! if project
end
it 'can approve and deny licenses in the pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1767' do
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
......@@ -113,15 +119,18 @@ module QA
license_compliance.deny_license denied_license_name
end
@project.visit!
project.visit!
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_on_licenses
aggregate_failures do
expect(pipeline).to have_approved_license approved_license_name
expect(pipeline).to have_denied_license denied_license_name
end
end
end
end
end
end
......@@ -11,47 +11,60 @@ module QA
let(:dast_scan_example_vuln) { 'Cookie Without SameSite Attribute' }
describe 'Security Reports' do
after(:all) do
@runner.remove_via_api!
before(:context) do
@project = Resource::Project.fabricate_via_api! do |project|
project.name = 'project-with-secure'
project.description = 'Project with Secure'
project.group = Resource::Group.fabricate_via_api!
end
end
before(:all) do
@executor = "qa-runner-#{Time.now.to_i}"
before do
Flow::Login.sign_in_unless_signed_in
@project.visit!
end
Flow::Login.sign_in
after(:context) do
@project&.remove_via_api! if @project
end
it 'dependency list has empty state', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1787' do
Page::Project::Menu.perform(&:click_on_dependency_list)
@project = Resource::Project.fabricate_via_api! do |p|
p.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
p.description = 'Project with Secure'
p.group = Resource::Group.fabricate_via_api!
EE::Page::Project::Secure::DependencyList.perform do |dependency_list|
expect(dependency_list).to have_empty_state_description('The dependency list details information about the components used within your project.')
expect(dependency_list).to have_link('More Information', href: %r{\/help\/user\/application_security\/dependency_list\/index})
end
end
context 'populated reports are displayed' do
before(:context) do
Flow::Login.sign_in_unless_signed_in
@runner = Resource::Runner.fabricate! do |runner|
@runner = Resource::Runner.fabricate_via_api! do |runner|
runner.project = @project
runner.name = @executor
runner.name = "runner-for-#{@project.name}"
runner.tags = %w[qa test]
end
# Push fixture to generate Secure reports
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = @project
push.directory = Pathname
Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project
project_push.directory = Pathname
.new(__dir__)
.join('../../../../../ee/fixtures/secure_premade_reports')
push.commit_message = 'Create Secure compatible application to serve premade reports'
project_push.commit_message = 'Create Secure compatible application to serve premade reports'
end.project.visit!
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end
before do
Flow::Login.sign_in_unless_signed_in
@project.visit!
after(:context) do
@runner&.remove_via_api! if @runner
end
it 'displays security reports in the pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1777', quarantine: { only: { pipeline: [:master, :nightly] }, issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/325612', type: :bug } do
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_on_security
......@@ -145,4 +158,5 @@ module QA
page.filter_report_type report # Disable filter to avoid combining
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