Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 8b739bef

Přidáno uživatelem Stanislav Král před téměř 4 roky(ů)

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

Zobrazit rozdíly:

robot_tests/user_stories.robot
1
*** Settings ***
2
Library   Browser
3
Suite Teardown  Teardown
4

  
5
*** Variables ***
6
${url}  http://localhost:5000
7
${root_ca_common_name}  Root CA
8
${inter_ca_common_name}  Inter CA
9
${common_name_field}    xpath=//input[@id='subject_CN']
10
${created_certificate_link}    xpath=//table//td[1]/a
11
${delete_button}    xpath=//button[contains(@class, 'certificate-control') and text()="Delete"]
12
${delete_button_modal}    xpath=//div[@id="deleteModal"]//button[text()="Delete"]
13
${table_rows}   xpath=//div[@id="certificateListingPage"]//table/tbody/tr
14
${create_cert_select}   xpath=//select[@id="CA"]
15
${revocation_reason_select}   xpath=//select[@id="reasonSelect"]
16
${revoke_button_modal}   xpath=//div[@id="revokeModal"]//button[text() = "Revoke"]
17
${certificate_status_span}   xpath=//table//td[2]/h5/span
18

  
19
*** Test Cases ***
20
User Can Manage Certificate Authorities
21
    Setup Homepage
22
    Page Title Is    Certificate Listing
23
    Certificate Table Is Empty
24
    Create Root Certificate Authority   ${root_ca_common_name}
25
    Page Title Is    Certificate Listing
26
    Certificate Table Has Number Of Entries     1
27
    Verify Certificate Is A Certificate Authority   ${root_ca_common_name}
28
    Create Intermediate Certificate Authority   ${root_ca_common_name}  ${inter_ca_common_name}
29
    Certificate Table Has Number Of Entries     2
30
    Verify Certificate Is A Certificate Authority   ${inter_ca_common_name}
31
    Open Certificate Detail   ${inter_ca_common_name}
32
    Page Title Is    Certificate Detailed View
33
    Certificate Status Is   Valid
34
    Revoke Certificate  keyCompromise
35
    Check Certificate Is Revoked
36
    Click Delete Button
37
    Confirm Delete Dialog
38
    Page Title Is   Certificate Listing
39
    Certificate Table Has Number Of Entries     1
40
    First Certificate Table Entry Common Name Is     ${root_ca_common_name}
41

  
42
*** Keywords ***
43
Teardown
44
    Log    Inside teardown
45
    Setup Homepage
46
    FOR    ${i}    IN RANGE    1
47
           Log    About teardown
48
           ${certificate_table_is_empty}   Certificate Table Is Empty
49
           Exit For Loop If    ${certificate_table_is_empty}
50
           Click First Certificate Table Entry
51
           Click Delete Button
52
           Confirm Delete Dialog
53
    END
54
    Log    Exited
55

  
56
Create Root Certificate Authority
57
    [Arguments]    ${common_name}
58
    Click   "+"
59
    Page Title Is    Create Certificate
60
    Fill Common Name Field    ${common_name}
61
    Click   "Create certificate"
62

  
63
Create Intermediate Certificate Authority
64
    [Arguments]    ${issuer_common_name}   ${common_name}
65
    Click   "+"
66
    Page Title Is    Create Certificate
67
    Select Issuer   ${issuer_common_name}
68
    Fill Common Name Field    ${common_name}
69
    Check Checkbox  "CA"
70
    Click   "Create certificate"
71
    Page Title Is    Certificate Listing
72

  
73
Open Certificate Detail
74
    [Arguments]     ${common_name}
75
    Click   xpath=//td/a[string() = "${common_name}"]
76

  
77
Revoke Certificate
78
    [Arguments]  ${reason}
79
    Click Revoke Button
80
    Select Revocation Reason    ${reason}
81
    Confirm Revoke Dialog
82

  
83
Verify Certificate Is A Certificate Authority
84
    [Arguments]     ${common_name}
85
    Open Certificate Detail     ${common_name}
86
    Get Checkbox State  xpath=//input[@id="isCA"]   ==  checked
87
    Go Back
88

  
89
Setup Homepage
90
    New Page    ${url}
91

  
92
Certificate Table Has Number Of Entries
93
    [Arguments]     ${number_of_entries}
94
    Get Element Count     ${table_rows}   ==  ${number_of_entries}
95

  
96
Certificate Table Is Empty
97
    Certificate Table Has Number Of Entries     0
98

  
99
Page Title Is
100
    [Arguments]     ${title}
101
    Get Text    h1    contains    ${title}
102

  
103
Fill Common Name Field
104
    [Arguments]     ${common_name}
105
    Fill Text   ${common_name_field}    ${common_name}
106

  
107
First Certificate Table Entry Common Name Is
108
    [Arguments]     ${common_name}
109
    Get Text    ${created_certificate_link}  ==     ${common_name}
110

  
111
Click First Certificate Table Entry
112
    Click   ${created_certificate_link}
113

  
114
Click Delete Button
115
    Click   ${delete_button}
116

  
117
Confirm Delete Dialog
118
    Click   ${delete_button_modal}
119

  
120
Select Issuer
121
    [Arguments]     ${issuer_name}
122
    Select Options By   ${create_cert_select}   Label   ${issuer_name}
123

  
124
Click Revoke Button
125
    Click   "Revoke"
126

  
127
Confirm Revoke Dialog
128
    Click   ${revoke_button_modal}
129

  
130
Select Revocation Reason
131
    [Arguments]     ${revocation_reason}
132
    Log     Revocation Reason
133
    Log     ${revocation_reason}
134
    Get Element     ${revocation_reason_select}
135
    Select Options By   ${revocation_reason_select}   Label   ${revocation_reason}
136

  
137
Revocation Success Messsage Is Shown
138
    Get Element     xpath=//div[@class="alert alert-success" and contains(string(), "Certificate revocation successful.")]
139

  
140
Certificate Status Is
141
    [Arguments]     ${certificate_status}
142
    Get Text    ${certificate_status_span}  ==  ${certificate_status}
143

  
144
Check Certificate Is Revoked
145
    Revocation Success Messsage Is Shown
146
    Certificate Status Is   Revoked
147

  

Také k dispozici: Unified diff