-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ This Cypress command does a few extra things out of the box compared to calling | |
|
||
- 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. | ||
- The request timeout is adjustable by passing `timeout` in the request options. By default it uses a timeout of 5 minutes. | ||
- By default it returns emails in the last 15 minutes. This ensures that only new emails are returned. Without this, older emails would also be returned, potentially disrupting you if you were waiting for a specific email. This can be overriden by passing the `from_timestamp` parameter (`from_timestamp: 0` will disable filtering by email age). | ||
- 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). | ||
|
||
```js | ||
// timeout of 5 minute | ||
|
@@ -60,9 +60,55 @@ cy.mailiskSearchInbox(namespace, {}, { timeout: 1000 * 60 }); | |
cy.mailiskSearchInbox(namespace, { wait: false }); | ||
``` | ||
|
||
The implementation of these features is explained in the [NodeJS Guide](/guides/nodejs). | ||
For the full list of filters and their description see the [Search Inbox](/api-reference/search-inbox#request-1) endpoint reference. | ||
|
||
## Example | ||
### Filter by TO address | ||
|
||
The `to_addr_prefix` option allows filtering by the email's TO address. Specifically the TO address has to start with this. | ||
|
||
For example, if someone sends an email to `[email protected]`, you can filter it by using `my-user-1@`: | ||
|
||
```js | ||
cy.mailiskSearchInbox(namespace, { | ||
to_addr_prefix: 'my-user-1@', | ||
}); | ||
``` | ||
|
||
### Filter by FROM address | ||
|
||
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_. | ||
|
||
For example, if someone sends an email from the `example.com` domain we could filter like so: | ||
|
||
```js | ||
cy.mailiskSearchInbox(namespace, { | ||
from_addr_includes: '@example.com', | ||
}); | ||
``` | ||
|
||
If we know a specific email address we want to listen to we can do this: | ||
|
||
```js | ||
cy.mailiskSearchInbox(namespace, { | ||
from_addr_includes: '[email protected]', | ||
}); | ||
``` | ||
|
||
### Filter by Subject | ||
|
||
The `subject_includes` option allows filtering by the email's Subject. Specifically the Subject has to include this (case-insensitive). | ||
|
||
If we're testing password reset that sends an email with the subject `Password reset request`. We could filter by something like this: | ||
|
||
```js | ||
cy.mailiskSearchInbox(namespace, { | ||
subject_includes: 'password reset request', | ||
}); | ||
``` | ||
|
||
## Common test cases | ||
|
||
### Password reset page | ||
|
||
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. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters