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