fixed config.around hook

This commit is contained in:
Jack Walker
2020-04-22 16:25:50 +10:00
parent 6bf47508cb
commit 44092d8519

View File

@@ -69,9 +69,9 @@ RSpec.configure do |config|
end
end
# BrowserStack
config.around(:context, :run_on_browserstack => true) do |context|
config.around(:example, :run_on_browserstack => true) do |example|
@caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID])
@caps["name"] = ENV['name'] || context.metadata[:name] || context.metadata[:file_path].split('/').last.split('.').first
@caps["name"] = ENV['name'] || example.metadata[:name] || example.metadata[:file_path].split('/').last.split('.').first
enable_local = @caps["browserstack.local"] && @caps["browserstack.local"].to_s == "true"
# Code to start browserstack local before start of test
@@ -99,7 +99,7 @@ RSpec.configure do |config|
@session = JSON.parse(@hooks)['hooked-browsers']['online']['0']['session']
begin
context.run
example.run
ensure
@driver.quit
# Code to stop browserstack local after end of test