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
11*314cd9f9SRahul Maheshwari    xpath_textbox_hostname = "//input[@id='host']"
12*314cd9f9SRahul Maheshwari    xpath_textbox_username = "//input[@id='username']"
13*314cd9f9SRahul Maheshwari    xpath_textbox_password = "//input[@id='password']"
14b89977a4SRahul Maheshwari    xpath_button_login = "//*[@id='login__submit']"
15b89977a4SRahul Maheshwari    xpath_button_logout = "//*[@id='header']/a"
16b89977a4SRahul Maheshwari    xpath_yes_button = "//button[text()='Yes']"
17b89977a4SRahul Maheshwari    xpath_openbmc_url = "http://localhost:8080/#/login"
18b89977a4SRahul Maheshwari    xpath_openbmc_ip = "//*[@id='login__form']/input[1]"
19b89977a4SRahul Maheshwari    xpath_power_indicator = "//*[@id='power-indicator-bar']"
20b89977a4SRahul Maheshwari    xpath_display_server_power_status = \
21b89977a4SRahul Maheshwari        "//*[@id='header__wrapper']/div/div[3]/a[3]/span"
22b89977a4SRahul Maheshwari    xpath_select_button_power_on = "//*[@id='power__power-on']"
23b89977a4SRahul Maheshwari
24b89977a4SRahul Maheshwari    xpath_select_button_warm_reboot = \
25b89977a4SRahul Maheshwari        "//*[@id='power__warm-boot']"
26b89977a4SRahul Maheshwari    xpath_warm_reboot_warning_message = \
27b89977a4SRahul Maheshwari        "//*[@id='power-operations']" \
28b89977a4SRahul Maheshwari        "/div[3]/div[3]/confirm/div/div[1]/p[1]/strong"
29b89977a4SRahul Maheshwari    xpath_select_button_warm_reboot_no = \
30b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]" \
31b89977a4SRahul Maheshwari        "/div[3]/confirm/div/div[2]/button[2]"
32b89977a4SRahul Maheshwari    text_warm_reboot_warning_message = "warm reboot?"
33b89977a4SRahul Maheshwari    xpath_select_button_warm_reboot_yes = \
34b89977a4SRahul Maheshwari        "//*[@id='power-operations']" \
35b89977a4SRahul Maheshwari        "/div[3]/div[3]/confirm/div/div[2]/button[1]"
36b89977a4SRahul Maheshwari
37b89977a4SRahul Maheshwari    xpath_select_button_cold_reboot = \
38b89977a4SRahul Maheshwari        "//*[@id='power__cold-boot']"
39b89977a4SRahul Maheshwari    xpath_cold_reboot_warning_message = \
40b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[4]" \
41b89977a4SRahul Maheshwari        "/confirm/div/div[1]/p[1]/strong"
42b89977a4SRahul Maheshwari    xpath_select_button_cold_reboot_no = \
43b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[4]" \
44b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[2]"
45b89977a4SRahul Maheshwari    text_cold_reboot_warning_message = "cold reboot?"
46b89977a4SRahul Maheshwari    xpath_select_button_cold_reboot_yes = \
47b89977a4SRahul Maheshwari        "//*[@id='power-operations']" \
48b89977a4SRahul Maheshwari        "/div[3]/div[4]/confirm/div/div[2]/button[2]"
49b89977a4SRahul Maheshwari
50b89977a4SRahul Maheshwari    xpath_select_button_orderly_shutdown = \
51b89977a4SRahul Maheshwari        "//*[@id='power__soft-shutdown']"
52b89977a4SRahul Maheshwari    xpath_orderly_shutdown_warning_message = \
53b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[5]/" \
54b89977a4SRahul Maheshwari        "confirm/div/div[1]/p[1]/strong"
55b89977a4SRahul Maheshwari    xpath_select_button_orderly_shutdown_button_no = \
56b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[5]"\
57b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[2]"
58b89977a4SRahul Maheshwari    text_orderly_shutdown_warning_message = "orderly shutdown?"
59b89977a4SRahul Maheshwari    xpath_select_button_orderly_shutdown_yes = \
60b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[5]" \
61b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
62b89977a4SRahul Maheshwari
63b89977a4SRahul Maheshwari    xpath_select_button_immediate_shutdown = \
64b89977a4SRahul Maheshwari        "//*[@id='power__hard-shutdown']"
65b89977a4SRahul Maheshwari    xpath_immediate_shutdown_warning_message = \
66b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[6]" \
67b89977a4SRahul Maheshwari        "/confirm/div/div[1]/p[1]/strong"
68b89977a4SRahul Maheshwari    xpath_select_button_immediate_shutdown_no = \
69b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[6]" \
70b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[2]"
71b89977a4SRahul Maheshwari    text_immediate_shutdown_warning_message = "immediate shutdown?"
72b89977a4SRahul Maheshwari    xpath_select_button_immediate_shutdown_yes = \
73b89977a4SRahul Maheshwari        "//*[@id='power-operations']/div[3]/div[6]" \
74b89977a4SRahul Maheshwari        "/confirm/div/div[2]/button[1]"
75b89977a4SRahul Maheshwari
76b89977a4SRahul Maheshwari    obmc_off_state = "Off"
77b89977a4SRahul Maheshwari    obmc_standby_state = "Standby"
78b89977a4SRahul Maheshwari    obmc_running_state = "Running"
79b89977a4SRahul Maheshwari
80b89977a4SRahul Maheshwari    # Power operation elements needed for power on.
81b89977a4SRahul Maheshwari    header_wrapper = "3"
82b89977a4SRahul Maheshwari    header_wrapper_elt = "3"
83b89977a4SRahul Maheshwari
84b89977a4SRahul Maheshwari    # Power operation elements needed for power operations confirmation.
85b89977a4SRahul Maheshwari    power_operations = "3"
86b89977a4SRahul Maheshwari    warm_boot = "3"
87b89977a4SRahul Maheshwari    cold_boot = "4"
88b89977a4SRahul Maheshwari    shut_down = "5"
89b89977a4SRahul Maheshwari    power_off = "6"
90b89977a4SRahul Maheshwari    confirm_msg = "2"
91b89977a4SRahul Maheshwari    yes = "1"
92b89977a4SRahul Maheshwari    No = "2"
93b89977a4SRahul Maheshwari
94b89977a4SRahul Maheshwari    # GUI header elements locators.
95b89977a4SRahul Maheshwari    xpath_select_server_power = "//a[@href='#/server-control/power-operations']"
96b89977a4SRahul Maheshwari
97b89977a4SRahul Maheshwari    # Server health elements locators.
98b89977a4SRahul Maheshwari    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
99b89977a4SRahul Maheshwari    xpath_server_health_text =  \
100b89977a4SRahul Maheshwari        "//*[@id='header__wrapper']/div/div[3]/a[2]/span"
101b89977a4SRahul Maheshwari    xpath_select_refresh_button = \
102b89977a4SRahul Maheshwari        "//*[@id='header__wrapper']/div/div[3]/button"
103b89977a4SRahul Maheshwari    xpath_event_severity_all = "//*[@id='event-filter']/div[1]/button[1]"
104b89977a4SRahul Maheshwari    xpath_event_severity_high = "//*[@id='event-filter']/div[1]/button[2]"
105b89977a4SRahul Maheshwari    xpath_event_severity_medium = "//*[@id='event-filter']/div[1]/button[3]"
106b89977a4SRahul Maheshwari    xpath_event_severity_low = "//*[@id='event-filter']/div[1]/button[4]"
107b89977a4SRahul Maheshwari    xpath_drop_down_timezone_edt = \
108b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/button"
109b89977a4SRahul Maheshwari    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
110b89977a4SRahul Maheshwari    xpath_drop_down_timezone_utc =  \
111b89977a4SRahul Maheshwari        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
112b89977a4SRahul Maheshwari    xpath_event_filter_all = "//*[@id='event-filter']/div[3]/div/button"
113b89977a4SRahul Maheshwari    xpath_event_filter_resolved =  \
114b89977a4SRahul Maheshwari        "//*[@id='event-filter']/div[3]/div/ul/li[2]/button"
115b89977a4SRahul Maheshwari    xpath_event_filter_unresolved = \
116b89977a4SRahul Maheshwari        "//*[@id='event-filter']/div[3]/div/ul/li[3]/button"
117b89977a4SRahul Maheshwari    xpath_event_action_bars = \
118b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[1]/label/span"
119b89977a4SRahul Maheshwari    xpath_event_action_delete = \
120b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
121b89977a4SRahul Maheshwari    xpath_event_action_export = \
122b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
123b89977a4SRahul Maheshwari    xpath_number_of_events = \
124b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/p[2]/span"
125b89977a4SRahul Maheshwari    xpath_mark_as_resolved = \
126b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
127b89977a4SRahul Maheshwari    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
128b89977a4SRahul Maheshwari    xpath_event_delete_no = \
129b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[1]/div[2]/button[2]"
130b89977a4SRahul Maheshwari    xpath_event_delete_yes = \
131b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[1]/div[2]/button[1]"
132b89977a4SRahul Maheshwari    xpath_individual_event_select = \
133b89977a4SRahul Maheshwari        "//*[@id='event-log__events']/log-event[1]/div/div[1]/div[2]/label/" +\
134b89977a4SRahul Maheshwari        "span"
135b89977a4SRahul Maheshwari    xpath_individual_event_delete = \
136b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
137b89977a4SRahul Maheshwari    xpath_second_event_select = \
138b89977a4SRahul Maheshwari        "//*[@id='event-log__events']/log-event[2]/div/div[1]/div[2]/label/" +\
139b89977a4SRahul Maheshwari        "span"
140b89977a4SRahul Maheshwari    xpath_individual_event_resolved = \
141b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
142b89977a4SRahul Maheshwari    xpath_individual_event_export = \
143b89977a4SRahul Maheshwari        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
144