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
9*20f38712SPatrick Williamsclass resource_variables:
10314cd9f9SRahul Maheshwari    xpath_textbox_hostname = "//input[@id='host']"
11314cd9f9SRahul Maheshwari    xpath_textbox_username = "//input[@id='username']"
12314cd9f9SRahul Maheshwari    xpath_textbox_password = "//input[@id='password']"
139233ce15SAnves Kumar rayankula    xpath_input_password = "//input[@id='password']"
149233ce15SAnves Kumar rayankula    xpath_input_confirm_password = "//input[@id='passwordConfirm']"
159233ce15SAnves Kumar rayankula    xpath_submit_button = '//button[@type="submit"]'
169233ce15SAnves Kumar rayankula    xpath_button_profile_settings = '//a[@href="#/profile-settings"]'
17b89977a4SRahul Maheshwari    xpath_button_login = "//*[@id='login__submit']"
1831b3c434SRahul Maheshwari    xpath_button_user_action = "//button[@id='user-actions']"
1931b3c434SRahul Maheshwari    xpath_button_logout = '//button[text()="Log out"]'
20b89977a4SRahul Maheshwari    xpath_yes_button = "//button[text()='Yes']"
21b89977a4SRahul Maheshwari    xpath_power_indicator = "//*[@id='power-indicator-bar']"
22b89977a4SRahul Maheshwari    xpath_select_button_power_on = "//*[@id='power__power-on']"
23dd3bb604SRahul Maheshwari    xpath_cancel_button = "//button[contains(text(),'Cancel')]"
24dd3bb604SRahul Maheshwari    xpath_save_setting_button = "//button[contains(text(),'Save settings')]"
25bb20cb09SAnusha Dathatri    xpath_save_button = "//button[contains(text(),'Save')]"
26e9650a6aSAnusha Dathatri    xpath_remove_button = "//button[contains(text(),'Remove')]"
27e9650a6aSAnusha Dathatri    xpath_add_button = "//button[@type='submit']"
28b89977a4SRahul Maheshwari
29*20f38712SPatrick Williams    xpath_select_button_warm_reboot = "//*[@id='power__warm-boot']"
30*20f38712SPatrick Williams    xpath_operation_warning_message = "//*[@class='inline__confirm active']"
31b89977a4SRahul Maheshwari    text_warm_reboot_warning_message = "warm reboot?"
32*20f38712SPatrick Williams    xpath_select_button_warm_reboot_yes = (
33*20f38712SPatrick Williams        "//*[@id='power-operations']"
34b89977a4SRahul Maheshwari        "/div[3]/div[3]/confirm/div/div[2]/button[1]"
35*20f38712SPatrick Williams    )
36b89977a4SRahul Maheshwari
37*20f38712SPatrick Williams    xpath_select_button_cold_reboot = "//*[@id='power__cold-boot']"
38b89977a4SRahul Maheshwari    text_cold_reboot_warning_message = "cold reboot?"
39*20f38712SPatrick Williams    xpath_select_button_cold_reboot_yes = (
40*20f38712SPatrick Williams        "//*[@id='power-operations']"
41b89977a4SRahul Maheshwari        "/div[3]/div[4]/confirm/div/div[2]/button[2]"
42*20f38712SPatrick Williams    )
43b89977a4SRahul Maheshwari
44*20f38712SPatrick Williams    xpath_select_button_orderly_shutdown = "//*[@id='power__soft-shutdown']"
45*20f38712SPatrick Williams    xpath_select_button_orderly_shutdown_button_no = (
46*20f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[5]"
47b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[2]"
48*20f38712SPatrick Williams    )
49b89977a4SRahul Maheshwari    text_orderly_shutdown_warning_message = "orderly shutdown?"
50*20f38712SPatrick Williams    xpath_select_button_orderly_shutdown_yes = (
51*20f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[5]"
52b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
53*20f38712SPatrick Williams    )
54b89977a4SRahul Maheshwari
55*20f38712SPatrick Williams    xpath_select_button_immediate_shutdown = "//*[@id='power__hard-shutdown']"
56b89977a4SRahul Maheshwari    text_immediate_shutdown_warning_message = "immediate shutdown?"
57*20f38712SPatrick Williams    xpath_select_button_immediate_shutdown_yes = (
58*20f38712SPatrick Williams        "//*[@id='power-operations']/div[3]/div[6]"
59b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
60*20f38712SPatrick Williams    )
61b89977a4SRahul Maheshwari
62b89977a4SRahul Maheshwari    obmc_off_state = "Off"
63b89977a4SRahul Maheshwari    obmc_standby_state = "Standby"
64b89977a4SRahul Maheshwari    obmc_running_state = "Running"
65b89977a4SRahul Maheshwari
6657a4155fSRahul Maheshwari    # xpath for main menu.
6757a4155fSRahul Maheshwari    xpath_select_server_control = "//button[contains(@class,'btn-control')]"
68*20f38712SPatrick Williams    xpath_select_server_configuration = (
69*20f38712SPatrick Williams        "//button[contains(@class,'btn-config')]"
70*20f38712SPatrick Williams    )
71*20f38712SPatrick Williams    xpath_select_access_control = (
72*20f38712SPatrick Williams        "//button[contains(@class,'btn-access-control')]"
73*20f38712SPatrick Williams    )
7457a4155fSRahul Maheshwari
7557a4155fSRahul Maheshwari    # xpath for sub main menu.
76*20f38712SPatrick Williams    xpath_select_server_power_operations = (
77*20f38712SPatrick Williams        "//a[@href='#/server-control/power-operations']"
78*20f38712SPatrick Williams    )
79dd3bb604SRahul Maheshwari    xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
80*20f38712SPatrick Williams    xpath_select_manage_power_usage = (
81*20f38712SPatrick Williams        "//a[@href='#/server-control/power-usage']"
82*20f38712SPatrick Williams    )
8323decff0SRahul Maheshwari    xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
8423decff0SRahul Maheshwari    xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
8523decff0SRahul Maheshwari    xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
8623decff0SRahul Maheshwari    xpath_select_ldap = "//a[@href='#/access-control/ldap']"
8723decff0SRahul Maheshwari    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
88f0821d4aSAnusha Dathatri    xpath_select_server_led = "//a[@href='#/server-control/server-led']"
89c8ca7682SAnusha Dathatri    xpath_select_date_time_settings = "//a[@href='#/configuration/date-time']"
90dc74fdc5SAnusha Dathatri    xpath_select_local_users = "//a[@href='#/access-control/local-users']"
9157a4155fSRahul Maheshwari
92b89977a4SRahul Maheshwari    # GUI header elements locators.
93*20f38712SPatrick Williams    xpath_select_server_power = (
94*20f38712SPatrick Williams        "//a[@href='#/server-control/power-operations']"
95*20f38712SPatrick Williams    )
96b89977a4SRahul Maheshwari
97b89977a4SRahul Maheshwari    # Server health elements locators.
98*20f38712SPatrick Williams    xpath_select_refresh_button = "//*[contains(text(),'Refresh')]"
99*20f38712SPatrick Williams    xpath_event_severity_all = (
100*20f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[1]"
101*20f38712SPatrick Williams    )
102*20f38712SPatrick Williams    xpath_event_severity_high = (
103*20f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[2]"
104*20f38712SPatrick Williams    )
105*20f38712SPatrick Williams    xpath_event_severity_medium = (
106*20f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[3]"
107*20f38712SPatrick Williams    )
108*20f38712SPatrick Williams    xpath_event_severity_low = (
109*20f38712SPatrick Williams        "//*[text()='Filter by severity']/following-sibling::button[4]"
110*20f38712SPatrick Williams    )
111*20f38712SPatrick Williams    xpath_drop_down_timezone_edt = (
112b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/button"
113*20f38712SPatrick Williams    )
114b89977a4SRahul Maheshwari    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
115*20f38712SPatrick Williams    xpath_drop_down_timezone_utc = (
116b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
117*20f38712SPatrick Williams    )
118cae580a6SAnusha Dathatri    xpath_event_filter_all = "//*[text()='All events']"
119cae580a6SAnusha Dathatri    xpath_event_filter_resolved = "//*[text()='Resolved events']"
120cae580a6SAnusha Dathatri    xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
121*20f38712SPatrick Williams    xpath_event_action_bars = "//*[@id='event__actions-bar']/div[1]/label/span"
122*20f38712SPatrick Williams    xpath_event_action_delete = (
123b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
124*20f38712SPatrick Williams    )
125*20f38712SPatrick Williams    xpath_event_action_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
126*20f38712SPatrick Williams    xpath_number_of_events = "//*[@id='event__actions-bar']/div[2]/p[2]/span"
127*20f38712SPatrick Williams    xpath_mark_as_resolved = (
128b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
129*20f38712SPatrick Williams    )
130b89977a4SRahul Maheshwari    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
131cae580a6SAnusha Dathatri    xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
132*20f38712SPatrick Williams    xpath_individual_event_delete = (
133b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
134*20f38712SPatrick Williams    )
135cae580a6SAnusha Dathatri    xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
136*20f38712SPatrick Williams    xpath_individual_event_resolved = (
137b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
138*20f38712SPatrick Williams    )
139*20f38712SPatrick Williams    xpath_individual_event_export = (
140b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
141*20f38712SPatrick Williams    )
142cae580a6SAnusha Dathatri    xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
143