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