cypress-mailisk 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ This Cypress command does a few extra things out of the box compared to calling
|
|
|
49
49
|
|
|
50
50
|
- By default it uses the `wait` flag. This means the call won't return until at least one email is received. Disabling this flag via `wait: false` can cause it to return an empty response immediately.
|
|
51
51
|
- The request timeout is adjustable by passing `timeout` in the request options. By default it uses a timeout of 5 minutes.
|
|
52
|
-
- By default it returns emails in the last 15 minutes. This ensures that only new emails are returned.
|
|
52
|
+
- By default it returns emails in the last 15 minutes. This ensures that only new emails are returned. This can be overriden by passing the `from_timestamp` parameter (`from_timestamp: 0` will disable filtering by email age).
|
|
53
53
|
|
|
54
54
|
```js
|
|
55
55
|
// timeout of 5 minute
|
|
@@ -60,9 +60,55 @@ cy.mailiskSearchInbox(namespace, {}, { timeout: 1000 * 60 });
|
|
|
60
60
|
cy.mailiskSearchInbox(namespace, { wait: false });
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
For the full list of filters and their description see the [Search Inbox](/api-reference/search-inbox#request-1) endpoint reference.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
### Filter by TO address
|
|
66
|
+
|
|
67
|
+
The `to_addr_prefix` option allows filtering by the email's TO address. Specifically the TO address has to start with this.
|
|
68
|
+
|
|
69
|
+
For example, if someone sends an email to `my-user-1@yournamespace.mailisk.net`, you can filter it by using `my-user-1@`:
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
cy.mailiskSearchInbox(namespace, {
|
|
73
|
+
to_addr_prefix: 'my-user-1@',
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Filter by FROM address
|
|
78
|
+
|
|
79
|
+
The `from_addr_includes` option allows filtering by the email's FROM address. Specifically the TO address has to include this. Note that this is different from the to address as it is _includes_ not _prefix_.
|
|
80
|
+
|
|
81
|
+
For example, if someone sends an email from the `example.com` domain we could filter like so:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
cy.mailiskSearchInbox(namespace, {
|
|
85
|
+
from_addr_includes: '@example.com',
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If we know a specific email address we want to listen to we can do this:
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
cy.mailiskSearchInbox(namespace, {
|
|
93
|
+
from_addr_includes: 'no-reply@example.com',
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Filter by Subject
|
|
98
|
+
|
|
99
|
+
The `subject_includes` option allows filtering by the email's Subject. Specifically the Subject has to include this (case-insensitive).
|
|
100
|
+
|
|
101
|
+
If we're testing password reset that sends an email with the subject `Password reset request`. We could filter by something like this:
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
cy.mailiskSearchInbox(namespace, {
|
|
105
|
+
subject_includes: 'password reset request',
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Common test cases
|
|
110
|
+
|
|
111
|
+
### Password reset page
|
|
66
112
|
|
|
67
113
|
This example demonstrates going to a password reset page, requesting a new password, receiving reset code link via email and finally setting the new password.
|
|
68
114
|
|