1e7e9171eSGeorge Keishing#!/usr/bin/env python3
2b89977a4SRahul Maheshwari
3b89977a4SRahul Maheshwarir"""
4b89977a4SRahul MaheshwariContains xpaths and related string constants applicable to all openBMC GUI
5b89977a4SRahul Maheshwarimenus.
6b89977a4SRahul Maheshwari"""
7b89977a4SRahul Maheshwari
8b89977a4SRahul Maheshwari
920f38712SPatrick Williamsclass resource_variables:
10fdd2dcfeSGeorge Keishing    r"""
11fdd2dcfeSGeorge Keishing    Base class for GUI resource related XPATH variables.
12fdd2dcfeSGeorge Keishing    """
13*9c223095SGeorge Keishing
14314cd9f9SRahul Maheshwari    xpath_textbox_hostname = "//input[@id='host']"
15314cd9f9SRahul Maheshwari    xpath_textbox_username = "//input[@id='username']"
16314cd9f9SRahul Maheshwari    xpath_textbox_password = "//input[@id='password']"
179233ce15SAnves Kumar rayankula    xpath_input_password = "//input[@id='password']"
189233ce15SAnves Kumar rayankula    xpath_input_confirm_password = "//input[@id='passwordConfirm']"
199233ce15SAnves Kumar rayankula    xpath_submit_button = '//button[@type="submit"]'
209233ce15SAnves Kumar rayankula    xpath_button_profile_settings = '//a[@href="#/profile-settings"]'
21b89977a4SRahul Maheshwari    xpath_button_login = "//*[@id='login__submit']"
2231b3c434SRahul Maheshwari    xpath_button_user_action = "//button[@id='user-actions']"
2331b3c434SRahul Maheshwari    xpath_button_logout = '//button[text()="Log out"]'
24b89977a4SRahul Maheshwari    xpath_yes_button = "//button[text()='Yes']"
25b89977a4SRahul Maheshwari    xpath_power_indicator = "//*[@id='power-indicator-bar']"
26b89977a4SRahul Maheshwari    xpath_select_button_power_on = "//*[@id='power__power-on']"
27dd3bb604SRahul Maheshwari    xpath_cancel_button = "//button[contains(text(),'Cancel')]"
28dd3bb604SRahul Maheshwari    xpath_save_setting_button = "//button[contains(text(),'Save settings')]"
29bb20cb09SAnusha Dathatri    xpath_save_button = "//button[contains(text(),'Save')]"
30e9650a6aSAnusha Dathatri    xpath_remove_button = "//button[contains(text(),'Remove')]"
31e9650a6aSAnusha Dathatri    xpath_add_button = "//button[@type='submit']"
32b89977a4SRahul Maheshwari
3320f38712SPatrick Williams    xpath_select_button_warm_reboot = "//*[@id='power__warm-boot']"
3420f38712SPatrick Williams    xpath_operation_warning_message = "//*[@class='inline__confirm active']"
35b89977a4SRahul Maheshwari    text_warm_reboot_warning_message = "warm reboot?"
3620f38712SPatrick Williams    xpath_select_button_warm_reboot_yes = (
3720f38712SPatrick Williams        "//*[@id='power-operations']"
38b89977a4SRahul Maheshwari        "/div[3]/div[3]/confirm/div/div[2]/button[1]"
3920f38712SPatrick Williams    )
40b89977a4SRahul Maheshwari
4120f38712SPatrick Williams    xpath_select_button_cold_reboot = "//*[@id='power__cold-boot']"
42b89977a4SRahul Maheshwari    text_cold_reboot_warning_message = "cold reboot?"
4320f38712SPatrick Williams    xpath_select_button_cold_reboot_yes = (
4420f38712SPatrick Williams        "//*[@id='power-operations']"
45b89977a4SRahul Maheshwari        "/div[3]/div[4]/confirm/div/div[2]/button[2]"
4620f38712SPatrick Williams    )
47b89977a4SRahul Maheshwari
4820f38712SPatrick Williams    xpath_select_button_orderly_shutdown = "//*[@id='power__soft-shutdown']"
4920f38712SPatrick Williams    xpath_select_button_orderly_shutdown_button_no = (
5020f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[5]"
51b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[2]"
5220f38712SPatrick Williams    )
53b89977a4SRahul Maheshwari    text_orderly_shutdown_warning_message = "orderly shutdown?"
5420f38712SPatrick Williams    xpath_select_button_orderly_shutdown_yes = (
5520f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[5]"
56b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
5720f38712SPatrick Williams    )
58b89977a4SRahul Maheshwari
5920f38712SPatrick Williams    xpath_select_button_immediate_shutdown = "//*[@id='power__hard-shutdown']"
60b89977a4SRahul Maheshwari    text_immediate_shutdown_warning_message = "immediate shutdown?"
6120f38712SPatrick Williams    xpath_select_button_immediate_shutdown_yes = (
6220f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[6]"
63b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
6420f38712SPatrick Williams    )
65b89977a4SRahul Maheshwari
66b89977a4SRahul Maheshwari    obmc_off_state = "Off"
67b89977a4SRahul Maheshwari    obmc_standby_state = "Standby"
68b89977a4SRahul Maheshwari    obmc_running_state = "Running"
69b89977a4SRahul Maheshwari
7057a4155fSRahul Maheshwari    # xpath for main menu.
7157a4155fSRahul Maheshwari    xpath_select_server_control = "//button[contains(@class,'btn-control')]"
7220f38712SPatrick Williams    xpath_select_server_configuration = (
7320f38712SPatrick Williams        "//button[contains(@class,'btn-config')]"
7420f38712SPatrick Williams    )
7520f38712SPatrick Williams    xpath_select_access_control = (
7620f38712SPatrick Williams        "//button[contains(@class,'btn-access-control')]"
7720f38712SPatrick Williams    )
7857a4155fSRahul Maheshwari
7957a4155fSRahul Maheshwari    # xpath for sub main menu.
8020f38712SPatrick Williams    xpath_select_server_power_operations = (
8120f38712SPatrick Williams        "//a[@href='#/server-control/power-operations']"
8220f38712SPatrick Williams    )
83dd3bb604SRahul Maheshwari    xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
8420f38712SPatrick Williams    xpath_select_manage_power_usage = (
8520f38712SPatrick Williams        "//a[@href='#/server-control/power-usage']"
8620f38712SPatrick Williams    )
8723decff0SRahul Maheshwari    xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
8823decff0SRahul Maheshwari    xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
8923decff0SRahul Maheshwari    xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
9023decff0SRahul Maheshwari    xpath_select_ldap = "//a[@href='#/access-control/ldap']"
9123decff0SRahul Maheshwari    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
92f0821d4aSAnusha Dathatri    xpath_select_server_led = "//a[@href='#/server-control/server-led']"
93c8ca7682SAnusha Dathatri    xpath_select_date_time_settings = "//a[@href='#/configuration/date-time']"
94dc74fdc5SAnusha Dathatri    xpath_select_local_users = "//a[@href='#/access-control/local-users']"
9557a4155fSRahul Maheshwari
96b89977a4SRahul Maheshwari    # GUI header elements locators.
9720f38712SPatrick Williams    xpath_select_server_power = (
9820f38712SPatrick Williams        "//a[@href='#/server-control/power-operations']"
9920f38712SPatrick Williams    )
100b89977a4SRahul Maheshwari
101b89977a4SRahul Maheshwari    # Server health elements locators.
10220f38712SPatrick Williams    xpath_select_refresh_button = "//*[contains(text(),'Refresh')]"
10320f38712SPatrick Williams    xpath_event_severity_all = (
10420f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[1]"
10520f38712SPatrick Williams    )
10620f38712SPatrick Williams    xpath_event_severity_high = (
10720f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[2]"
10820f38712SPatrick Williams    )
10920f38712SPatrick Williams    xpath_event_severity_medium = (
11020f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[3]"
11120f38712SPatrick Williams    )
11220f38712SPatrick Williams    xpath_event_severity_low = (
11320f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[4]"
11420f38712SPatrick Williams    )
11520f38712SPatrick Williams    xpath_drop_down_timezone_edt = (
116b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/button"
11720f38712SPatrick Williams    )
118b89977a4SRahul Maheshwari    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
11920f38712SPatrick Williams    xpath_drop_down_timezone_utc = (
120b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
12120f38712SPatrick Williams    )
122cae580a6SAnusha Dathatri    xpath_event_filter_all = "//*[text()='All events']"
123cae580a6SAnusha Dathatri    xpath_event_filter_resolved = "//*[text()='Resolved events']"
124cae580a6SAnusha Dathatri    xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
12520f38712SPatrick Williams    xpath_event_action_bars = "//*[@id='event__actions-bar']/div[1]/label/span"
12620f38712SPatrick Williams    xpath_event_action_delete = (
127b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
12820f38712SPatrick Williams    )
12920f38712SPatrick Williams    xpath_event_action_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
13020f38712SPatrick Williams    xpath_number_of_events = "//*[@id='event__actions-bar']/div[2]/p[2]/span"
13120f38712SPatrick Williams    xpath_mark_as_resolved = (
132b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
13320f38712SPatrick Williams    )
134b89977a4SRahul Maheshwari    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
135cae580a6SAnusha Dathatri    xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
13620f38712SPatrick Williams    xpath_individual_event_delete = (
137b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
13820f38712SPatrick Williams    )
139cae580a6SAnusha Dathatri    xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
14020f38712SPatrick Williams    xpath_individual_event_resolved = (
141b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
14220f38712SPatrick Williams    )
14320f38712SPatrick Williams    xpath_individual_event_export = (
144b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
14520f38712SPatrick Williams    )
146cae580a6SAnusha Dathatri    xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
147