Class: SpecMonitor
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
150
151
152
153
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 150
def check_live_video?
report_parental_controls(parental_lock)
super
end
|
69
70
71
72
73
74
75
76
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 69
def
log_hash('spec_menu ', @health_hash)
spectrum_main_menu = roi_resolution(, dut.height, dut.width)
unless spectrum_main_menu.wait_until_displayed?(15_000, key: 'menu')
set_err_result(@health_hash, 'Unable to nav to menu. Check platform or device health', 'SP3.1')
end
end
|
#equip_info ⇒ Object
16
17
18
19
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 16
def equip_info
dut.roi.text.new(x: 708, y: 36, width: 500, height: 102, similarity: 70,
text: 'Equipment Info', only_digits: false, ref_img: '')
end
|
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 121
def find_mac
log_hash('spec_mac_1 ', @health_hash)
instantiate_rois
try_again = lambda {
dut.press_key('select', :sleep_time=>5.sec)
dut.press_key('exit', :sleep_time=>5.sec)
set_err_result(@health_hash, "Failed to reach spec menu", 'SP3.2') unless @spectrum_main_menu.wait_until_displayed?(20000, key: "menu")
7.times { dut.press_key('down_arrow', :sleep_time=>3.sec) }
dut.press_key('select', :sleep_time=>0.sec)
}
7.times { dut.press_key('down_arrow', :sleep_time=>1.sec) }
dut.press_key('select', :sleep_time=>0.sec)
if @restart_spec.displayed?(timeout: 1500)
try_again.call
end
set_err_result(@health_hash, 'Failed to nav to settings', 'SP3.3') unless @spectrum_settings_roi.wait_until_displayed?(30000)
nav_equip_info
nav_account_info
set_mac_results
2.times { dut.press_key('exit', :sleep_time=>3.sec) }
log_hash('spec_mac_2 ', @health_hash)
end
|
#instantiate_rois ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 78
def instantiate_rois
@spectrum_main_menu = roi_resolution(, dut.height, dut.width)
@spectrum_settings_roi = roi_resolution(spectrum_settings, dut.height, dut.width)
@restart_spec = roi_resolution(restart_spectrum_guide, dut.height, dut.width)
@spec_acct_roi = roi_resolution(spec_an, dut.height, dut.width)
@mac_roi = roi_resolution(spec_mac, dut.height, dut.width)
@sn_roi = roi_resolution(spec_sn, dut.height, dut.width)
@model_roi = roi_resolution(spec_hardware_type, dut.height, dut.width)
@dev_id_roi = roi_resolution(spec_dev_id, dut.height, dut.width)
@account_inf_roi = roi_resolution(mac_acc_info, dut.height, dut.width)
@equip_inf_roi = roi_resolution(equip_info, dut.height, dut.width)
end
|
#mac_acc_info ⇒ Object
11
12
13
14
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 11
def mac_acc_info
dut.roi.text.new(x: 576, y: 434, width: 224, height: 102, similarity: 70,
text: 'Account Info', only_digits: false, ref_img: '')
end
|
#nav_account_info ⇒ Object
105
106
107
108
109
110
111
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 105
def nav_account_info
dut.press_key('left_arrow', :sleep_time=>2.sec)
dut.press_key('select', :sleep_time=>0.sec)
@spectrum_settings_roi.wait_until_displayed?(8000)
@health_hash[:screenshot_2] = take_screenshot
log_hash('spec_nav_account_info ', @health_hash)
end
|
#nav_equip_info ⇒ Object
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 91
def nav_equip_info
6.times { dut.press_key('down_arrow', sleep_time: 1.sec) }
dut.press_key('select', sleep_time: 1.sec)
@account_inf_roi.wait_until_displayed?(8000)
dut.press_key('right_arrow', sleep_time: 2.sec)
dut.press_key('select', sleep_time: 1.sec)
@equip_inf_roi.wait_until_displayed?(8000)
@health_hash[:device_id] = @dev_id_roi.retrieve
@health_hash[:screenshot_1] = take_screenshot
dut.press_key('last', :sleep_time=>0.sec)
@account_inf_roi.wait_until_displayed?(8000)
end
|
#parental_lock ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 61
def parental_lock
roi_resolution(dut.roi.text.new(:x => 600, :y => 282,
:width => 778, :height => 78,
:similarity => 70, :text => 'Parental Control PIN',
:only_digits => false, :ref_img => ""),
dut.height, dut.width)
end
|
#restart_spectrum_guide ⇒ Object
31
32
33
34
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 31
def restart_spectrum_guide
dut.roi.text.new(x: 424, y: 306, width: 980, height: 230, similarity: 70,
text: 'We\'re Restarting Spectrum \n Guide', only_digits: false, ref_img: '')
end
|
#set_mac_results ⇒ Object
113
114
115
116
117
118
119
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 113
def set_mac_results
@health_hash[:account] = @spec_acct_roi.retrieve.gsub(" ", "")
@health_hash[:mac] = @mac_roi.retrieve
@health_hash[:serial_number] = @sn_roi.retrieve
@health_hash[:model] = @model_roi.retrieve
log_hash('spec_set_mac_results ', @health_hash)
end
|
#settings_and_support_text ⇒ Object
26
27
28
29
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 26
def settings_and_support_text
dut.roi.text.new(x: 629, y: 90, width: 656, height: 102, similarity: 80,
text: 'Settings & Support', only_digits: false, ref_img: '')
end
|
51
52
53
54
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 51
def spec_an
dut.roi.text.new(x: 846, y: 434, width: 380, height: 100, similarity: 70,
text: '', only_digits: false, ref_img: '')
end
|
#spec_dev_id ⇒ Object
56
57
58
59
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 56
def spec_dev_id
dut.roi.text.new(x: 392, y: 496, width: 470, height: 36, similarity: 70,
text: '', only_digits: false, ref_img: '')
end
|
#spec_hardware_type ⇒ Object
41
42
43
44
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 41
def spec_hardware_type
dut.roi.text.new(x: 684, y: 658, width: 286, height: 46, similarity: 70,
text: '', only_digits: false, ref_img: '')
end
|
36
37
38
39
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 36
def spec_mac
dut.roi.text.new(x: 800, y: 742, width: 310, height: 58, similarity: 70,
text: '', only_digits: false, ref_img: '')
end
|
46
47
48
49
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 46
def spec_sn
dut.roi.text.new(x: 808, y: 784, width: 398, height: 58, similarity: 70,
text: '', only_digits: false, ref_img: '')
end
|
6
7
8
9
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 6
def
dut.roi.text.new(x: 18, y: 463, width: 457, height: 101, similarity: 80,
text: 'My Library', only_digits: false, ref_img: '')
end
|
#spectrum_settings ⇒ Object
21
22
23
24
|
# File 'lib/test_case/monitoring/spec_monitor.rb', line 21
def spectrum_settings
dut.roi.text.new(x: 640, y: 76, width: 644, height: 114, similarity: 80,
text: 'Settings & Support', only_digits: false, ref_img: '')
end
|