Class: RegressyCommon::TestSets::Base

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/regressy_common/test_sets/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#capabilityObject

Returns the value of attribute capability.



5
6
7
# File 'lib/regressy_common/test_sets/base.rb', line 5

def capability
  @capability
end

#driverObject

Returns the value of attribute driver.



5
6
7
# File 'lib/regressy_common/test_sets/base.rb', line 5

def driver
  @driver
end

#target_hostObject

Returns the value of attribute target_host.



5
6
7
# File 'lib/regressy_common/test_sets/base.rb', line 5

def target_host
  @target_host
end

Class Method Details

.define_capability(capability_name) ⇒ Object



8
9
10
11
12
# 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) ⇒ Object



14
15
16
17
18
19
20
21
# 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

Instance Method Details

#define_capability(capability_name) ⇒ Object



38
39
40
41
42
43
# 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?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/regressy_common/test_sets/base.rb', line 45

def is_smartphone?
  (@capability)? @capability.is_smartphone? : false
end

#setupObject



23
24
25
26
27
28
29
30
31
# 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

#teardownObject



33
34
35
36
# File 'lib/regressy_common/test_sets/base.rb', line 33

def teardown
  @driver&.quit
  assert_equal [], @verification_errors if @verification_errors
end