Added Read only user testcases to verify GUI page
Changes:
- Verify Server Power Operations Page With
Read only User With Host On State
- Verify Server Power Operations Page With
Read only User With Host Off State
- Verify Save Button With Read only User
Tested:
- Successfully ran this from gui/gui_test
Change-Id: I9068eb3a53993e21d6b4358e6b4e54e57a8c06af
Signed-off-by: rramyasr in <rramyasr@in.ibm.com>
diff --git a/gui/data/gui_variables.py b/gui/data/gui_variables.py
index f36208c..088be97 100644
--- a/gui/data/gui_variables.py
+++ b/gui/data/gui_variables.py
@@ -130,6 +130,7 @@
xpath_confirm_button = "//button[contains(text(),'Confirm')]"
xpath_cancel_button = "//button[contains(text(),'Cancel')]"
xpath_add_button = "//button[normalize-space(text())='Add']"
+ xpath_close_information_message = "//button[contains(text(),'×')]"
xpath_page_loading_progress_bar = (
"//*[@aria-label='Page loading progress bar']"
)
diff --git a/gui/gui_test/operations_menu/test_server_power_operations_sub_menu.robot b/gui/gui_test/operations_menu/test_server_power_operations_sub_menu.robot
index 062aba6..4bd634e 100644
--- a/gui/gui_test/operations_menu/test_server_power_operations_sub_menu.robot
+++ b/gui/gui_test/operations_menu/test_server_power_operations_sub_menu.robot
@@ -5,8 +5,9 @@
Resource ../../lib/gui_resource.robot
Resource ../../../lib/state_manager.robot
-Test Setup Run Keywords Launch Browser And Login GUI AND Navigate to Server Power Operation Page
-Test Teardown Close Browser
+Suite Setup Launch Browser And Login GUI
+Suite Teardown Close Browser
+Test Setup Navigate to Server Power Operation Page
Test Tags Server_Power_Operations_Sub_Menu
@@ -151,6 +152,49 @@
Wait Until Keyword Succeeds 10 min 15 sec Element Should Contain ${xpath_current_power_state} On
+Verify Server Power Operations Page With Readonly User When Host On State
+ [Documentation] Verify Server Power Operations page with readonly user when Host On state.
+ [Tags] Verify_Server_Power_Operations_Page_With_Readonly_User_When_Host_On_State
+ [Setup] Run Keywords Power On Server AND Create Readonly User And Login To GUI
+ ... AND Navigate to Server Power Operation Page
+ [Teardown] Delete Readonly User And Logout Current GUI Session
+
+ # Perform Reboot operation.
+ Perform Server Operations With Readonly User ${EMPTY} ${xpath_reboot_button}
+
+ # Perform Shutdown Orderly operation.
+ Perform Server Operations With Readonly User ${xpath_shutdown_orderly_radio} ${xpath_shutdown_button}
+
+ # Perform Shutdown Immediate operation.
+ Perform Server Operations With Readonly User ${xpath_shutdown_immediate_radio} ${xpath_shutdown_button}
+
+
+Verify Server Power Operations Page With Readonly User When Host Off State
+ [Documentation] Verify Server Power Operations page with readonly user when Host Off state.
+ [Tags] Verify_Server_Power_Operations_Page_With_Readonly_User_When_Host_Off_State
+ [Setup] Run Keywords Power Off Server AND Create Readonly User And Login To GUI
+ ... AND Navigate to Server Power Operation Page
+ [Teardown] Delete Readonly User And Logout Current GUI Session
+
+ Refresh GUI
+ Page Should Contain Element ${xpath_poweron_button}
+ Click Element ${xpath_poweron_button}
+ Wait Until Page Contains Element ${xpath_unauthorized_popup} timeout=10
+ Page Should Contain Unauthorized
+ Click Element ${xpath_unauthorized_popup}
+
+
+Verify Save Button With Readonly User
+ [Documentation] Verify Save button On Server Power Operation page with readonly user.
+ [Tags] Verify_Save_Button_With_Readonly_User
+ [Setup] Run Keywords Create Readonly User And Login To GUI
+ ... AND Navigate to Server Power Operation Page
+ [Teardown] Delete Readonly User And Logout Current GUI Session
+
+ Click Element ${xpath_save_button}
+ Verify Error And Unauthorized Message On GUI
+
+
*** Keywords ***
Navigate to Server Power Operation Page
@@ -166,3 +210,27 @@
Refresh GUI
Element Should Contain ${xpath_current_power_state} Off
+
+
+Perform Server Operations With Readonly User
+ [Documentation] Perform Reboot, Orderly and Immediate shutdown with readonly user
+ ... and verify Unauthorized message on BMC GUI Page
+ [Arguments] ${orderly_immediate_operation} ${operations}
+
+ # Description of argument(s):
+ # orderly_immediate_operation Eg: Perform shutdown_orderly and shutdown_immediate operations.
+ # operations Eg: Perform reboot and shutdown operations.
+ #
+
+ IF $orderly_immediate_operation != ''
+ Click Element At Coordinates ${orderly_immediate_operation} 0 0
+ END
+
+ Click Element ${Operations}
+ Wait Until Page Contains Element ${xpath_confirm_button} timeout=10
+ Sleep 5s
+ Click Element At Coordinates ${xpath_confirm_button} 0 0
+ Wait Until Page Contains Element ${xpath_unauthorized_popup} timeout=10
+ Page Should Contain Unauthorized
+ Click Element ${xpath_unauthorized_popup}
+ Refresh GUI
diff --git a/gui/lib/gui_resource.robot b/gui/lib/gui_resource.robot
index a8bf8aa..4a1c14b 100644
--- a/gui/lib/gui_resource.robot
+++ b/gui/lib/gui_resource.robot
@@ -222,7 +222,7 @@
[Documentation] Navigate To Server Power Page.
Click Element ${xpath_power_page}
- Wait Until Element Is Not Visible ${xpath_progress_bar} timeout=30
+ Wait Until Element Is Not Visible {xpath_page_loading_progress_bar} timeout=30
Power Off Server
@@ -235,6 +235,7 @@
Click Element ${xpath_power_shutdown}
Click Button ${xpath_confirm}
Wait Until Element Is Visible ${xpath_power_poweron} timeout=60
+ Click Element ${xpath_close_information_message}
ELSE
Log To console Server is already powered Off.
END
@@ -249,6 +250,7 @@
IF (${present})
Click Element ${xpath_power_power_on}
Wait Until Element Is Visible ${xpath_power_shutdown} timeout=60
+ Click Element ${xpath_close_information_message}
ELSE
Log To console Server is already powered On.
END
@@ -286,7 +288,7 @@
Page Should Contain Error
Page Should Contain Unauthorized
Click Element ${xpath_error_popup}
- Click Element ${xpath_Unauthorized_popup}
+ Click Element ${xpath_unauthorized_popup}
Create Readonly User And Login To GUI
@@ -309,7 +311,7 @@
# Delete Read-only user and Logout current GUI session.
Logout GUI
Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user
+ Close Browser
# Login BMC GUI with default user.
Launch Browser And Login GUI
-