commit 8b739befc6bf009a66891597b0165d2036db11a5
Author: Stanislav Král <stanislav.kral3@gmail.com>
Date:   Thu May 6 22:11:05 2021 +0200

    Re #8703 - Added user_stories.robot test and implemented a test case that verifies the "User Can Manage Certificate Authorities" user story

diff --git a/robot_tests/user_stories.robot b/robot_tests/user_stories.robot
new file mode 100644
index 0000000..6597ee9
--- /dev/null
+++ b/robot_tests/user_stories.robot
@@ -0,0 +1,147 @@
+*** Settings ***
+Library   Browser
+Suite Teardown  Teardown
+
+*** Variables ***
+${url}  http://localhost:5000
+${root_ca_common_name}  Root CA
+${inter_ca_common_name}  Inter CA
+${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
+${create_cert_select}   xpath=//select[@id="CA"]
+${revocation_reason_select}   xpath=//select[@id="reasonSelect"]
+${revoke_button_modal}   xpath=//div[@id="revokeModal"]//button[text() = "Revoke"]
+${certificate_status_span}   xpath=//table//td[2]/h5/span
+
+*** Test Cases ***
+User Can Manage Certificate Authorities
+    Setup Homepage
+    Page Title Is    Certificate Listing
+    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}
+    Certificate Table Has Number Of Entries     2
+    Verify Certificate Is A Certificate Authority   ${inter_ca_common_name}
+    Open Certificate Detail   ${inter_ca_common_name}
+    Page Title Is    Certificate Detailed View
+    Certificate Status Is   Valid
+    Revoke Certificate  keyCompromise
+    Check Certificate Is Revoked
+    Click Delete Button
+    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}
+
+*** Keywords ***
+Teardown
+    Log    Inside 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
+
+Create Root Certificate Authority
+    [Arguments]    ${common_name}
+    Click   "+"
+    Page Title Is    Create Certificate
+    Fill Common Name Field    ${common_name}
+    Click   "Create certificate"
+
+Create Intermediate Certificate Authority
+    [Arguments]    ${issuer_common_name}   ${common_name}
+    Click   "+"
+    Page Title Is    Create Certificate
+    Select Issuer   ${issuer_common_name}
+    Fill Common Name Field    ${common_name}
+    Check Checkbox  "CA"
+    Click   "Create certificate"
+    Page Title Is    Certificate Listing
+
+Open Certificate Detail
+    [Arguments]     ${common_name}
+    Click   xpath=//td/a[string() = "${common_name}"]
+
+Revoke Certificate
+    [Arguments]  ${reason}
+    Click Revoke Button
+    Select Revocation Reason    ${reason}
+    Confirm Revoke Dialog
+
+Verify Certificate Is A Certificate Authority
+    [Arguments]     ${common_name}
+    Open Certificate Detail     ${common_name}
+    Get Checkbox State  xpath=//input[@id="isCA"]   ==  checked
+    Go Back
+
+Setup Homepage
+    New Page    ${url}
+
+Certificate Table Has Number Of Entries
+    [Arguments]     ${number_of_entries}
+    Get Element Count     ${table_rows}   ==  ${number_of_entries}
+
+Certificate Table Is Empty
+    Certificate Table Has Number Of Entries     0
+
+Page Title Is
+    [Arguments]     ${title}
+    Get Text    h1    contains    ${title}
+
+Fill Common Name Field
+    [Arguments]     ${common_name}
+    Fill Text   ${common_name_field}    ${common_name}
+
+First Certificate Table Entry Common Name Is
+    [Arguments]     ${common_name}
+    Get Text    ${created_certificate_link}  ==     ${common_name}
+
+Click First Certificate Table Entry
+    Click   ${created_certificate_link}
+
+Click Delete Button
+    Click   ${delete_button}
+
+Confirm Delete Dialog
+    Click   ${delete_button_modal}
+
+Select Issuer
+    [Arguments]     ${issuer_name}
+    Select Options By   ${create_cert_select}   Label   ${issuer_name}
+
+Click Revoke Button
+    Click   "Revoke"
+
+Confirm Revoke Dialog
+    Click   ${revoke_button_modal}
+
+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}
+
+Revocation Success Messsage Is Shown
+    Get Element     xpath=//div[@class="alert alert-success" and contains(string(), "Certificate revocation successful.")]
+
+Certificate Status Is
+    [Arguments]     ${certificate_status}
+    Get Text    ${certificate_status_span}  ==  ${certificate_status}
+
+Check Certificate Is Revoked
+    Revocation Success Messsage Is Shown
+    Certificate Status Is   Revoked
+
