1b89977a4SRahul Maheshwari#!/usr/bin/python
2b89977a4SRahul Maheshwari
3b89977a4SRahul Maheshwarir"""
4b89977a4SRahul MaheshwariContains xpaths and related string constants applicable to all openBMC GUI
5b89977a4SRahul Maheshwarimenus.
6b89977a4SRahul Maheshwari"""
7b89977a4SRahul Maheshwari
8b89977a4SRahul Maheshwari
9b89977a4SRahul Maheshwariclass resource_variables():
10b89977a4SRahul Maheshwari
11314cd9f9SRahul Maheshwari    xpath_textbox_hostname = "//input[@id='host']"
12314cd9f9SRahul Maheshwari    xpath_textbox_username = "//input[@id='username']"
13314cd9f9SRahul Maheshwari    xpath_textbox_password = "//input[@id='password']"
14b89977a4SRahul Maheshwari    xpath_button_login = "//*[@id='login__submit']"
15*31b3c434SRahul Maheshwari    xpath_button_user_action = "//button[@id='user-actions']"
16*31b3c434SRahul Maheshwari    xpath_button_logout = '//button[text()="Log out"]'
17b89977a4SRahul Maheshwari    xpath_yes_button = "//button[text()='Yes']"
18b89977a4SRahul Maheshwari    xpath_power_indicator = "//*[@id='power-indicator-bar']"
19b89977a4SRahul Maheshwari    xpath_select_button_power_on = "//*[@id='power__power-on']"
20dd3bb604SRahul Maheshwari    xpath_cancel_button = "//button[contains(text(),'Cancel')]"
21dd3bb604SRahul Maheshwari    xpath_save_setting_button = "//button[contains(text(),'Save settings')]"
22bb20cb09SAnusha Dathatri    xpath_save_button = "//button[contains(text(),'Save')]"
23e9650a6aSAnusha Dathatri    xpath_remove_button = "//button[contains(text(),'Remove')]"
24e9650a6aSAnusha Dathatri    xpath_add_button = "//button[@type='submit']"
25b89977a4SRahul Maheshwari
26b89977a4SRahul Maheshwari    xpath_select_button_warm_reboot = \
27b89977a4SRahul Maheshwari        "//*[@id='power__warm-boot']"
28f93a5c41SAnusha Dathatri    xpath_operation_warning_message = \
29f93a5c41SAnusha Dathatri        "//*[@class='inline__confirm active']"
30b89977a4SRahul Maheshwari    text_warm_reboot_warning_message = "warm reboot?"
31b89977a4SRahul Maheshwari    xpath_select_button_warm_reboot_yes = \
32b89977a4SRahul Maheshwari        "//*[@id='power-operations']" \
33b89977a4SRahul Maheshwari        "/div[3]/div[3]/confirm/div/div[2]/button[1]"
34b89977a4SRahul Maheshwari
35b89977a4SRahul Maheshwari    xpath_select_button_cold_reboot = \
36b89977a4SRahul Maheshwari        "//*[@id='power__cold-boot']"
37b89977a4SRahul Maheshwari    text_cold_reboot_warning_message = "cold reboot?"
38b89977a4SRahul Maheshwari    xpath_select_button_cold_reboot_yes = \
39b89977a4SRahul Maheshwari        "//*[@id='power-operations']" \
40b89977a4SRahul Maheshwari        "/div[3]/div[4]/confirm/div/div[2]/button[2]"
41b89977a4SRahul Maheshwari
42b89977a4SRahul Maheshwari    xpath_select_button_orderly_shutdown = \
43b89977a4SRahul Maheshwari        "//*[@id='power__soft-shutdown']"
44b89977a4SRahul Maheshwari    xpath_select_button_orderly_shutdown_button_no = \
45b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[5]"\
46b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[2]"
47b89977a4SRahul Maheshwari    text_orderly_shutdown_warning_message = "orderly shutdown?"
48b89977a4SRahul Maheshwari    xpath_select_button_orderly_shutdown_yes = \
49b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[5]" \
50b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
51b89977a4SRahul Maheshwari
52b89977a4SRahul Maheshwari    xpath_select_button_immediate_shutdown = \
53b89977a4SRahul Maheshwari        "//*[@id='power__hard-shutdown']"
54b89977a4SRahul Maheshwari    text_immediate_shutdown_warning_message = "immediate shutdown?"
55b89977a4SRahul Maheshwari    xpath_select_button_immediate_shutdown_yes = \
56b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[6]" \
57b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
58b89977a4SRahul Maheshwari
59b89977a4SRahul Maheshwari    obmc_off_state = "Off"
60b89977a4SRahul Maheshwari    obmc_standby_state = "Standby"
61b89977a4SRahul Maheshwari    obmc_running_state = "Running"
62b89977a4SRahul Maheshwari
6357a4155fSRahul Maheshwari    # xpath for main menu.
6457a4155fSRahul Maheshwari    xpath_select_server_control = "//button[contains(@class,'btn-control')]"
65dd3bb604SRahul Maheshwari    xpath_select_server_configuration = "//button[contains(@class,'btn-config')]"
662bc8c08eSRahul Maheshwari    xpath_select_access_control = "//button[contains(@class,'btn-access-control')]"
6757a4155fSRahul Maheshwari
6857a4155fSRahul Maheshwari    # xpath for sub main menu.
6957a4155fSRahul Maheshwari    xpath_select_server_power_operations = "//a[@href='#/server-control/power-operations']"
70dd3bb604SRahul Maheshwari    xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
7123decff0SRahul Maheshwari    xpath_select_manage_power_usage = "//a[@href='#/server-control/power-usage']"
7223decff0SRahul Maheshwari    xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
7323decff0SRahul Maheshwari    xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
7423decff0SRahul Maheshwari    xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
7523decff0SRahul Maheshwari    xpath_select_ldap = "//a[@href='#/access-control/ldap']"
7623decff0SRahul Maheshwari    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
77f0821d4aSAnusha Dathatri    xpath_select_server_led = "//a[@href='#/server-control/server-led']"
78c8ca7682SAnusha Dathatri    xpath_select_date_time_settings = "//a[@href='#/configuration/date-time']"
79dc74fdc5SAnusha Dathatri    xpath_select_local_users = "//a[@href='#/access-control/local-users']"
8057a4155fSRahul Maheshwari
81b89977a4SRahul Maheshwari    # GUI header elements locators.
82b89977a4SRahul Maheshwari    xpath_select_server_power = "//a[@href='#/server-control/power-operations']"
83b89977a4SRahul Maheshwari
84b89977a4SRahul Maheshwari    # Server health elements locators.
85b89977a4SRahul Maheshwari    xpath_select_refresh_button = \
862513ae5bSAnusha Dathatri        "//*[contains(text(),'Refresh')]"
87dadb75e5SAnusha Dathatri    xpath_event_severity_all = "//*[text()='Filter by severity']/following-sibling::button[1]"
88dadb75e5SAnusha Dathatri    xpath_event_severity_high = "//*[text()='Filter by severity']/following-sibling::button[2]"
89dadb75e5SAnusha Dathatri    xpath_event_severity_medium = "//*[text()='Filter by severity']/following-sibling::button[3]"
90dadb75e5SAnusha Dathatri    xpath_event_severity_low = "//*[text()='Filter by severity']/following-sibling::button[4]"
91b89977a4SRahul Maheshwari    xpath_drop_down_timezone_edt = \
92b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/button"
93b89977a4SRahul Maheshwari    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
94b89977a4SRahul Maheshwari    xpath_drop_down_timezone_utc =  \
95b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
96cae580a6SAnusha Dathatri    xpath_event_filter_all = "//*[text()='All events']"
97cae580a6SAnusha Dathatri    xpath_event_filter_resolved = "//*[text()='Resolved events']"
98cae580a6SAnusha Dathatri    xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
99b89977a4SRahul Maheshwari    xpath_event_action_bars = \
100b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[1]/label/span"
101b89977a4SRahul Maheshwari    xpath_event_action_delete = \
102b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
103b89977a4SRahul Maheshwari    xpath_event_action_export = \
104b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
105b89977a4SRahul Maheshwari    xpath_number_of_events = \
106b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/p[2]/span"
107b89977a4SRahul Maheshwari    xpath_mark_as_resolved = \
108b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
109b89977a4SRahul Maheshwari    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
110cae580a6SAnusha Dathatri    xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
111b89977a4SRahul Maheshwari    xpath_individual_event_delete = \
112b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
113cae580a6SAnusha Dathatri    xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
114b89977a4SRahul Maheshwari    xpath_individual_event_resolved = \
115b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
116b89977a4SRahul Maheshwari    xpath_individual_event_export = \
117b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
118cae580a6SAnusha Dathatri    xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
119