@auxcode/auxta 1.3.32-beta.0 → 1.3.33

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
@@ -94,4 +94,12 @@ npm i
94
94
 
95
95
  ##backlog
96
96
  Implement a way to scout the skipped steps w/ $failed=true, $skipped=++
97
- control click go to source directory
97
+ control click go to source directory
98
+
99
+
100
+ ##Improvements
101
+ * introduce the new headless mode, by Puppeteer.
102
+
103
+ ### platform improvements
104
+ Also some improvements to the platform in general:
105
+ * get the console state after a fail, this would increase the value of each failed report.
@@ -14,7 +14,6 @@ declare class AuxTA extends FunctionHelper {
14
14
  organization: string;
15
15
  netlifyPath: string;
16
16
  digitalProduct: string;
17
- bucket: string;
18
17
  token: string;
19
18
  screenWidth: number;
20
19
  screenHeight: number;
@@ -82,7 +82,7 @@ class AuxTA extends code_helper_1.FunctionHelper {
82
82
  catch (e) {
83
83
  console.log("Missing field in auxta.json:", e);
84
84
  }
85
- this.uploadModel = new upload_model_1.UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment, jsonConfig.bucket);
85
+ this.uploadModel = new upload_model_1.UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment);
86
86
  }
87
87
  catch (e) {
88
88
  console.log("Missing or corrupted config: auxta.json. Searching in location:", file);
@@ -91,7 +91,7 @@ class AuxTA extends code_helper_1.FunctionHelper {
91
91
  }
92
92
  }
93
93
  else {
94
- this.uploadModel = new upload_model_1.UploadModel('', '', '', '', '');
94
+ this.uploadModel = new upload_model_1.UploadModel('', '', '', '');
95
95
  }
96
96
  }
97
97
  run(event, overrideConfig) {
@@ -118,8 +118,6 @@ class AuxTA extends code_helper_1.FunctionHelper {
118
118
  this.uploadModel.environment = overrideConfig.environment;
119
119
  if (overrideConfig.baseURL)
120
120
  this.uploadModel.baseUrl = overrideConfig.baseURL;
121
- if (overrideConfig.bucket)
122
- this.uploadModel.bucket = overrideConfig.bucket;
123
121
  this.config = (0, config_1.setupOverrideConfig)(overrideConfig);
124
122
  }
125
123
  }
@@ -5,7 +5,6 @@ export declare function setupConfig(jsonConfig: any): {
5
5
  organization: string;
6
6
  netlifyPath: string;
7
7
  digitalProduct: string;
8
- bucket: string;
9
8
  token: string;
10
9
  screenWidth: number;
11
10
  screenHeight: number;
@@ -24,7 +23,6 @@ export declare function setupOverrideConfig(overrideConfig: any): {
24
23
  organization: string;
25
24
  netlifyPath: string;
26
25
  digitalProduct: string;
27
- bucket: string;
28
26
  token: string;
29
27
  screenWidth: number;
30
28
  screenHeight: number;
@@ -43,7 +41,6 @@ export declare let config: {
43
41
  organization: string;
44
42
  netlifyPath: string;
45
43
  digitalProduct: string;
46
- bucket: string;
47
44
  token: string;
48
45
  screenWidth: number;
49
46
  screenHeight: number;
@@ -8,9 +8,6 @@ function setupConfig(jsonConfig) {
8
8
  if (!jsonConfig.digitalProduct)
9
9
  throw new Error("digitalProduct");
10
10
  exports.config.digitalProduct = jsonConfig.digitalProduct;
11
- if (!jsonConfig.testsURL)
12
- throw new Error("testsURL");
13
- exports.config.bucket = jsonConfig.bucket;
14
11
  if (!jsonConfig.testsURL)
15
12
  throw new Error("testsURL");
16
13
  exports.config.netlifyPath = (process.env.ENVIRONMENT == 'LOCAL') ? 'http://localhost:9999/' : jsonConfig.testsURL;
@@ -49,13 +46,12 @@ function setupOverrideConfig(overrideConfig) {
49
46
  }
50
47
  exports.setupOverrideConfig = setupOverrideConfig;
51
48
  exports.config = {
52
- auxtaURL: "https://acceptance--auxta.netlify.app/.netlify/functions/",
49
+ auxtaURL: "https://auxta.live/.netlify/functions/",
53
50
  baseURL: "",
54
51
  siteURL: "",
55
52
  organization: "",
56
53
  netlifyPath: "",
57
54
  digitalProduct: "",
58
- bucket: "",
59
55
  token: "",
60
56
  screenWidth: 1920,
61
57
  screenHeight: 1080,
@@ -4,18 +4,15 @@ export declare class UploadModel {
4
4
  private _digitalProduct;
5
5
  private _baseUrl;
6
6
  private readonly _organization;
7
- private _bucket;
8
7
  private _environment;
9
8
  private _currentSuite;
10
9
  private _retries;
11
10
  private _featureName;
12
11
  private _scenarioName;
13
- constructor(org: string, baseUrl: string, digitalProduct: string, environment: string, bucket: string);
12
+ constructor(org: string, baseUrl: string, digitalProduct: string, environment: string);
14
13
  set currentSuite(value: string);
15
14
  set retries(value: number);
16
15
  get currentSuite(): string;
17
- get bucket(): string;
18
- set bucket(value: string);
19
16
  get retries(): number;
20
17
  get reportId(): string;
21
18
  set reportId(value: string);
@@ -2,13 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UploadModel = void 0;
4
4
  class UploadModel {
5
- constructor(org, baseUrl, digitalProduct, environment, bucket) {
5
+ constructor(org, baseUrl, digitalProduct, environment) {
6
6
  this._reportId = '';
7
7
  this._nextSuites = [];
8
8
  this._currentSuite = '';
9
9
  this._retries = 0;
10
10
  this._organization = org;
11
- this._bucket = bucket;
12
11
  this._digitalProduct = digitalProduct;
13
12
  this._environment = environment;
14
13
  this._baseUrl = baseUrl;
@@ -24,12 +23,6 @@ class UploadModel {
24
23
  get currentSuite() {
25
24
  return this._currentSuite;
26
25
  }
27
- get bucket() {
28
- return this._bucket;
29
- }
30
- set bucket(value) {
31
- this._bucket = value;
32
- }
33
26
  get retries() {
34
27
  return this._retries;
35
28
  }
@@ -43,8 +43,7 @@ function createEmptyReport(body) {
43
43
  const token = yield auth();
44
44
  return (yield axios_1.default.post(config_1.config.auxtaURL + "create-empty-report", {
45
45
  environment: body.environment,
46
- digitalProductToken: body.digitalProduct,
47
- bucket: body.bucket,
46
+ digitalProductName: body.digitalProduct,
48
47
  start: new Date(),
49
48
  url: body.baseUrl
50
49
  }, headers(token))).data.reportId;
@@ -142,7 +141,7 @@ function postNotifications(body) {
142
141
  let token = yield auth();
143
142
  yield axios_1.default.post(`${config_1.config.auxtaURL}post-notification-after-run-background`, {
144
143
  environmentName: body.environment,
145
- digitalProductToken: body.digitalProduct,
144
+ digitalProductName: body.digitalProduct,
146
145
  organizationName: body.organization,
147
146
  reportId: body.reportId,
148
147
  }, headers(token));
@@ -154,7 +153,7 @@ function postNotificationsOnFail(body) {
154
153
  let token = yield auth();
155
154
  yield axios_1.default.post(`${config_1.config.auxtaURL}post-notifications-after-case-fail-background`, {
156
155
  environmentName: body.environment,
157
- digitalProductToken: body.digitalProduct,
156
+ digitalProductName: body.digitalProduct,
158
157
  organizationName: body.organization,
159
158
  reportId: body.reportId,
160
159
  featureName: body.featureName,
@@ -14,10 +14,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.captureScreenshot = void 0;
16
16
  const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
17
+ const log_service_1 = __importDefault(require("../services/log.service"));
18
+ const status_of_step_1 = __importDefault(require("../enums/status-of.step"));
17
19
  function captureScreenshot() {
18
20
  return __awaiter(this, void 0, void 0, function* () {
19
21
  try {
20
22
  const pages = yield puppeteer_1.default.defaultPage.browser().pages();
23
+ console.log(pages.length);
21
24
  if (!pages.length)
22
25
  return undefined;
23
26
  const lastPage = pages[pages.length - 1] || puppeteer_1.default.defaultPage;
@@ -25,10 +28,16 @@ function captureScreenshot() {
25
28
  fullPage: true,
26
29
  encoding: 'binary'
27
30
  });
31
+ console.log('screenshotBuffer');
32
+ console.log(screenshotBuffer);
28
33
  if (Buffer.isBuffer(screenshotBuffer))
29
34
  return screenshotBuffer;
30
35
  }
31
36
  catch (e) {
37
+ const pages = yield puppeteer_1.default.defaultPage.browser().pages();
38
+ console.log(pages.length);
39
+ console.log(e);
40
+ log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
32
41
  }
33
42
  return undefined;
34
43
  });
@@ -15,23 +15,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.EmailHelper = void 0;
16
16
  const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
17
17
  const AuxGoogleAuth_1 = require("./AuxGoogleAuth");
18
- const base64 = require('js-base64');
19
18
  const AuxTA_1 = require("../../AuxTA");
19
+ const base64 = require('js-base64');
20
20
  const MailComposer = require('nodemailer/lib/mail-composer');
21
21
  class EmailHelper {
22
22
  verifyEmail(from_name, from_email, subject, body, link = false) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
24
  yield AuxGoogleAuth_1.AuxGoogleAuth.setup();
25
- const res = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.list({
26
- userId: "me",
27
- maxResults: 3
28
- });
29
- const messagesIds = res.data.messages;
30
- if (!messagesIds || messagesIds.length === 0) {
31
- throw new Error('No messagesIds found.');
32
- }
33
25
  let timeoutCount = 12000;
34
26
  while (timeoutCount <= 60000) {
27
+ const res = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.list({
28
+ userId: "me",
29
+ maxResults: 3
30
+ });
31
+ const messagesIds = res.data.messages;
32
+ if (!messagesIds || messagesIds.length === 0) {
33
+ throw new Error('No messagesIds found.');
34
+ }
35
35
  for (const messageId of messagesIds) {
36
36
  if (messageId.id) {
37
37
  const gmailResponse = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.get({
@@ -56,7 +56,11 @@ class EmailHelper {
56
56
  });
57
57
  if (link) {
58
58
  const html_link = yield this.getUrl(message_body);
59
- return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: html_link };
59
+ return {
60
+ id: gmailResponse.data.id,
61
+ threadId: gmailResponse.data.threadId,
62
+ link: html_link
63
+ };
60
64
  }
61
65
  return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: '' };
62
66
  }
@@ -14,7 +14,6 @@ declare class AuxTA extends FunctionHelper {
14
14
  organization: string;
15
15
  netlifyPath: string;
16
16
  digitalProduct: string;
17
- bucket: string;
18
17
  token: string;
19
18
  screenWidth: number;
20
19
  screenHeight: number;
@@ -53,7 +53,7 @@ class AuxTA extends FunctionHelper {
53
53
  catch (e) {
54
54
  console.log("Missing field in auxta.json:", e);
55
55
  }
56
- this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment, jsonConfig.bucket);
56
+ this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment);
57
57
  }
58
58
  catch (e) {
59
59
  console.log("Missing or corrupted config: auxta.json. Searching in location:", file);
@@ -62,7 +62,7 @@ class AuxTA extends FunctionHelper {
62
62
  }
63
63
  }
64
64
  else {
65
- this.uploadModel = new UploadModel('', '', '', '', '');
65
+ this.uploadModel = new UploadModel('', '', '', '');
66
66
  }
67
67
  }
68
68
  run(event, overrideConfig) {
@@ -89,8 +89,6 @@ class AuxTA extends FunctionHelper {
89
89
  this.uploadModel.environment = overrideConfig.environment;
90
90
  if (overrideConfig.baseURL)
91
91
  this.uploadModel.baseUrl = overrideConfig.baseURL;
92
- if (overrideConfig.bucket)
93
- this.uploadModel.bucket = overrideConfig.bucket;
94
92
  this.config = setupOverrideConfig(overrideConfig);
95
93
  }
96
94
  }
@@ -5,7 +5,6 @@ export declare function setupConfig(jsonConfig: any): {
5
5
  organization: string;
6
6
  netlifyPath: string;
7
7
  digitalProduct: string;
8
- bucket: string;
9
8
  token: string;
10
9
  screenWidth: number;
11
10
  screenHeight: number;
@@ -24,7 +23,6 @@ export declare function setupOverrideConfig(overrideConfig: any): {
24
23
  organization: string;
25
24
  netlifyPath: string;
26
25
  digitalProduct: string;
27
- bucket: string;
28
26
  token: string;
29
27
  screenWidth: number;
30
28
  screenHeight: number;
@@ -43,7 +41,6 @@ export declare let config: {
43
41
  organization: string;
44
42
  netlifyPath: string;
45
43
  digitalProduct: string;
46
- bucket: string;
47
44
  token: string;
48
45
  screenWidth: number;
49
46
  screenHeight: number;
@@ -5,9 +5,6 @@ export function setupConfig(jsonConfig) {
5
5
  if (!jsonConfig.digitalProduct)
6
6
  throw new Error("digitalProduct");
7
7
  config.digitalProduct = jsonConfig.digitalProduct;
8
- if (!jsonConfig.testsURL)
9
- throw new Error("testsURL");
10
- config.bucket = jsonConfig.bucket;
11
8
  if (!jsonConfig.testsURL)
12
9
  throw new Error("testsURL");
13
10
  config.netlifyPath = (process.env.ENVIRONMENT == 'LOCAL') ? 'http://localhost:9999/' : jsonConfig.testsURL;
@@ -44,13 +41,12 @@ export function setupOverrideConfig(overrideConfig) {
44
41
  return config;
45
42
  }
46
43
  export let config = {
47
- auxtaURL: "https://acceptance--auxta.netlify.app/.netlify/functions/",
44
+ auxtaURL: "https://auxta.live/.netlify/functions/",
48
45
  baseURL: "",
49
46
  siteURL: "",
50
47
  organization: "",
51
48
  netlifyPath: "",
52
49
  digitalProduct: "",
53
- bucket: "",
54
50
  token: "",
55
51
  screenWidth: 1920,
56
52
  screenHeight: 1080,
@@ -4,18 +4,15 @@ export declare class UploadModel {
4
4
  private _digitalProduct;
5
5
  private _baseUrl;
6
6
  private readonly _organization;
7
- private _bucket;
8
7
  private _environment;
9
8
  private _currentSuite;
10
9
  private _retries;
11
10
  private _featureName;
12
11
  private _scenarioName;
13
- constructor(org: string, baseUrl: string, digitalProduct: string, environment: string, bucket: string);
12
+ constructor(org: string, baseUrl: string, digitalProduct: string, environment: string);
14
13
  set currentSuite(value: string);
15
14
  set retries(value: number);
16
15
  get currentSuite(): string;
17
- get bucket(): string;
18
- set bucket(value: string);
19
16
  get retries(): number;
20
17
  get reportId(): string;
21
18
  set reportId(value: string);
@@ -1,11 +1,10 @@
1
1
  export class UploadModel {
2
- constructor(org, baseUrl, digitalProduct, environment, bucket) {
2
+ constructor(org, baseUrl, digitalProduct, environment) {
3
3
  this._reportId = '';
4
4
  this._nextSuites = [];
5
5
  this._currentSuite = '';
6
6
  this._retries = 0;
7
7
  this._organization = org;
8
- this._bucket = bucket;
9
8
  this._digitalProduct = digitalProduct;
10
9
  this._environment = environment;
11
10
  this._baseUrl = baseUrl;
@@ -21,12 +20,6 @@ export class UploadModel {
21
20
  get currentSuite() {
22
21
  return this._currentSuite;
23
22
  }
24
- get bucket() {
25
- return this._bucket;
26
- }
27
- set bucket(value) {
28
- this._bucket = value;
29
- }
30
23
  get retries() {
31
24
  return this._retries;
32
25
  }
@@ -37,8 +37,7 @@ export function createEmptyReport(body) {
37
37
  const token = yield auth();
38
38
  return (yield axios.post(config.auxtaURL + "create-empty-report", {
39
39
  environment: body.environment,
40
- digitalProductToken: body.digitalProduct,
41
- bucket: body.bucket,
40
+ digitalProductName: body.digitalProduct,
42
41
  start: new Date(),
43
42
  url: body.baseUrl
44
43
  }, headers(token))).data.reportId;
@@ -130,7 +129,7 @@ export function postNotifications(body) {
130
129
  let token = yield auth();
131
130
  yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
132
131
  environmentName: body.environment,
133
- digitalProductToken: body.digitalProduct,
132
+ digitalProductName: body.digitalProduct,
134
133
  organizationName: body.organization,
135
134
  reportId: body.reportId,
136
135
  }, headers(token));
@@ -141,7 +140,7 @@ export function postNotificationsOnFail(body) {
141
140
  let token = yield auth();
142
141
  yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
143
142
  environmentName: body.environment,
144
- digitalProductToken: body.digitalProduct,
143
+ digitalProductName: body.digitalProduct,
145
144
  organizationName: body.organization,
146
145
  reportId: body.reportId,
147
146
  featureName: body.featureName,
@@ -8,10 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import puppeteer from "../../puppeteer/puppeteer";
11
+ import log from "../services/log.service";
12
+ import StatusOfStep from "../enums/status-of.step";
11
13
  export function captureScreenshot() {
12
14
  return __awaiter(this, void 0, void 0, function* () {
13
15
  try {
14
16
  const pages = yield puppeteer.defaultPage.browser().pages();
17
+ console.log(pages.length);
15
18
  if (!pages.length)
16
19
  return undefined;
17
20
  const lastPage = pages[pages.length - 1] || puppeteer.defaultPage;
@@ -19,10 +22,16 @@ export function captureScreenshot() {
19
22
  fullPage: true,
20
23
  encoding: 'binary'
21
24
  });
25
+ console.log('screenshotBuffer');
26
+ console.log(screenshotBuffer);
22
27
  if (Buffer.isBuffer(screenshotBuffer))
23
28
  return screenshotBuffer;
24
29
  }
25
30
  catch (e) {
31
+ const pages = yield puppeteer.defaultPage.browser().pages();
32
+ console.log(pages.length);
33
+ console.log(e);
34
+ log.push('When', e.toString(), StatusOfStep.FAILED);
26
35
  }
27
36
  return undefined;
28
37
  });
@@ -9,23 +9,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import log from "../../auxta/services/log.service";
11
11
  import { AuxGoogleAuth } from "./AuxGoogleAuth";
12
- const base64 = require('js-base64');
13
12
  import { StepStatus } from "../../AuxTA";
13
+ const base64 = require('js-base64');
14
14
  const MailComposer = require('nodemailer/lib/mail-composer');
15
15
  export class EmailHelper {
16
16
  verifyEmail(from_name, from_email, subject, body, link = false) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  yield AuxGoogleAuth.setup();
19
- const res = yield AuxGoogleAuth.gmailClient.users.messages.list({
20
- userId: "me",
21
- maxResults: 3
22
- });
23
- const messagesIds = res.data.messages;
24
- if (!messagesIds || messagesIds.length === 0) {
25
- throw new Error('No messagesIds found.');
26
- }
27
19
  let timeoutCount = 12000;
28
20
  while (timeoutCount <= 60000) {
21
+ const res = yield AuxGoogleAuth.gmailClient.users.messages.list({
22
+ userId: "me",
23
+ maxResults: 3
24
+ });
25
+ const messagesIds = res.data.messages;
26
+ if (!messagesIds || messagesIds.length === 0) {
27
+ throw new Error('No messagesIds found.');
28
+ }
29
29
  for (const messageId of messagesIds) {
30
30
  if (messageId.id) {
31
31
  const gmailResponse = yield AuxGoogleAuth.gmailClient.users.messages.get({
@@ -50,7 +50,11 @@ export class EmailHelper {
50
50
  });
51
51
  if (link) {
52
52
  const html_link = yield this.getUrl(message_body);
53
- return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: html_link };
53
+ return {
54
+ id: gmailResponse.data.id,
55
+ threadId: gmailResponse.data.threadId,
56
+ link: html_link
57
+ };
54
58
  }
55
59
  return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: '' };
56
60
  }