From 639d14c682cda8e8f249b0663c76834a384e51b7 Mon Sep 17 00:00:00 2001 From: aussieklutz Date: Thu, 2 May 2019 08:50:43 +1000 Subject: [PATCH 1/4] Switching to current selenium-webdriver for tests Disabling selenium and adding geckodriver-helper and selenium webdriver for the current version of selenium. --- Gemfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 4c3cc6528..b4dfffe9b 100644 --- a/Gemfile +++ b/Gemfile @@ -86,8 +86,9 @@ group :test do # sudo apt-get install libcurl4-openssl-dev gem 'curb' # selenium-webdriver 3.x is incompatible with Firefox version 48 and prior - gem 'selenium' - gem 'selenium-webdriver', '~> 2.53.4' + # gem 'selenium' # Requires old version of selenium which is no longer available + gem 'geckodriver-helper' + gem 'selenium-webdriver' # nokogirl is needed by capybara which may require one of the below commands # sudo apt-get install libxslt-dev libxml2-dev # sudo port install libxml2 libxslt From 5eb3b686f1abc753832f0e7919efd03093b7df25 Mon Sep 17 00:00:00 2001 From: aussieklutz Date: Thu, 2 May 2019 09:49:21 +1000 Subject: [PATCH 2/4] Replace selenium with selenium-webdriver gem Replace gem require + update Session.new calls with headless firefox (:selenium_headless) module --- test/common/beef_test.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/common/beef_test.rb b/test/common/beef_test.rb index 94ecd47ab..be752c8da 100644 --- a/test/common/beef_test.rb +++ b/test/common/beef_test.rb @@ -6,9 +6,10 @@ require 'test/unit' require 'capybara' +require 'capybara/rspec' Capybara.run_server = false # we need to run our own BeEF server -require 'selenium/webdriver' +require 'selenium-webdriver' class BeefTest @@ -18,7 +19,7 @@ class BeefTest end def self.login(session = nil) - session = Capybara::Session.new(:selenium) if session.nil? + session = Capybara::Session.new(:selenium_headless) if session.nil? session.visit(ATTACK_URL) sleep 2.0 session.has_content?('BeEF Authentication') @@ -41,7 +42,7 @@ class BeefTest end def self.new_victim - victim = Capybara::Session.new(:selenium) + victim = Capybara::Session.new(:selenium_headless) victim.visit(VICTIM_URL) victim end From 64d5638a81f9462e68e7cbc8e6f220128d580c7b Mon Sep 17 00:00:00 2001 From: aussieklutz Date: Thu, 2 May 2019 09:51:24 +1000 Subject: [PATCH 3/4] Replace selenium with selenium-webdriver Replace gem require --- test/integration/ts_integration.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/ts_integration.rb b/test/integration/ts_integration.rb index b3cc3a540..0f9939ee4 100644 --- a/test/integration/ts_integration.rb +++ b/test/integration/ts_integration.rb @@ -8,9 +8,10 @@ require '../common/ts_common' require 'capybara' +require 'capybara/rspec' Capybara.run_server = false # we need to run our own BeEF server -require 'selenium/webdriver' +require 'selenium-webdriver' require './check_environment' # Basic log in and log out tests require './tc_debug_modules' # RESTful API tests (as well as debug modules) From b8fe5f1b80509aa8f551fb088b7bab897a7d6cb5 Mon Sep 17 00:00:00 2001 From: aussieklutz Date: Thu, 2 May 2019 09:55:01 +1000 Subject: [PATCH 4/4] Replace selenium with selenium-webdriver Update Session.new calls with headless firefox (:selenium_headless) module --- test/integration/tc_login.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/tc_login.rb b/test/integration/tc_login.rb index b49041b24..15b99297c 100644 --- a/test/integration/tc_login.rb +++ b/test/integration/tc_login.rb @@ -12,7 +12,7 @@ class TC_Login < Test::Unit::TestCase include RSpec::Matchers def test_log_in - session = Capybara::Session.new(:selenium) + session = Capybara::Session.new(:selenium_headless) session.visit(ATTACK_URL) sleep 2.0 BeefTest.save_screenshot(session) @@ -82,7 +82,7 @@ class TC_Login < Test::Unit::TestCase attacker.should have_content('Details') attacker.should have_content('Commands') - attacker.should have_content('Rider') + # attacker.should have_content('Rider') # Old functionality BeefTest.save_screenshot(attacker) BeefTest.save_screenshot(victim)