Top Level Namespace

Defined Under Namespace

Modules: MAGNETON Classes: Helper

Constant Summary collapse

BROWSER =
ENV['BROWSER']
ENVIRONMENT_TYPE =
ENV['ENVIRONMENT_TYPE']
IMATCHER =
Imatcher::Matcher.new mode: :grayscale, tolerance: 1

Instance Method Summary collapse

Instance Method Details

#all_list_elements_eqObject

matcher to validate if all elements in list are equals



4
5
6
7
8
9
10
11
12
13
# File 'lib/skeleton/features/support/matchers/custom.rb', line 4

RSpec::Matchers.define :all_list_elements_eq do |expected|
  match do |actual|
    actual.each do |i|
      expect(i).to eq(expected)
    end
  end
  failure_message_for_should do |actual|
    "expected that all elements in #{actual} list would be equals #{expected}"
  end
end

#seleniumObject

register driver according with browser chosen



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/skeleton/features/support/env.rb', line 19

Capybara.register_driver :selenium do |app|
  if BROWSER.eql?('chrome')
    caps = Selenium::WebDriver::Remote::Capabilities.chrome(
    'chromeOptions' => {
      "args" => [ "--window-size=1600,1300"]
    }
    )
    Capybara::Selenium::Driver.new(app, {:browser => :chrome, :desired_capabilities => caps})
  elsif BROWSER.eql?('firefox')
    Capybara::Selenium::Driver.new(app, browser: :firefox)
  elsif BROWSER.eql?('internet_explorer')
    Capybara::Selenium::Driver.new(app, browser: :internet_explorer)
  elsif BROWSER.eql?('safari')
    Capybara::Selenium::Driver.new(app, browser: :safari)
  elsif BROWSER.eql?('poltergeist')
    options = { js_errors: false }
    Capybara::Poltergeist::Driver.new(app, options)
  end
end