@auxcode/auxta 1.3.52-beta.2 → 1.3.53

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 (79) hide show
  1. package/build/{cjs/macros → macros}/helpers/AuxGoogleAuth.js +61 -28
  2. package/build/{cjs/macros → macros}/helpers/emailHelper.js +12 -18
  3. package/build/{cjs/puppeteer → puppeteer}/puppeteer.d.ts +2 -2
  4. package/build/{cjs/puppeteer → puppeteer}/puppeteer.js +7 -3
  5. package/package.json +5 -5
  6. package/build/esm/AuxTA.d.ts +0 -62
  7. package/build/esm/AuxTA.js +0 -125
  8. package/build/esm/auxta/configs/config.d.ts +0 -57
  9. package/build/esm/auxta/configs/config.js +0 -64
  10. package/build/esm/auxta/enums/status-of.step.d.ts +0 -7
  11. package/build/esm/auxta/enums/status-of.step.js +0 -8
  12. package/build/esm/auxta/helpers/response.helper.d.ts +0 -10
  13. package/build/esm/auxta/helpers/response.helper.js +0 -11
  14. package/build/esm/auxta/helpers/start.helper.d.ts +0 -1
  15. package/build/esm/auxta/helpers/start.helper.js +0 -24
  16. package/build/esm/auxta/hooks/report.hook.d.ts +0 -14
  17. package/build/esm/auxta/hooks/report.hook.js +0 -59
  18. package/build/esm/auxta/models/upload.model.d.ts +0 -35
  19. package/build/esm/auxta/models/upload.model.js +0 -78
  20. package/build/esm/auxta/services/log.service.d.ts +0 -31
  21. package/build/esm/auxta/services/log.service.js +0 -57
  22. package/build/esm/auxta/services/report.service.d.ts +0 -31
  23. package/build/esm/auxta/services/report.service.js +0 -168
  24. package/build/esm/auxta/services/runtime.service.d.ts +0 -16
  25. package/build/esm/auxta/services/runtime.service.js +0 -37
  26. package/build/esm/auxta/utilities/runtime.helper.d.ts +0 -15
  27. package/build/esm/auxta/utilities/runtime.helper.js +0 -15
  28. package/build/esm/auxta/utilities/screenshot.helper.d.ts +0 -4
  29. package/build/esm/auxta/utilities/screenshot.helper.js +0 -51
  30. package/build/esm/auxta/utilities/start-suite.helper.d.ts +0 -17
  31. package/build/esm/auxta/utilities/start-suite.helper.js +0 -26
  32. package/build/esm/macros/helpers/Aux2faAuth.d.ts +0 -7
  33. package/build/esm/macros/helpers/Aux2faAuth.js +0 -25
  34. package/build/esm/macros/helpers/AuxGoogleAuth.d.ts +0 -22
  35. package/build/esm/macros/helpers/AuxGoogleAuth.js +0 -190
  36. package/build/esm/macros/helpers/code.helper.d.ts +0 -23
  37. package/build/esm/macros/helpers/code.helper.js +0 -218
  38. package/build/esm/macros/helpers/emailHelper.d.ts +0 -19
  39. package/build/esm/macros/helpers/emailHelper.js +0 -170
  40. package/build/esm/macros/helpers/extend-default-page.d.ts +0 -6
  41. package/build/esm/macros/helpers/extend-default-page.js +0 -82
  42. package/build/esm/puppeteer/puppeteer.d.ts +0 -25
  43. package/build/esm/puppeteer/puppeteer.js +0 -201
  44. package/build/tsconfig-cjs.tsbuildinfo +0 -1
  45. package/build/tsconfig.tsbuildinfo +0 -1
  46. /package/build/{cjs/AuxTA.d.ts → AuxTA.d.ts} +0 -0
  47. /package/build/{cjs/AuxTA.js → AuxTA.js} +0 -0
  48. /package/build/{cjs/auxta → auxta}/configs/config.d.ts +0 -0
  49. /package/build/{cjs/auxta → auxta}/configs/config.js +0 -0
  50. /package/build/{cjs/auxta → auxta}/enums/status-of.step.d.ts +0 -0
  51. /package/build/{cjs/auxta → auxta}/enums/status-of.step.js +0 -0
  52. /package/build/{cjs/auxta → auxta}/helpers/response.helper.d.ts +0 -0
  53. /package/build/{cjs/auxta → auxta}/helpers/response.helper.js +0 -0
  54. /package/build/{cjs/auxta → auxta}/helpers/start.helper.d.ts +0 -0
  55. /package/build/{cjs/auxta → auxta}/helpers/start.helper.js +0 -0
  56. /package/build/{cjs/auxta → auxta}/hooks/report.hook.d.ts +0 -0
  57. /package/build/{cjs/auxta → auxta}/hooks/report.hook.js +0 -0
  58. /package/build/{cjs/auxta → auxta}/models/upload.model.d.ts +0 -0
  59. /package/build/{cjs/auxta → auxta}/models/upload.model.js +0 -0
  60. /package/build/{cjs/auxta → auxta}/services/log.service.d.ts +0 -0
  61. /package/build/{cjs/auxta → auxta}/services/log.service.js +0 -0
  62. /package/build/{cjs/auxta → auxta}/services/report.service.d.ts +0 -0
  63. /package/build/{cjs/auxta → auxta}/services/report.service.js +0 -0
  64. /package/build/{cjs/auxta → auxta}/services/runtime.service.d.ts +0 -0
  65. /package/build/{cjs/auxta → auxta}/services/runtime.service.js +0 -0
  66. /package/build/{cjs/auxta → auxta}/utilities/runtime.helper.d.ts +0 -0
  67. /package/build/{cjs/auxta → auxta}/utilities/runtime.helper.js +0 -0
  68. /package/build/{cjs/auxta → auxta}/utilities/screenshot.helper.d.ts +0 -0
  69. /package/build/{cjs/auxta → auxta}/utilities/screenshot.helper.js +0 -0
  70. /package/build/{cjs/auxta → auxta}/utilities/start-suite.helper.d.ts +0 -0
  71. /package/build/{cjs/auxta → auxta}/utilities/start-suite.helper.js +0 -0
  72. /package/build/{cjs/macros → macros}/helpers/Aux2faAuth.d.ts +0 -0
  73. /package/build/{cjs/macros → macros}/helpers/Aux2faAuth.js +0 -0
  74. /package/build/{cjs/macros → macros}/helpers/AuxGoogleAuth.d.ts +0 -0
  75. /package/build/{cjs/macros → macros}/helpers/code.helper.d.ts +0 -0
  76. /package/build/{cjs/macros → macros}/helpers/code.helper.js +0 -0
  77. /package/build/{cjs/macros → macros}/helpers/emailHelper.d.ts +0 -0
  78. /package/build/{cjs/macros → macros}/helpers/extend-default-page.d.ts +0 -0
  79. /package/build/{cjs/macros → macros}/helpers/extend-default-page.js +0 -0
@@ -1,59 +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, uploadScenario, uploadStep } 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('--- Uploading scenario and feature for AUXTA report ---');
20
- const stepsArr = log.returnScenarioReport();
21
- try {
22
- const stepRes = yield uploadStep(stepsArr, scenarioName, screenshotBuffer, errMessage);
23
- const scenarioRes = yield uploadScenario(stepRes, featureName, basename(__filename), (statusCode != 200));
24
- const scenario = {
25
- scenarioId: scenarioRes.scenarioRef,
26
- scenarioName: scenarioRes.name,
27
- scenarioUri: scenarioRes.uri,
28
- status: scenarioRes.status,
29
- scenariosCount: scenarioRes.scenariosCount,
30
- lastFiveStepsHash: scenarioRes.lastFiveStepsHash
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, scenario, 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
- return yield startSuite(body.nextSuites, body.reportId);
51
- }
52
- });
53
- }
54
- export function afterComplete(body) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- if (process.env.ENVIRONMENT == "LIVE")
57
- yield postNotifications(body);
58
- });
59
- }
@@ -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,78 +0,0 @@
1
- export class UploadModel {
2
- constructor(org, baseUrl, digitalProduct, environment, bucket) {
3
- this._reportId = '';
4
- this._nextSuites = [];
5
- this._currentSuite = '';
6
- this._retries = 0;
7
- this._organization = org;
8
- this._bucket = bucket;
9
- this._digitalProduct = digitalProduct;
10
- this._environment = environment;
11
- this._baseUrl = baseUrl;
12
- this._featureName = '';
13
- this._scenarioName = '';
14
- }
15
- set currentSuite(value) {
16
- this._currentSuite = value;
17
- }
18
- set retries(value) {
19
- this._retries = value;
20
- }
21
- get currentSuite() {
22
- return this._currentSuite;
23
- }
24
- get bucket() {
25
- return this._bucket;
26
- }
27
- set bucket(value) {
28
- this._bucket = value;
29
- }
30
- get retries() {
31
- return this._retries;
32
- }
33
- get reportId() {
34
- return this._reportId;
35
- }
36
- set reportId(value) {
37
- this._reportId = value;
38
- }
39
- get nextSuites() {
40
- return this._nextSuites;
41
- }
42
- set nextSuites(value) {
43
- this._nextSuites = value;
44
- }
45
- get digitalProduct() {
46
- return this._digitalProduct;
47
- }
48
- set digitalProduct(value) {
49
- this._digitalProduct = value;
50
- }
51
- get organization() {
52
- return this._organization;
53
- }
54
- get baseUrl() {
55
- return this._baseUrl;
56
- }
57
- set baseUrl(value) {
58
- this._baseUrl = value;
59
- }
60
- get environment() {
61
- return this._environment;
62
- }
63
- set environment(value) {
64
- this._environment = value;
65
- }
66
- get featureName() {
67
- return this._featureName;
68
- }
69
- set featureName(value) {
70
- this._featureName = value;
71
- }
72
- get scenarioName() {
73
- return this._scenarioName;
74
- }
75
- set scenarioName(value) {
76
- this._scenarioName = value;
77
- }
78
- }
@@ -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,57 +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, imageCompareKey: '', 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, screenshot = '', imageCompareKey = '') {
29
- console.log(`System log -- status: ${status} -- : ${name} `);
30
- this.statusCounter[status]++;
31
- const currentStep = new Date().getTime();
32
- if (screenshot != '') {
33
- const embedding = {
34
- data: screenshot,
35
- mime_type: "image/png"
36
- };
37
- this.stepLog.push({
38
- keyword,
39
- name,
40
- imageCompareKey,
41
- result: { status, duration: currentStep - this.lastStepTime, embedding: embedding }
42
- });
43
- }
44
- else {
45
- this.stepLog.push({ keyword, name, imageCompareKey, result: { status, duration: currentStep - this.lastStepTime } });
46
- }
47
- this.lastStepTime = currentStep;
48
- }
49
- returnScenarioReport() {
50
- return this.stepLog;
51
- }
52
- getStatusCount(status) {
53
- return this.statusCounter[status];
54
- }
55
- }
56
- const log = new LogSteps();
57
- export default log;
@@ -1,31 +0,0 @@
1
- /// <reference types="node" />
2
- import { Step } from "./log.service";
3
- import { UploadModel } from "../models/upload.model";
4
- export interface Scenarios {
5
- scenarioId: string;
6
- scenarioName: string;
7
- scenarioUri: string;
8
- status: string;
9
- scenariosCount: number;
10
- lastFiveStepsHash: number;
11
- }
12
- export interface Steps {
13
- failedSteps: number;
14
- passedSteps: number;
15
- skippedSteps: number;
16
- suggestedSteps: number;
17
- }
18
- export declare function createEmptyReport(body: any): Promise<string>;
19
- export declare function uploadStep(stepLog: Step[], scenarioName: string, screenshot?: Buffer, errMessage?: object): Promise<{
20
- stepRef: any;
21
- name: any;
22
- status: any;
23
- stepsCount: any;
24
- }[]>;
25
- export declare function uploadScenario(stepRes: any[], scenarioName: string, uri: string, hasFailed: boolean): Promise<any>;
26
- export declare function updateReport(reportId: string, scenario: Scenarios, steps: Steps, isFinal: boolean): Promise<void>;
27
- export declare function getReport(reportId: string): Promise<any>;
28
- export declare function getLastDayResults(): Promise<any>;
29
- export declare function compareScreenshots(key: string, screenshot: string): Promise<any>;
30
- export declare function postNotifications(body: UploadModel): Promise<void>;
31
- export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;
@@ -1,168 +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
- digitalProductToken: body.digitalProduct,
41
- bucket: body.bucket,
42
- start: new Date(),
43
- url: body.baseUrl
44
- }, headers(token))).data.reportId;
45
- });
46
- }
47
- export function uploadStep(stepLog, scenarioName, screenshot, errMessage) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- let scenarios = [];
50
- let token = yield auth();
51
- let lastStep = stepLog[stepLog.length - 1];
52
- const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
53
- stepLogFormat.pop();
54
- let output = (yield axios.post(config.auxtaURL + "create-steps", {
55
- json: {
56
- name: scenarioName,
57
- steps: [
58
- ...stepLogFormat,
59
- (lastStep.result.status == 'failed')
60
- ? Object.assign(lastStep, {
61
- result: Object.assign(Object.assign({}, lastStep.result), { error_message: JSON.stringify(errMessage) })
62
- })
63
- : lastStep,
64
- {
65
- keyword: "After",
66
- result: {
67
- status: "passed",
68
- duration: 2678000000
69
- },
70
- embeddings: (screenshot) ? [{
71
- data: screenshot.toString("base64"),
72
- mime_type: "image/png"
73
- }] : undefined,
74
- }
75
- ],
76
- }
77
- }, headers(token))).data.scenarios;
78
- scenarios.push({
79
- stepRef: output.stepRef,
80
- name: output.name,
81
- status: output.status,
82
- stepsCount: output.stepsCount
83
- });
84
- return scenarios;
85
- });
86
- }
87
- export function uploadScenario(stepRes, scenarioName, uri, hasFailed) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- let token = yield auth();
90
- return (yield axios.post(config.auxtaURL + "create-scenario", {
91
- json: {
92
- name: scenarioName,
93
- uri: uri
94
- },
95
- scenarios: stepRes,
96
- hasFailed: hasFailed
97
- }, headers(token))).data;
98
- });
99
- }
100
- export function updateReport(reportId, scenario, steps, isFinal) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- let token = yield auth();
103
- yield axios.post(config.auxtaURL + "update-inprogress-report", {
104
- reportId: reportId,
105
- isFinal: isFinal,
106
- data: Object.assign({ scenario: {
107
- scenarioRef: scenario.scenarioId,
108
- name: scenario.scenarioName,
109
- uri: scenario.scenarioUri,
110
- status: scenario.status,
111
- scenariosCount: scenario.scenariosCount,
112
- lastFiveStepsHash: scenario.lastFiveStepsHash
113
- } }, steps)
114
- }, headers(token));
115
- });
116
- }
117
- export function getReport(reportId) {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- let token = yield auth();
120
- return (yield axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
121
- });
122
- }
123
- export function getLastDayResults() {
124
- return __awaiter(this, void 0, void 0, function* () {
125
- let token = yield auth();
126
- return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
127
- });
128
- }
129
- export function compareScreenshots(key, screenshot) {
130
- return __awaiter(this, void 0, void 0, function* () {
131
- let token = yield auth();
132
- const embedding = {
133
- data: screenshot,
134
- mime_type: "image/png"
135
- };
136
- return yield axios.post(`${config.auxtaURL}save-compared-screenshot`, {
137
- organization: config.organization,
138
- key: key,
139
- embedding: embedding,
140
- }, headers(token));
141
- });
142
- }
143
- export function postNotifications(body) {
144
- return __awaiter(this, void 0, void 0, function* () {
145
- let token = yield auth();
146
- yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
147
- environmentName: body.environment,
148
- digitalProductToken: body.digitalProduct,
149
- organizationName: body.organization,
150
- bucketName: body.bucket,
151
- reportId: body.reportId,
152
- }, headers(token));
153
- });
154
- }
155
- export function postNotificationsOnFail(body) {
156
- return __awaiter(this, void 0, void 0, function* () {
157
- let token = yield auth();
158
- yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
159
- environmentName: body.environment,
160
- digitalProductToken: body.digitalProduct,
161
- organizationName: body.organization,
162
- bucketName: body.bucket,
163
- reportId: body.reportId,
164
- featureName: body.featureName,
165
- scenarioName: body.scenarioName
166
- }, headers(token));
167
- });
168
- }
@@ -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
- }
@@ -1,15 +0,0 @@
1
- import { RunTime } from "../services/runtime.service";
2
- export declare class CalculateRuntime {
3
- private runtime;
4
- startTimeSeconds: string;
5
- startTimeMinutes: string;
6
- startTimeHours: string;
7
- startTimeDay: string;
8
- startTimeMonth: string;
9
- endTimeSeconds: string;
10
- endTimeMinutes: string;
11
- endTimeHours: string;
12
- endTimeDay: string;
13
- endTimeMonth: string;
14
- constructor(r: RunTime);
15
- }
@@ -1,15 +0,0 @@
1
- export class CalculateRuntime {
2
- constructor(r) {
3
- this.runtime = r;
4
- this.startTimeSeconds = (this.runtime.startTime.getSeconds() < 10) ? `0${this.runtime.startTime.getSeconds()}` : `${this.runtime.startTime.getSeconds()}`;
5
- this.startTimeMinutes = (this.runtime.startTime.getMinutes() < 10) ? `0${this.runtime.startTime.getMinutes()}` : `${this.runtime.startTime.getMinutes()}`;
6
- this.startTimeHours = (this.runtime.startTime.getHours() < 10) ? `0${this.runtime.startTime.getHours()}` : `${this.runtime.startTime.getHours()}`;
7
- this.startTimeDay = (this.runtime.startTime.getDate() < 10) ? `0${this.runtime.startTime.getDate()}` : `${this.runtime.startTime.getDate()}`;
8
- this.startTimeMonth = (this.runtime.startTime.getMonth() + 1 < 10) ? `0${this.runtime.startTime.getMonth() + 1}` : `${this.runtime.startTime.getMonth() + 1}`;
9
- this.endTimeSeconds = (this.runtime.endTime.getSeconds() < 10) ? `0${this.runtime.endTime.getSeconds()}` : `${this.runtime.endTime.getSeconds()}`;
10
- this.endTimeMinutes = (this.runtime.endTime.getMinutes() < 10) ? `0${this.runtime.endTime.getMinutes()}` : `${this.runtime.endTime.getMinutes()}`;
11
- this.endTimeHours = (this.runtime.endTime.getHours() < 10) ? `0${this.runtime.endTime.getHours()}` : `${this.runtime.endTime.getHours()}`;
12
- this.endTimeDay = (this.runtime.endTime.getDate() < 10) ? `0${this.runtime.endTime.getDate()}` : `${this.runtime.endTime.getDate()}`;
13
- this.endTimeMonth = (this.runtime.endTime.getMonth() + 1 < 10) ? `0${this.runtime.endTime.getMonth() + 1}` : `${this.runtime.endTime.getMonth() + 1}`;
14
- }
15
- }
@@ -1,4 +0,0 @@
1
- /// <reference types="node" />
2
- import { Page } from "puppeteer";
3
- export declare function captureScreenshot(): Promise<Buffer | undefined>;
4
- export declare function captureScreenshotPage(page: Page): Promise<Buffer | undefined>;
@@ -1,51 +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 puppeteer from "../../puppeteer/puppeteer";
11
- import log from "../services/log.service";
12
- import StatusOfStep from "../enums/status-of.step";
13
- export function captureScreenshot() {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- try {
16
- const pages = yield puppeteer.defaultPage.browser().pages();
17
- if (!pages.length)
18
- return undefined;
19
- const lastPage = pages[pages.length - 1] || puppeteer.defaultPage;
20
- const screenshotBuffer = yield lastPage.screenshot({
21
- fullPage: true,
22
- captureBeyondViewport: false,
23
- encoding: 'binary'
24
- });
25
- if (Buffer.isBuffer(screenshotBuffer))
26
- return screenshotBuffer;
27
- }
28
- catch (e) {
29
- log.push('When', e.toString(), StatusOfStep.FAILED);
30
- return undefined;
31
- }
32
- return undefined;
33
- });
34
- }
35
- export function captureScreenshotPage(page) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- try {
38
- const screenshotBuffer = yield page.screenshot({
39
- fullPage: true,
40
- captureBeyondViewport: false,
41
- encoding: 'binary'
42
- });
43
- if (Buffer.isBuffer(screenshotBuffer))
44
- return screenshotBuffer;
45
- }
46
- catch (e) {
47
- log.push('When', e.toString(), StatusOfStep.FAILED);
48
- return undefined;
49
- }
50
- });
51
- }
@@ -1,17 +0,0 @@
1
- export declare function startSuite(suites: string[], reportId?: string): Promise<{
2
- nextSuites?: undefined;
3
- reportId?: undefined;
4
- currentSuite?: undefined;
5
- retries?: undefined;
6
- } | {
7
- nextSuites: string[];
8
- reportId: string | undefined;
9
- currentSuite: string | undefined;
10
- retries: string;
11
- }>;
12
- export declare function retrySuite(suites: string[], reportId: string, currentSuite: string, retries: number): Promise<false | {
13
- nextSuites: string[];
14
- reportId: string;
15
- currentSuite: string;
16
- retries: number;
17
- }>;
@@ -1,26 +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
- export function startSuite(suites, reportId) {
11
- return __awaiter(this, void 0, void 0, function* () {
12
- if (suites.length === 0)
13
- return {};
14
- const next = suites.shift();
15
- return { nextSuites: suites, reportId: reportId, currentSuite: next, retries: "0" };
16
- });
17
- }
18
- export function retrySuite(suites, reportId, currentSuite, retries) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- console.log('I repeat again the current suite: ' + currentSuite);
21
- if (retries >= 2) {
22
- return false;
23
- }
24
- return { nextSuites: suites, reportId: reportId, currentSuite: currentSuite, retries: retries };
25
- });
26
- }
@@ -1,7 +0,0 @@
1
- export declare class Aux2faAuth {
2
- authenticator(): any;
3
- verifyToken(token: string): boolean;
4
- private getSecret;
5
- }
6
- declare const _default: Aux2faAuth;
7
- export default _default;