commit 7294a1db2652c790823da2a7aa741c63511d4811
Author: Stanislav Král <stanislav.kral3@gmail.com>
Date:   Thu May 6 23:36:40 2021 +0200

    Re #8703 - Extended user_stories.robot with a test case that verifies the "User can manage certificates " user story
    
    Added test case comments describing which FRs are being tested.

diff --git a/robot_tests/user_stories.robot b/robot_tests/user_stories.robot
index 6597ee9..1fed7f5 100644
--- a/robot_tests/user_stories.robot
+++ b/robot_tests/user_stories.robot
@@ -1,16 +1,19 @@
 *** Settings ***
 Library   Browser
-Suite Teardown  Teardown
+Test Setup     Setup Homepage
+Test Teardown  Delete Root Certificate Authority Teardown
 
 *** Variables ***
 ${url}  http://localhost:5000
 ${root_ca_common_name}  Root CA
 ${inter_ca_common_name}  Inter CA
+${end_cert_common_name}  Foo Certificate
 ${common_name_field}    xpath=//input[@id='subject_CN']
 ${created_certificate_link}    xpath=//table//td[1]/a
 ${delete_button}    xpath=//button[contains(@class, 'certificate-control') and text()="Delete"]
 ${delete_button_modal}    xpath=//div[@id="deleteModal"]//button[text()="Delete"]
 ${table_rows}   xpath=//div[@id="certificateListingPage"]//table/tbody/tr
+${table_rows_count}   xpath=count(//div[@id="certificateListingPage"]//table/tbody/tr)
 ${create_cert_select}   xpath=//select[@id="CA"]
 ${revocation_reason_select}   xpath=//select[@id="reasonSelect"]
 ${revoke_button_modal}   xpath=//div[@id="revokeModal"]//button[text() = "Revoke"]
@@ -18,40 +21,46 @@ ${certificate_status_span}   xpath=//table//td[2]/h5/span
 
 *** Test Cases ***
 User Can Manage Certificate Authorities
-    Setup Homepage
-    Page Title Is    Certificate Listing
+    Page Title Is    Certificate Listing                                                        # FR 1.1 - root CA
     Certificate Table Is Empty
     Create Root Certificate Authority   ${root_ca_common_name}
     Page Title Is    Certificate Listing
     Certificate Table Has Number Of Entries     1
     Verify Certificate Is A Certificate Authority   ${root_ca_common_name}
-    Create Intermediate Certificate Authority   ${root_ca_common_name}  ${inter_ca_common_name}
+    Create Intermediate Certificate Authority   ${root_ca_common_name}  ${inter_ca_common_name}     # FR 1.1 - inter CA
     Certificate Table Has Number Of Entries     2
     Verify Certificate Is A Certificate Authority   ${inter_ca_common_name}
-    Open Certificate Detail   ${inter_ca_common_name}
+    Open Certificate Detail   ${inter_ca_common_name}                                           # FR 1.3 - validity
     Page Title Is    Certificate Detailed View
     Certificate Status Is   Valid
-    Revoke Certificate  keyCompromise
+    Revoke Certificate  keyCompromise                                                           # FR 1.2 - revocation
     Check Certificate Is Revoked
-    Click Delete Button
+    Click Delete Button                                                                         # FR 1.3 - deletion
     Confirm Delete Dialog
     Page Title Is   Certificate Listing
     Certificate Table Has Number Of Entries     1
     First Certificate Table Entry Common Name Is     ${root_ca_common_name}
 
+User Can Manage Certificates
+    Page Title Is   Certificate Listing                                                         # root CA required
+    Certificate Table Is Empty
+    Create Root Certificate Authority   ${root_ca_common_name}
+    Create Certificate  ${root_ca_common_name}  ${end_cert_common_name}                         # FR 2.1
+    Certificate Table Has Number Of Entries     2
+    Open Certificate Detail     ${end_cert_common_name}                                         # FR 2.3
+    Certificate Status Is   Valid
+    Revoke Certificate  keyCompromise                                                           # FR 2.2
+    Check Certificate Is Revoked
+
 *** Keywords ***
-Teardown
-    Log    Inside teardown
+Delete Root Certificate Authority Teardown
     Setup Homepage
-    FOR    ${i}    IN RANGE    1
-           Log    About teardown
-           ${certificate_table_is_empty}   Certificate Table Is Empty
-           Exit For Loop If    ${certificate_table_is_empty}
-           Click First Certificate Table Entry
-           Click Delete Button
-           Confirm Delete Dialog
-    END
-    Log    Exited
+    Page Title Is    Certificate Listing
+    Open Certificate Detail     ${root_ca_common_name}
+    # deleting the root CA deletes all of it's children
+    Click Delete Button
+    Confirm Delete Dialog
+    Certificate Table Is Empty
 
 Create Root Certificate Authority
     [Arguments]    ${common_name}
@@ -59,6 +68,7 @@ Create Root Certificate Authority
     Page Title Is    Create Certificate
     Fill Common Name Field    ${common_name}
     Click   "Create certificate"
+    Page Title Is    Certificate Listing
 
 Create Intermediate Certificate Authority
     [Arguments]    ${issuer_common_name}   ${common_name}
@@ -70,6 +80,15 @@ Create Intermediate Certificate Authority
     Click   "Create certificate"
     Page Title Is    Certificate Listing
 
+Create Certificate
+    [Arguments]    ${issuer_common_name}   ${common_name}
+    Click   "+"
+    Page Title Is    Create Certificate
+    Select Issuer   ${issuer_common_name}
+    Fill Common Name Field    ${common_name}
+    Click   "Create certificate"
+    Page Title Is    Certificate Listing
+
 Open Certificate Detail
     [Arguments]     ${common_name}
     Click   xpath=//td/a[string() = "${common_name}"]
@@ -129,8 +148,6 @@ Confirm Revoke Dialog
 
 Select Revocation Reason
     [Arguments]     ${revocation_reason}
-    Log     Revocation Reason
-    Log     ${revocation_reason}
     Get Element     ${revocation_reason_select}
     Select Options By   ${revocation_reason_select}   Label   ${revocation_reason}
 
