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