Module: Cukunity::PlatformHelpers

Extended by:
Forwardable
Defined in:
lib/cukunity/cucumber/support/platform_helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.__tags__=(tags) ⇒ Object



72
73
74
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 72

def self.__tags__=(tags)
  @@__tags__ = tags
end

Instance Method Details

#appObject



52
53
54
55
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 52

def app
  raise Exception::UnspecifiedPlatform.new if @platform.nil?
  @platform::App
end

#current_appObject



18
19
20
21
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 18

def current_app
  raise Exception::InvalidApp.new if @current_app.nil?
  @current_app
end

#current_app=(path) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 23

def current_app=(path)
  case File.extname(path).downcase
  when '.app'
    set_current_app_ios(path)
  when '.apk'
    set_current_app_android(path)
  else
    # @ios is defined as a tag?
    tags = @@__tags__
    if tags.include?('@ios') or tags.include?('@~android')
      path = set_current_app_ios("#{path}.app")
    # @android is defined as a tag?
    elsif tags.include?('@android') or tags.include?('@~ios')
      path = set_current_app_android("#{path}.apk")
    else
      raise Exception::InvalidApp.new(path)
    end
  end
  @current_app = path
end

#keyboardObject



67
68
69
70
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 67

def keyboard 
  raise Exception::UnspecifiedPlatform.new if @platform.nil?
  @platform::KeyboardInput
end

#platform_defined?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 48

def platform_defined?
  not @platform.nil?
end

#processObject



57
58
59
60
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 57

def process
  raise Exception::UnspecifiedPlatform.new if @platform.nil?
  @platform::Process
end

#set_current_app(path) ⇒ Object



44
45
46
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 44

def set_current_app(path)
  self.current_app = path
end

#touchObject



62
63
64
65
# File 'lib/cukunity/cucumber/support/platform_helpers.rb', line 62

def touch
  raise Exception::UnspecifiedPlatform.new if @platform.nil?
  @platform::TouchInput
end