Fix for server power operation suite

Changes:
As part on "Redfish Power On" keyword, all existing session
are deleted at the end. Due to this GUI page is getting logged
out. To fix this, GUI login is added after Redfish Power
On.

Change-Id: I4527c054937c051dd6877a9caef614e17bbb84cf
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/gui/gui_test/control_menu/test_server_power_operations_sub_menu.robot b/gui/gui_test/control_menu/test_server_power_operations_sub_menu.robot
index bf2a874..0c7a0dd 100644
--- a/gui/gui_test/control_menu/test_server_power_operations_sub_menu.robot
+++ b/gui/gui_test/control_menu/test_server_power_operations_sub_menu.robot
@@ -5,9 +5,8 @@
 Resource        ../../lib/gui_resource.robot
 Resource        ../../../lib/state_manager.robot
 
-Suite Setup     Launch Browser And Login GUI
-Suite Teardown  Close Browser
-Test Setup      Test Setup Execution
+Test Setup      Run Keywords  Launch Browser And Login GUI  AND  Navigate to Server Power Operation Page
+Test Teardown   Close Browser
 
 
 *** Variables ***
@@ -23,10 +22,11 @@
 ${xpath_shutdown_orderly_radio}            //*[@data-test-id='serverPowerOperations-radio-shutdownOrderly']
 ${xpath_shutdown_immediate_radio}          //*[@data-test-id='serverPowerOperations-radio-shutdownImmediate']
 ${xpath_confirm_button}                    //button[contains(text(),'Confirm')]
-${xpath_current_power_state}               //*[contains(@class,'row mb-4')]
+${xpath_current_power_state}               //*[@data-test-id='powerServerOps-text-hostStatus']
 ${xpath_reboot_orderly_radio}              //*[@data-test-id='serverPowerOperations-radio-rebootOrderly']
 ${xpath_reboot_immediate_radio}            //*[@data-test-id='serverPowerOperations-radio-rebootImmediate']
 
+
 *** Test Cases ***
 
 Verify Navigation To Server Power Operations Page
@@ -39,25 +39,27 @@
 Verify Immediate Shutdown
     [Documentation]  Verify shutdown after clicking immediate shutdown button.
     [Tags]  Verify_Immediate_Shutdown
+    [Setup]  Run Keywords  Redfish Power On  stack_mode=skip  AND  Launch Browser And Login GUI
+    ...  AND  Navigate to Server Power Operation Page
 
-    Redfish Power On  stack_mode=skip
     Click Element At Coordinates  ${xpath_shutdown_immediate_radio}  0  0
     Click Element  ${xpath_shutdown_button}
     Wait Until Page Contains Element  ${xpath_confirm_button}  timeout=10
     Click Element  ${xpath_confirm_button}
-    Wait Until Keyword Succeeds  3 min  0 sec  Element Should Contain  ${xpath_current_power_state}  Off
+    Wait Until Keyword Succeeds  3 min  15 sec  Element Should Contain  ${xpath_current_power_state}  Off
 
 
 Verify Orderly Shutdown
     [Documentation]  Verify shutdown after clicking orderly shutdown button.
     [Tags]  Verify_Orderly_Shutdown
+    [Setup]  Run Keywords  Redfish Power On  stack_mode=skip  AND  Launch Browser And Login GUI
+    ...  AND  Navigate to Server Power Operation Page
 
-    Redfish Power On  stack_mode=skip
     Click Element At Coordinates  ${xpath_shutdown_orderly_radio}  0  0
     Click Element  ${xpath_shutdown_button}
     Wait Until Page Contains Element  ${xpath_confirm_button}  timeout=10
     Click Element  ${xpath_confirm_button}
-    Wait Until Keyword Succeeds  10 min  0 sec  Element Should Contain  ${xpath_current_power_state}  Off
+    Wait Until Keyword Succeeds  10 min  15 sec  Element Should Contain  ${xpath_current_power_state}  Off
 
 
 Verify Existence Of All Sections In Server Power Operations Page
@@ -97,8 +99,9 @@
 Verify System State At Power On
     [Documentation]  Verify state of the system in power on state.
     [Tags]  Verify_System_State_At_Power_On
+    [Setup]  Run Keywords  Redfish Power On  stack_mode=skip  AND  Launch Browser And Login GUI
+    ...  AND  Navigate to Server Power Operation Page
 
-    Redfish Power On  stack_mode=skip
     Page Should Contain Element  ${xpath_current_power_state}
     Element Should Contain   ${xpath_current_power_state}  On
 
@@ -115,8 +118,9 @@
 Verify Shutdown And Reboot Buttons Presence At Power On
     [Documentation]  Verify existence of shutdown and reboot buttons at power on.
     [Tags]  Verify_Shutdown_And_Reboot_Buttons_Presence_At_Power_On
+    [Setup]  Run Keywords  Redfish Power On  stack_mode=skip  AND  Launch Browser And Login GUI
+    ...  AND  Navigate to Server Power Operation Page
 
-    Redfish Power On  stack_mode=skip
     # TODO: Implement power on using GUI later.
     Page Should Contain Element  ${xpath_shutdown_button}
     Page Should Contain Element  ${xpath_reboot_button}
@@ -133,36 +137,39 @@
 Verify Host Immediate Reboot
     [Documentation]  Verify host reboot after triggering immediate reboot.
     [Tags]  Verify_Host_Immediate_Reboot
+    [Setup]  Run Keywords  Redfish Power On  stack_mode=skip  AND  Launch Browser And Login GUI
+    ...  AND  Navigate to Server Power Operation Page
 
-    Redfish Power On  stack_mode=skip
     Click Element At Coordinates  ${xpath_reboot_immediate_radio}  0  0
     Click Element  ${xpath_reboot_button}
     Wait Until Page Contains Element  ${xpath_confirm_button}  timeout=10
     Click Element  ${xpath_confirm_button}
-    Wait Until Keyword Succeeds  3 min  0 sec  Element Should Contain  ${xpath_current_power_state}  Off
+    Wait Until Keyword Succeeds  3 min  2 sec  Element Should Contain  ${xpath_current_power_state}  Off
     Click Element  ${xpath_refresh_button}
-    Wait Until Keyword Succeeds  3 min  0 sec  Element Should Contain  ${xpath_current_power_state}  On
+    Wait Until Keyword Succeeds  10 min  15 sec  Element Should Contain  ${xpath_current_power_state}  On
 
 
 Verify Host Orderly Reboot
     [Documentation]  Verify host reboot after triggering orderly reboot.
     [Tags]  Verify_Host_Orderly_Reboot
+    [Setup]  Run Keywords  Redfish Power On  stack_mode=skip  AND  Launch Browser And Login GUI
+    ...  AND  Navigate to Server Power Operation Page
 
-    Redfish Power On  stack_mode=skip
     Click Element At Coordinates  ${xpath_reboot_orderly_radio}  0  0
     Click Element  ${xpath_reboot_button}
     Wait Until Page Contains Element  ${xpath_confirm_button}  timeout=10
     Click Element  ${xpath_confirm_button}
-    Wait Until Keyword Succeeds  10 min  0 sec  Element Should Contain  ${xpath_current_power_state}  Off
+    Wait Until Keyword Succeeds  3 min  2 sec  Element Should Contain  ${xpath_current_power_state}  Off
     Click Element  ${xpath_refresh_button}
-    Wait Until Keyword Succeeds  10 min  0 sec  Element Should Contain  ${xpath_current_power_state}  On
+    Wait Until Keyword Succeeds  10 min  15 sec  Element Should Contain  ${xpath_current_power_state}  On
 
 
 *** Keywords ***
 
-Test Setup Execution
-    [Documentation]  Do test case setup tasks.
+Navigate to Server Power Operation Page
+    [Documentation]  Go to server power operation page.
 
     Click Element  ${xpath_control_menu}
     Click Element  ${xpath_server_power_operations_sub_menu}
     Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  server-power-operations
+