From 3b94be5332c201a56dc060ce33c697293deaf673 Mon Sep 17 00:00:00 2001 From: Tomas D'Stefano Date: Tue, 24 Dec 2024 15:29:37 +0000 Subject: [PATCH] Add more things for debugging selenium --- spec/spec_helper_system.rb | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb index 268fb7f8da..dff0502619 100644 --- a/spec/spec_helper_system.rb +++ b/spec/spec_helper_system.rb @@ -31,6 +31,38 @@ RSpec.configure do |config| screen_size = [1400, 1400] + config.before(:suite) do + selenium_directories = { + chrome: '/root/.cache/selenium/chrome/linux64', + chromedriver: '/root/.cache/selenium/chromedriver/linux64' + } + + selenium_directories.each do |name, base_dir| + version_dir = Dir.glob("#{base_dir}/*").first + + if version_dir + puts "Contents of #{version_dir}:" + + file_name = name.to_s + file_path = File.join(version_dir, file_name) + + if File.exist?(file_path) + puts "#{file_name}:" + puts "- Path: #{file_path}" + puts "- Size: #{File.size(file_path)} bytes" + puts "- Permissions: #{sprintf('%o', File.stat(file_path).mode)}" + puts "- Modified: #{File.mtime(file_path)}" + else + puts "Error: #{file_name} not found in #{version_dir}." + end + + puts "Setup complete for #{version_dir}." + else + puts "Error: Selenium #{name.capitalize} directory not found in #{base_dir}." + end + end + end + config.before(:each, type: :system) do service = self.class.metadata[:service] @@ -39,10 +71,10 @@ end config.before(:each, :js, type: :system) do - driven_by :selenium_chrome_headless, using: :headless_chrome, screen_size: + driven_by :selenium_chrome_headless, using: :headless_chrome, screen_size: screen_size end config.before(:each, :js_browser, type: :system) do - driven_by :selenium, using: :chrome, screen_size: + driven_by :selenium, using: :chrome, screen_size: screen_size end end