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 ...@@ -13,7 +13,7 @@ module QA
license_page.add_new_license(license) unless license_page.license? license_page.add_new_license(license) unless license_page.license?
end end
QA::Page::Main::Menu.perform(&:sign_out_if_signed_in) QA::Page::Main::Menu.perform(&:sign_out)
end end
end end
end end
......
...@@ -10,14 +10,16 @@ module QA ...@@ -10,14 +10,16 @@ module QA
end end
def perform_before_hooks 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'] 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']) EE::Resource::License.fabricate!(ENV['EE_LICENSE'])
end end
end end
end end
end
end
end end
...@@ -15,10 +15,6 @@ module QA ...@@ -15,10 +15,6 @@ module QA
CAPYBARA_MAX_WAIT_TIME = 10 CAPYBARA_MAX_WAIT_TIME = 10
class << self
attr_accessor :rspec_configured, :capybara_configured
end
def initialize def initialize
self.class.configure! self.class.configure!
end end
...@@ -49,40 +45,11 @@ module QA ...@@ -49,40 +45,11 @@ module QA
end end
def self.configure! 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| RSpec.configure do |config|
config.define_derived_metadata(file_path: %r{/qa/specs/features/}) do |metadata| config.define_derived_metadata(file_path: %r{/qa/specs/features/}) do |metadata|
metadata[:type] = :feature metadata[:type] = :feature
end 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
end
def self.configure_capybara!
return if self.capybara_configured
self.capybara_configured = true
Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i
......
...@@ -14,9 +14,11 @@ module QA ...@@ -14,9 +14,11 @@ module QA
attr_writer :logger attr_writer :logger
def logger def logger
@logger ||= ::Logger.new(Runtime::Env.log_destination).tap do |logger| return @logger if @logger
logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::ERROR
end @logger = ::Logger.new Runtime::Env.log_destination
@logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::ERROR
@logger
end end
end end
end end
......
...@@ -23,6 +23,11 @@ module QA ...@@ -23,6 +23,11 @@ module QA
def perform(options, *args) def perform(options, *args)
extract_address(:gitlab_address, 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) Runtime::Feature.enable(options[:enable_feature]) if options.key?(:enable_feature)
Specs::Runner.perform do |specs| Specs::Runner.perform do |specs|
......
...@@ -20,6 +20,11 @@ module QA ...@@ -20,6 +20,11 @@ module QA
def self.do_perform(address, *rspec_options) def self.do_perform(address, *rspec_options)
Runtime::Scenario.define(:gitlab_address, address) 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::Runner.perform do |specs|
specs.tty = true specs.tty = true
specs.options = rspec_options if rspec_options.any? specs.options = rspec_options if rspec_options.any?
......
...@@ -16,7 +16,7 @@ module QA ...@@ -16,7 +16,7 @@ module QA
super super
end 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}") log("next wait uses reload: #{reload}")
# Logging of wait start/end/duration is handled by QA::Support::Waiter # Logging of wait start/end/duration is handled by QA::Support::Waiter
......
...@@ -62,7 +62,7 @@ describe QA::Page::Base do ...@@ -62,7 +62,7 @@ describe QA::Page::Base do
end end
end end
describe '#wait_until' do describe '#wait' do
subject { Class.new(described_class).new } subject { Class.new(described_class).new }
context 'when the condition is true' do context 'when the condition is true' do
......
...@@ -31,6 +31,12 @@ shared_examples 'a QA scenario class' 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) expect(attributes).to have_received(:define).with(:gitlab_address, 'http://gitlab_address').at_least(:once)
end end
it 'performs before hooks' do
subject.perform(args)
expect(release).to have_received(:perform_before_hooks)
end
it 'sets tags on runner' do it 'sets tags on runner' do
subject.perform(args) subject.perform(args)
......
...@@ -12,9 +12,9 @@ QA::Runtime::Browser.configure! ...@@ -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 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 } %w[helpers shared_examples].each do |d|
Dir[::File.join(__dir__, "support/shared_contexts/*.rb")].each { |f| require f } Dir[::File.join(__dir__, d, '**', '*.rb')].each { |f| require f }
Dir[::File.join(__dir__, "support/shared_examples/*.rb")].each { |f| require f } end
RSpec.configure do |config| RSpec.configure do |config|
QA::Specs::Helpers::Quarantine.configure_rspec 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