Class: OdnMonitor
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_health, #check_platform, #check_power, #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_live_video? ⇒ Boolean
133
134
135
136
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 133
def check_live_video?
report_parental_controls(odn_parental_control)
super
end
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 116
def
boot_wait = 430_000
unless odn_boot.wait_until_not_displayed?(boot_wait)
set_err_result(@health_hash,
"Stuck on boot screen for over #{(boot_wait / 1000 / 60.0).floor(1)} minutes", 'O3.1'
)
end
dut.press_key('menu', sleep_time: 0)
unless .wait_until_displayed?(30000)
set_err_result(@health_hash,
'Unable to nav to menu. Check platform or device health', 'O3.2'
)
end
end
|
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 77
def find_mac
odn_nav_to_settings
odn_nav_to_about_settings
mac = odn_mac.retrieve.gsub(':', '')
hw_type = odn_hardware_type.retrieve
@health_hash [:mac] = mac
@health_hash [:model] = hw_type
@health_hash [:url] = take_screenshot
dut.press_key('exit', :sleep_time=>2.sec)
end
|
53
54
55
56
57
58
59
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 53
def
roi_resolution(dut.roi.color.new(x: 426, y: 212,
width: 46, height: 52,
similarity: 90, rgb: [3, 87, 145],
ref_img: ''),
dut.height, dut.width)
end
|
This is in the settings of the ODN software. Returns new ROI every check for the crawl
90
91
92
93
94
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 90
def (height, roi)
roi.y += height/15
roi
end
|
#odn_about_home ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 14
def odn_about_home
roi_resolution(dut.roi.text.new(x: 98, y: 32,
width: 500, height: 85,
similarity: 70, text: 'Settings',
only_digits: false, ref_img: ''),
dut.height, dut.width)
end
|
61
62
63
64
65
66
67
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 61
def
roi_resolution(dut.roi.text.new(x: 196, y: 536,
width: 424, height: 46,
similarity: 70, text: 'About',
only_digits: false, ref_img: ''),
dut.height, dut.width)
end
|
45
46
47
48
49
50
51
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 45
def odn_boot
roi_resolution(dut.roi.text.new(x: 624, y: 146,
width: 686, height: 156,
similarity: 70, text: 'technicolor',
only_digits: false, ref_img: ''),
dut.height, dut.width)
end
|
#odn_hardware_type ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 22
def odn_hardware_type
roi_resolution(dut.roi.text.new(x: 1134, y: 632,
width: 568, height: 58,
similarity: 70, text: '',
only_digits: false, ref_img: ''),
dut.height, dut.width)
end
|
30
31
32
33
34
35
36
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 30
def odn_mac
roi_resolution(dut.roi.text.new(x: 1146, y: 682,
width: 384, height: 66,
similarity: 70, text: '',
only_digits: false, ref_img: ''),
dut.height, dut.width)
end
|
38
39
40
41
42
43
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 38
def
dut.roi.text.new(x: 102, y: 200,
width: 500, height: 78,
similarity: 70, text: 'Settings',
only_digits: false, ref_img: '')
end
|
6
7
8
9
10
11
12
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 6
def
roi_resolution(dut.roi.text.new(x: 120, y: 200,
width: 500, height: 85,
similarity: 70,text: 'Watch TV',
only_digits: false, ref_img: ''),
dut.height, dut.width)
end
|
#odn_nav_to_about_settings ⇒ Object
Used to ensure we get to the ‘About’ page.
97
98
99
100
101
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 97
def odn_nav_to_about_settings
.press_key_until_displayed?("up_arrow", presses: 5, timeout: 5000, try_every: 1000, try_timeout: 1000)
dut.press_key('select', sleep_time:0)
odn_about_home.wait_until_displayed?(30_000)
end
|
#odn_nav_to_settings ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 103
def odn_nav_to_settings
tries = 0
found = false
= roi_resolution(, dut.height, dut.width)
until found || tries == 10
found = .displayed?(timeout: 3000) if tries > 4
dut.press_key('select', sleep_time: 2.sec) if found
= (dut.height, )
dut.press_key('down_arrow', sleep_time: 1.sec) unless found
tries += 1
end
end
|
#odn_parental_control ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/test_case/monitoring/odn_monitor.rb', line 69
def odn_parental_control
roi_resolution(dut.roi.text.new(:x => 800, :y => 644,
:width => 446, :height => 58,
:similarity => 70, :text => 'Unblock this program',
:only_digits => false, :ref_img => ""),
dut.height, dut.width)
end
|