-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
email.feature
177 lines (167 loc) · 5.66 KB
/
email.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
Feature: Check that email assertions work for or D9
@api
Scenario: As a developer, I want to know that email step definitions work as
expected.
# @note: No @email tag on scenario to test "Given I enable the test email system" step.
Given I enable the test email system
When I send test email to "[email protected]" with
"""
Line one of the test email content
Line two of the test email content
Line three with tabs and spaces
"""
Then an email is sent to "[email protected]"
And an email body contains:
"""
Line two of the test email content
"""
And an email body does not contain:
"""
Line four of the test email content
"""
And an email body contains exact:
"""
Line three with tabs and spaces
"""
And an email body does not contain exact:
"""
Line three with tabs and spaces
"""
But an email body contains:
"""
Line three with tabs and spaces
"""
And an email body contains:
"""
Line three with tabs and spaces
"""
And I disable the test email system
@api
Scenario: As a developer, I want to know that an email is sent to step definition can correctly assert
emails sent to multiple recipients.
Given I enable the test email system
When I send test email to "[email protected],[email protected]" with
"""
Line one of the test email content
Line two of the test email content
Line three of the test email content
"""
Then an email is sent to "[email protected]"
And an email is sent to "[email protected]"
And no emails were sent to "[email protected]"
And an email header "Content-Type" contains:
"""
text/plain
"""
And an email header "X-Mailer" contains:
"""
Drupal
"""
@api
Scenario: As a developer, I want to know that test email system is activated
as before and after scenario steps.
Given I enable the test email system
When I send test email to "[email protected]" with
"""
Line one of the test email content
Line two of the test email content
Line three of the test email content
"""
Then an email is sent to "[email protected]"
And an email "body" contains:
"""
Line two of the test email content
"""
And an email body does not contain:
"""
Line four of the test email content
"""
And I disable the test email system
@api
Scenario: As a developer, I want to know that test email system queue clearing
step is working.
Given I enable the test email system
When I send test email to "[email protected]" with
"""
Line one of the test email content
Line two of the test email content
Line three of the test email content
"""
Then an email is sent to "[email protected]"
And an email body contains:
"""
Line two of the test email content
"""
And an email body does not contain:
"""
Line four of the test email content
"""
When I clear the test email system queue
And an email body does not contain:
"""
Line two of the test email content
"""
And I disable the test email system
@api @email
Scenario: As a developer, I want to know that test email system is automatically
activated when @email tag is added to the scenario.
When I send test email to "[email protected]" with
"""
Line one of the test email content
Line two of the test email content
Line three of the test email content
"""
Then an email is sent to "[email protected]"
And an email body contains:
"""
Line two of the test email content
"""
@api @email
Scenario Outline: As a developer, I want to know that following a link from
the email is working.
Given I send test email to "[email protected]" with
"""
Line one of the test email content
"<content>"
Line two of the test email content
"""
Then an email is sent to "[email protected]"
And I follow the link number "<number>" in the email with the subject:
"""
Test Email
"""
Then the response status code should be 200
And I should see "Example Domain"
Examples:
| content | number |
| http://example.com | 1 |
| http://www.example.com | 1 |
| www.example.com | 1 |
| Link is a part of content http://example.com | 1 |
| http://1.example.com http://example.com http://3.example.com | 2 |
| http://1.example.com http://2.example.com http://example.com | 3 |
@api @email
Scenario: As a developer, I want to know that no emails assertions works as expected.
Given no emails were sent
Given I send test email to "[email protected]" with
"""
Line one of the test email content
"<content>"
Line two of the test email content
"""
Then an email is sent to "[email protected]"
When I clear the test email system queue
Then no emails were sent
@trait:EmailTrait
Scenario: Assert that an email was sent to an address.
Given some behat configuration
And scenario steps:
"""
Given I am logged in as a user with the "administrator" role
Then an email is sent to "[email protected]"
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
Unable to find email sent to "[email protected]" retrieved from test record collector.
"""