Testing new client side wait to increase hook consistency in test.

This commit is contained in:
Jack Walker
2020-04-29 12:50:12 +10:00
parent 0b4428951c
commit ca1df10953
3 changed files with 15 additions and 3 deletions

View File

@@ -98,7 +98,11 @@ RSpec.describe 'AutoRunEngine Test', :run_on_browserstack => true do
puts @driver.execute_script("return window.beef.session.get_hook_session_id()")
@hooks = JSON.parse(RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}")
@session = @hooks['hooked-browsers']['online']['0']['session'] || @driver.execute_script("return window.beef.session.get_hook_session_id()")
if @hooks['hooked-browsers']['online'].empty?
@session = @driver.execute_script("return window.beef.session.get_hook_session_id()")
else
@session = @hooks['hooked-browsers']['online']['0']['session']
end
end
after(:all) do

View File

@@ -95,7 +95,11 @@ RSpec.describe 'Browser Details Handler', :run_on_browserstack => true do
puts @driver.execute_script("return window.beef.session.get_hook_session_id()")
@hooks = JSON.parse(RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}")
@session = @hooks['hooked-browsers']['online']['0']['session'] || @driver.execute_script("return window.beef.session.get_hook_session_id()")
if @hooks['hooked-browsers']['online'].empty?
@session = @driver.execute_script("return window.beef.session.get_hook_session_id()")
else
@session = @hooks['hooked-browsers']['online']['0']['session']
end
end
after(:all) do

View File

@@ -94,7 +94,11 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do
puts @driver.execute_script("return window.beef.session.get_hook_session_id()")
@hooks = JSON.parse(RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}")
@session = @hooks['hooked-browsers']['online']['0']['session'] || @driver.execute_script("return window.beef.session.get_hook_session_id()")
if @hooks['hooked-browsers']['online'].empty?
@session = @driver.execute_script("return window.beef.session.get_hook_session_id()")
else
@session = @hooks['hooked-browsers']['online']['0']['session']
end
# Grab Command Module IDs as they can differ from machine to machine
@debug_mod_ids = JSON.parse(RestClient.get "#{RESTAPI_MODULES}?token=#{@token}")