Commit 867a00d7 authored by Igor Frenkel's avatar Igor Frenkel Committed by Tiffany Rea

Support license compliance feature flag in qa test

Add support for :lc_remove_legacy_approval-status feature flag in order
to be able to test software license allow/deny with flag on or off.
parent 726ef151
......@@ -31,11 +31,11 @@ module QA
end
end
def approve_license(license)
def approve_license(license, selector = :approved_license_radio)
click_element(:license_add_button)
expand_select_list
search_and_select_exact(license)
choose_element(:approved_license_radio, true)
choose_element(selector, true)
click_element(:add_license_submit_button)
has_approved_license?(license)
......@@ -48,11 +48,11 @@ module QA
end
end
def deny_license(license)
def deny_license(license, selector = :blacklisted_license_radio)
click_element(:license_add_button)
expand_select_list
search_and_select_exact(license)
choose_element(:blacklisted_license_radio, true)
choose_element(selector, true)
click_element(:add_license_submit_button)
has_denied_license?(license)
......
# frozen_string_literal: true
module QA
RSpec.describe 'Secure', :runner do
RSpec.describe 'Secure', :runner, :requires_admin do
describe 'License Compliance' do
before(:all) do
@project = Resource::Project.fabricate_via_api! do |project|
......@@ -60,8 +60,12 @@ module QA
Page::Project::Menu.perform(&:click_on_license_compliance)
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
license_compliance.approve_license(approved_license_name)
license_compliance.deny_license(denied_license_name)
selector = Runtime::Feature.enabled?(:lc_remove_legacy_approval_status) ? :allowed_license_radio : :approved_license_radio
license_compliance.approve_license(approved_license_name, selector)
selector = Runtime::Feature.enabled?(:lc_remove_legacy_approval_status) ? :denied_license_radio : :blacklisted_license_radio
license_compliance.deny_license(denied_license_name, selector)
end
end
......
......@@ -8,14 +8,10 @@ module QA
let(:executor) { "qa-runner-#{Time.now.to_i}" }
after do
Runtime::Feature.enable(:lc_remove_legacy_approval_status) if @feature_was_enabled
@runner.remove_via_api!
end
before do
@feature_was_enabled = Runtime::Feature.enabled?(:lc_remove_legacy_approval_status)
Runtime::Feature.disable(:lc_remove_legacy_approval_status)
Flow::Login.sign_in
@project = Resource::Project.fabricate_via_api! do |project|
......@@ -115,8 +111,12 @@ module QA
EE::Page::Project::Secure::LicenseCompliance.perform do |license_compliance|
license_compliance.open_tab
license_compliance.approve_license approved_license_name
license_compliance.deny_license denied_license_name
selector = Runtime::Feature.enabled?(:lc_remove_legacy_approval_status) ? :allowed_license_radio : :approved_license_radio
license_compliance.approve_license(approved_license_name, selector)
selector = Runtime::Feature.enabled?(:lc_remove_legacy_approval_status) ? :denied_license_radio : :blacklisted_license_radio
license_compliance.deny_license(denied_license_name, selector)
end
@merge_request.visit!
......
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