cypress-mailisk 1.0.2 → 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 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, this means the call won't timeout until at least one email is received or 5 minutes pass. This timeout is adjustable by passing `timeout` in the options array.
51
- ```js
52
- // timeout of 1 minute
53
- cy.mailiskSearchInbox(namespace, { timeout: 1000 * 60 });
54
- // disable wait entirely, may return empty emails objects immediately
55
- cy.mailiskSearchInbox(namespace, { wait: false });
56
- ```
57
- - It has a default `from_timestamp` of **current timestmap - 5 seconds**. This means that only new emails will be returned. Without this older emails would be returned, permaturely returning the results if you were waiting for a specific email to arrive.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-mailisk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Mailisk library for Cypress",
5
5
  "keywords": [
6
6
  "mailisk",
@@ -97,7 +97,7 @@ declare global {
97
97
  *
98
98
  * See https://docs.cypress.io/api/commands/request#Arguments
99
99
  */
100
- options?: Cypress.RequestOptions,
100
+ options?: Partial<Cypress.RequestOptions>,
101
101
  ): Cypress.Chainable<SearchInboxResponse>;
102
102
  }
103
103
  }
@@ -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?.from_timestamp === undefined || params?.from_timestamp === null) {
25
+ if (params.from_timestamp == null) {
26
26
  _params.from_timestamp = Math.floor(new Date().getTime() / 1000) - 5;
27
27
  }
28
28