@auxcode/auxta 1.3.8 → 1.3.9
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 +60 -60
- package/package.json +29 -29
- package/build/cjs/AuxTA.d.ts +0 -42
- package/build/cjs/AuxTA.js +0 -148
- package/build/cjs/auxta/configs/config.d.ts +0 -51
- package/build/cjs/auxta/configs/config.js +0 -66
- package/build/cjs/auxta/enums/status-of.step.d.ts +0 -7
- package/build/cjs/auxta/enums/status-of.step.js +0 -11
- package/build/cjs/auxta/helpers/response.helper.d.ts +0 -10
- package/build/cjs/auxta/helpers/response.helper.js +0 -15
- package/build/cjs/auxta/helpers/start.helper.d.ts +0 -1
- package/build/cjs/auxta/helpers/start.helper.js +0 -26
- package/build/cjs/auxta/hooks/report.hook.d.ts +0 -4
- package/build/cjs/auxta/hooks/report.hook.js +0 -66
- package/build/cjs/auxta/models/upload.model.d.ts +0 -32
- package/build/cjs/auxta/models/upload.model.js +0 -75
- package/build/cjs/auxta/services/log.service.d.ts +0 -26
- package/build/cjs/auxta/services/log.service.js +0 -47
- package/build/cjs/auxta/services/report.service.d.ts +0 -36
- package/build/cjs/auxta/services/report.service.js +0 -164
- package/build/cjs/auxta/services/runtime.service.d.ts +0 -16
- package/build/cjs/auxta/services/runtime.service.js +0 -41
- package/build/cjs/auxta/utilities/runtime.helper.d.ts +0 -15
- package/build/cjs/auxta/utilities/runtime.helper.js +0 -19
- package/build/cjs/auxta/utilities/screenshot.helper.d.ts +0 -2
- package/build/cjs/auxta/utilities/screenshot.helper.js +0 -36
- package/build/cjs/auxta/utilities/start-suite.helper.d.ts +0 -12
- package/build/cjs/auxta/utilities/start-suite.helper.js +0 -31
- package/build/cjs/macros/helpers/Aux2faAuth.d.ts +0 -7
- package/build/cjs/macros/helpers/Aux2faAuth.js +0 -29
- package/build/cjs/macros/helpers/code.helper.d.ts +0 -21
- package/build/cjs/macros/helpers/code.helper.js +0 -188
- package/build/cjs/macros/helpers/extend-default-page.d.ts +0 -6
- package/build/cjs/macros/helpers/extend-default-page.js +0 -88
- package/build/cjs/puppeteer/puppeteer.d.ts +0 -15
- package/build/cjs/puppeteer/puppeteer.js +0 -200
- package/build/esm/AuxTA.d.ts +0 -42
- package/build/esm/AuxTA.js +0 -119
- package/build/esm/auxta/configs/config.d.ts +0 -51
- package/build/esm/auxta/configs/config.js +0 -61
- package/build/esm/auxta/enums/status-of.step.d.ts +0 -7
- package/build/esm/auxta/enums/status-of.step.js +0 -8
- package/build/esm/auxta/helpers/response.helper.d.ts +0 -10
- package/build/esm/auxta/helpers/response.helper.js +0 -11
- package/build/esm/auxta/helpers/start.helper.d.ts +0 -1
- package/build/esm/auxta/helpers/start.helper.js +0 -24
- package/build/esm/auxta/hooks/report.hook.d.ts +0 -4
- package/build/esm/auxta/hooks/report.hook.js +0 -58
- package/build/esm/auxta/models/upload.model.d.ts +0 -32
- package/build/esm/auxta/models/upload.model.js +0 -71
- package/build/esm/auxta/services/log.service.d.ts +0 -26
- package/build/esm/auxta/services/log.service.js +0 -43
- package/build/esm/auxta/services/report.service.d.ts +0 -36
- package/build/esm/auxta/services/report.service.js +0 -150
- package/build/esm/auxta/services/runtime.service.d.ts +0 -16
- package/build/esm/auxta/services/runtime.service.js +0 -37
- package/build/esm/auxta/utilities/runtime.helper.d.ts +0 -15
- package/build/esm/auxta/utilities/runtime.helper.js +0 -15
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +0 -2
- package/build/esm/auxta/utilities/screenshot.helper.js +0 -29
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +0 -12
- package/build/esm/auxta/utilities/start-suite.helper.js +0 -26
- package/build/esm/macros/helpers/Aux2faAuth.d.ts +0 -7
- package/build/esm/macros/helpers/Aux2faAuth.js +0 -25
- package/build/esm/macros/helpers/code.helper.d.ts +0 -21
- package/build/esm/macros/helpers/code.helper.js +0 -181
- package/build/esm/macros/helpers/extend-default-page.d.ts +0 -6
- package/build/esm/macros/helpers/extend-default-page.js +0 -81
- package/build/esm/puppeteer/puppeteer.d.ts +0 -15
- package/build/esm/puppeteer/puppeteer.js +0 -192
- package/build/tsconfig-cjs.tsbuildinfo +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -1,51 +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
|
-
token: string;
|
|
9
|
-
screenWidth: number;
|
|
10
|
-
screenHeight: number;
|
|
11
|
-
timeout: number;
|
|
12
|
-
suitesList: never[];
|
|
13
|
-
auxtaCredentials: {
|
|
14
|
-
email: string;
|
|
15
|
-
password: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare function setupOverrideConfig(overrideConfig: any): {
|
|
19
|
-
auxtaURL: string;
|
|
20
|
-
baseURL: string;
|
|
21
|
-
siteURL: string;
|
|
22
|
-
organization: string;
|
|
23
|
-
netlifyPath: string;
|
|
24
|
-
digitalProduct: string;
|
|
25
|
-
token: string;
|
|
26
|
-
screenWidth: number;
|
|
27
|
-
screenHeight: number;
|
|
28
|
-
timeout: number;
|
|
29
|
-
suitesList: never[];
|
|
30
|
-
auxtaCredentials: {
|
|
31
|
-
email: string;
|
|
32
|
-
password: string;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export declare let config: {
|
|
36
|
-
auxtaURL: string;
|
|
37
|
-
baseURL: string;
|
|
38
|
-
siteURL: string;
|
|
39
|
-
organization: string;
|
|
40
|
-
netlifyPath: string;
|
|
41
|
-
digitalProduct: string;
|
|
42
|
-
token: string;
|
|
43
|
-
screenWidth: number;
|
|
44
|
-
screenHeight: number;
|
|
45
|
-
timeout: number;
|
|
46
|
-
suitesList: never[];
|
|
47
|
-
auxtaCredentials: {
|
|
48
|
-
email: string;
|
|
49
|
-
password: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export function setupConfig(jsonConfig) {
|
|
2
|
-
if (!jsonConfig.baseURL)
|
|
3
|
-
throw new Error("baseURL");
|
|
4
|
-
config.baseURL = jsonConfig.baseURL;
|
|
5
|
-
if (!jsonConfig.digitalProduct)
|
|
6
|
-
throw new Error("digitalProduct");
|
|
7
|
-
config.digitalProduct = jsonConfig.digitalProduct;
|
|
8
|
-
if (!jsonConfig.testsURL)
|
|
9
|
-
throw new Error("testsURL");
|
|
10
|
-
config.netlifyPath = (process.env.ENVIRONMENT == 'LOCAL') ? 'http://localhost:9999/' : jsonConfig.testsURL;
|
|
11
|
-
if (!jsonConfig.organization)
|
|
12
|
-
throw new Error("organization");
|
|
13
|
-
config.organization = jsonConfig.organization;
|
|
14
|
-
if (!process.env.token)
|
|
15
|
-
throw new Error("token");
|
|
16
|
-
config.token = process.env.token;
|
|
17
|
-
if (!jsonConfig.email)
|
|
18
|
-
throw new Error("email");
|
|
19
|
-
config.auxtaCredentials.email = jsonConfig.email;
|
|
20
|
-
if (!process.env.auxta_password)
|
|
21
|
-
throw new Error("password");
|
|
22
|
-
config.auxtaCredentials.password = process.env.auxta_password;
|
|
23
|
-
if (!jsonConfig.suitesList)
|
|
24
|
-
throw new Error("suitesList");
|
|
25
|
-
config.suitesList = jsonConfig.suitesList;
|
|
26
|
-
if (jsonConfig.timeout)
|
|
27
|
-
config.timeout = jsonConfig.timeout;
|
|
28
|
-
if (jsonConfig.screenWidth)
|
|
29
|
-
config.screenWidth = jsonConfig.screenWidth;
|
|
30
|
-
if (jsonConfig.screenHeight)
|
|
31
|
-
config.screenHeight = jsonConfig.screenHeight;
|
|
32
|
-
return config;
|
|
33
|
-
}
|
|
34
|
-
export function setupOverrideConfig(overrideConfig) {
|
|
35
|
-
if (overrideConfig.baseURL)
|
|
36
|
-
config.baseURL = overrideConfig.baseURL;
|
|
37
|
-
if (overrideConfig.digitalProduct)
|
|
38
|
-
config.digitalProduct = overrideConfig.digitalProduct;
|
|
39
|
-
if (overrideConfig.screenWidth)
|
|
40
|
-
config.screenWidth = overrideConfig.screenWidth;
|
|
41
|
-
if (overrideConfig.screenHeight)
|
|
42
|
-
config.screenHeight = overrideConfig.screenHeight;
|
|
43
|
-
return config;
|
|
44
|
-
}
|
|
45
|
-
export let config = {
|
|
46
|
-
auxtaURL: "https://auxta.live/.netlify/functions/",
|
|
47
|
-
baseURL: "",
|
|
48
|
-
siteURL: "",
|
|
49
|
-
organization: "",
|
|
50
|
-
netlifyPath: "",
|
|
51
|
-
digitalProduct: "",
|
|
52
|
-
token: "",
|
|
53
|
-
screenWidth: 1920,
|
|
54
|
-
screenHeight: 1080,
|
|
55
|
-
timeout: 10000,
|
|
56
|
-
suitesList: [],
|
|
57
|
-
auxtaCredentials: {
|
|
58
|
-
email: "",
|
|
59
|
-
password: "",
|
|
60
|
-
},
|
|
61
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var StatusOfStep;
|
|
2
|
-
(function (StatusOfStep) {
|
|
3
|
-
StatusOfStep["PASSED"] = "passed";
|
|
4
|
-
StatusOfStep["FAILED"] = "failed";
|
|
5
|
-
StatusOfStep["SKIPPED"] = "skipped";
|
|
6
|
-
StatusOfStep["SUGGESTION"] = "suggestion";
|
|
7
|
-
})(StatusOfStep || (StatusOfStep = {}));
|
|
8
|
-
export default StatusOfStep;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { join } from 'path';
|
|
11
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
-
const r = /^--params\.suite=(.*)$/g;
|
|
13
|
-
let suite = process.argv.find(el => !!el.match(r));
|
|
14
|
-
if (!suite)
|
|
15
|
-
throw `Locale is undefined`;
|
|
16
|
-
let suites = suite.replace('--params.suite=', '');
|
|
17
|
-
let suitesArr = suites.split(',');
|
|
18
|
-
if (!suitesArr)
|
|
19
|
-
suitesArr = [suites];
|
|
20
|
-
for (const suite of suitesArr) {
|
|
21
|
-
let f = require(join(process.cwd(), 'build', 'functions', 'controllers', suite));
|
|
22
|
-
yield f.handler();
|
|
23
|
-
}
|
|
24
|
-
}))();
|
|
@@ -1,4 +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<void>;
|
|
4
|
-
export declare function afterComplete(body: UploadModel): Promise<void>;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { basename } from 'path';
|
|
11
|
-
import log from "../services/log.service";
|
|
12
|
-
import { postNotifications, updateReport, uploadFeature, uploadScenario } from '../services/report.service';
|
|
13
|
-
import { startSuite } from '../utilities/start-suite.helper';
|
|
14
|
-
import { StatusOfStep } from "../enums/status-of.step";
|
|
15
|
-
export function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
let isFinal = false;
|
|
18
|
-
if (process.env.ENVIRONMENT == "LIVE") {
|
|
19
|
-
console.log('asc ' + errMessage);
|
|
20
|
-
console.log('--- Uploading scenario and feature for AUXTA report ---');
|
|
21
|
-
const stepsArr = log.returnScenarioReport();
|
|
22
|
-
try {
|
|
23
|
-
const scenarioRes = yield uploadScenario(stepsArr, scenarioName, screenshotBuffer, errMessage);
|
|
24
|
-
const featureRes = yield uploadFeature(scenarioRes, featureName, basename(__filename), (statusCode != 200));
|
|
25
|
-
const feature = {
|
|
26
|
-
featureId: featureRes.featureRef,
|
|
27
|
-
featureName: featureRes.name,
|
|
28
|
-
featureUri: featureRes.uri,
|
|
29
|
-
status: featureRes.status,
|
|
30
|
-
scenariosCount: featureRes.scenariosCount
|
|
31
|
-
};
|
|
32
|
-
const stepCounts = {
|
|
33
|
-
failedSteps: log.getStatusCount(StatusOfStep.FAILED),
|
|
34
|
-
passedSteps: log.getStatusCount(StatusOfStep.PASSED),
|
|
35
|
-
skippedSteps: log.getStatusCount(StatusOfStep.SKIPPED),
|
|
36
|
-
suggestedSteps: log.getStatusCount(StatusOfStep.SUGGESTION)
|
|
37
|
-
};
|
|
38
|
-
isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
|
|
39
|
-
yield updateReport(body.reportId, feature, stepCounts, isFinal);
|
|
40
|
-
console.log('--- Finished uploading report data to AUXTA ---');
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
console.log('--- Failed to update report in AUXTA ---');
|
|
44
|
-
console.log(error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (isFinal)
|
|
48
|
-
yield afterComplete(body);
|
|
49
|
-
else if (body && body.nextSuites)
|
|
50
|
-
yield startSuite(body.nextSuites, body.reportId);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
export function afterComplete(body) {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
if (process.env.ENVIRONMENT == "LIVE")
|
|
56
|
-
yield postNotifications(body);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
@@ -1,32 +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 _environment;
|
|
8
|
-
private _currentSuite;
|
|
9
|
-
private _retries;
|
|
10
|
-
private _featureName;
|
|
11
|
-
private _scenarioName;
|
|
12
|
-
constructor(org: string, baseUrl: string, digitalProduct: string, environment: string);
|
|
13
|
-
set currentSuite(value: string);
|
|
14
|
-
set retries(value: number);
|
|
15
|
-
get currentSuite(): string;
|
|
16
|
-
get retries(): number;
|
|
17
|
-
get reportId(): string;
|
|
18
|
-
set reportId(value: string);
|
|
19
|
-
get nextSuites(): [];
|
|
20
|
-
set nextSuites(value: []);
|
|
21
|
-
get digitalProduct(): string;
|
|
22
|
-
set digitalProduct(value: string);
|
|
23
|
-
get organization(): string;
|
|
24
|
-
get baseUrl(): string;
|
|
25
|
-
set baseUrl(value: string);
|
|
26
|
-
get environment(): string;
|
|
27
|
-
set environment(value: string);
|
|
28
|
-
get featureName(): string;
|
|
29
|
-
set featureName(value: string);
|
|
30
|
-
get scenarioName(): string;
|
|
31
|
-
set scenarioName(value: string);
|
|
32
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export class UploadModel {
|
|
2
|
-
constructor(org, baseUrl, digitalProduct, environment) {
|
|
3
|
-
this._reportId = '';
|
|
4
|
-
this._nextSuites = [];
|
|
5
|
-
this._currentSuite = '';
|
|
6
|
-
this._retries = 0;
|
|
7
|
-
this._organization = org;
|
|
8
|
-
this._digitalProduct = digitalProduct;
|
|
9
|
-
this._environment = environment;
|
|
10
|
-
this._baseUrl = baseUrl;
|
|
11
|
-
this._featureName = '';
|
|
12
|
-
this._scenarioName = '';
|
|
13
|
-
}
|
|
14
|
-
set currentSuite(value) {
|
|
15
|
-
this._currentSuite = value;
|
|
16
|
-
}
|
|
17
|
-
set retries(value) {
|
|
18
|
-
this._retries = value;
|
|
19
|
-
}
|
|
20
|
-
get currentSuite() {
|
|
21
|
-
return this._currentSuite;
|
|
22
|
-
}
|
|
23
|
-
get retries() {
|
|
24
|
-
return this._retries;
|
|
25
|
-
}
|
|
26
|
-
get reportId() {
|
|
27
|
-
return this._reportId;
|
|
28
|
-
}
|
|
29
|
-
set reportId(value) {
|
|
30
|
-
this._reportId = value;
|
|
31
|
-
}
|
|
32
|
-
get nextSuites() {
|
|
33
|
-
return this._nextSuites;
|
|
34
|
-
}
|
|
35
|
-
set nextSuites(value) {
|
|
36
|
-
this._nextSuites = value;
|
|
37
|
-
}
|
|
38
|
-
get digitalProduct() {
|
|
39
|
-
return this._digitalProduct;
|
|
40
|
-
}
|
|
41
|
-
set digitalProduct(value) {
|
|
42
|
-
this._digitalProduct = value;
|
|
43
|
-
}
|
|
44
|
-
get organization() {
|
|
45
|
-
return this._organization;
|
|
46
|
-
}
|
|
47
|
-
get baseUrl() {
|
|
48
|
-
return this._baseUrl;
|
|
49
|
-
}
|
|
50
|
-
set baseUrl(value) {
|
|
51
|
-
this._baseUrl = value;
|
|
52
|
-
}
|
|
53
|
-
get environment() {
|
|
54
|
-
return this._environment;
|
|
55
|
-
}
|
|
56
|
-
set environment(value) {
|
|
57
|
-
this._environment = value;
|
|
58
|
-
}
|
|
59
|
-
get featureName() {
|
|
60
|
-
return this._featureName;
|
|
61
|
-
}
|
|
62
|
-
set featureName(value) {
|
|
63
|
-
this._featureName = value;
|
|
64
|
-
}
|
|
65
|
-
get scenarioName() {
|
|
66
|
-
return this._scenarioName;
|
|
67
|
-
}
|
|
68
|
-
set scenarioName(value) {
|
|
69
|
-
this._scenarioName = value;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { StatusOfStep } from "../enums/status-of.step";
|
|
2
|
-
export interface Step {
|
|
3
|
-
keyword: string;
|
|
4
|
-
name: string;
|
|
5
|
-
result: {
|
|
6
|
-
status: StatusOfStep;
|
|
7
|
-
duration: number;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export declare class LogSteps {
|
|
11
|
-
private stepLog;
|
|
12
|
-
private lastStepTime;
|
|
13
|
-
statusCounter: {
|
|
14
|
-
passed: number;
|
|
15
|
-
failed: number;
|
|
16
|
-
skipped: number;
|
|
17
|
-
suggestion: number;
|
|
18
|
-
};
|
|
19
|
-
addSuggestion(text: string): void;
|
|
20
|
-
clear(): void;
|
|
21
|
-
push(keyword: string, name: string, status: StatusOfStep): void;
|
|
22
|
-
returnScenarioReport(): Step[];
|
|
23
|
-
getStatusCount(status: StatusOfStep): number;
|
|
24
|
-
}
|
|
25
|
-
declare const log: LogSteps;
|
|
26
|
-
export default log;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { StatusOfStep } from "../enums/status-of.step";
|
|
2
|
-
export class LogSteps {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.stepLog = [];
|
|
5
|
-
this.lastStepTime = new Date().getTime();
|
|
6
|
-
this.statusCounter = {
|
|
7
|
-
[StatusOfStep.PASSED]: 0,
|
|
8
|
-
[StatusOfStep.FAILED]: 0,
|
|
9
|
-
[StatusOfStep.SKIPPED]: 0,
|
|
10
|
-
[StatusOfStep.SUGGESTION]: 0,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
addSuggestion(text) {
|
|
14
|
-
this.statusCounter[StatusOfStep.SUGGESTION]++;
|
|
15
|
-
this.stepLog.push({
|
|
16
|
-
keyword: 'Suggestion', name: text, result: { status: StatusOfStep.SUGGESTION, duration: 0 }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
clear() {
|
|
20
|
-
this.stepLog = [];
|
|
21
|
-
this.statusCounter = {
|
|
22
|
-
[StatusOfStep.PASSED]: 0,
|
|
23
|
-
[StatusOfStep.FAILED]: 0,
|
|
24
|
-
[StatusOfStep.SKIPPED]: 0,
|
|
25
|
-
[StatusOfStep.SUGGESTION]: 0,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
push(keyword, name, status) {
|
|
29
|
-
console.log(`System log -- status: ${status} -- : ${name} `);
|
|
30
|
-
this.statusCounter[status]++;
|
|
31
|
-
const currentStep = new Date().getTime();
|
|
32
|
-
this.stepLog.push({ keyword, name, result: { status, duration: currentStep - this.lastStepTime } });
|
|
33
|
-
this.lastStepTime = currentStep;
|
|
34
|
-
}
|
|
35
|
-
returnScenarioReport() {
|
|
36
|
-
return this.stepLog;
|
|
37
|
-
}
|
|
38
|
-
getStatusCount(status) {
|
|
39
|
-
return this.statusCounter[status];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const log = new LogSteps();
|
|
43
|
-
export default log;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Step } from "./log.service";
|
|
3
|
-
import { UploadModel } from "../models/upload.model";
|
|
4
|
-
export interface Feature {
|
|
5
|
-
featureId: string;
|
|
6
|
-
featureName: string;
|
|
7
|
-
featureUri: string;
|
|
8
|
-
status: string;
|
|
9
|
-
scenariosCount: number;
|
|
10
|
-
}
|
|
11
|
-
export interface Scenario {
|
|
12
|
-
featureId: string;
|
|
13
|
-
featureName: string;
|
|
14
|
-
featureUri: string;
|
|
15
|
-
status: string;
|
|
16
|
-
scenariosCount: number;
|
|
17
|
-
}
|
|
18
|
-
export interface Steps {
|
|
19
|
-
failedSteps: number;
|
|
20
|
-
passedSteps: number;
|
|
21
|
-
skippedSteps: number;
|
|
22
|
-
suggestedSteps: number;
|
|
23
|
-
}
|
|
24
|
-
export declare function createEmptyReport(body: any): Promise<string>;
|
|
25
|
-
export declare function uploadScenario(stepLog: Step[], scenarioName: string, screenshot?: Buffer, errMessage?: object): Promise<{
|
|
26
|
-
scenarioRef: any;
|
|
27
|
-
name: any;
|
|
28
|
-
status: any;
|
|
29
|
-
stepsCount: any;
|
|
30
|
-
}[]>;
|
|
31
|
-
export declare function uploadFeature(scenarioId: any[], scenarioName: string, uri: string, hasFailed: boolean): Promise<any>;
|
|
32
|
-
export declare function updateReport(reportId: string, feature: Feature, steps: Steps, isFinal: boolean): Promise<void>;
|
|
33
|
-
export declare function getReport(reportId: string): Promise<any>;
|
|
34
|
-
export declare function getLastDayResults(): Promise<any>;
|
|
35
|
-
export declare function postNotifications(body: UploadModel): Promise<void>;
|
|
36
|
-
export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import axios from "axios";
|
|
11
|
-
import { config } from "../configs/config";
|
|
12
|
-
function headers(token) {
|
|
13
|
-
return {
|
|
14
|
-
headers: {
|
|
15
|
-
'Content-Type': 'application/json',
|
|
16
|
-
'cookie': `authToken=${token}`
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function auth() {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return axios.post(config.auxtaURL + 'login', config.auxtaCredentials, {
|
|
23
|
-
headers: {
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
.then(({ data }) => {
|
|
28
|
-
return data.token;
|
|
29
|
-
})
|
|
30
|
-
.catch(() => {
|
|
31
|
-
throw new Error("Invalid login credentials");
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function createEmptyReport(body) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const token = yield auth();
|
|
38
|
-
return (yield axios.post(config.auxtaURL + "create-empty-report", {
|
|
39
|
-
environment: body.environment,
|
|
40
|
-
digitalProductName: body.digitalProduct,
|
|
41
|
-
start: new Date(),
|
|
42
|
-
url: body.baseUrl
|
|
43
|
-
}, headers(token))).data.reportId;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
export function uploadScenario(stepLog, scenarioName, screenshot, errMessage) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
let scenarios = [];
|
|
49
|
-
let token = yield auth();
|
|
50
|
-
let lastStep = stepLog[stepLog.length - 1];
|
|
51
|
-
const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
|
|
52
|
-
stepLogFormat.pop();
|
|
53
|
-
let output = (yield axios.post(config.auxtaURL + "create-scenario", {
|
|
54
|
-
json: {
|
|
55
|
-
name: scenarioName,
|
|
56
|
-
steps: [
|
|
57
|
-
...stepLogFormat,
|
|
58
|
-
(lastStep.result.status == 'failed')
|
|
59
|
-
? Object.assign(lastStep, {
|
|
60
|
-
result: Object.assign(Object.assign({}, lastStep.result), { error_message: JSON.stringify(errMessage) })
|
|
61
|
-
})
|
|
62
|
-
: lastStep,
|
|
63
|
-
{
|
|
64
|
-
keyword: "After",
|
|
65
|
-
result: {
|
|
66
|
-
status: "passed",
|
|
67
|
-
duration: 2678000000
|
|
68
|
-
},
|
|
69
|
-
embeddings: (screenshot) ? [{
|
|
70
|
-
data: screenshot.toString("base64"),
|
|
71
|
-
mime_type: "image/png"
|
|
72
|
-
}] : undefined,
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
}
|
|
76
|
-
}, headers(token))).data.scenarios;
|
|
77
|
-
scenarios.push({
|
|
78
|
-
scenarioRef: output.scenarioRef,
|
|
79
|
-
name: output.name,
|
|
80
|
-
status: output.status,
|
|
81
|
-
stepsCount: output.stepsCount
|
|
82
|
-
});
|
|
83
|
-
return scenarios;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
export function uploadFeature(scenarioId, scenarioName, uri, hasFailed) {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
let token = yield auth();
|
|
89
|
-
return (yield axios.post(config.auxtaURL + "create-feature", {
|
|
90
|
-
json: {
|
|
91
|
-
name: scenarioName,
|
|
92
|
-
uri: uri
|
|
93
|
-
},
|
|
94
|
-
scenarios: scenarioId,
|
|
95
|
-
hasFailed: hasFailed
|
|
96
|
-
}, headers(token))).data;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
export function updateReport(reportId, feature, steps, isFinal) {
|
|
100
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
let token = yield auth();
|
|
102
|
-
yield axios.post(config.auxtaURL + "update-inprogress-report", {
|
|
103
|
-
reportId: reportId,
|
|
104
|
-
isFinal: isFinal,
|
|
105
|
-
data: Object.assign({ feature: {
|
|
106
|
-
featureRef: feature.featureId,
|
|
107
|
-
name: feature.featureName,
|
|
108
|
-
uri: feature.featureUri,
|
|
109
|
-
status: feature.status,
|
|
110
|
-
scenariosCount: feature.scenariosCount
|
|
111
|
-
} }, steps)
|
|
112
|
-
}, headers(token));
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
export function getReport(reportId) {
|
|
116
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
let token = yield auth();
|
|
118
|
-
return (yield axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
export function getLastDayResults() {
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
let token = yield auth();
|
|
124
|
-
return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
export function postNotifications(body) {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
let token = yield auth();
|
|
130
|
-
yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
|
|
131
|
-
environmentName: body.environment,
|
|
132
|
-
digitalProductName: body.digitalProduct,
|
|
133
|
-
organizationName: body.organization,
|
|
134
|
-
reportId: body.reportId,
|
|
135
|
-
}, headers(token));
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
export function postNotificationsOnFail(body) {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
let token = yield auth();
|
|
141
|
-
yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
|
|
142
|
-
environmentName: body.environment,
|
|
143
|
-
digitalProductName: body.digitalProduct,
|
|
144
|
-
organizationName: body.organization,
|
|
145
|
-
reportId: body.reportId,
|
|
146
|
-
featureName: body.featureName,
|
|
147
|
-
scenarioName: body.scenarioName
|
|
148
|
-
}, headers(token));
|
|
149
|
-
});
|
|
150
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface RunTime {
|
|
2
|
-
duration: String;
|
|
3
|
-
startTime: Date;
|
|
4
|
-
endTime: Date;
|
|
5
|
-
}
|
|
6
|
-
export declare class Runtime {
|
|
7
|
-
private start;
|
|
8
|
-
private end;
|
|
9
|
-
private runtime;
|
|
10
|
-
constructor(s: Date, e: Date);
|
|
11
|
-
private calculateDuration;
|
|
12
|
-
private splitAtDecimanlMinutes;
|
|
13
|
-
private splitAtDecimanlHours;
|
|
14
|
-
private formatRuntime;
|
|
15
|
-
returnRuntime(): RunTime;
|
|
16
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export class Runtime {
|
|
2
|
-
constructor(s, e) {
|
|
3
|
-
this.start = s;
|
|
4
|
-
this.end = e;
|
|
5
|
-
}
|
|
6
|
-
calculateDuration() {
|
|
7
|
-
let currentTime = new Date;
|
|
8
|
-
let duration = currentTime.getTime() - this.start.getTime();
|
|
9
|
-
return duration;
|
|
10
|
-
}
|
|
11
|
-
splitAtDecimanlMinutes(time) {
|
|
12
|
-
let minutes = time.toFixed(2).toString().split('.');
|
|
13
|
-
return `${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
|
|
14
|
-
}
|
|
15
|
-
splitAtDecimanlHours(time) {
|
|
16
|
-
let hours = time.toFixed(2).toString().split('.');
|
|
17
|
-
let minutes = (Number(hours[1]) / 100 * 60).toFixed(2).toString().split('.');
|
|
18
|
-
return `${hours[0]}h ${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
|
|
19
|
-
}
|
|
20
|
-
formatRuntime(duration) {
|
|
21
|
-
if (duration / 1000 < 60)
|
|
22
|
-
return `${(duration / 1000).toFixed(0)}s`;
|
|
23
|
-
else {
|
|
24
|
-
if (duration / 60000 < 60)
|
|
25
|
-
return this.splitAtDecimanlMinutes(duration / 60000);
|
|
26
|
-
else
|
|
27
|
-
return this.splitAtDecimanlHours(duration / 3600000);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
returnRuntime() {
|
|
31
|
-
let duration = this.formatRuntime(this.calculateDuration());
|
|
32
|
-
let startTime = this.start;
|
|
33
|
-
let endTime = this.end;
|
|
34
|
-
this.runtime = { duration, startTime, endTime };
|
|
35
|
-
return this.runtime;
|
|
36
|
-
}
|
|
37
|
-
}
|