Tightened up some of the test cases.

This commit is contained in:
Jack Walker
2020-05-27 19:01:54 +10:00
parent af6db74058
commit e1430f5e43
4 changed files with 8 additions and 20 deletions

View File

@@ -123,11 +123,7 @@ RSpec.describe 'AutoRunEngine Test', :run_on_browserstack => true do
it 'AutoRunEngine is working' do
begin
if @hooks['hooked-browsers']['online'].empty?
expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script("return window.beef.session.get_hook_session_id()"))).to eq true
else
expect(@hooks['hooked-browsers']['online']).not_to be_empty
end
expect(@hooks['hooked-browsers']['online']).not_to be_empty
rescue => exception
print_info "Exception: #{exception}"
print_info "Exception Class: #{exception.class}"
@@ -136,7 +132,7 @@ RSpec.describe 'AutoRunEngine Test', :run_on_browserstack => true do
exception.class == NoMethodError
exit 1
else
exit 0
expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script("return window.beef.session.get_hook_session_id()"))).to eq true
end
end
end

View File

@@ -100,7 +100,7 @@ RSpec.describe 'Browser Details Handler', :run_on_browserstack => true do
@hook_request = RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}"
@hooks = JSON.parse(@hook_request)
@session = @hooks['hooked-browsers']['online'][0]['session']
rescue => exception
print_info "Exception: #{exception}"
print_info "Exception Class: #{exception.class}"
@@ -120,11 +120,7 @@ RSpec.describe 'Browser Details Handler', :run_on_browserstack => true do
it 'can successfully hook a browser' do
begin
if @hooks['hooked-browsers']['online'].empty?
expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script("return window.beef.session.get_hook_session_id()"))).to eq true
else
expect(@hooks['hooked-browsers']['online']).not_to be_empty
end
expect(@hooks['hooked-browsers']['online']).not_to be_empty
rescue => exception
print_info "Exception: #{exception}"
print_info "Exception Class: #{exception.class}"
@@ -133,7 +129,7 @@ RSpec.describe 'Browser Details Handler', :run_on_browserstack => true do
exception.class == NoMethodError
exit 1
else
exit 0
expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script("return window.beef.session.get_hook_session_id()"))).to eq true
end
end
end

View File

@@ -120,11 +120,7 @@ RSpec.describe 'Browser hooking with Websockets', :run_on_browserstack => true d
it 'can successfully hook a browser' do
begin
if @hooks['hooked-browsers']['online'].empty?
expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script("return window.beef.session.get_hook_session_id()"))).to eq true
else
expect(@hooks['hooked-browsers']['online']).not_to be_empty
end
expect(@hooks['hooked-browsers']['online']).not_to be_empty
rescue => exception
print_info "Exception: #{exception}"
print_info "Exception Class: #{exception.class}"
@@ -133,7 +129,7 @@ RSpec.describe 'Browser hooking with Websockets', :run_on_browserstack => true d
exception.class == NoMethodError
exit 1
else
exit 0
expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script("return window.beef.session.get_hook_session_id()"))).to eq true
end
end
end

View File

@@ -278,7 +278,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do
exception.class == NoMethodError
exit 1
else
exit 0
true
end
end
end