added a cycle through the debug tests using their yml files
This commit is contained in:
@@ -34,6 +34,7 @@ RSpec.describe 'Debug Modules Integration' do
|
||||
def navigate_to_hooked_browser(hooked_browser_text = nil)
|
||||
expect(@beef_session).to have_content('Hooked Browsers', wait: PAGE_LOAD_TIMEOUT)
|
||||
|
||||
# BeefTest.save_screenshot(@beef_session, "./")
|
||||
hooked_browser_text = '127.0.0.1' if hooked_browser_text.nil?
|
||||
expect(@beef_session).to have_content(hooked_browser_text, wait: BROWSER_HOOKING_TIMEOUT)
|
||||
|
||||
@@ -52,7 +53,6 @@ RSpec.describe 'Debug Modules Integration' do
|
||||
|
||||
def click_on_debug_module(module_name)
|
||||
navigate_to_debug_modules unless @beef_session.has_content?('Current Browser')
|
||||
puts module_name
|
||||
expect(@beef_session).to have_content(module_name, wait: PAGE_LOAD_TIMEOUT)
|
||||
@beef_session.click_on(module_name)
|
||||
end
|
||||
@@ -62,5 +62,50 @@ RSpec.describe 'Debug Modules Integration' do
|
||||
expect(@beef_session).to have_content('Execute', wait: PAGE_LOAD_TIMEOUT)
|
||||
BeefTest.save_screenshot(@beef_session, "./")
|
||||
#TODO: 'Implement the rest of the test'
|
||||
end
|
||||
|
||||
it "Load all debug modules" do
|
||||
Dir.glob("modules/debug/**/config.yaml").each do |file|
|
||||
module_yaml_data = YAML.load_file(file)
|
||||
|
||||
module_yaml_data['beef']['module'].each do |module_key, module_value|
|
||||
module_category = module_value['category']
|
||||
module_name = module_value['name']
|
||||
# some descriptions are too long and include html tags
|
||||
module_description_sub = module_value['description'][0, 20]
|
||||
|
||||
expect(@beef_session).to have_content(module_category, wait: PAGE_LOAD_TIMEOUT)
|
||||
expect(module_category).not_to be_nil
|
||||
expect(module_category).to be_a(String)
|
||||
expect(module_name).not_to be_nil
|
||||
expect(module_name).to be_a(String)
|
||||
expect(module_description_sub).not_to be_nil
|
||||
expect(module_description_sub).to be_a(String)
|
||||
|
||||
click_on_debug_module(module_name)
|
||||
|
||||
expect(@beef_session).to have_content(module_description_sub, wait: PAGE_LOAD_TIMEOUT)
|
||||
expect(@beef_session).to have_content('Execute', wait: PAGE_LOAD_TIMEOUT)
|
||||
|
||||
click_on_debug_module('Execute')
|
||||
|
||||
expect(@beef_session).to have_content('command 1', wait: PAGE_LOAD_TIMEOUT)
|
||||
|
||||
@beef_session.all('div.x-grid3-cell-inner').each do |div|
|
||||
if div.text == 'command 1'
|
||||
div.click
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if module_name == 'Return Image'
|
||||
image_selector = "img[src^='data:image/png;base64,iVBORw0KGgo']"
|
||||
expect(@beef_session).to have_css(image_selector, wait: PAGE_LOAD_TIMEOUT)
|
||||
else
|
||||
expect(@beef_session).to have_content('data: ', wait: PAGE_LOAD_TIMEOUT)
|
||||
end
|
||||
# BeefTest.save_screenshot(@hooked_browser, "./")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user