Expire and change password via GUI

Change-Id: Iaab0d24ec963cf37d19c3ed594555e12e74cc087
Signed-off-by: Anves Kumar rayankula <anvesr77@in.ibm.com>
diff --git a/gui/data/resource_variables.py b/gui/data/resource_variables.py
index 3e8a942..3a61268 100644
--- a/gui/data/resource_variables.py
+++ b/gui/data/resource_variables.py
@@ -11,6 +11,10 @@
     xpath_textbox_hostname = "//input[@id='host']"
     xpath_textbox_username = "//input[@id='username']"
     xpath_textbox_password = "//input[@id='password']"
+    xpath_input_password = "//input[@id='password']"
+    xpath_input_confirm_password = "//input[@id='passwordConfirm']"
+    xpath_submit_button = '//button[@type="submit"]'
+    xpath_button_profile_settings = '//a[@href="#/profile-settings"]'
     xpath_button_login = "//*[@id='login__submit']"
     xpath_button_user_action = "//button[@id='user-actions']"
     xpath_button_logout = '//button[text()="Log out"]'
diff --git a/security/test_bmc_expire_password.robot b/security/test_bmc_expire_password.robot
index 1bd261b..ef4eff8 100644
--- a/security/test_bmc_expire_password.robot
+++ b/security/test_bmc_expire_password.robot
@@ -2,6 +2,7 @@
 Documentation     Test root user expire password.
 
 Resource          ../lib/resource.robot
+Resource          ../gui/lib/resource.robot
 Resource          ../lib/bmc_redfish_resource.robot
 Resource          ../lib/ipmi_client.robot
 Library           ../lib/bmc_ssh_utils.py
@@ -107,7 +108,6 @@
     [Teardown]  Run Keywords  Wait Until Keyword Succeeds  1 min  10 sec
     ...  Restore Default Password For Root User  AND  FFDC On Test Case Fail
 
-
     Open Connection And Log In  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}
     ${output}  ${stderr}  ${rc}=  BMC Execute Command  passwd --expire ${OPENBMC_USERNAME}
     Should Contain  ${output}  password expiry information changed
@@ -120,6 +120,32 @@
     ...  valid_status_codes=[${HTTP_FORBIDDEN}]
 
 
+Expire And Change Root Password Via GUI
+    [Documentation]  Expire and change root password via GUI.
+    [Tags]  Expire_And_Change_Root_Password_Via_GUI
+    [Setup]  Run Keywords  Launch Browser And Login OpenBMC GUI
+    [Teardown]  Run Keywords  Logout And Close Browser
+    ...  AND  Restore Default Password For Root User  AND  FFDC On Test Case Fail
+
+    Open Connection And Log In  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}
+    ${output}  ${stderr}  ${rc}=  BMC Execute Command  passwd --expire ${OPENBMC_USERNAME}
+    Should Contain  ${output}  password expiry information changed
+
+    Click Button  ${xpath_button_user_action}
+    Click Element  ${xpath_button_profile_settings}
+    Page Should Contain  Change password
+    Sleep  2s
+    # Change valid password.
+    Input Text  ${xpath_input_password}  0penBmc123
+    Input Text  ${xpath_input_confirm_password}  0penBmc123
+    Click Button  ${xpath_submit_button}
+
+    # Verify valid password.
+    Open Browser With URL  ${obmc_gui_url}
+    Login OpenBMC GUI  ${OPENBMC_USERNAME}  0penBmc123
+    Redfish.Login  ${OPENBMC_USERNAME}  0penBmc123
+
+
 *** Keywords ***
 
 Suite Setup Execution