Added Read only user testcases to verify GUI page
Changes:
- Verify Profile Setting Menu With Read only User
- Verify Server LED Turn Off And On With Read only User
- Added variable and xpath for Error and Unauthorized option
- keyword for create readonly user
- Keyword for verify success message
- keyword for Delete user and Logout current GUI session.
Tested:
- Successfully ran this from gui/gui_test
Change-Id: I683d819a27aef1b2405c2e35d6056216c7bf5771
Signed-off-by: Ramyasree Reddicherla <rramyasr@in.ibm.com>
diff --git a/gui/data/gui_variables.py b/gui/data/gui_variables.py
index 0f713de..f36208c 100644
--- a/gui/data/gui_variables.py
+++ b/gui/data/gui_variables.py
@@ -104,7 +104,6 @@
xpath_power_sub_menu = "//*[@data-test-id='nav-item-power']"
xpath_power_link = "//a[@href='#/resource-management/power']"
xpath_power_heading = "//h1[contains(text(), 'Power')]"
- xpath_success_message = "//*[contains(text(),'Success')]"
# Profile settings
xpath_default_UTC = "//*[@data-test-id='profileSettings-radio-defaultUTC']"
@@ -135,6 +134,15 @@
"//*[@aria-label='Page loading progress bar']"
)
+ # Pop up variables
+ xpath_success_message = "//*[contains(text(),'Success')]"
+ xpath_error_popup = (
+ "//*[contains(text(),'Error')]/following-sibling::button"
+ )
+ xpath_unauthorized_popup = (
+ "//*[contains(text(),'Unauthorized')]/following-sibling::button"
+ )
+
# Reboot sub menu
xpath_reboot_bmc_heading = "//h1[text()='Reboot BMC']"
xpath_reboot_bmc_button = "//button[contains(text(),'Reboot BMC')]"
diff --git a/gui/gui_test/gui_header/test_profile_settings_sub_menu.robot b/gui/gui_test/gui_header/test_profile_settings_sub_menu.robot
index 5fc27cf..f738d98 100644
--- a/gui/gui_test/gui_header/test_profile_settings_sub_menu.robot
+++ b/gui/gui_test/gui_header/test_profile_settings_sub_menu.robot
@@ -3,6 +3,7 @@
Documentation Test OpenBMC GUI "Profile settings" menu.
Resource ../../lib/gui_resource.robot
+Resource ../../../lib/bmc_redfish_utils.robot
Suite Setup Launch Browser And Login GUI
Suite Teardown Close Browser
@@ -17,6 +18,7 @@
${xpath_logged_usename} //*[@data-test-id='appHeader-container-user']
${xpath_default_UTC} //*[@data-test-id='profileSettings-radio-defaultUTC']
${xpath_profile_settings_save_button} //*[@data-test-id='profileSettings-button-saveSettings']
+${xpath_browser_offset} //*[@data-test-id='profileSettings-radio-browserOffset']
*** Test Cases ***
@@ -77,6 +79,25 @@
Page Should Contain ${cli_hour_and_min}
+Verify Profile Setting Menu With Readonly User
+ [Documentation] Verify All Buttons,sections and radio buttons with
+ ... Readonly user in Profile setting menu.
+ [Tags] Verify_Profile_Setting_Menu_With_Readonly_User
+ [Setup] Run Keywords Create Readonly User And Login To GUI AND Test Setup Execution
+ [Teardown] Delete Readonly User And Logout Current GUI Session
+ # input username and password value and submit.
+ Input Text ${xpath_new_password} ${OPENBMC_PASSWORD}
+ Input Text ${xpath_confirm_password} ${OPENBMC_PASSWORD}
+ Click Element At Coordinates ${xpath_default_UTC} 0 0
+ Click Element ${xpath_profile_settings_save_button}
+ # Readonly user have access to change self password,
+ # So expecting success messages on this page.
+ Verify Success Message On BMC GUI Page
+ Click Element At Coordinates ${xpath_browser_offset} 0 0
+ Click Element ${xpath_profile_settings_save_button}
+ Verify Success Message On BMC GUI Page
+
+
*** Keywords ***
Test Setup Execution
diff --git a/gui/gui_test/overview_menu/test_overview_menu.robot b/gui/gui_test/overview_menu/test_overview_menu.robot
index 42e2406..d942e10 100644
--- a/gui/gui_test/overview_menu/test_overview_menu.robot
+++ b/gui/gui_test/overview_menu/test_overview_menu.robot
@@ -25,7 +25,7 @@
${xpath_event_logs_view_more_button} (//*[text()="View more"])[5]
${xpath_inventory_and_leds_view_more_button} (//*[text()="View more"])[6]
${xpath_launch_host_console} //*[@data-test-id='overviewQuickLinks-button-solConsole']
-${xpath_led_button} //*[@data-test-id='overviewInventory-checkbox-identifyLed']
+${xpath_led_button} //*[@for="identifyLedSwitch"]
${xpath_dumps_view_more_button} (//*[text()="View more"])[7]
${xpath_critical_logs_count} //dt[contains(text(),'Critical')]/following-sibling::dd[1]
${xpath_warning_logs_count} //dt[contains(text(),'Warning')]/following-sibling::dd[1]
@@ -175,7 +175,7 @@
Refresh GUI
# Turn OFF the LED via GUI.
- Click Element At Coordinates ${xpath_led_button} 0 0
+ Click Element ${xpath_led_button}
# Cross check that server LED off state via Redfish.
Verify Identify LED State Via Redfish Off
@@ -324,6 +324,24 @@
Page Should Contain Total
+Verify Server LED Turn Off And On With Readonly User
+ [Documentation] Turn off and on server LED via GUI with Readonly user.
+ [Tags] Verify_Server_LED_Turn_Off_And_On_With_Readonly_User
+ [Setup] Create Readonly User And Login To GUI
+ [Teardown] Delete Readonly User And Logout Current GUI Session
+ # Turn On the server LED via Redfish and refresh GUI.
+ Set IndicatorLED State Lit
+ Refresh GUI
+ # Turn OFF the LED via GUI.
+ Click Element ${xpath_led_button}
+ Verify Error And Unauthorized Message On GUI
+ # Turn ON the LED via GUI.
+ Set IndicatorLED State Off
+ Refresh GUI
+ Click Element ${xpath_led_button}
+ Verify Error And Unauthorized Message On GUI
+
+
*** Keywords ***
Test Setup Execution
diff --git a/gui/lib/gui_resource.robot b/gui/lib/gui_resource.robot
index 96b9f13..a8bf8aa 100644
--- a/gui/lib/gui_resource.robot
+++ b/gui/lib/gui_resource.robot
@@ -105,6 +105,7 @@
Wait Until Element Is Not Visible
... ${xpath_page_loading_progress_bar} timeout=120s
+
Launch Browser And Login GUI With Given User
[Documentation] Launch browser and login eBMC with specified user
... credentials through GUI.
@@ -117,6 +118,7 @@
Open Browser With URL ${OPENBMC_GUI_URL}
LOGIN GUI ${user_name} ${user_password}
+
Logout GUI
[Documentation] Logout of OpenBMC GUI.
@@ -149,8 +151,8 @@
[Documentation] Refresh GUI via refresh button in header.
Click Element ${xpath_refresh_button}
- # Added delay for page to load fully after refresh.
- Sleep 5s
+ # Waiting for page to load fully after refresh.
+ Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=120s
Refresh GUI And Verify Element Value
@@ -266,3 +268,48 @@
ELSE
Log To console Server is already powered Off, can't reboot.
END
+
+
+Verify Success Message On BMC GUI Page
+ [Documentation] Perform actions on the GUI and verify that a success message is displayed.
+
+ Wait Until Element Is Visible ${xpath_success_message} timeout=30
+ Page Should Contain Element ${xpath_success_message}
+ Wait Until Element Is Not Visible ${xpath_success_message} timeout=30
+
+
+Verify Error And Unauthorized Message On GUI
+ [Documentation] Perform operations on GUI with Readonly user and
+ ... verify Error and Unauthorized messages.
+
+ Wait Until Element Is Visible ${xpath_error_popup}
+ Page Should Contain Error
+ Page Should Contain Unauthorized
+ Click Element ${xpath_error_popup}
+ Click Element ${xpath_Unauthorized_popup}
+
+
+Create Readonly User And Login To GUI
+ [Documentation] Logout current GUI sessions and Created Readonly_user via Redfish
+ ... and Login BMC GUI with Readonly user
+
+ # Logout current GUI session.
+ Logout GUI
+
+ # Created readonly_user via redfish and login BMC GUI with readonly user to perfrom test.
+ Redfish.Login
+ Redfish Create User readonly_user ${OPENBMC_PASSWORD} ReadOnly ${True}
+ Login GUI readonly_user ${OPENBMC_PASSWORD}
+
+
+Delete Readonly User And Logout Current GUI Session
+ [Documentation] Logout current GUI session and delete Readonly user,
+ ... Perform Login GUI with default user and password.
+
+ # Delete Read-only user and Logout current GUI session.
+ Logout GUI
+ Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user
+
+ # Login BMC GUI with default user.
+ Launch Browser And Login GUI
+