You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/plausible_web/email_test.exs
+91-1Lines changed: 91 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ defmodule PlausibleWeb.EmailTest do
14
14
})
15
15
16
16
assertemail.html_body=~"Hey John,"
17
+
assertemail.text_body=~"Hey John,"
17
18
end
18
19
19
20
test"greets impersonally when user not in template assigns"do
@@ -22,6 +23,7 @@ defmodule PlausibleWeb.EmailTest do
22
23
|>Email.render("welcome_email.html")
23
24
24
25
assertemail.html_body=~"Hey,"
26
+
assertemail.text_body=~"Hey,"
25
27
end
26
28
27
29
test"renders plausible link"do
@@ -30,6 +32,7 @@ defmodule PlausibleWeb.EmailTest do
30
32
|>Email.render("welcome_email.html")
31
33
32
34
assertemail.html_body=~plausible_link()
35
+
assertemail.text_body=~plausible_url()
33
36
end
34
37
35
38
@tag:ee_only
@@ -50,6 +53,9 @@ defmodule PlausibleWeb.EmailTest do
50
53
51
54
refuteemail.html_body=~"Hey John,"
52
55
refuteemail.html_body=~plausible_link()
56
+
57
+
refuteemail.text_body=~"Hey John,"
58
+
refuteemail.text_body=~plausible_url()
53
59
end
54
60
end
55
61
@@ -74,6 +80,7 @@ defmodule PlausibleWeb.EmailTest do
74
80
})
75
81
76
82
assertemail.html_body=~"Hey John,"
83
+
assertemail.text_body=~"Hey John,"
77
84
end
78
85
79
86
test"greets impersonally when user not in template assigns"do
@@ -84,6 +91,7 @@ defmodule PlausibleWeb.EmailTest do
84
91
})
85
92
86
93
assertemail.html_body=~"Hey,"
94
+
assertemail.text_body=~"Hey,"
87
95
end
88
96
89
97
test"renders plausible link"do
@@ -94,6 +102,7 @@ defmodule PlausibleWeb.EmailTest do
94
102
})
95
103
96
104
assertemail.html_body=~plausible_link()
105
+
assertemail.text_body=~plausible_url()
97
106
end
98
107
99
108
test"does not render unsubscribe placeholder"do
@@ -115,6 +124,9 @@ defmodule PlausibleWeb.EmailTest do
115
124
116
125
refuteemail.html_body=~"Hey John,"
117
126
refuteemail.html_body=~plausible_link()
127
+
128
+
refuteemail.text_body=~"Hey John,"
129
+
refuteemail.text_body=~plausible_url()
118
130
end
119
131
end
120
132
@@ -326,8 +338,86 @@ defmodule PlausibleWeb.EmailTest do
326
338
end
327
339
end
328
340
341
+
describe"text_body"do
342
+
@tag:ee_only
343
+
test"welcome_email (EE)"do
344
+
email=
345
+
Email.base_email()
346
+
|>Email.render("welcome_email.html",%{
347
+
user: build(:user,name: "John Doe"),
348
+
code: "123"
349
+
})
350
+
351
+
assertemail.text_body=="""
352
+
Hey John,
353
+
354
+
We are building Plausible to provide a simple and ethical approach to tracking website visitors. We're super excited to have you on board!
355
+
356
+
Here's how to get the most out of your Plausible experience:
357
+
358
+
* Enable email reports (https://plausible.io/docs/email-reports) and notifications for traffic spikes (https://plausible.io/docs/traffic-spikes)
359
+
* Integrate with Search Console (https://plausible.io/docs/google-search-console-integration) to get keyword phrases people find your site with
360
+
* Invite team members and other collaborators (https://plausible.io/docs/users-roles)
361
+
* Set up easy goals including 404 error pages (https://plausible.io/docs/error-pages-tracking-404), file downloads (https://plausible.io/docs/file-downloads-tracking) and outbound link clicks (https://plausible.io/docs/outbound-link-click-tracking)
362
+
* Opt out from counting your own visits (https://plausible.io/docs/excluding)
363
+
* If you're concerned about adblockers, set up a proxy to bypass them (https://plausible.io/docs/proxy/introduction)
364
+
365
+
366
+
Then you're ready to start exploring your fast loading, ethical and actionable Plausible dashboard (https://plausible.io/sites).
367
+
368
+
Have a question, feedback or need some guidance? Do reply back to this email.
369
+
370
+
Regards,
371
+
The Plausible Team 💌
372
+
373
+
--
374
+
375
+
http://localhost:8000
376
+
{{{ pm:unsubscribe }}}\
377
+
"""
378
+
end
379
+
380
+
@tag:ce_build_only
381
+
test"welcome_email (CE)"do
382
+
email=
383
+
Email.base_email()
384
+
|>Email.render("welcome_email.html",%{
385
+
user: build(:user,name: "John Doe"),
386
+
code: "123"
387
+
})
388
+
389
+
assertemail.text_body=="""
390
+
Hey John,
391
+
392
+
We are building Plausible to provide a simple and ethical approach to tracking website visitors. We're super excited to have you on board!
393
+
394
+
Here's how to get the most out of your Plausible experience:
395
+
396
+
* Enable email reports (https://plausible.io/docs/email-reports) and notifications for traffic spikes (https://plausible.io/docs/traffic-spikes)
397
+
* Integrate with Search Console (https://plausible.io/docs/google-search-console-integration) to get keyword phrases people find your site with
398
+
* Invite team members and other collaborators (https://plausible.io/docs/users-roles)
399
+
* Set up easy goals including 404 error pages (https://plausible.io/docs/error-pages-tracking-404), file downloads (https://plausible.io/docs/file-downloads-tracking) and outbound link clicks (https://plausible.io/docs/outbound-link-click-tracking)
400
+
* Opt out from counting your own visits (https://plausible.io/docs/excluding)
401
+
* If you're concerned about adblockers, set up a proxy to bypass them (https://plausible.io/docs/proxy/introduction)
402
+
403
+
404
+
Then you're ready to start exploring your fast loading, ethical and actionable Plausible dashboard (https://plausible.io/sites).
405
+
406
+
Have a question, feedback or need some guidance? Do reply back to this email.
0 commit comments