@auxcode/auxta 1.3.133 → 1.3.134

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.
@@ -61,7 +61,7 @@ class LogSteps {
61
61
  };
62
62
  }
63
63
  push(keyword, tag, name, status, screenshot = new Uint8Array(), imageCompareKey = '') {
64
- console.log(`System log -- status: ${status} -- tag: ${tag} -- : ${name} `);
64
+ console.log(`${new Date().toISOString()} System log -- status: ${status} -- tag: ${tag} -- : ${name} `);
65
65
  this.statusCounter[status]++;
66
66
  const currentStep = new Date().getTime();
67
67
  if (screenshot.byteLength != 0) {
@@ -264,7 +264,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
264
264
  }
265
265
  catch (e) {
266
266
  this.log('Then', `I wait for the password step of the microsoft login`, AuxTA_1.StepStatus.FAILED);
267
- throw new Error(`I wait for the password step of the microsoft login`);
267
+ throw new Error(`I wait for the password step of the microsoft login (${yield (0, extend_default_page_1.describePageFailure)(loginPage, e)})`);
268
268
  }
269
269
  yield this.failOnMicrosoftLoginError(loginPage, login_error);
270
270
  const accountTypeTile = yield loginPage.$(account_type_tile);
@@ -286,7 +286,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
286
286
  }
287
287
  catch (e) {
288
288
  this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.FAILED);
289
- throw new Error(`I type password into the ${password_input}`);
289
+ throw new Error(`I type password into the ${password_input} (${yield (0, extend_default_page_1.describePageFailure)(loginPage, e)})`);
290
290
  }
291
291
  yield loginPage.keyboard.press('Enter');
292
292
  if (staySignIn) {
@@ -306,7 +306,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
306
306
  }
307
307
  catch (e) {
308
308
  this.log('Then', `I wait for the Stay signed in prompt of the microsoft login`, AuxTA_1.StepStatus.FAILED);
309
- throw new Error(`I wait for the Stay signed in prompt of the microsoft login`);
309
+ throw new Error(`I wait for the Stay signed in prompt of the microsoft login (${yield (0, extend_default_page_1.describePageFailure)(loginPage, e)})`);
310
310
  }
311
311
  if (outcome === 'error') {
312
312
  yield this.failOnMicrosoftLoginError(loginPage, login_error);
@@ -1,3 +1,4 @@
1
+ export declare function describePageFailure(page: any, error: any): Promise<string>;
1
2
  export declare class ExtendDefaultPage {
2
3
  defaultTimeout: number;
3
4
  extend_page_functions(page: any, time?: number): Promise<any>;
@@ -13,9 +13,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ExtendDefaultPage = void 0;
16
+ exports.describePageFailure = describePageFailure;
16
17
  const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
17
18
  const status_of_step_1 = require("../../auxta/enums/status-of.step");
18
19
  const config_1 = require("../../auxta/configs/config");
20
+ function describePageFailure(page, error) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ var _a, _b;
23
+ const reason = String((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error).split('\n')[0];
24
+ let url = '';
25
+ let text = '';
26
+ try {
27
+ url = page.url();
28
+ text = yield page.evaluate(() => { var _a, _b; return ((_b = (_a = document.body) === null || _a === void 0 ? void 0 : _a.innerText) !== null && _b !== void 0 ? _b : '').replace(/\s+/g, ' ').trim().slice(0, 300); });
29
+ }
30
+ catch (e) {
31
+ text = `(page text unavailable: ${String((_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : e).split('\n')[0]})`;
32
+ }
33
+ const details = `reason: ${reason} | url: ${url} | page text: ${text}`;
34
+ console.log(`${new Date().toISOString()} Failure details -- ${details}`);
35
+ return details;
36
+ });
37
+ }
19
38
  class ExtendDefaultPage {
20
39
  constructor() {
21
40
  this.defaultTimeout = config_1.config.timeout;
@@ -44,7 +63,7 @@ class ExtendDefaultPage {
44
63
  catch (e) {
45
64
  const msg = `I click on the '${selector}'`;
46
65
  log_service_1.default.push('Then', log_service_1.default.tag, msg, status_of_step_1.StatusOfStep.FAILED);
47
- throw new Error(msg);
66
+ throw new Error(`${msg} (${yield describePageFailure(page, e)})`);
48
67
  }
49
68
  });
50
69
  };
@@ -59,7 +78,7 @@ class ExtendDefaultPage {
59
78
  }
60
79
  catch (e) {
61
80
  log_service_1.default.push('Then', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.FAILED);
62
- throw new Error(message);
81
+ throw new Error(`${message} (${yield describePageFailure(page, e)})`);
63
82
  }
64
83
  return result;
65
84
  });
@@ -80,7 +99,7 @@ class ExtendDefaultPage {
80
99
  catch (e) {
81
100
  const msg = `I type '${value}' into the '${field}' field`;
82
101
  log_service_1.default.push('Then', log_service_1.default.tag, msg, status_of_step_1.StatusOfStep.FAILED);
83
- throw new Error(msg);
102
+ throw new Error(`${msg} (${yield describePageFailure(page, e)})`);
84
103
  }
85
104
  });
86
105
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.133",
3
+ "version": "1.3.134",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",
@@ -9,8 +9,8 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "tsc": "tsc -p tsconfig.json",
12
- "prepublish": "tsc",
13
- "test": "npm run prepublish & node ./build/AuxTA.js"
12
+ "prepublishOnly": "tsc -p tsconfig.json --incremental false",
13
+ "test": "npm run tsc && node ./build/AuxTA.js"
14
14
  },
15
15
  "author": "auxcode",
16
16
  "license": "ISC",