Skip to content

Commit

Permalink
Add link to test run
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Pronyakin committed Jul 1, 2019
1 parent 70a1fc1 commit 68c9cf2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_dispatch.show_exceptions = false
end

Rails.logger = Logger.new('/dev/null')

STDERR.reopen('/dev/null')
18 changes: 14 additions & 4 deletions spec/support/fast_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def stop_test_record
end

def current_test_run
url = "https://api.wallarm.com/v1/test_run/#{@test_run_id}"
url = "https://#{ENV['WALLARM_API_HOST']}/v1/test_run/#{@test_run_id}"

response = RestClient.get url, auth_headers
resp_body = JSON.parse(response.body)['body']
Expand All @@ -44,21 +44,31 @@ def wait_test_run_for_finish

test_run = current_test_run

link = frontend_url + '/testing/testruns/' + @test_run_id.to_s

puts
case current_test_run['state']
when 'failed'
puts 'FAST tests are failed'.red
puts "FAST tests have failed #{link}".red
exit 1
when 'interrupted'
puts 'FAST tests are interrupted'.red
puts "FAST tests have been interrupted #{link}".red
exit 1
when 'passed'
puts 'FAST tests are passed'.green
puts "FAST tests have passed #{link}".green
end
end

private

def frontend_url
url = "https://#{ENV['WALLARM_API_HOST']}/v1/user"

response = RestClient.post url, {}, auth_headers

JSON.parse(response.body)['body']['frontend_url']
end

def auth_headers
{
'X-WallarmApi-Token' => ENV['WALLARM_API_TOKEN']
Expand Down

0 comments on commit 68c9cf2

Please sign in to comment.