Added new testcases for Certificate page

Changes :
    - Verify Informational Message Under Add Certificate
    - Verify Delete Button Should Be Disabled For
      Https And LDAP Certificates
    - Verify Success Message After Deleting CA Certificate
    - Verify Cancel Button While Deleting The CA Certificate
    - Verify Certificate Page With Readonly User

Tested : Ran suite successfully from sandbox.

Change-Id: Ib0db92bf9b5a13d740dbaa9f4828a00124287756
Signed-off-by: rramyasr in <rramyasr@in.ibm.com>
diff --git a/gui/gui_test/security_and_access_menu/test_certificates_sub_menu.robot b/gui/gui_test/security_and_access_menu/test_certificates_sub_menu.robot
index 5edcf4c..b8c526f 100644
--- a/gui/gui_test/security_and_access_menu/test_certificates_sub_menu.robot
+++ b/gui/gui_test/security_and_access_menu/test_certificates_sub_menu.robot
@@ -6,7 +6,7 @@
 Resource        ../../../lib/certificate_utils.robot
 
 Suite Setup     Suite Setup Execution
-Suite Teardown  Close Browser
+Suite Teardown  Close All Browsers
 Test Setup      Test Setup Execution
 
 Test Tags      Certificates_Sub_Menu
@@ -18,6 +18,7 @@
 ${xpath_generate_csr_button}       //*[@data-test-id='certificates-button-generateCsr']
 ${xpath_generate_csr_heading}      //h5[contains(text(), "Generate a Certificate Signing Request")]
 ${xpath_select_certificate_type}   //*[@data-test-id='modalGenerateCsr-select-certificateType']
+${xpath_key_pair_algoritham}       //*[@data-test-id='modalGenerateCsr-select-keyPairAlgorithm']
 ${xpath_select_country}            //*[@data-test-id='modalGenerateCsr-select-country']
 ${xpath_input_state}               //*[@data-test-id='modalGenerateCsr-input-state']
 ${xpath_input_city}                //*[@data-test-id='modalGenerateCsr-input-city']
@@ -29,6 +30,12 @@
 ${xpath_generate_csr_submit}       //*[@data-test-id='modalGenerateCsr-button-ok']
 ${xpath_csr_cancel_button}         //button[contains(text(),"Cancel")]
 ${xpath_select_algorithm_button}   //*[@data-test-id='modalGenerateCsr-select-keyPairAlgorithm']
+${xpath_delete_ca_certificate}     (//*[@title="Delete certificate"])[2]
+${xpath_delete_ldap_certificate}   (//*[@title="Delete certificate"])[3]
+${xpath_delete_https_certificate}  (//*[@title="Delete certificate"])[4]
+${xpath_delete_button}             //button[contains(text(),"Delete")]
+${xpath_cancel_button}             //button[contains(text(),"Cancel")]
+
 
 *** Test Cases ***
 
@@ -55,6 +62,8 @@
     [Tags]  Verify_Existence_Of_Add_Certificate_Button
 
     Page Should Contain Element  ${xpath_add_certificate_button}
+    Page Should Contain Element  ${xpath_generate_csr_button}
+
 
 Verify Generate CSR Certificate Button
     [Documentation]  Verify existence of all the fields of CSR generation.
@@ -64,6 +73,7 @@
     Page Should Contain Element  ${xpath_generate_csr_button}
     Click Element  ${xpath_generate_csr_button}
     Wait Until Page Contains Element  ${xpath_generate_csr_heading}
+
     Page Should Contain Element  ${xpath_select_certificate_type}
     Page Should Contain Element  ${xpath_select_country}
     Page Should Contain Element  ${xpath_input_state}
@@ -74,13 +84,33 @@
     Page Should Contain Element  ${xpath_input_email_address}
     Page Should Contain Element  ${xpath_select_algorithm_button}
     Page Should Contain Element  ${xpath_generate_csr_submit}
+    Page Should Contain Element  ${xpath_key_pair_algoritham}
+
+
+Verify Informational Message Under Add Certificate
+    [Documentation]  Verify informational message under add certificate tab.
+    [Tags]  Verify_Informational_Message_Under_Add_Certificate
+
+    Click Element  ${xpath_add_certificate_button}
+    Wait Until Page Contains Element  ${xpath_cancel_button}
+    Page Should Contain  BMC shell and Resource dump ACF certificates will not be listed in the table.
+    ...                  System has to be powered on to upload Resource dump ACF certificate.
+    Click Element  ${xpath_cancel_button}
+
+
+Verify Delete Button Should Be Disabled For HTTPS And LDAP Certificates
+    [Documentation]  Verify delete buttons should be disabled for HTTPS and LDAP certificates.
+    [Tags]  Verify_Delete_Buttons_Should_Be_Disabled_For_HTTPS_And_LDAP_Certificates
+    [Setup]  Install CA Certificate
+
+    Element Should Be Disabled  ${xpath_delete_ldap_certificate}
+    Element Should Be Disabled  ${xpath_delete_https_certificate}
 
 
 Verify Installed CA Certificate
     [Documentation]  Install CA certificate and verify the same via GUI.
     [Tags]  Verify_Installed_CA_Certificate
-
-    Delete All CA Certificate Via Redfish
+    [Setup]  Delete All CA Certificate Via Redfish
 
     # Install CA certificate via Redfish.
     ${file_data}=  Generate Certificate File Data  CA
@@ -121,6 +151,38 @@
     Wait Until Page Contains  LDAP Certificate  timeout=10
 
 
+Verify Success Message After Deleting CA Certificate
+    [Documentation]  Delete CA certificate and verify success message on BMC GUI page.
+    [Tags]  Verify_Success_Message_After_Deleting_CA_Certificate
+    [Setup]  Install CA Certificate
+    [Teardown]  Install CA Certificate
+
+    Click Element  ${xpath_delete_ca_certificate}
+    Click Element  ${xpath_delete_button}
+    Verify Success Message On BMC GUI Page
+
+
+Verify Cancel Button While Deleting The CA Certificate
+    [Documentation]  Verify Cancel button while deleting the CA certificate
+    [Tags]  Verify_Cancel_Button_While_Deleting_CA_Certificate
+    [Setup]  Install CA Certificate
+
+     Click Element  ${xpath_delete_ca_certificate}
+     Click Element  ${xpath_cancel_button}
+     Page Should Not Contain Element  Click Element  ${xpath_cancel_button}
+
+
+Verify Certificate Page With Readonly User
+    [Documentation]  Verify Certificate page with readonly user.
+    [Tags]  Verify_Certificate_Page_With_Readonly_User
+    [Setup]  Run Keywords  Logout GUI  AND  Create Readonly User And Login To GUI
+    ...      AND  Navigate To Required Sub Menu  ${xpath_secuity_and_accesss_menu}
+    ...      ${xpath_certificates_sub_menu}  certificates
+    [Teardown]  Delete Readonly User And Logout Current GUI Session
+
+    Page Should Contain  No items available
+
+
 *** Keywords ***
 
 Generate Certificate File Data
@@ -157,3 +219,19 @@
 
     Launch Browser And Login GUI
     Create Directory  certificate_dir
+
+
+Install CA Certificate
+    [Documentation]  Install CA certificate via redfish.
+
+    Redfish.Login
+    Delete All CA Certificate Via Redfish
+
+    # Install CA certificate via Redfish.
+    ${file_data}=  Generate Certificate File Data  CA
+    Install And Verify Certificate Via Redfish  CA  Valid Certificate  ok
+
+    # Refresh GUI and verify CA certificate availability in GUI.
+    Refresh GUI
+    Wait Until Page Contains  CA Certificate  timeout=10
+
diff --git a/gui/lib/gui_resource.robot b/gui/lib/gui_resource.robot
index 2681931..e2270ed 100644
--- a/gui/lib/gui_resource.robot
+++ b/gui/lib/gui_resource.robot
@@ -323,11 +323,7 @@
 
 
 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
+    [Documentation]   Created Readonly_user via Redfish and Login BMC GUI with Readonly user.
 
     # Created readonly_user via redfish and login BMC GUI with readonly
     # user to perform test.