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,88 +16,102 @@ 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
# Push fixture to generate Secure reports
Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project
project_push.directory = Pathname
.new(__dir__)
.join('../../../../../ee/fixtures/secure_license_files')
project_push.commit_message = 'Create Secure compatible application to serve premade reports'
end.project.visit!
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
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
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)
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|
license_compliance.open_tab
license_compliance.approve_license approved_license_name
expect(license_compliance).to have_approved_license approved_license_name
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
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)
describe 'approve or deny licenses' do
before(:context) do
Flow::Login.sign_in_unless_signed_in
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
license_compliance.deny_license denied_license_name
# Push fixture to generate Secure reports
Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project
project_push.directory = Pathname
.new(__dir__)
.join('../../../../../ee/fixtures/secure_license_files')
project_push.commit_message = 'Create Secure compatible application to serve premade reports'
end.project.visit!
expect(license_compliance).to have_denied_license denied_license_name
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
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}"}
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
after do
@runner.remove_via_api!
end
expect(license_compliance).to have_approved_license approved_license_name
end
end
before do
@executor = "qa-runner-#{Time.now.to_i}"
it 'can deny a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/963' do
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
license_compliance.deny_license denied_license_name
Flow::Login.sign_in
expect(license_compliance).to have_denied_license denied_license_name
end
end
end
end
@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')
.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,13 +119,16 @@ 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
expect(pipeline).to have_approved_license approved_license_name
expect(pipeline).to have_denied_license denied_license_name
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
......
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