cypress-mailisk 1.0.4 → 1.0.7
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/package.json +1 -1
- package/src/mailiskCommands.js +21 -1
package/package.json
CHANGED
package/src/mailiskCommands.js
CHANGED
|
@@ -18,6 +18,19 @@ class MailiskCommands {
|
|
|
18
18
|
return this.request.get('api/namespaces');
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
_mailiskSearchAction(namespace, _options, urlParams, startTime, nextTimeout) {
|
|
22
|
+
return this.request
|
|
23
|
+
.get(`api/emails/${namespace}/inbox?${urlParams.toString()}`, { ..._options, timeout: nextTimeout })
|
|
24
|
+
.then((response) => {
|
|
25
|
+
if (response.total_count !== 0) {
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
const timeout = Math.max(_options.timeout - (Date.now() - startTime), 1);
|
|
29
|
+
cy.wait(Math.min(timeout, 9000), { log: false });
|
|
30
|
+
return this._mailiskSearchAction(namespace, _options, urlParams, startTime, timeout);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
mailiskSearchInbox(namespace, params, options = {}) {
|
|
22
35
|
let _params = { ...params };
|
|
23
36
|
|
|
@@ -44,7 +57,14 @@ class MailiskCommands {
|
|
|
44
57
|
_options.timeout = 1000 * 60 * 5;
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
|
|
60
|
+
// temporary workaround due cypress not supporting overriding maxRedirects
|
|
61
|
+
if (_params.wait) {
|
|
62
|
+
urlParams.delete('wait');
|
|
63
|
+
const startTime = Date.now();
|
|
64
|
+
return this._mailiskSearchAction(namespace, _options, urlParams, startTime, _options.timeout);
|
|
65
|
+
} else {
|
|
66
|
+
return this.request.get(`api/emails/${namespace}/inbox?${urlParams.toString()}`, _options);
|
|
67
|
+
}
|
|
48
68
|
}
|
|
49
69
|
}
|
|
50
70
|
|