Commit a06a5e38 authored by Rémy Coutable's avatar Rémy Coutable

Revert "Merge branch...

Revert "Merge branch '196770-qa-log-out-sometimes-fails-after-entering-the-ee-license' into 'master'"

This reverts commit c9c86caa, reversing
changes made to 6268ee84.
parent d7537806
......@@ -13,7 +13,7 @@ module QA
license_page.add_new_license(license) unless license_page.license?
end
QA::Page::Main::Menu.perform(&:sign_out_if_signed_in)
QA::Page::Main::Menu.perform(&:sign_out)
end
end
end
......
......@@ -10,14 +10,16 @@ module QA
end
def perform_before_hooks
# The login page could take some time to load the first time it is visited.
# We visit the login page and wait for it to properly load only once before the tests.
QA::Support::Retrier.retry_on_exception do
QA::Runtime::Browser.visit(:gitlab, QA::Page::Main::Login)
end
return unless ENV['EE_LICENSE']
QA::Support::Retrier.retry_on_exception do
QA::Runtime::Browser.visit(:gitlab, QA::Page::Main::Login) do
EE::Resource::License.fabricate!(ENV['EE_LICENSE'])
end
end
end
end
end
end
......@@ -15,10 +15,6 @@ module QA
CAPYBARA_MAX_WAIT_TIME = 10
class << self
attr_accessor :rspec_configured, :capybara_configured
end
def initialize
self.class.configure!
end
......@@ -49,40 +45,11 @@ module QA
end
def self.configure!
configure_rspec!
configure_capybara!
end
def self.configure_rspec!
# We don't want to enter this infinite loop:
# Runtime::Release.perform_before_hooks -> `QA::Runtime::Browser.visit` -> configure! -> configure_rspec! -> Runtime::Release.perform_before_hooks
# So we make sure this method is called only once.
return if self.rspec_configured
browser = self
RSpec.configure do |config|
config.define_derived_metadata(file_path: %r{/qa/specs/features/}) do |metadata|
metadata[:type] = :feature
end
config.before do
unless browser.rspec_configured
browser.rspec_configured = true
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
end
end
end
end
def self.configure_capybara!
return if self.capybara_configured
self.capybara_configured = true
Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i
......
......@@ -14,9 +14,11 @@ module QA
attr_writer :logger
def logger
@logger ||= ::Logger.new(Runtime::Env.log_destination).tap do |logger|
logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::ERROR
end
return @logger if @logger
@logger = ::Logger.new Runtime::Env.log_destination
@logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::ERROR
@logger
end
end
end
......
......@@ -23,6 +23,11 @@ module QA
def perform(options, *args)
extract_address(:gitlab_address, options, args)
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
Runtime::Feature.enable(options[:enable_feature]) if options.key?(:enable_feature)
Specs::Runner.perform do |specs|
......
......@@ -20,6 +20,11 @@ module QA
def self.do_perform(address, *rspec_options)
Runtime::Scenario.define(:gitlab_address, address)
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs|
specs.tty = true
specs.options = rspec_options if rspec_options.any?
......
......@@ -16,7 +16,7 @@ module QA
super
end
def wait_until(max_duration: 60, sleep_interval: 0.1, reload: true, raise_on_failure: false)
def wait_until(max_duration: 60, sleep_interval: 0.1, reload: true)
log("next wait uses reload: #{reload}")
# Logging of wait start/end/duration is handled by QA::Support::Waiter
......
......@@ -62,7 +62,7 @@ describe QA::Page::Base do
end
end
describe '#wait_until' do
describe '#wait' do
subject { Class.new(described_class).new }
context 'when the condition is true' do
......
......@@ -31,6 +31,12 @@ shared_examples 'a QA scenario class' do
expect(attributes).to have_received(:define).with(:gitlab_address, 'http://gitlab_address').at_least(:once)
end
it 'performs before hooks' do
subject.perform(args)
expect(release).to have_received(:perform_before_hooks)
end
it 'sets tags on runner' do
subject.perform(args)
......
......@@ -12,9 +12,9 @@ QA::Runtime::Browser.configure!
QA::Runtime::Scenario.from_env(QA::Runtime::Env.runtime_scenario_attributes) if QA::Runtime::Env.runtime_scenario_attributes
Dir[::File.join(__dir__, "support/helpers/*.rb")].each { |f| require f }
Dir[::File.join(__dir__, "support/shared_contexts/*.rb")].each { |f| require f }
Dir[::File.join(__dir__, "support/shared_examples/*.rb")].each { |f| require f }
%w[helpers shared_examples].each do |d|
Dir[::File.join(__dir__, d, '**', '*.rb')].each { |f| require f }
end
RSpec.configure do |config|
QA::Specs::Helpers::Quarantine.configure_rspec
......
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