1#!/usr/bin/env python3
2
3r"""
4Contains xpaths and related string constants applicable for new Vue based OpenBMC GUI.
5"""
6
7
8class gui_variables:
9    r"""
10    Base class for GUI related XPATH variables.
11    """
12
13    # Login page
14    xpath_login_hostname_input = "//input[@id='host']"
15    xpath_login_username_input = "//*[@data-test-id='login-input-username']"
16    xpath_login_password_input = "//*[@data-test-id='login-input-password']"
17    xpath_login_button = "//*[@data-test-id='login-button-submit']"
18    xpath_logout_button = "//*[@data-test-id='appHeader-link-logout']"
19
20    # Overview menu
21    xpath_overview_menu = "//*[@data-test-id='nav-item-overview']"
22
23    # GUI header
24    xpath_root_button_menu = "//*[@data-test-id='appHeader-container-user']"
25    xpath_profile_settings = "//*[@data-test-id='appHeader-link-profile']"
26    xpath_server_health_header = (
27        "//*[@data-test-id='appHeader-container-health']"
28    )
29    xpath_server_power_header = (
30        "//*[@data-test-id='appHeader-container-power']"
31    )
32    xpath_refresh_button = "//*[@data-test-id='appHeader-button-refresh']"
33
34    # Logs menu
35    xpath_logs_menu = "//*[@data-test-id='nav-button-logs']"
36    xpath_dumps_sub_menu = "//*[@data-test-id='nav-item-dumps']"
37    xpath_dumps_header = "//h1[text()='Dumps']"
38    xpath_event_logs_sub_menu = "//*[@data-test-id='nav-item-event-logs']"
39    xpath_event_logs_heading = "//h1[contains(text(), 'Event logs')]"
40    xpath_event_search = "//input[@placeholder='Search logs']"
41    xpath_progress_logs_sub_menu = (
42        "//*[@data-test-id='nav-item-post-code-logs']"
43    )
44
45    # Hardware status menu
46    xpath_hardware_status_menu = (
47        "//*[@data-test-id='nav-button-hardware-status']"
48    )
49    xpath_inventory_and_leds_sub_menu = (
50        "//*[@data-test-id='nav-item-inventory']"
51    )
52    xpath_sensor_sub_menu = "//*[@data-test-id='nav-item-sensors']"
53    xpath_inventory_and_leds_heading = (
54        "//h1[contains(text(), 'Inventory and LEDs')]"
55    )
56
57    # Operations menu
58    xpath_operations_menu = "//*[@data-test-id='nav-button-operations']"
59    xpath_factory_reset_sub_menu = (
60        "//*[@data-test-id='nav-item-factory-reset']"
61    )
62    xpath_firmware_update_sub_menu = "//*[@data-test-id='nav-item-firmware']"
63    xpath_reboot_bmc_sub_menu = "//*[@data-test-id='nav-item-reboot-bmc']"
64    xpath_host_console_sub_menu = "//*[@data-test-id='nav-item-host-console']"
65    xpath_server_power_operations_sub_menu = (
66        "//*[@data-test-id='nav-item-server-power-operations']"
67    )
68    xpath_host_console_heading = "//h1[text()='Host console']"
69    xpath_firmware_heading = "//h1[contains(text(), 'Firmware')]"
70
71    # Settings menu
72    xpath_settings_menu = "//*[@data-test-id='nav-button-settings']"
73    xpath_network_heading = "//h1[text()='Network']"
74    xpath_date_time_sub_menu = "//*[@data-test-id='nav-item-date-time']"
75    xpath_network_sub_menu = "//*[@data-test-id='nav-item-network']"
76    xpath_power_restore_policy_sub_menu = (
77        "//*[@data-test-id='nav-item-power-restore-policy']"
78    )
79    xpath_static_dns = "//h2[text()='Static DNS']"
80    xpath_dns_servers_toggle = (
81        "//*[@data-test-id='networkSettings-switch-useDns']"
82    )
83    xpath_add_dns_ip_address_button = (
84        "//button[contains(text(),'Add IP address')]"
85    )
86    xpath_input_static_dns = "//*[@id='staticDns']"
87
88    # Security and access menu
89    xpath_secuity_and_accesss_menu = (
90        "//*[@data-test-id='nav-button-security-and-access']"
91    )
92    xpath_sessions_sub_menu = "//*[@data-test-id='nav-item-sessions']"
93    xpath_ldap_sub_menu = "//*[@data-test-id='nav-item-ldap']"
94    xpath_user_management_sub_menu = (
95        "//*[@data-test-id='nav-item-user-management']"
96    )
97    xpath_policies_sub_menu = "//*[@data-test-id='nav-item-policies']"
98    xpath_certificates_sub_menu = "//*[@data-test-id='nav-item-certificates']"
99
100    # Resource management menu
101    xpath_resource_management_menu = (
102        "//*[@data-test-id='nav-button-resource-management']"
103    )
104    xpath_power_sub_menu = "//*[@data-test-id='nav-item-power']"
105    xpath_power_link = "//a[@href='#/resource-management/power']"
106    xpath_power_heading = "//h1[contains(text(), 'Power')]"
107    xpath_success_message = "//*[contains(text(),'Success')]"
108
109    # Profile settings
110    xpath_default_UTC = "//*[@data-test-id='profileSettings-radio-defaultUTC']"
111    xpath_profile_save_button = (
112        "//*[@data-test-id='profileSettings-button-saveSettings']"
113    )
114    xpath_profile_settings_link = "//a[contains(text(),'Profile Settings')]"
115    xpath_profile_settings_heading = "//h1[text()='Profile settings']"
116    xpath_browser_offset = (
117        "//*[@data-test-id='profileSettings-radio-browserOffset']"
118    )
119    xpath_browser_offset_textfield = (
120        xpath_browser_offset + "/following-sibling::*"
121    )
122    xpath_input_password = (
123        "//*[@data-test-id='profileSettings-input-newPassword']"
124    )
125    xpath_input_confirm_password = (
126        "//*[@data-test-id='profileSettings-input-confirmPassword']"
127    )
128
129    # Common variables
130    xpath_save_settings_button = "//button[contains(text(),'Save')]"
131    xpath_confirm_button = "//button[contains(text(),'Confirm')]"
132    xpath_cancel_button = "//button[contains(text(),'Cancel')]"
133    xpath_add_button = "//button[normalize-space(text())='Add']"
134    xpath_page_loading_progress_bar = (
135        "//*[@aria-label='Page loading progress bar']"
136    )
137
138    # Reboot sub menu
139    xpath_reboot_bmc_heading = "//h1[text()='Reboot BMC']"
140    xpath_reboot_bmc_button = "//button[contains(text(),'Reboot BMC')]"
141    xpath_confirm_bmc_reboot = "//*[@class='btn btn-primary']"
142