Commit b4701005 authored by Will Meek's avatar Will Meek

Dequarantine and fix licence spec pipeline test

Dequarantine the licence compliance spec
pipeline test.
Also fix the syntax.
Create the project and approve/deny the
licences once to improve execution time
parent fe58a584
...@@ -2,130 +2,106 @@ ...@@ -2,130 +2,106 @@
module QA module QA
RSpec.describe 'Secure', :runner do RSpec.describe 'Secure', :runner do
let(:approved_license_name) { "MIT License" } describe 'License Compliance' do
let(:denied_license_name) { "Apache License 2.0" } before(:all) do
context 'License Compliance page' do
before(:context) do
@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'
end end
@runner = Resource::Runner.fabricate! do |runner|
runner.project = @project
runner.name = "runner-for-#{@project.name}"
runner.tags = ['secure_license']
end
end end
after(:context) do after(:all) do
@runner&.remove_via_api! if @runner
@project&.remove_via_api! if @project @project&.remove_via_api! if @project
end end
before do it 'has empty state', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1839' do
Flow::Login.sign_in_unless_signed_in Flow::Login.sign_in_unless_signed_in
@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/-/quality/test_cases/1839' do
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance| EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
aggregate_failures do
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_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}) expect(license_compliance).to have_link('More Information', href: %r{\/help\/user\/compliance\/license_compliance\/index})
end end
end end
end
describe 'approve or deny licenses' do context 'License Management' do
before(:context) do approved_license_name = 'MIT License'
Flow::Login.sign_in_unless_signed_in denied_license_name = 'Apache License 2.0'
before(:context) do
@runner = Resource::Runner.fabricate_via_api! do |runner|
runner.project = @project
runner.name = "runner-for-#{@project.name}"
runner.tags = ['secure_license']
end
# 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.files = [{ name: '.gitlab-ci.yml',
content: File.read(
Pathname
.new(__dir__) .new(__dir__)
.join('../../../../../ee/fixtures/secure_license_files') .join('../../../../../ee/fixtures/secure_license_files/.gitlab-ci.yml')) },
{ name: 'gl-license-scanning-report.json',
content: File.read(
Pathname
.new(__dir__)
.join('../../../../../ee/fixtures/secure_premade_reports/gl-license-scanning-report.json')) }]
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.project.visit!
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
end end
it 'can approve a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1286' do Flow::Login.sign_in_unless_signed_in
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance| @project.visit!
license_compliance.open_tab Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
license_compliance.approve_license approved_license_name @project.visit!
Page::Project::Menu.perform(&:click_on_license_compliance)
expect(license_compliance).to have_approved_license approved_license_name
end
end
it 'can deny a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1287' 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
license_compliance.deny_license denied_license_name license_compliance.approve_license(approved_license_name)
license_compliance.deny_license(denied_license_name)
expect(license_compliance).to have_denied_license denied_license_name
end
end
end end
end end
context 'License Compliance pipeline reports', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284658', type: :bug } do before do
let(:project) do Flow::Login.sign_in_unless_signed_in
Resource::Project.fabricate_via_api! do |project| @project.visit!
project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure' Page::Project::Menu.perform(&:click_on_license_compliance)
project.description = 'Project with Secure'
end
end end
let(:runner) do after(:context) do
Resource::Runner.fabricate! do |runner| @runner&.remove_via_api!
runner.project = project
runner.name = "runner-for-#{project.name}"
runner.tags = %w[qa test]
end
end end
before(:context) do it 'can approve a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1286' do
Flow::Login.sign_in_unless_signed_in EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
# Push fixture to generate Secure reports expect(license_compliance).to have_approved_license(approved_license_name)
Resource::Repository::ProjectPush.fabricate! do |project_push|
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.project.visit!
Flow::Pipeline.wait_for_latest_pipeline(pipeline_condition: 'succeeded')
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 end
it 'can approve and deny licenses in the pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1285' do it 'can deny a license in the settings page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1287' 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
license_compliance.approve_license approved_license_name expect(license_compliance).to have_denied_license(denied_license_name)
license_compliance.deny_license denied_license_name end
end end
project.visit! describe 'Pipeline Licence tab', { only: [:staging, :production, :pre] } do
it 'can approve and deny licenses in the pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1285' do
@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
aggregate_failures do aggregate_failures do
expect(pipeline).to have_approved_license approved_license_name expect(pipeline).to have_approved_license(approved_license_name)
expect(pipeline).to have_denied_license denied_license_name expect(pipeline).to have_denied_license(denied_license_name)
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