Added test case for changing manual to NTP

Changes:
   - Added test case "Verify Changing BMC Time From NTP To Manual."
Tested:
   - Ran the test case from sandbox successfully.

Change-Id: Ic28dfbf813c38707968de27ee365e9aa75061675
Signed-off-by: sarandev3 <saranyad@in.ibm.com>
diff --git a/gui/gui_test/settings_menu/test_date_and_time_sub_menu.robot b/gui/gui_test/settings_menu/test_date_and_time_sub_menu.robot
index 9f8b444..6de04e9 100644
--- a/gui/gui_test/settings_menu/test_date_and_time_sub_menu.robot
+++ b/gui/gui_test/settings_menu/test_date_and_time_sub_menu.robot
@@ -191,7 +191,7 @@
     [Tags]  Verify_Changing_BMC_Time_From_NTP_To_Manual
     [Setup]  Setup To Power Off And Navigate
 
-    # Add NPT server for BMC time to sync.
+    # Add NTP server for BMC time to sync.
     Click Element At Coordinates  ${xpath_select_ntp}  0  0
     Input Text  ${xpath_ntp_server1}  time.google.com
     Click Element  ${xpath_select_save_settings}
@@ -220,6 +220,30 @@
     Sleep  15
 
 
+Verify Changing BMC Time From Manual To NTP
+    [Documentation]  Verify BMC time syncing with NTP server time
+    ...  from manual time.
+    [Tags]  Verify_Changing_BMC_Time_From_Manual_To_NTP
+    [Setup]  Setup To Power Off And Navigate
+
+    # Add Manual date and time for BMC to sync.
+    Set Manual Date and Time Via GUI
+
+    # Set BMC date time to sync with NTP server.
+    Click Element At Coordinates  ${xpath_select_ntp}  0  0
+    Input Text  ${xpath_ntp_server1}  216.239.35.0
+    Click Element  ${xpath_select_save_settings}
+
+    Wait Until Element Is Visible   ${xpath_success_message}  timeout=60
+    ${cli_date_time}=  CLI Get BMC DateTime
+    ${ntp_date}=  Convert Date  ${cli_date_time}  result_format=%Y-%m-%d
+    ${ntp_time}=  Convert Date  ${cli_date_time}  result_format=%H:%M
+    Wait Until Page Contains  ${ntp_date}   timeout=60s
+    Page Should Contain   ${ntp_time}
+
+    Wait Until Element Is Not Visible   ${xpath_success_message}  timeout=60
+
+
 *** Keywords ***
 
 Suite Setup Execution
@@ -241,7 +265,6 @@
    Redfish Power off  stack_mode=skip
    Navigate To Date and Time Page
 
-
 Navigate To Date and Time Page
     [Documentation]  Navigate to the date and time page from main menu.
 
@@ -250,3 +273,20 @@
     Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  date-time
     Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
 
+Set Manual Date and Time Via GUI
+    [Documentation]  Set BMC date and time to one month in future via GUI.
+
+    ${cli_date_time}=  CLI Get BMC DateTime
+    ${new_date}=  Add Time To Date  ${cli_date_time}  31 days
+    ${new_date_time}=  Add Time To Date  ${new_date}  05:10:00
+    Log  "Setting BMC date : ${new_date_time} using Manual option"
+    ${date}=  Convert Date  ${new_date_time}  result_format=%Y-%m-%d
+    ${time}=  Convert Date  ${new_date_time}  result_format=%H:%M
+    Click Element At Coordinates  ${xpath_select_manual}  0  0
+    Input Text  ${xpath_manual_date}  ${date}
+    Input Text  ${xpath_manual_time}  ${time}
+    Click Element  ${xpath_select_save_settings}
+
+    # Wait for changes to take effect.
+    Wait Until Element Is Enabled  ${xpath_select_ntp}  timeout=30s
+