Commit 58980ca1 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Update qa:internal specs with test for browser.log attachment

parent c1d3f201
......@@ -80,7 +80,7 @@ module QA
config.append_after do |example|
Allure.add_attachment(
name: 'browser.log',
source: page.driver.browser.logs.get(:browser).map(&:to_s).join("\n\n"),
source: Capybara.current_session.driver.browser.logs.get(:browser).map(&:to_s).join("\n\n"),
type: Allure::ContentType::TXT,
test_case: true
)
......
......@@ -3,7 +3,7 @@
describe QA::Runtime::AllureReport do
include QA::Support::Helpers::StubEnv
let(:rspec_config) { double('RSpec::Core::Configuration', 'add_formatter': nil, after: nil) }
let(:rspec_config) { double('RSpec::Core::Configuration', 'add_formatter': nil, append_after: nil) }
let(:png_path) { 'png_path' }
let(:html_path) { 'html_path' }
......@@ -46,6 +46,8 @@ describe QA::Runtime::AllureReport do
let(:html_file) { 'html-file' }
let(:ci_job) { 'ee:relative 5' }
let(:versions) { { version: '14', revision: '6ced31db947' } }
let(:session) { double('session') }
let(:browser_log) { ['log message 1', 'log message 2'] }
before do
stub_env('CI', 'true')
......@@ -58,6 +60,9 @@ describe QA::Runtime::AllureReport do
allow(RestClient::Request).to receive(:execute) { double('response', code: 200, body: versions.to_json) }
allow(QA::Runtime::Scenario).to receive(:method_missing).with(:gitlab_address).and_return('gitlab.com')
allow(Capybara).to receive(:current_session).and_return(session)
allow(session).to receive_message_chain('driver.browser.logs.get').and_return(browser_log)
described_class.configure!
end
......@@ -76,7 +81,11 @@ describe QA::Runtime::AllureReport do
.with(QA::Support::Formatters::AllureMetadataFormatter).ordered
end
it 'configures screenshot saving' do
it 'configures attachments saving' do
expect(rspec_config).to have_received(:append_after) do |&arg|
arg.call
end
aggregate_failures do
expect(Allure).to have_received(:add_attachment).with(
name: 'screenshot',
......@@ -90,6 +99,12 @@ describe QA::Runtime::AllureReport do
type: 'text/html',
test_case: true
)
expect(Allure).to have_received(:add_attachment).with(
name: 'browser.log',
source: browser_log.join("\n\n"),
type: Allure::ContentType::TXT,
test_case: true
)
end
end
end
......
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