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 { ...@@ -122,6 +122,7 @@ export default {
v-else-if="showEmptyState" v-else-if="showEmptyState"
:title="emptyStateOptions.title" :title="emptyStateOptions.title"
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
data-qa-selector="dependency_list_empty_state_description_content"
> >
<template #description> <template #description>
{{ emptyStateOptions.description }} {{ emptyStateOptions.description }}
......
...@@ -97,6 +97,7 @@ export default { ...@@ -97,6 +97,7 @@ export default {
v-else-if="hasEmptyState" v-else-if="hasEmptyState"
:title="s__('Licenses|View license details for your project')" :title="s__('Licenses|View license details for your project')"
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
data-qa-selector="license_compliance_empty_state_description_content"
> >
<template #description> <template #description>
{{ {{
......
...@@ -9,6 +9,11 @@ module QA ...@@ -9,6 +9,11 @@ module QA
view 'ee/app/assets/javascripts/dependencies/components/dependencies_table.vue' do view 'ee/app/assets/javascripts/dependencies/components/dependencies_table.vue' do
element :dependencies_table_content element :dependencies_table_content
end 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) def has_dependency_count_of?(expected)
within_element(:dependencies_table_content) do within_element(:dependencies_table_content) do
# expected rows plus header row # expected rows plus header row
...@@ -16,6 +21,12 @@ module QA ...@@ -16,6 +21,12 @@ module QA
all('tr').count.equal?(expected + header_row) all('tr').count.equal?(expected + header_row)
end end
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 end
end end
......
...@@ -9,6 +9,7 @@ module QA ...@@ -9,6 +9,7 @@ module QA
include QA::Page::Component::Select2 include QA::Page::Component::Select2
view 'ee/app/assets/javascripts/license_compliance/components/app.vue' do view 'ee/app/assets/javascripts/license_compliance/components/app.vue' do
element :license_compliance_empty_state_description_content
element :policies_tab element :policies_tab
end end
...@@ -24,6 +25,12 @@ module QA ...@@ -24,6 +25,12 @@ module QA
element :admin_license_compliance_container element :admin_license_compliance_container
end 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) def approve_license(license)
click_element(:license_add_button) click_element(:license_add_button)
expand_select_list expand_select_list
......
...@@ -7,16 +7,8 @@ module QA ...@@ -7,16 +7,8 @@ module QA
let(:approved_license_name) { "MIT License" } let(:approved_license_name) { "MIT License" }
let(:denied_license_name) { "Apache License 2.0" } let(:denied_license_name) { "Apache License 2.0" }
describe 'License Compliance page' do context 'License Compliance page' do
after(:all) do before(:context) do
@runner.remove_via_api!
end
before(:all) do
@executor = "qa-runner-#{Time.now.to_i}"
Flow::Login.sign_in
@project = Resource::Project.fabricate_via_api! do |project| @project = Resource::Project.fabricate_via_api! do |project|
project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure' project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
project.description = 'Project with Secure' project.description = 'Project with Secure'
...@@ -24,88 +16,102 @@ module QA ...@@ -24,88 +16,102 @@ module QA
@runner = Resource::Runner.fabricate! do |runner| @runner = Resource::Runner.fabricate! do |runner|
runner.project = @project runner.project = @project
runner.name = @executor runner.name = "runner-for-#{@project.name}"
runner.tags = %w[qa test] runner.tags = %w[qa test]
end end
end
# Push fixture to generate Secure reports after(:context) do
Resource::Repository::ProjectPush.fabricate! do |project_push| @runner&.remove_via_api! if @runner
project_push.project = @project @project&.remove_via_api! if @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')
end end
before do before do
Flow::Login.sign_in_unless_signed_in 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! @project.visit!
Page::Project::Menu.perform(&:click_on_license_compliance) 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| EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab expect(license_compliance).to have_empty_state_description('The license list details information about the licenses used within your project.')
license_compliance.approve_license approved_license_name expect(license_compliance).to have_link('More Information', href: %r{\/help\/user\/compliance\/license_compliance\/index})
expect(license_compliance).to have_approved_license approved_license_name
end end
end end
it 'can deny a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/963' do describe 'approve or deny licenses' do
@project.visit! before(:context) do
Page::Project::Menu.perform(&:click_on_license_compliance) Flow::Login.sign_in_unless_signed_in
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance| # Push fixture to generate Secure reports
license_compliance.open_tab Resource::Repository::ProjectPush.fabricate! do |project_push|
license_compliance.deny_license denied_license_name 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
end
describe 'License Compliance pipeline reports', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/241448', type: :bug } do it 'can approve a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/964' do
let(:executor) {"qa-runner-#{Time.now.to_i}"} EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
license_compliance.approve_license approved_license_name
after do expect(license_compliance).to have_approved_license approved_license_name
@runner.remove_via_api! end
end end
before do it 'can deny a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/963' do
@executor = "qa-runner-#{Time.now.to_i}" 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.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
project.description = 'Project with Secure' project.description = 'Project with Secure'
end end
end
@runner = Resource::Runner.fabricate! do |runner| let(:runner) do
runner.project = @project Resource::Runner.fabricate! do |runner|
runner.name = executor runner.project = project
runner.name = "runner-for-#{project.name}"
runner.tags = %w[qa test] runner.tags = %w[qa test]
end end
end
before(:context) do
Flow::Login.sign_in_unless_signed_in
# Push fixture to generate Secure reports # Push fixture to generate Secure reports
Resource::Repository::ProjectPush.fabricate! do |project_push| Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project project_push.project = project
project_push.directory = Pathname project_push.directory = Pathname
.new(__dir__) .new(__dir__)
.join('../../../../../ee/fixtures/secure_premade_reports') .join('../../../../../ee/fixtures/secure_premade_reports')
project_push.commit_message = 'Create Secure compatible application to serve 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') Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
Page::Project::Menu.perform(&:click_on_license_compliance) Page::Project::Menu.perform(&:click_on_license_compliance)
end 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 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| EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab license_compliance.open_tab
...@@ -113,13 +119,16 @@ module QA ...@@ -113,13 +119,16 @@ module QA
license_compliance.deny_license denied_license_name license_compliance.deny_license denied_license_name
end end
@project.visit! project.visit!
Flow::Pipeline.visit_latest_pipeline Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline| Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_on_licenses 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 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