cypress-mailisk 1.0.3 → 1.0.4
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 +12 -8
- package/package.json +1 -1
- package/src/mailiskCommands.js +1 -1
package/README.md
CHANGED
|
@@ -47,14 +47,18 @@ cy.mailiskSearchInbox('yournamespace', { to_addr_prefix: 'test.user@' }).then((r
|
|
|
47
47
|
|
|
48
48
|
This Cypress command does a few extra things out of the box compared to calling the raw API directly:
|
|
49
49
|
|
|
50
|
-
- By default it uses the `wait` flag
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
- The request timeout is adjustable by passing `timeout` in the request options. By default it uses a timeout of 5 minutes.
|
|
52
|
+
- By default `from_timestamp` is set to **current timestamp - 5 seconds**. 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_timestmap: 0` will disable filtering by email age).
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
// timeout of 5 minute
|
|
56
|
+
cy.mailiskSearchInbox(namespace);
|
|
57
|
+
// timeout of 1 minute
|
|
58
|
+
cy.mailiskSearchInbox(namespace, {}, { timeout: 1000 * 60 });
|
|
59
|
+
// returns immediately, even if the result would be empty
|
|
60
|
+
cy.mailiskSearchInbox(namespace, { wait: false });
|
|
61
|
+
```
|
|
58
62
|
|
|
59
63
|
The implementation of these features is explained in the [NodeJS Guide](/guides/nodejs).
|
|
60
64
|
|
package/package.json
CHANGED
package/src/mailiskCommands.js
CHANGED
|
@@ -22,7 +22,7 @@ class MailiskCommands {
|
|
|
22
22
|
let _params = { ...params };
|
|
23
23
|
|
|
24
24
|
// default timestamp, 5 seconds before starting this request
|
|
25
|
-
if (params
|
|
25
|
+
if (params.from_timestamp == null) {
|
|
26
26
|
_params.from_timestamp = Math.floor(new Date().getTime() / 1000) - 5;
|
|
27
27
|
}
|
|
28
28
|
|