cypress-mailisk 1.0.6 → 2.0.0

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
@@ -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 `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).
52
+ - 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).
53
53
 
54
54
  ```js
55
55
  // timeout of 5 minute
@@ -80,6 +80,7 @@ describe('Test password reset', () => {
80
80
  it('Gets a password reset email', () => {
81
81
  cy.mailiskSearchInbox(namespace, {
82
82
  to_addr_prefix: testEmailAddr,
83
+ subject_includes: 'password',
83
84
  }).then((response) => {
84
85
  expect(response.data).to.not.be.empty;
85
86
  const email = response.data[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-mailisk",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "description": "Mailisk library for Cypress",
5
5
  "keywords": [
6
6
  "mailisk",
@@ -54,9 +54,21 @@ export interface SearchInboxParams {
54
54
  /**
55
55
  * Filter emails by 'to' address. Address must start with this.
56
56
  *
57
- * 'foo' would return 'foobar@namespace.mailisk.net' but not 'barfoo@namespace.mailisk.net'
57
+ * 'foo' would return for 'foobar@namespace.mailisk.net' but not 'barfoo@namespace.mailisk.net'
58
58
  */
59
59
  to_addr_prefix?: string;
60
+ /**
61
+ * Filter emails by 'from' address. Address must include this.
62
+ *
63
+ * '@foo' would return for 'a@foo.com', 'b@foo.net'
64
+ */
65
+ from_addr_includes?: string;
66
+ /**
67
+ * Filter emails by subject. This is case insensitive. Subject must include this.
68
+ *
69
+ * 'password' would return for 'Password reset', 'Reset password notification' but not 'Reset'
70
+ */
71
+ subject_includes?: string;
60
72
  /**
61
73
  * Will keep the request going till at least one email would be returned.
62
74
  *
@@ -26,7 +26,7 @@ class MailiskCommands {
26
26
  return response;
27
27
  }
28
28
  const timeout = Math.max(_options.timeout - (Date.now() - startTime), 1);
29
- cy.wait(Math.min(timeout, 9000));
29
+ cy.wait(Math.min(timeout, 9000), { log: false });
30
30
  return this._mailiskSearchAction(namespace, _options, urlParams, startTime, timeout);
31
31
  });
32
32
  }
@@ -34,9 +34,9 @@ class MailiskCommands {
34
34
  mailiskSearchInbox(namespace, params, options = {}) {
35
35
  let _params = { ...params };
36
36
 
37
- // default timestamp, 5 seconds before starting this request
37
+ // default from_timestamp, 15 minutes before starting this request
38
38
  if (params.from_timestamp == null) {
39
- _params.from_timestamp = Math.floor(new Date().getTime() / 1000) - 5;
39
+ _params.from_timestamp = Math.floor(new Date().getTime() / 1000) - 15 * 60;
40
40
  }
41
41
 
42
42
  // by default wait for email