@auxcode/auxta 1.3.59 → 1.3.61

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.
Files changed (33) hide show
  1. package/build/macros/helpers/emailHelper.d.ts +0 -3
  2. package/build/macros/helpers/emailHelper.js +56 -51
  3. package/package.json +1 -1
  4. package/build/auxta/configs/config.d.ts +0 -57
  5. package/build/auxta/configs/config.js +0 -69
  6. package/build/auxta/enums/status-of.step.d.ts +0 -7
  7. package/build/auxta/enums/status-of.step.js +0 -11
  8. package/build/auxta/helpers/response.helper.d.ts +0 -10
  9. package/build/auxta/helpers/response.helper.js +0 -15
  10. package/build/auxta/helpers/start.helper.d.ts +0 -1
  11. package/build/auxta/helpers/start.helper.js +0 -26
  12. package/build/auxta/hooks/report.hook.d.ts +0 -14
  13. package/build/auxta/hooks/report.hook.js +0 -67
  14. package/build/auxta/models/upload.model.d.ts +0 -35
  15. package/build/auxta/models/upload.model.js +0 -82
  16. package/build/auxta/services/log.service.d.ts +0 -31
  17. package/build/auxta/services/log.service.js +0 -61
  18. package/build/auxta/services/report.service.d.ts +0 -31
  19. package/build/auxta/services/report.service.js +0 -183
  20. package/build/auxta/services/runtime.service.d.ts +0 -16
  21. package/build/auxta/services/runtime.service.js +0 -41
  22. package/build/auxta/utilities/runtime.helper.d.ts +0 -15
  23. package/build/auxta/utilities/runtime.helper.js +0 -19
  24. package/build/auxta/utilities/screenshot.helper.js +0 -59
  25. package/build/auxta/utilities/start-suite.helper.d.ts +0 -17
  26. package/build/auxta/utilities/start-suite.helper.js +0 -31
  27. package/build/macros/helpers/Aux2faAuth.d.ts +0 -7
  28. package/build/macros/helpers/Aux2faAuth.js +0 -29
  29. package/build/macros/helpers/AuxGoogleAuth.js +0 -232
  30. package/build/macros/helpers/code.helper.js +0 -230
  31. package/build/macros/helpers/extend-default-page.d.ts +0 -6
  32. package/build/macros/helpers/extend-default-page.js +0 -89
  33. package/build/puppeteer/puppeteer.js +0 -213
@@ -1,4 +1,3 @@
1
- import { gmail_v1 } from "googleapis";
2
1
  export declare class EmailHelper {
3
2
  verifyEmail(from_name: string, from_email: string, subject: string, body: string, link?: boolean): Promise<{
4
3
  id: string;
@@ -13,7 +12,5 @@ export declare class EmailHelper {
13
12
  private getCurrentUserEmail;
14
13
  private getUrl;
15
14
  }
16
- export interface gmailResponse extends gmail_v1.Gmail {
17
- }
18
15
  declare const _default: EmailHelper;
19
16
  export default _default;
@@ -21,67 +21,72 @@ 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
- yield AuxGoogleAuth_1.AuxGoogleAuth.setupHeadless();
25
- yield new Promise(r => setTimeout(r, 35000));
26
- let timeoutCount = 12000;
27
- while (timeoutCount <= 60000) {
28
- const res = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.list({
29
- userId: "me",
30
- maxResults: 20
31
- });
32
- const messagesIds = res.data.messages;
33
- if (!messagesIds || messagesIds.length === 0) {
34
- throw new Error('No messagesIds found.');
35
- }
36
- const runs = [];
37
- for (const messageId of messagesIds) {
38
- if (messageId.id) {
39
- runs.push(yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.get({
40
- userId: "me",
41
- id: messageId.id.toString(),
42
- format: 'FULL'
43
- }));
24
+ try {
25
+ yield AuxGoogleAuth_1.AuxGoogleAuth.setupHeadless();
26
+ yield new Promise(r => setTimeout(r, 35000));
27
+ let timeoutCount = 12000;
28
+ while (timeoutCount <= 60000) {
29
+ const res = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.list({
30
+ userId: "me",
31
+ maxResults: 20
32
+ });
33
+ const messagesIds = res.data.messages;
34
+ if (!messagesIds || messagesIds.length === 0) {
35
+ throw new Error('No messagesIds found.');
44
36
  }
45
- }
46
- yield Promise.all(runs);
47
- for (const gmailResponse of runs) {
48
- if (gmailResponse) {
49
- if (gmailResponse.data.payload && gmailResponse.data.id && gmailResponse.data.threadId) {
50
- const message_sender = this.getHeader('from', gmailResponse);
51
- const message_subject = this.getHeader('subject', gmailResponse);
52
- const message_body = this.getBody(subject, gmailResponse);
53
- if (message_sender.toLocaleLowerCase().includes(from_email) && message_sender.toLocaleLowerCase().includes(from_name.toLocaleLowerCase()) &&
54
- message_subject.toLocaleLowerCase().includes(subject.toLocaleLowerCase()) && message_body.toLocaleLowerCase().includes(body.toLocaleLowerCase())) {
55
- log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.PASSED);
56
- yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.modify({
57
- userId: "me",
58
- id: gmailResponse.data.id,
59
- requestBody: {
60
- 'addLabelIds': [],
61
- 'removeLabelIds': ['UNREAD']
62
- }
63
- });
64
- if (link) {
65
- const html_link = yield this.getUrl(message_body);
66
- yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.delete({
37
+ const runs = [];
38
+ for (const messageId of messagesIds) {
39
+ if (messageId.id) {
40
+ runs.push(yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.get({
41
+ userId: "me",
42
+ id: messageId.id.toString(),
43
+ format: 'FULL'
44
+ }));
45
+ }
46
+ }
47
+ yield Promise.all(runs);
48
+ for (const gmailResponse of runs) {
49
+ if (gmailResponse) {
50
+ if (gmailResponse.data.payload && gmailResponse.data.id && gmailResponse.data.threadId) {
51
+ const message_sender = this.getHeader('from', gmailResponse);
52
+ const message_subject = this.getHeader('subject', gmailResponse);
53
+ const message_body = this.getBody(subject, gmailResponse);
54
+ if (message_sender.toLocaleLowerCase().includes(from_email) && message_sender.toLocaleLowerCase().includes(from_name.toLocaleLowerCase()) &&
55
+ message_subject.toLocaleLowerCase().includes(subject.toLocaleLowerCase()) && message_body.toLocaleLowerCase().includes(body.toLocaleLowerCase())) {
56
+ log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.PASSED);
57
+ yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.modify({
67
58
  userId: "me",
68
59
  id: gmailResponse.data.id,
60
+ requestBody: {
61
+ 'addLabelIds': [],
62
+ 'removeLabelIds': ['UNREAD']
63
+ }
69
64
  });
70
- return {
71
- id: gmailResponse.data.id,
72
- threadId: gmailResponse.data.threadId,
73
- link: html_link
74
- };
65
+ if (link) {
66
+ const html_link = yield this.getUrl(message_body);
67
+ yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.delete({
68
+ userId: "me",
69
+ id: gmailResponse.data.id,
70
+ });
71
+ return {
72
+ id: gmailResponse.data.id,
73
+ threadId: gmailResponse.data.threadId,
74
+ link: html_link
75
+ };
76
+ }
77
+ return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: '' };
75
78
  }
76
- return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: '' };
77
79
  }
78
80
  }
79
81
  }
82
+ yield new Promise(r => setTimeout(r, timeoutCount));
83
+ timeoutCount += 12000;
80
84
  }
81
- yield new Promise(r => setTimeout(r, timeoutCount));
82
- timeoutCount += 12000;
85
+ yield log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.FAILED);
86
+ }
87
+ catch (e) {
88
+ throw new Error(e);
83
89
  }
84
- yield log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.FAILED);
85
90
  });
86
91
  }
87
92
  sendEmail(to, subject, body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.59",
3
+ "version": "1.3.61",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",
@@ -1,57 +0,0 @@
1
- export declare function setupConfig(jsonConfig: any): {
2
- auxtaURL: string;
3
- baseURL: string;
4
- siteURL: string;
5
- organization: string;
6
- netlifyPath: string;
7
- digitalProduct: string;
8
- bucket: string;
9
- token: string;
10
- screenWidth: number;
11
- screenHeight: number;
12
- timeout: number;
13
- suitesList: never[];
14
- googleEmail: string;
15
- auxtaCredentials: {
16
- email: string;
17
- password: string;
18
- };
19
- };
20
- export declare function setupOverrideConfig(overrideConfig: any): {
21
- auxtaURL: string;
22
- baseURL: string;
23
- siteURL: string;
24
- organization: string;
25
- netlifyPath: string;
26
- digitalProduct: string;
27
- bucket: string;
28
- token: string;
29
- screenWidth: number;
30
- screenHeight: number;
31
- timeout: number;
32
- suitesList: never[];
33
- googleEmail: string;
34
- auxtaCredentials: {
35
- email: string;
36
- password: string;
37
- };
38
- };
39
- export declare let config: {
40
- auxtaURL: string;
41
- baseURL: string;
42
- siteURL: string;
43
- organization: string;
44
- netlifyPath: string;
45
- digitalProduct: string;
46
- bucket: string;
47
- token: string;
48
- screenWidth: number;
49
- screenHeight: number;
50
- timeout: number;
51
- suitesList: never[];
52
- googleEmail: string;
53
- auxtaCredentials: {
54
- email: string;
55
- password: string;
56
- };
57
- };
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.config = exports.setupOverrideConfig = exports.setupConfig = void 0;
4
- function setupConfig(jsonConfig) {
5
- if (!jsonConfig.baseURL)
6
- throw new Error("baseURL");
7
- exports.config.baseURL = jsonConfig.baseURL;
8
- if (!jsonConfig.digitalProduct)
9
- throw new Error("digitalProduct");
10
- exports.config.digitalProduct = jsonConfig.digitalProduct;
11
- if (!jsonConfig.testsURL)
12
- throw new Error("testsURL");
13
- exports.config.bucket = jsonConfig.bucket;
14
- if (!jsonConfig.testsURL)
15
- throw new Error("testsURL");
16
- exports.config.netlifyPath = (process.env.ENVIRONMENT == 'LOCAL') ? 'http://localhost:9999/' : jsonConfig.testsURL;
17
- if (!jsonConfig.organization)
18
- throw new Error("organization");
19
- exports.config.organization = jsonConfig.organization;
20
- if (!jsonConfig.email)
21
- throw new Error("email");
22
- exports.config.auxtaCredentials.email = jsonConfig.email;
23
- if (!process.env.auxta_password)
24
- throw new Error("password");
25
- exports.config.auxtaCredentials.password = process.env.auxta_password;
26
- if (!jsonConfig.suitesList)
27
- throw new Error("suitesList");
28
- exports.config.suitesList = jsonConfig.suitesList;
29
- exports.config.googleEmail = jsonConfig.googleEmail;
30
- if (jsonConfig.timeout)
31
- exports.config.timeout = jsonConfig.timeout;
32
- if (jsonConfig.screenWidth)
33
- exports.config.screenWidth = jsonConfig.screenWidth;
34
- if (jsonConfig.screenHeight)
35
- exports.config.screenHeight = jsonConfig.screenHeight;
36
- return exports.config;
37
- }
38
- exports.setupConfig = setupConfig;
39
- function setupOverrideConfig(overrideConfig) {
40
- if (overrideConfig.baseURL)
41
- exports.config.baseURL = overrideConfig.baseURL;
42
- if (overrideConfig.digitalProduct)
43
- exports.config.digitalProduct = overrideConfig.digitalProduct;
44
- if (overrideConfig.screenWidth)
45
- exports.config.screenWidth = overrideConfig.screenWidth;
46
- if (overrideConfig.screenHeight)
47
- exports.config.screenHeight = overrideConfig.screenHeight;
48
- return exports.config;
49
- }
50
- exports.setupOverrideConfig = setupOverrideConfig;
51
- exports.config = {
52
- auxtaURL: "https://auxta.live/.netlify/functions/",
53
- baseURL: "",
54
- siteURL: "",
55
- organization: "",
56
- netlifyPath: "",
57
- digitalProduct: "",
58
- bucket: "",
59
- token: "",
60
- screenWidth: 1920,
61
- screenHeight: 1080,
62
- timeout: 60000,
63
- suitesList: [],
64
- googleEmail: "",
65
- auxtaCredentials: {
66
- email: "",
67
- password: "",
68
- },
69
- };
@@ -1,7 +0,0 @@
1
- export declare enum StatusOfStep {
2
- PASSED = "passed",
3
- FAILED = "failed",
4
- SKIPPED = "skipped",
5
- SUGGESTION = "suggestion"
6
- }
7
- export default StatusOfStep;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StatusOfStep = void 0;
4
- var StatusOfStep;
5
- (function (StatusOfStep) {
6
- StatusOfStep["PASSED"] = "passed";
7
- StatusOfStep["FAILED"] = "failed";
8
- StatusOfStep["SKIPPED"] = "skipped";
9
- StatusOfStep["SUGGESTION"] = "suggestion";
10
- })(StatusOfStep || (exports.StatusOfStep = StatusOfStep = {}));
11
- exports.default = StatusOfStep;
@@ -1,10 +0,0 @@
1
- /// <reference types="node" />
2
- export declare function returnImage(code: number, screenshot: Buffer): {
3
- isBase64Encoded: boolean;
4
- statusCode: number;
5
- headers: {
6
- "Content-Type": string;
7
- "Content-Length": string;
8
- };
9
- body: string;
10
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.returnImage = void 0;
4
- function returnImage(code, screenshot) {
5
- return {
6
- isBase64Encoded: true,
7
- statusCode: code,
8
- headers: {
9
- "Content-Type": "image/png",
10
- "Content-Length": screenshot.length.toString()
11
- },
12
- body: screenshot.toString("base64")
13
- };
14
- }
15
- exports.returnImage = returnImage;
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const path_1 = require("path");
13
- (() => __awaiter(void 0, void 0, void 0, function* () {
14
- const r = /^--params\.suite=(.*)$/g;
15
- let suite = process.argv.find(el => !!el.match(r));
16
- if (!suite)
17
- throw `Locale is undefined`;
18
- let suites = suite.replace('--params.suite=', '');
19
- let suitesArr = suites.split(',');
20
- if (!suitesArr)
21
- suitesArr = [suites];
22
- for (const suite of suitesArr) {
23
- let f = require((0, path_1.join)(process.cwd(), 'build', 'functions', 'controllers', suite));
24
- yield f.handler();
25
- }
26
- }))();
@@ -1,14 +0,0 @@
1
- /// <reference types="node" />
2
- import { UploadModel } from "../models/upload.model";
3
- export declare function onTestEnd(body: any, featureName: string, scenarioName: string, statusCode: number, screenshotBuffer?: Buffer, errMessage?: object): Promise<{
4
- nextSuites?: undefined;
5
- reportId?: undefined;
6
- currentSuite?: undefined;
7
- retries?: undefined;
8
- } | {
9
- nextSuites: string[];
10
- reportId: string | undefined;
11
- currentSuite: string | undefined;
12
- retries: string;
13
- } | undefined>;
14
- export declare function afterComplete(body: UploadModel): Promise<void>;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.afterComplete = exports.onTestEnd = void 0;
16
- const path_1 = require("path");
17
- const log_service_1 = __importDefault(require("../services/log.service"));
18
- const report_service_1 = require("../services/report.service");
19
- const start_suite_helper_1 = require("../utilities/start-suite.helper");
20
- const status_of_step_1 = require("../enums/status-of.step");
21
- function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- let isFinal = false;
24
- if (process.env.ENVIRONMENT == "LIVE") {
25
- console.log('--- Uploading scenario and feature for AUXTA report ---');
26
- const stepsArr = log_service_1.default.returnScenarioReport();
27
- try {
28
- const stepRes = yield (0, report_service_1.uploadStep)(stepsArr, scenarioName, screenshotBuffer, errMessage);
29
- const scenarioRes = yield (0, report_service_1.uploadScenario)(stepRes, featureName, (0, path_1.basename)(__filename), (statusCode != 200));
30
- const scenario = {
31
- scenarioId: scenarioRes.scenarioRef,
32
- scenarioName: scenarioRes.name,
33
- scenarioUri: scenarioRes.uri,
34
- status: scenarioRes.status,
35
- scenariosCount: scenarioRes.scenariosCount,
36
- lastFiveStepsHash: scenarioRes.lastFiveStepsHash
37
- };
38
- const stepCounts = {
39
- failedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.FAILED),
40
- passedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.PASSED),
41
- skippedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SKIPPED),
42
- suggestedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SUGGESTION)
43
- };
44
- isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
45
- yield (0, report_service_1.updateReport)(body.reportId, scenario, stepCounts, isFinal);
46
- console.log('--- Finished uploading report data to AUXTA ---');
47
- }
48
- catch (error) {
49
- console.log('--- Failed to update report in AUXTA ---');
50
- console.log(error);
51
- }
52
- }
53
- if (isFinal)
54
- yield afterComplete(body);
55
- else if (body && body.nextSuites) {
56
- return yield (0, start_suite_helper_1.startSuite)(body.nextSuites, body.reportId);
57
- }
58
- });
59
- }
60
- exports.onTestEnd = onTestEnd;
61
- function afterComplete(body) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- if (process.env.ENVIRONMENT == "LIVE")
64
- yield (0, report_service_1.postNotifications)(body);
65
- });
66
- }
67
- exports.afterComplete = afterComplete;
@@ -1,35 +0,0 @@
1
- export declare class UploadModel {
2
- private _reportId;
3
- private _nextSuites;
4
- private _digitalProduct;
5
- private _baseUrl;
6
- private readonly _organization;
7
- private _bucket;
8
- private _environment;
9
- private _currentSuite;
10
- private _retries;
11
- private _featureName;
12
- private _scenarioName;
13
- constructor(org: string, baseUrl: string, digitalProduct: string, environment: string, bucket: string);
14
- set currentSuite(value: string);
15
- set retries(value: number);
16
- get currentSuite(): string;
17
- get bucket(): string;
18
- set bucket(value: string);
19
- get retries(): number;
20
- get reportId(): string;
21
- set reportId(value: string);
22
- get nextSuites(): [];
23
- set nextSuites(value: []);
24
- get digitalProduct(): string;
25
- set digitalProduct(value: string);
26
- get organization(): string;
27
- get baseUrl(): string;
28
- set baseUrl(value: string);
29
- get environment(): string;
30
- set environment(value: string);
31
- get featureName(): string;
32
- set featureName(value: string);
33
- get scenarioName(): string;
34
- set scenarioName(value: string);
35
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UploadModel = void 0;
4
- class UploadModel {
5
- constructor(org, baseUrl, digitalProduct, environment, bucket) {
6
- this._reportId = '';
7
- this._nextSuites = [];
8
- this._currentSuite = '';
9
- this._retries = 0;
10
- this._organization = org;
11
- this._bucket = bucket;
12
- this._digitalProduct = digitalProduct;
13
- this._environment = environment;
14
- this._baseUrl = baseUrl;
15
- this._featureName = '';
16
- this._scenarioName = '';
17
- }
18
- set currentSuite(value) {
19
- this._currentSuite = value;
20
- }
21
- set retries(value) {
22
- this._retries = value;
23
- }
24
- get currentSuite() {
25
- return this._currentSuite;
26
- }
27
- get bucket() {
28
- return this._bucket;
29
- }
30
- set bucket(value) {
31
- this._bucket = value;
32
- }
33
- get retries() {
34
- return this._retries;
35
- }
36
- get reportId() {
37
- return this._reportId;
38
- }
39
- set reportId(value) {
40
- this._reportId = value;
41
- }
42
- get nextSuites() {
43
- return this._nextSuites;
44
- }
45
- set nextSuites(value) {
46
- this._nextSuites = value;
47
- }
48
- get digitalProduct() {
49
- return this._digitalProduct;
50
- }
51
- set digitalProduct(value) {
52
- this._digitalProduct = value;
53
- }
54
- get organization() {
55
- return this._organization;
56
- }
57
- get baseUrl() {
58
- return this._baseUrl;
59
- }
60
- set baseUrl(value) {
61
- this._baseUrl = value;
62
- }
63
- get environment() {
64
- return this._environment;
65
- }
66
- set environment(value) {
67
- this._environment = value;
68
- }
69
- get featureName() {
70
- return this._featureName;
71
- }
72
- set featureName(value) {
73
- this._featureName = value;
74
- }
75
- get scenarioName() {
76
- return this._scenarioName;
77
- }
78
- set scenarioName(value) {
79
- this._scenarioName = value;
80
- }
81
- }
82
- exports.UploadModel = UploadModel;
@@ -1,31 +0,0 @@
1
- import { StatusOfStep } from "../enums/status-of.step";
2
- export interface Step {
3
- keyword: string;
4
- name: string;
5
- imageCompareKey: string;
6
- result: {
7
- status: StatusOfStep;
8
- duration: number;
9
- embedding?: {
10
- data: string;
11
- mime_type: string;
12
- };
13
- };
14
- }
15
- export declare class LogSteps {
16
- private stepLog;
17
- private lastStepTime;
18
- statusCounter: {
19
- passed: number;
20
- failed: number;
21
- skipped: number;
22
- suggestion: number;
23
- };
24
- addSuggestion(text: string): void;
25
- clear(): void;
26
- push(keyword: string, name: string, status: StatusOfStep, screenshot?: string, imageCompareKey?: string): void;
27
- returnScenarioReport(): Step[];
28
- getStatusCount(status: StatusOfStep): number;
29
- }
30
- declare const log: LogSteps;
31
- export default log;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogSteps = void 0;
4
- const status_of_step_1 = require("../enums/status-of.step");
5
- class LogSteps {
6
- constructor() {
7
- this.stepLog = [];
8
- this.lastStepTime = new Date().getTime();
9
- this.statusCounter = {
10
- [status_of_step_1.StatusOfStep.PASSED]: 0,
11
- [status_of_step_1.StatusOfStep.FAILED]: 0,
12
- [status_of_step_1.StatusOfStep.SKIPPED]: 0,
13
- [status_of_step_1.StatusOfStep.SUGGESTION]: 0,
14
- };
15
- }
16
- addSuggestion(text) {
17
- this.statusCounter[status_of_step_1.StatusOfStep.SUGGESTION]++;
18
- this.stepLog.push({
19
- keyword: 'Suggestion', name: text, imageCompareKey: '', result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
20
- });
21
- }
22
- clear() {
23
- this.stepLog = [];
24
- this.statusCounter = {
25
- [status_of_step_1.StatusOfStep.PASSED]: 0,
26
- [status_of_step_1.StatusOfStep.FAILED]: 0,
27
- [status_of_step_1.StatusOfStep.SKIPPED]: 0,
28
- [status_of_step_1.StatusOfStep.SUGGESTION]: 0,
29
- };
30
- }
31
- push(keyword, name, status, screenshot = '', imageCompareKey = '') {
32
- console.log(`System log -- status: ${status} -- : ${name} `);
33
- this.statusCounter[status]++;
34
- const currentStep = new Date().getTime();
35
- if (screenshot != '') {
36
- const embedding = {
37
- data: screenshot,
38
- mime_type: "image/png"
39
- };
40
- this.stepLog.push({
41
- keyword,
42
- name,
43
- imageCompareKey,
44
- result: { status, duration: currentStep - this.lastStepTime, embedding: embedding }
45
- });
46
- }
47
- else {
48
- this.stepLog.push({ keyword, name, imageCompareKey, result: { status, duration: currentStep - this.lastStepTime } });
49
- }
50
- this.lastStepTime = currentStep;
51
- }
52
- returnScenarioReport() {
53
- return this.stepLog;
54
- }
55
- getStatusCount(status) {
56
- return this.statusCounter[status];
57
- }
58
- }
59
- exports.LogSteps = LogSteps;
60
- const log = new LogSteps();
61
- exports.default = log;