1#!/usr/bin/python
2
3r"""
4Contains xpaths and related string constants applicable to all openBMC GUI
5menus.
6"""
7
8
9class resource_variables():
10
11    xpath_textbox_hostname = "//input[@id='host']"
12    xpath_textbox_username = "//input[@id='username']"
13    xpath_textbox_password = "//input[@id='password']"
14    xpath_input_password = "//input[@id='password']"
15    xpath_input_confirm_password = "//input[@id='passwordConfirm']"
16    xpath_submit_button = '//button[@type="submit"]'
17    xpath_button_profile_settings = '//a[@href="#/profile-settings"]'
18    xpath_button_login = "//*[@id='login__submit']"
19    xpath_button_user_action = "//button[@id='user-actions']"
20    xpath_button_logout = '//button[text()="Log out"]'
21    xpath_yes_button = "//button[text()='Yes']"
22    xpath_power_indicator = "//*[@id='power-indicator-bar']"
23    xpath_select_button_power_on = "//*[@id='power__power-on']"
24    xpath_cancel_button = "//button[contains(text(),'Cancel')]"
25    xpath_save_setting_button = "//button[contains(text(),'Save settings')]"
26    xpath_save_button = "//button[contains(text(),'Save')]"
27    xpath_remove_button = "//button[contains(text(),'Remove')]"
28    xpath_add_button = "//button[@type='submit']"
29
30    xpath_select_button_warm_reboot = \
31        "//*[@id='power__warm-boot']"
32    xpath_operation_warning_message = \
33        "//*[@class='inline__confirm active']"
34    text_warm_reboot_warning_message = "warm reboot?"
35    xpath_select_button_warm_reboot_yes = \
36        "//*[@id='power-operations']" \
37        "/div[3]/div[3]/confirm/div/div[2]/button[1]"
38
39    xpath_select_button_cold_reboot = \
40        "//*[@id='power__cold-boot']"
41    text_cold_reboot_warning_message = "cold reboot?"
42    xpath_select_button_cold_reboot_yes = \
43        "//*[@id='power-operations']" \
44        "/div[3]/div[4]/confirm/div/div[2]/button[2]"
45
46    xpath_select_button_orderly_shutdown = \
47        "//*[@id='power__soft-shutdown']"
48    xpath_select_button_orderly_shutdown_button_no = \
49        "//*[@id='power-operations']/div[3]/div[5]"\
50        "/confirm/div/div[2]/button[2]"
51    text_orderly_shutdown_warning_message = "orderly shutdown?"
52    xpath_select_button_orderly_shutdown_yes = \
53        "//*[@id='power-operations']/div[3]/div[5]" \
54        "/confirm/div/div[2]/button[1]"
55
56    xpath_select_button_immediate_shutdown = \
57        "//*[@id='power__hard-shutdown']"
58    text_immediate_shutdown_warning_message = "immediate shutdown?"
59    xpath_select_button_immediate_shutdown_yes = \
60        "//*[@id='power-operations']/div[3]/div[6]" \
61        "/confirm/div/div[2]/button[1]"
62
63    obmc_off_state = "Off"
64    obmc_standby_state = "Standby"
65    obmc_running_state = "Running"
66
67    # xpath for main menu.
68    xpath_select_server_control = "//button[contains(@class,'btn-control')]"
69    xpath_select_server_configuration = "//button[contains(@class,'btn-config')]"
70    xpath_select_access_control = "//button[contains(@class,'btn-access-control')]"
71
72    # xpath for sub main menu.
73    xpath_select_server_power_operations = "//a[@href='#/server-control/power-operations']"
74    xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
75    xpath_select_manage_power_usage = "//a[@href='#/server-control/power-usage']"
76    xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
77    xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
78    xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
79    xpath_select_ldap = "//a[@href='#/access-control/ldap']"
80    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
81    xpath_select_server_led = "//a[@href='#/server-control/server-led']"
82    xpath_select_date_time_settings = "//a[@href='#/configuration/date-time']"
83    xpath_select_local_users = "//a[@href='#/access-control/local-users']"
84
85    # GUI header elements locators.
86    xpath_select_server_power = "//a[@href='#/server-control/power-operations']"
87
88    # Server health elements locators.
89    xpath_select_refresh_button = \
90        "//*[contains(text(),'Refresh')]"
91    xpath_event_severity_all = "//*[text()='Filter by severity']/following-sibling::button[1]"
92    xpath_event_severity_high = "//*[text()='Filter by severity']/following-sibling::button[2]"
93    xpath_event_severity_medium = "//*[text()='Filter by severity']/following-sibling::button[3]"
94    xpath_event_severity_low = "//*[text()='Filter by severity']/following-sibling::button[4]"
95    xpath_drop_down_timezone_edt = \
96        "//*[@id='event-log']/section[1]/div/div/button"
97    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
98    xpath_drop_down_timezone_utc =  \
99        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
100    xpath_event_filter_all = "//*[text()='All events']"
101    xpath_event_filter_resolved = "//*[text()='Resolved events']"
102    xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
103    xpath_event_action_bars = \
104        "//*[@id='event__actions-bar']/div[1]/label/span"
105    xpath_event_action_delete = \
106        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
107    xpath_event_action_export = \
108        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
109    xpath_number_of_events = \
110        "//*[@id='event__actions-bar']/div[2]/p[2]/span"
111    xpath_mark_as_resolved = \
112        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
113    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
114    xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
115    xpath_individual_event_delete = \
116        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
117    xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
118    xpath_individual_event_resolved = \
119        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
120    xpath_individual_event_export = \
121        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
122    xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
123
124    # New GUI variables
125    xpath_login_button = "//button[@type='submit']"
126    xpath_logout_button = "//button[@id='app-header-logout']"
127