Module: PrependSystemTestingDriver

Defined in:
lib/cyperful/framework_injections.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cyperful/framework_injections.rb', line 41

def initialize(...)
  super(...)

  # SUPER NAIVE way to include the width/height of the sidebar/header
  # in the new screen size
  @screen_size = [@screen_size.fetch(0) + 300, @screen_size.fetch(1) + 60]

  prev_capabilities = @capabilities
  @capabilities =
    proc do |driver_opts|
      prev_capabilities&.call(driver_opts)

      next unless driver_opts.respond_to?(:add_argument)

      # this assumes Selenium and Chrome:

      # so user isn't prompted when we start recording video w/ MediaStream
      driver_opts.add_argument("--auto-accept-this-tab-capture")
      driver_opts.add_argument("--use-fake-ui-for-media-stream")

      # make sure we're not in headless mode
      driver_opts.args.delete("--headless")
      driver_opts.args.delete("--headless=new")

      # hide the "Chrome is being controlled by automated test software" infobar
      driver_opts.args.delete("--enable-automation")
      driver_opts.exclude_switches << "enable-automation"
    end
end