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: readme.md
+26-6Lines changed: 26 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,10 @@
6
6
7
7
Extends [Verify](https://github.com/VerifyTests/Verify) to enable snapshotting of emails via [EmailPreviewServices](https://emailpreviewservices.com).<!-- singleLineInclude: intro. path: /docs/intro.include.md -->
8
8
9
+
The purpose of this project is provide faster feedback when using code to generate html emails.
10
+
11
+
[EmailPreviewServices is a paid service](https://emailpreviewservices.com/en/pricing), and a account is required to get an API key.
12
+
9
13
**See [Milestones](../../milestones?state=closed) for release notes.**
10
14
11
15
@@ -38,9 +42,9 @@ public static void Init() =>
38
42
<sup><ahref='/src/Tests/ModuleInitializer.cs#L3-L9'title='Snippet source file'>snippet source</a> | <ahref='#snippet-Initialize'title='Start of snippet'>anchor</a></sup>
39
43
<!-- endSnippet -->
40
44
41
-
The default behavior is to use an environment variable named `EmailPreviewServicesApiKey` as the api key.
45
+
The default behavior is to use an environment variable named `EmailPreviewServicesApiKey` as the API key.
42
46
43
-
An explicit api key can be used:
47
+
An explicit API key can be used:
44
48
45
49
<!-- snippet: InitializeWithKey -->
46
50
<aid='snippet-InitializeWithKey'></a>
@@ -53,6 +57,13 @@ public static void Init() =>
53
57
<!-- endSnippet -->
54
58
55
59
60
+
## Sample html
61
+
62
+
Assume the code under test produces the following html email.
63
+
64
+
snippet: html
65
+
66
+
56
67
## Generating previews
57
68
58
69
<!-- snippet: sample -->
@@ -67,7 +78,7 @@ public async Task GeneratePreview()
67
78
Html=html,
68
79
Devices=
69
80
[
70
-
Device.Outlook2016,
81
+
Device.Outlook2019,
71
82
]
72
83
};
73
84
awaitVerify(preview);
@@ -85,11 +96,20 @@ Result:
85
96
86
97
## Performance
87
98
88
-
Generating previews takes in the range of tens of seconds. The time take can vary based on the number and type of email devices selected. For example generating previews for 5 devices (OutlookWebChrome, Outlook2019, Outlook2016, iPhone13, and GmailFirefox) takes ~30sec.
99
+
Generating previews takes in the range of tens of seconds. The time take can vary based on the number and type of email devices selected. For example:
100
+
101
+
* Generating a a single device (GmailFirefox) takes ~20sec.
102
+
* Generating previews for 5 devices (OutlookWebChrome, Outlook2019, Outlook2016, iPhone13, and GmailFirefox) takes ~25sec.
103
+
104
+
Execution will timeout after 6min and throw an exception.
105
+
106
+
Splitting individual devices, or groups of devices, over multiple tests can be used to have more control of when previews are generated and achieve faster feedback.
107
+
108
+
109
+
## When to run tests
89
110
90
-
Execution will timeout after ~6.5min and throw an exception.
111
+
Tests that execute in the 10s of seconds range can significantly slow down a test run. As such it is recomended that email preview tests are configured to be explicit in `Debug` mode.
91
112
92
-
Splitting individual or groups of devices over multiple tests can be used to have more control of when previews are generated and getting faster feedback.
0 commit comments