askui 0.21.0 → 0.21.2

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.
@@ -23,7 +23,9 @@ class UiControllerClient {
23
23
  this.currentResolve = UiControllerClient.EMPTY_RESOLVE;
24
24
  }
25
25
  onMessage(data) {
26
+ logger_1.logger.debug('onMessage');
26
27
  clearTimeout(this.timeout);
28
+ this.timeout = undefined;
27
29
  const response = JSON.parse(data.toString());
28
30
  if (response.data.error) {
29
31
  logger_1.logger.error(response.data.error);
@@ -73,10 +75,14 @@ class UiControllerClient {
73
75
  sendAndReceive(msg, requestTimeout = UiControllerClient.REQUEST_TIMEOUT_IN_MS) {
74
76
  this.checkConnection();
75
77
  return new Promise((resolve, reject) => {
78
+ logger_1.logger.debug(`sendAndReceive - ${JSON.stringify(msg)}`);
76
79
  this.currentResolve = resolve;
77
80
  this.currentReject = reject;
78
81
  try {
79
82
  this.send(msg, requestTimeout);
83
+ if (this.timeout) {
84
+ throw new ui_controller_client_error_1.UiControllerClientError(`Clear the current request before setting a new one. Check for missing await. Error: ${JSON.stringify(msg)}`);
85
+ }
80
86
  this.timeout = setTimeout(() => this.currentReject(new ui_controller_client_error_1.UiControllerClientError('Request to UI Controller timed out. It seems that the UI Controller is not running. Please, make sure that it is running when executing tests.')), UiControllerClient.REQUEST_TIMEOUT_IN_MS);
81
87
  }
82
88
  catch (error) {
@@ -17,7 +17,9 @@ export class UiControllerClient {
17
17
  this.currentResolve = UiControllerClient.EMPTY_RESOLVE;
18
18
  }
19
19
  onMessage(data) {
20
+ logger.debug('onMessage');
20
21
  clearTimeout(this.timeout);
22
+ this.timeout = undefined;
21
23
  const response = JSON.parse(data.toString());
22
24
  if (response.data.error) {
23
25
  logger.error(response.data.error);
@@ -67,10 +69,14 @@ export class UiControllerClient {
67
69
  sendAndReceive(msg, requestTimeout = UiControllerClient.REQUEST_TIMEOUT_IN_MS) {
68
70
  this.checkConnection();
69
71
  return new Promise((resolve, reject) => {
72
+ logger.debug(`sendAndReceive - ${JSON.stringify(msg)}`);
70
73
  this.currentResolve = resolve;
71
74
  this.currentReject = reject;
72
75
  try {
73
76
  this.send(msg, requestTimeout);
77
+ if (this.timeout) {
78
+ throw new UiControllerClientError(`Clear the current request before setting a new one. Check for missing await. Error: ${JSON.stringify(msg)}`);
79
+ }
74
80
  this.timeout = setTimeout(() => this.currentReject(new UiControllerClientError('Request to UI Controller timed out. It seems that the UI Controller is not running. Please, make sure that it is running when executing tests.')), UiControllerClient.REQUEST_TIMEOUT_IN_MS);
75
81
  }
76
82
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askui",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "license": "MIT",
5
5
  "author": "askui GmbH <info@askui.com> (http://www.askui.com/)",
6
6
  "description": "Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on",