Skip to content

Commit

Permalink
Add more things for debugging selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-stefano committed Dec 24, 2024
1 parent 4d9a2a7 commit 3b94be5
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions spec/spec_helper_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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

0 comments on commit 3b94be5

Please sign in to comment.