Top Level Namespace

Defined Under Namespace

Modules: Happo

Instance Method Summary collapse

Instance Method Details

#init_driverObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/happo/runner.rb', line 18

def init_driver
  tries = 0
  begin
    driver = Selenium::WebDriver.for Happo::Utils.config['driver'].to_sym
  rescue Selenium::WebDriver::Error::WebDriverError => e
    # "unable to obtain stable firefox connection in 60 seconds"
    #
    # This seems to happen sporadically for some versions of Firefox, so we want
    # to retry a couple of times it in case it will work the second time around.
    tries += 1
    retry if tries <= 3
    raise e
  end

  driver.manage.timeouts.script_timeout = 3 # move to config?

  driver
end

#resolve_viewports(example) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/happo/runner.rb', line 7

def resolve_viewports(example)
  configured_viewports = Happo::Utils.config['viewports']

  viewports =
    example['options']['viewports'] || [configured_viewports.first.first]

  viewports.map do |viewport|
    configured_viewports[viewport].merge('name' => viewport)
  end
end