Class: Roku

Inherits:
Platform show all
Defined in:
lib/platform/roku/roku.rb

Overview

Roku adds to or modifies Platform with Roku-specific functionality

Direct Known Subclasses

Roku720

Instance Attribute Summary

Attributes inherited from Platform

#id, #keys, #remotes, #roi, #screens

Instance Method Summary collapse

Methods inherited from Platform

#alt_parental_controls_pin, #app_version, #audio_level, #audio_level_left, #audio_level_right, #audio_present?, #capture_audio, #capture_frames, #capture_screen, #device_type_is?, #device_type_not?, #entitlements, #has_power?, #height, #high_def?, #ip_address, #is_generic?, #lock, #mac_address, #model, #name, #parental_controls_pin, #password, #platform, #power_cycle, #power_off, #power_on, #power_on?, #press_key, #record_audio, #record_video, #remote_type=, #remote_type_is?, #reset_video, #resolution, #save_last_screen_captured, #slot, #snmp_get, #snmp_set, #stop_audio, #stop_video, #upload_screenshot, #username, #width

Constructor Details

#initialize(*args) ⇒ Roku

Public: Initializes a Roku.



12
13
14
15
16
17
# File 'lib/platform/roku/roku.rb', line 12

def initialize(*args)
  super(*args)
  @screens = RokuScreens.new(self)
  @roi = RokuRois.new(self)
  set_keys(RokuKeys.new)
end

Instance Method Details

#controllerObject

Public: Gets the controller.

Returns the RokuController instance.



82
83
84
85
86
87
# File 'lib/platform/roku/roku.rb', line 82

def controller
  if @controller.nil?
    @controller = RokuController.new(:dut => self)
  end
  @controller
end

#init?Boolean

Public: Ensures device is on and can nav to home screen.

Returns a Boolean true if the device was initialized, otherwise false.

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/platform/roku/roku.rb', line 22

def init?
  super do
    if has_power?
      # exit to the home screen
      2.times { press_key.MENU(sleep_time: 2.sec) }
      return false unless screens.home.displayed?(timeout: 10.sec)
    else
      # device was powered off. power on and wait up to 2 mins for "No Signal" to go away.
      power_on
      return false unless roi.text.no_input_signal.wait_until_not_displayed?(2.min)
      return false unless screens.home.displayed?(timeout: 2.min)
    end
    # leaving incase we need it back
    # start = Time.now
    # loop do
    #   return false if (Time.now - start) > 180  # timeout 3 mins
    #   if roi.image.respond_to?("#{app_slot_roi}_1")
    #     if roi.image.send("#{app_slot_roi}_1").displayed?
    #       press_key.SELECT(sleep_time: 2.sec)
    #       break
    #     elsif roi.image.send("#{app_slot_roi}_2").displayed?
    #       press_key.ARROW_RIGHT(sleep_time: 2.sec)
    #       press_key.SELECT(sleep_time: 2.sec)
    #       break
    #     elsif roi.image.send("#{app_slot_roi}_3").displayed?
    #       #elsif roi.image.dev_app_slot_3.displayed?
    #       2.times { press_key.ARROW_RIGHT(sleep_time: 2.sec) }
    #       press_key.SELECT(sleep_time: 2.sec)
    #       break
    #     end
    #   elsif roi.image.send(app_slot_roi).displayed?
    #     press_key.SELECT(sleep_time: 2.sec)
    #     break
    #   end
    #   press_key.ARROW_DOWN(sleep_time: 2.sec)
    # end
    # if screens.home.is_spectrum_loading_screen_displayed?
    #   # wait for loading screen to go away
    #   return false unless screens.home.wait_till_loading_screen_not_displayed?(30.sec)
    # end
    # if screens.home.is_spectrum_launch_screen_displayed?
    #   # wait for launch screen to go away
    #   return false unless screens.home.wait_till_launch_screen_not_displayed?(30.sec)
    # end
    # if roi.text.welcome_screen_text.displayed?
    #   # dismiss welcome screen
    #   press_key.SELECT(sleep_time: 3.sec)
    #   return false unless roi.text.welcome_screen_text.wait_until_not_displayed?(30.sec)
    # end
    # if screens.login.is_username_page_displayed?
    #   # sign in
    #   return false unless screens.login.login?
    # end
    true
  end
end

#software_versionObject

Public: Gets the device software version.

Returns the String software version.



92
93
94
# File 'lib/platform/roku/roku.rb', line 92

def software_version
  super || @test_case.options[:current_roku_version] || '2.0.34'
end