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:
10*fdd2dcfeSGeorge Keishing    r"""
11*fdd2dcfeSGeorge Keishing    Base class for GUI resource related XPATH variables.
12*fdd2dcfeSGeorge Keishing    """
13314cd9f9SRahul Maheshwari    xpath_textbox_hostname = "//input[@id='host']"
14314cd9f9SRahul Maheshwari    xpath_textbox_username = "//input[@id='username']"
15314cd9f9SRahul Maheshwari    xpath_textbox_password = "//input[@id='password']"
169233ce15SAnves Kumar rayankula    xpath_input_password = "//input[@id='password']"
179233ce15SAnves Kumar rayankula    xpath_input_confirm_password = "//input[@id='passwordConfirm']"
189233ce15SAnves Kumar rayankula    xpath_submit_button = '//button[@type="submit"]'
199233ce15SAnves Kumar rayankula    xpath_button_profile_settings = '//a[@href="#/profile-settings"]'
20b89977a4SRahul Maheshwari    xpath_button_login = "//*[@id='login__submit']"
2131b3c434SRahul Maheshwari    xpath_button_user_action = "//button[@id='user-actions']"
2231b3c434SRahul Maheshwari    xpath_button_logout = '//button[text()="Log out"]'
23b89977a4SRahul Maheshwari    xpath_yes_button = "//button[text()='Yes']"
24b89977a4SRahul Maheshwari    xpath_power_indicator = "//*[@id='power-indicator-bar']"
25b89977a4SRahul Maheshwari    xpath_select_button_power_on = "//*[@id='power__power-on']"
26dd3bb604SRahul Maheshwari    xpath_cancel_button = "//button[contains(text(),'Cancel')]"
27dd3bb604SRahul Maheshwari    xpath_save_setting_button = "//button[contains(text(),'Save settings')]"
28bb20cb09SAnusha Dathatri    xpath_save_button = "//button[contains(text(),'Save')]"
29e9650a6aSAnusha Dathatri    xpath_remove_button = "//button[contains(text(),'Remove')]"
30e9650a6aSAnusha Dathatri    xpath_add_button = "//button[@type='submit']"
31b89977a4SRahul Maheshwari
3220f38712SPatrick Williams    xpath_select_button_warm_reboot = "//*[@id='power__warm-boot']"
3320f38712SPatrick Williams    xpath_operation_warning_message = "//*[@class='inline__confirm active']"
34b89977a4SRahul Maheshwari    text_warm_reboot_warning_message = "warm reboot?"
3520f38712SPatrick Williams    xpath_select_button_warm_reboot_yes = (
3620f38712SPatrick Williams        "//*[@id='power-operations']"
37b89977a4SRahul Maheshwari        "/div[3]/div[3]/confirm/div/div[2]/button[1]"
3820f38712SPatrick Williams    )
39b89977a4SRahul Maheshwari
4020f38712SPatrick Williams    xpath_select_button_cold_reboot = "//*[@id='power__cold-boot']"
41b89977a4SRahul Maheshwari    text_cold_reboot_warning_message = "cold reboot?"
4220f38712SPatrick Williams    xpath_select_button_cold_reboot_yes = (
4320f38712SPatrick Williams        "//*[@id='power-operations']"
44b89977a4SRahul Maheshwari        "/div[3]/div[4]/confirm/div/div[2]/button[2]"
4520f38712SPatrick Williams    )
46b89977a4SRahul Maheshwari
4720f38712SPatrick Williams    xpath_select_button_orderly_shutdown = "//*[@id='power__soft-shutdown']"
4820f38712SPatrick Williams    xpath_select_button_orderly_shutdown_button_no = (
4920f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[5]"
50b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[2]"
5120f38712SPatrick Williams    )
52b89977a4SRahul Maheshwari    text_orderly_shutdown_warning_message = "orderly shutdown?"
5320f38712SPatrick Williams    xpath_select_button_orderly_shutdown_yes = (
5420f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[5]"
55b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
5620f38712SPatrick Williams    )
57b89977a4SRahul Maheshwari
5820f38712SPatrick Williams    xpath_select_button_immediate_shutdown = "//*[@id='power__hard-shutdown']"
59b89977a4SRahul Maheshwari    text_immediate_shutdown_warning_message = "immediate shutdown?"
6020f38712SPatrick Williams    xpath_select_button_immediate_shutdown_yes = (
6120f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[6]"
62b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
6320f38712SPatrick Williams    )
64b89977a4SRahul Maheshwari
65b89977a4SRahul Maheshwari    obmc_off_state = "Off"
66b89977a4SRahul Maheshwari    obmc_standby_state = "Standby"
67b89977a4SRahul Maheshwari    obmc_running_state = "Running"
68b89977a4SRahul Maheshwari
6957a4155fSRahul Maheshwari    # xpath for main menu.
7057a4155fSRahul Maheshwari    xpath_select_server_control = "//button[contains(@class,'btn-control')]"
7120f38712SPatrick Williams    xpath_select_server_configuration = (
7220f38712SPatrick Williams        "//button[contains(@class,'btn-config')]"
7320f38712SPatrick Williams    )
7420f38712SPatrick Williams    xpath_select_access_control = (
7520f38712SPatrick Williams        "//button[contains(@class,'btn-access-control')]"
7620f38712SPatrick Williams    )
7757a4155fSRahul Maheshwari
7857a4155fSRahul Maheshwari    # xpath for sub main menu.
7920f38712SPatrick Williams    xpath_select_server_power_operations = (
8020f38712SPatrick Williams        "//a[@href='#/server-control/power-operations']"
8120f38712SPatrick Williams    )
82dd3bb604SRahul Maheshwari    xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
8320f38712SPatrick Williams    xpath_select_manage_power_usage = (
8420f38712SPatrick Williams        "//a[@href='#/server-control/power-usage']"
8520f38712SPatrick Williams    )
8623decff0SRahul Maheshwari    xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
8723decff0SRahul Maheshwari    xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
8823decff0SRahul Maheshwari    xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
8923decff0SRahul Maheshwari    xpath_select_ldap = "//a[@href='#/access-control/ldap']"
9023decff0SRahul Maheshwari    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
91f0821d4aSAnusha Dathatri    xpath_select_server_led = "//a[@href='#/server-control/server-led']"
92c8ca7682SAnusha Dathatri    xpath_select_date_time_settings = "//a[@href='#/configuration/date-time']"
93dc74fdc5SAnusha Dathatri    xpath_select_local_users = "//a[@href='#/access-control/local-users']"
9457a4155fSRahul Maheshwari
95b89977a4SRahul Maheshwari    # GUI header elements locators.
9620f38712SPatrick Williams    xpath_select_server_power = (
9720f38712SPatrick Williams        "//a[@href='#/server-control/power-operations']"
9820f38712SPatrick Williams    )
99b89977a4SRahul Maheshwari
100b89977a4SRahul Maheshwari    # Server health elements locators.
10120f38712SPatrick Williams    xpath_select_refresh_button = "//*[contains(text(),'Refresh')]"
10220f38712SPatrick Williams    xpath_event_severity_all = (
10320f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[1]"
10420f38712SPatrick Williams    )
10520f38712SPatrick Williams    xpath_event_severity_high = (
10620f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[2]"
10720f38712SPatrick Williams    )
10820f38712SPatrick Williams    xpath_event_severity_medium = (
10920f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[3]"
11020f38712SPatrick Williams    )
11120f38712SPatrick Williams    xpath_event_severity_low = (
11220f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[4]"
11320f38712SPatrick Williams    )
11420f38712SPatrick Williams    xpath_drop_down_timezone_edt = (
115b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/button"
11620f38712SPatrick Williams    )
117b89977a4SRahul Maheshwari    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
11820f38712SPatrick Williams    xpath_drop_down_timezone_utc = (
119b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
12020f38712SPatrick Williams    )
121cae580a6SAnusha Dathatri    xpath_event_filter_all = "//*[text()='All events']"
122cae580a6SAnusha Dathatri    xpath_event_filter_resolved = "//*[text()='Resolved events']"
123cae580a6SAnusha Dathatri    xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
12420f38712SPatrick Williams    xpath_event_action_bars = "//*[@id='event__actions-bar']/div[1]/label/span"
12520f38712SPatrick Williams    xpath_event_action_delete = (
126b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
12720f38712SPatrick Williams    )
12820f38712SPatrick Williams    xpath_event_action_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
12920f38712SPatrick Williams    xpath_number_of_events = "//*[@id='event__actions-bar']/div[2]/p[2]/span"
13020f38712SPatrick Williams    xpath_mark_as_resolved = (
131b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
13220f38712SPatrick Williams    )
133b89977a4SRahul Maheshwari    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
134cae580a6SAnusha Dathatri    xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
13520f38712SPatrick Williams    xpath_individual_event_delete = (
136b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
13720f38712SPatrick Williams    )
138cae580a6SAnusha Dathatri    xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
13920f38712SPatrick Williams    xpath_individual_event_resolved = (
140b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
14120f38712SPatrick Williams    )
14220f38712SPatrick Williams    xpath_individual_event_export = (
143b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
14420f38712SPatrick Williams    )
145cae580a6SAnusha Dathatri    xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
146