Commit 56d4ffd2 authored by Aleksandr Soborov's avatar Aleksandr Soborov Committed by Ramya Authappan

Added E2E License Compliance settings tests

Also adjusted page object functions and data selectors as needed.
parent b6c1b1db
......@@ -55,7 +55,7 @@ export default {
};
</script>
<template>
<div>
<div data-qa-selector="license_compliance_row">
<issue-status-icon :status="status" class="float-left append-right-default" />
<span class="js-license-name" data-qa-selector="license_name_content">{{ license.name }}</span>
<div class="float-right">
......
......@@ -21,9 +21,26 @@ module QA::EE
end
view 'ee/app/assets/javascripts/vue_shared/license_management/components/license_management_row.vue' do
element :license_compliance_row
element :license_name_content
end
view 'app/assets/javascripts/reports/components/issue_status_icon.vue' do
element :icon_status, ':data-qa-selector="`status_${status}_icon`" ' # rubocop:disable QA/ElementWithPattern
end
def has_approved_license?(name)
within_element(:license_compliance_row, text: name) do
has_element?(:status_success_icon)
end
end
def has_denied_license?(name)
within_element(:license_compliance_row, text: name) do
has_element?(:status_failed_icon)
end
end
def approve_license(license)
click_element :license_add_button
expand_select_list
......@@ -31,9 +48,7 @@ module QA::EE
click_element :approved_license_radio
click_element :add_license_submit_button
within_element :license_compliance_list do
has_element?(:license_name_content, text: license)
end
has_approved_license? license
end
def deny_license(license)
......@@ -43,9 +58,7 @@ module QA::EE
click_element :blacklisted_license_radio
click_element :add_license_submit_button
within_element :license_compliance_list do
has_element?(:license_name_content, text: license)
end
has_denied_license? license
end
end
end
......
......@@ -4,10 +4,43 @@ require 'pathname'
module QA
context 'Secure', :docker do
describe 'License Compliance' do
let(:approved_license_name) { "MIT" }
let(:denied_license_name) { "WTFPL" }
describe 'License Compliance settings page' do
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
@project = Resource::Project.fabricate_via_api! do |project|
project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
project.description = 'Project with Secure'
end
@project.visit!
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
Page::Project::Settings::CICD.perform(&:expand_license_compliance)
end
it 'can approve a license in the settings page' do
QA::EE::Page::Project::Settings::LicenseCompliance.perform do |license_compliance|
license_compliance.approve_license approved_license_name
expect(license_compliance).to have_approved_license approved_license_name
end
end
it 'can deny a license in the settings page' do
QA::EE::Page::Project::Settings::LicenseCompliance.perform do |license_compliance|
license_compliance.deny_license denied_license_name
expect(license_compliance).to have_denied_license denied_license_name
end
end
end
describe 'License Compliance pipeline reports' do
let(:number_of_licenses_in_fixture) { 2 }
let(:approved_license_name) { "MIT" }
let(:denied_license_name) { "WTFPL" }
after do
Service::DockerRun::GitlabRunner.new(@executor).remove!
......
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