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

Take screenshots upon exception in QA::Runtime::Release#method_missing

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 245e5ded
......@@ -6,18 +6,17 @@ module QA
extend self
def extend_autoloads!
require 'qa/ce/strategy'
require 'qa/ee'
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)
# Without a license, perform the CE before hooks only.
unless ENV['EE_LICENSE']
QA::CE::Strategy.perform_before_hooks
return
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'])
......
# frozen_string_literal: true
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
module QA
module Runtime
##
......@@ -24,6 +27,13 @@ module QA
def self.method_missing(name, *args)
self.new.strategy.public_send(name, *args)
rescue
saved = Capybara::Screenshot.screenshot_and_save_page
QA::Runtime::Logger.error("Screenshot: #{saved[:image]}") if saved&.key?(:image)
QA::Runtime::Logger.error("HTML capture: #{saved[:html]}") if saved&.key?(:html)
raise
end
end
end
......
......@@ -31,10 +31,10 @@ 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
it 'performs before hooks only once' do
subject.perform(args)
expect(release).to have_received(:perform_before_hooks)
expect(release).to have_received(:perform_before_hooks).once
end
it 'sets tags on runner' do
......
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