class RegressyCommon::TestSets::Base

Attributes

capability[RW]
driver[RW]
target_host[RW]

Public Class Methods

define_capability(capability_name) click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 8
def self.define_capability(capability_name)
  singleton_class.send(:define_method, :required_capability, -> do
    @capability = RegressyCommon::Capabilities::Capability.new(capability_name)
  end)
end
suite_with_capability(capability_name) click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 14
def self.suite_with_capability(capability_name)
  test_suite = suite
  test_suite.tests.map! do |v|
    v.capability = RegressyCommon::Capabilities::Capability.new(capability_name)
    v
  end
  test_suite
end

Public Instance Methods

define_capability(capability_name) click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 38
def define_capability(capability_name)
  singleton_class.send(:define_method, :required_capability, -> do
    @capability = RegressyCommon::Capabilities::Capability.new(capability_name)
  end)
  self
end
is_smartphone?() click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 45
def is_smartphone?
  (@capability)? @capability.is_smartphone? : false
end
setup() click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 23
def setup
  set_driver
  set_window_size
  @accept_next_alert = true
  @verification_errors = []

  # set timezone
  ENV['TZ'] = "Asia/Tokyo"
end
teardown() click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 33
def teardown
  @driver&.quit
  assert_equal [], @verification_errors if @verification_errors
end

Protected Instance Methods

logger() click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 61
def logger
  RegressyCommon::Utils::StandardLogger.instance
end
set_driver() click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 51
def set_driver
  @driver = RegressyCommon::DriverCreator.new(@capability).create_driver
end
set_window_size() click to toggle source
# File lib/regressy_common/test_sets/base.rb, line 55
def set_window_size
  unless is_smartphone?
    @driver&.manage.window.resize_to(1600, 1024)
  end
end