Class: RokuMonitor
Overview
This class should be included in the MonitoringTest module
Instance Attribute Summary
Attributes inherited from BaseMonitor
#health_hash, #host, #id, #identity, #iteration, #job, #logger, #ssh, #start_time, #status, #stop_time
Instance Method Summary
collapse
Methods inherited from BaseMonitor
#black_screen_roi, #check_black_screen, #check_live_video?, #check_menu, #check_platform, #dut, #initialize, #no_input_roi, #report_parental_controls, #server_name
Methods included from TmcHelpers
#aws_config, #aws_create_s3_bucket, #aws_delete_s3, #aws_delete_s3_bucket, #aws_read_s3, #aws_upload_s3, #aws_write_s3, #get_clean_ocr_text, #get_readable_size, #get_readable_time, #get_string_similarity, #get_substring_similarity, #is_rating?, #is_year?, #jsonify, #pick_random, #rubify, #send_webex_alert, #to_camel_case, #to_pascal_case, #to_snake_case, #twb_case_exists?, #twb_get_case_instance_id, #twb_get_suite_instance_id, #twb_post_screenshot, #twb_post_screenshot!, #twb_post_suite, #twb_post_testcase, #twb_post_teststep, #twb_post_teststep!, #twb_prep_s3_screenshot, #twb_suite_exists?, #until_condition, #until_equals, #until_includes, #until_not_empty, #until_not_equals, #until_not_includes, #until_not_nil, #until_same, #web_delete, #web_get, #web_post, #web_put
Methods included from HttpHelper
#web_request
Methods included from CsvHelper
#csv_parse, #csv_read
Methods included from SshHelper
#ssh_to
#send_email, #send_email_setup
Methods included from SnmpHelper
#snmp_get, #snmp_set
#assign_email_params?, #assign_test_params, #confirm_platform, #generate_email_msg, #invalid_report, #log_hash, #send_legacy_err_hash, #set_err_result, #sword_send_results, #take_screenshot
Methods included from RoiHelper
#roi_resolution
Constructor Details
This class inherits a constructor from BaseMonitor
Instance Method Details
#check_health ⇒ Object
33
34
35
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 33
def check_health
end
|
#check_power ⇒ Object
37
38
39
40
41
42
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 37
def check_power
dut.press_key('select', sleep_time: 500)
dut.press_key('last', sleep_time: 500)
end
|
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 77
def find_mac
@height = dut.height
@width = dut.width
system_roi = roi_resolution(system_text, @height, @width)
roku_nav_settings
dut.press_key('right_arrow', sleep_time: 1000)
set_err_result(@health_hash, 'Failed to nav to Roku system info', 'R3.3') unless system_roi.press_key_until_displayed?('down_arrow', presses: 10, timeout: 15_000, try_every: 300)
2.times { dut.press_key('right_arrow', sleep_time: 1000) }
roku_report_sys_info
end
|
#roku_curr_app ⇒ Object
28
29
30
31
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 28
def roku_curr_app
dut.roi.text.new(:x => 176, :y => 176, :width => 270, :height => 40, :similarity => 70, :text => '', :only_digits => false, :ref_img => "")
end
|
#roku_hardware_type ⇒ Object
20
21
22
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 20
def roku_hardware_type
dut.roi.text.new(:x => 972, :y => 314, :width => 534, :height => 58, :similarity => 70, :text => '', :only_digits => false, :ref_img => "")
end
|
16
17
18
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 16
def roku_mac
dut.roi.text.new(x: 972, y: 690, :width => 335, :height => 58, :similarity => 70, :text => '', :only_digits => false, :ref_img => "")
end
|
6
7
8
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 6
def
dut.roi.text.new(x: 180, y: 240, width: 360,height: 62, similarity: 70,text: 'Home', only_digits: false, ref_img: '')
end
|
#roku_nav_settings ⇒ Object
def spectrum_app_avail Andrew said don’t do this anymore.
checked_apps = []
app_roi = roi_resolution(roku_curr_app, @height, @width)
app_roi.text= 'Spectrum TV'
dut.press_key('right_arrow', sleep_time: 1000)
row = 1
until app_roi.displayed?(timeout:1000)
curr_app = app_roi.retrieve
already_checked = checked_apps.include?(curr_app)
if already_checked
dut.press_key('right_arrow', sleep_time:1000)
row += 1
@nav_right = true
end
checked_apps.push(curr_app) unless already_checked
unless @nav_right
dut.press_key('down_arrow', sleep_time:1000)
end
set_err_result(@health_hash, 'Unable to find spectrum app') if row > 3
@nav_right = false
end
2.times { dut.press_key('menu', sleep_time: 500) }
nil
end
70
71
72
73
74
75
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 70
def roku_nav_settings
= roi_resolution(, @height, @width)
set_err_result(@health_hash,'Failed to nav to Roku home. May need to be set up.', 'R3.1') unless .press_key_until_displayed?('menu', presses: 10, timeout: 15_000, try_every: 300)
.text = 'Settings'
set_err_result(@health_hash,'Failed to nav to Roku settings', 'R3.2') unless .press_key_until_displayed?('up_arrow', presses: 10, timeout: 15_000, try_every: 300)
end
|
#roku_report_sys_info ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 89
def roku_report_sys_info
roku_mac_roi = roi_resolution(roku_mac, @height, @width)
roku_hw_roi = roi_resolution(roku_hardware_type, @height, @width)
roku_sn_roi = roi_resolution(roku_sn, @height, @width)
@health_hash[:screenshot_1] = take_screenshot
@health_hash[:mac] = roku_mac_roi.retrieve.gsub(':', '')
set_err_result(@health_hash, 'No connection found', 'R4') unless @health_hash[:mac].match(/[0-9]/)
@health_hash[:serial_number] = roku_sn_roi.retrieve
@health_hash[:model] = roku_hw_roi.retrieve
end
|
24
25
26
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 24
def roku_sn
dut.roi.text.new(:x => 972, :y => 375, :width => 335, :height => 58, :similarity => 70, :text => '', :only_digits => false, :ref_img => "")
end
|
#system_text ⇒ Object
10
11
12
13
14
|
# File 'lib/test_case/monitoring/roku_monitor.rb', line 10
def system_text
dut.roi.text.new(x: 186, y: 250, width: 360,
height: 44, similarity: 70,
text: 'System', only_digits: false, ref_img: '')
end
|