@auxcode/auxta 1.3.91 → 1.3.92-beta.1

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.
@@ -49,7 +49,7 @@ function setupOverrideConfig(overrideConfig) {
49
49
  }
50
50
  exports.setupOverrideConfig = setupOverrideConfig;
51
51
  exports.config = {
52
- auxtaURL: "https://auxta.live/.netlify/functions/",
52
+ auxtaURL: "http://localhost:8888/.netlify/functions/",
53
53
  baseURL: "",
54
54
  siteURL: "",
55
55
  organization: "",
@@ -39,7 +39,8 @@ function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer
39
39
  failedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.FAILED),
40
40
  passedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.PASSED),
41
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)
42
+ suggestedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SUGGESTION),
43
+ performanceFailure: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.PERFORMANCE_FAIL)
43
44
  };
44
45
  isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
45
46
  yield (0, report_service_1.updateReport)(body.reportId, scenario, stepCounts, isFinal);
@@ -14,6 +14,7 @@ export interface Steps {
14
14
  passedSteps: number;
15
15
  skippedSteps: number;
16
16
  suggestedSteps: number;
17
+ performanceFailure: number;
17
18
  }
18
19
  export declare function createEmptyReport(body: any): Promise<string>;
19
20
  export declare function uploadStep(stepLog: Step[], scenarioName: string, screenshot?: Buffer, errMessage?: object): Promise<{
@@ -8,6 +8,7 @@ export declare class FunctionHelper extends ExtendDefaultPage {
8
8
  screenshot(page?: import("puppeteer").Page): Promise<Buffer | undefined>;
9
9
  screenshotCompare(key: string, threshold?: number, page?: import("puppeteer").Page): Promise<void>;
10
10
  suggest(name: string): void;
11
+ performanceFail(name: string, screenshot?: ArrayBuffer): void;
11
12
  clickByText(selector: string, text: string, dotOrText?: string, options?: {}, page?: import("puppeteer").Page, time?: number, log_message?: boolean): Promise<void>;
12
13
  clickByTextWithClass(class_selector: string, class_name: string, selector: string, text: string, dotOrText?: string, page?: import("puppeteer").Page): Promise<void>;
13
14
  waitForSelectorWithText(selector: string, text: string, dotOrText?: string, page?: import("puppeteer").Page): Promise<boolean>;
@@ -56,6 +56,9 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
56
56
  suggest(name) {
57
57
  log_service_1.default.addSuggestion(name);
58
58
  }
59
+ performanceFail(name, screenshot) {
60
+ log_service_1.default.addPerformanceFail(name, screenshot);
61
+ }
59
62
  clickByText(selector, text, dotOrText = '.', options = {}, page = puppeteer_1.default.defaultPage, time = this.defaultTimeout, log_message = true) {
60
63
  return __awaiter(this, void 0, void 0, function* () {
61
64
  const message = `I clicked on the '${text}' '${selector}'`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.91",
3
+ "version": "1.3.92-beta.1",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",
@@ -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: Buffer;
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
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,38 +0,0 @@
1
- export declare class UploadModel {
2
- private readonly _organization;
3
- constructor(org: string, baseUrl: string, digitalProduct: string, environment: string, bucket: string, isOfficial: boolean);
4
- private _reportId;
5
- get reportId(): string;
6
- set reportId(value: string);
7
- private _nextSuites;
8
- get nextSuites(): [];
9
- set nextSuites(value: []);
10
- private _digitalProduct;
11
- get digitalProduct(): string;
12
- set digitalProduct(value: string);
13
- private _baseUrl;
14
- get baseUrl(): string;
15
- set baseUrl(value: string);
16
- private _bucket;
17
- get bucket(): string;
18
- set bucket(value: string);
19
- private _environment;
20
- get environment(): string;
21
- set environment(value: string);
22
- private _currentSuite;
23
- get currentSuite(): string;
24
- set currentSuite(value: string);
25
- private _retries;
26
- get retries(): number;
27
- set retries(value: number);
28
- private _featureName;
29
- get featureName(): string;
30
- set featureName(value: string);
31
- private _scenarioName;
32
- get scenarioName(): string;
33
- set scenarioName(value: string);
34
- private _isOfficial;
35
- get isOfficial(): boolean;
36
- set isOfficial(value: boolean);
37
- get organization(): string;
38
- }
@@ -1,89 +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, isOfficial) {
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
- this._isOfficial = isOfficial;
18
- }
19
- get reportId() {
20
- return this._reportId;
21
- }
22
- set reportId(value) {
23
- this._reportId = value;
24
- }
25
- get nextSuites() {
26
- return this._nextSuites;
27
- }
28
- set nextSuites(value) {
29
- this._nextSuites = value;
30
- }
31
- get digitalProduct() {
32
- return this._digitalProduct;
33
- }
34
- set digitalProduct(value) {
35
- this._digitalProduct = value;
36
- }
37
- get baseUrl() {
38
- return this._baseUrl;
39
- }
40
- set baseUrl(value) {
41
- this._baseUrl = value;
42
- }
43
- get bucket() {
44
- return this._bucket;
45
- }
46
- set bucket(value) {
47
- this._bucket = value;
48
- }
49
- get environment() {
50
- return this._environment;
51
- }
52
- set environment(value) {
53
- this._environment = value;
54
- }
55
- get currentSuite() {
56
- return this._currentSuite;
57
- }
58
- set currentSuite(value) {
59
- this._currentSuite = value;
60
- }
61
- get retries() {
62
- return this._retries;
63
- }
64
- set retries(value) {
65
- this._retries = value;
66
- }
67
- get featureName() {
68
- return this._featureName;
69
- }
70
- set featureName(value) {
71
- this._featureName = value;
72
- }
73
- get scenarioName() {
74
- return this._scenarioName;
75
- }
76
- set scenarioName(value) {
77
- this._scenarioName = value;
78
- }
79
- get isOfficial() {
80
- return this._isOfficial;
81
- }
82
- set isOfficial(value) {
83
- this._isOfficial = value;
84
- }
85
- get organization() {
86
- return this._organization;
87
- }
88
- }
89
- 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: ArrayBuffer;
11
- mime_type: string;
12
- };
13
- };
14
- }
15
- export declare class LogSteps {
16
- statusCounter: {
17
- passed: number;
18
- failed: number;
19
- skipped: number;
20
- suggestion: number;
21
- };
22
- private stepLog;
23
- private lastStepTime;
24
- addSuggestion(text: string): void;
25
- clear(): void;
26
- push(keyword: string, name: string, status: StatusOfStep, screenshot?: ArrayBuffer, imageCompareKey?: string): void;
27
- returnScenarioReport(): Step[];
28
- getStatusCount(status: StatusOfStep): number;
29
- }
30
- declare const log: LogSteps;
31
- export default log;
@@ -1,66 +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.statusCounter = {
8
- [status_of_step_1.StatusOfStep.PASSED]: 0,
9
- [status_of_step_1.StatusOfStep.FAILED]: 0,
10
- [status_of_step_1.StatusOfStep.SKIPPED]: 0,
11
- [status_of_step_1.StatusOfStep.SUGGESTION]: 0,
12
- };
13
- this.stepLog = [];
14
- this.lastStepTime = new Date().getTime();
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 = new ArrayBuffer(0), imageCompareKey = '') {
32
- console.log(`System log -- status: ${status} -- : ${name} `);
33
- this.statusCounter[status]++;
34
- const currentStep = new Date().getTime();
35
- if (screenshot.byteLength != 0) {
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({
49
- keyword,
50
- name,
51
- imageCompareKey,
52
- result: { status, duration: currentStep - this.lastStepTime }
53
- });
54
- }
55
- this.lastStepTime = currentStep;
56
- }
57
- returnScenarioReport() {
58
- return this.stepLog;
59
- }
60
- getStatusCount(status) {
61
- return this.statusCounter[status];
62
- }
63
- }
64
- exports.LogSteps = LogSteps;
65
- const log = new LogSteps();
66
- exports.default = log;
@@ -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
- returnRuntime(): RunTime;
12
- private calculateDuration;
13
- private splitAtDecimanlMinutes;
14
- private splitAtDecimanlHours;
15
- private formatRuntime;
16
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Runtime = void 0;
4
- class Runtime {
5
- constructor(s, e) {
6
- this.start = s;
7
- this.end = e;
8
- }
9
- returnRuntime() {
10
- let duration = this.formatRuntime(this.calculateDuration());
11
- let startTime = this.start;
12
- let endTime = this.end;
13
- this.runtime = { duration, startTime, endTime };
14
- return this.runtime;
15
- }
16
- calculateDuration() {
17
- let currentTime = new Date;
18
- return currentTime.getTime() - this.start.getTime();
19
- }
20
- splitAtDecimanlMinutes(time) {
21
- let minutes = time.toFixed(2).toString().split('.');
22
- return `${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
23
- }
24
- splitAtDecimanlHours(time) {
25
- let hours = time.toFixed(2).toString().split('.');
26
- let minutes = (Number(hours[1]) / 100 * 60).toFixed(2).toString().split('.');
27
- return `${hours[0]}h ${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
28
- }
29
- formatRuntime(duration) {
30
- if (duration / 1000 < 60)
31
- return `${(duration / 1000).toFixed(0)}s`;
32
- else {
33
- if (duration / 60000 < 60)
34
- return this.splitAtDecimanlMinutes(duration / 60000);
35
- else
36
- return this.splitAtDecimanlHours(duration / 3600000);
37
- }
38
- }
39
- }
40
- exports.Runtime = Runtime;
@@ -1,15 +0,0 @@
1
- import { RunTime } from "../services/runtime.service";
2
- export declare class CalculateRuntime {
3
- startTimeSeconds: string;
4
- startTimeMinutes: string;
5
- startTimeHours: string;
6
- startTimeDay: string;
7
- startTimeMonth: string;
8
- endTimeSeconds: string;
9
- endTimeMinutes: string;
10
- endTimeHours: string;
11
- endTimeDay: string;
12
- endTimeMonth: string;
13
- private runtime;
14
- constructor(r: RunTime);
15
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CalculateRuntime = void 0;
4
- class CalculateRuntime {
5
- constructor(r) {
6
- this.runtime = r;
7
- this.startTimeSeconds = (this.runtime.startTime.getSeconds() < 10) ? `0${this.runtime.startTime.getSeconds()}` : `${this.runtime.startTime.getSeconds()}`;
8
- this.startTimeMinutes = (this.runtime.startTime.getMinutes() < 10) ? `0${this.runtime.startTime.getMinutes()}` : `${this.runtime.startTime.getMinutes()}`;
9
- this.startTimeHours = (this.runtime.startTime.getHours() < 10) ? `0${this.runtime.startTime.getHours()}` : `${this.runtime.startTime.getHours()}`;
10
- this.startTimeDay = (this.runtime.startTime.getDate() < 10) ? `0${this.runtime.startTime.getDate()}` : `${this.runtime.startTime.getDate()}`;
11
- this.startTimeMonth = (this.runtime.startTime.getMonth() + 1 < 10) ? `0${this.runtime.startTime.getMonth() + 1}` : `${this.runtime.startTime.getMonth() + 1}`;
12
- this.endTimeSeconds = (this.runtime.endTime.getSeconds() < 10) ? `0${this.runtime.endTime.getSeconds()}` : `${this.runtime.endTime.getSeconds()}`;
13
- this.endTimeMinutes = (this.runtime.endTime.getMinutes() < 10) ? `0${this.runtime.endTime.getMinutes()}` : `${this.runtime.endTime.getMinutes()}`;
14
- this.endTimeHours = (this.runtime.endTime.getHours() < 10) ? `0${this.runtime.endTime.getHours()}` : `${this.runtime.endTime.getHours()}`;
15
- this.endTimeDay = (this.runtime.endTime.getDate() < 10) ? `0${this.runtime.endTime.getDate()}` : `${this.runtime.endTime.getDate()}`;
16
- this.endTimeMonth = (this.runtime.endTime.getMonth() + 1 < 10) ? `0${this.runtime.endTime.getMonth() + 1}` : `${this.runtime.endTime.getMonth() + 1}`;
17
- }
18
- }
19
- exports.CalculateRuntime = CalculateRuntime;
@@ -1,101 +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.captureScreenshotPage = exports.captureScreenshot = void 0;
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"));
19
- const RETRY_NUMBERS = 10;
20
- function captureScreenshot() {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const pages = yield puppeteer_1.default.defaultPage.browser().pages();
23
- if (!pages.length)
24
- return undefined;
25
- for (let i = 0; i < pages.length; i++) {
26
- const page = pages[i];
27
- if ((pages.length - 1) == i || pages.length == 1) {
28
- let count = 0;
29
- while (count <= RETRY_NUMBERS) {
30
- try {
31
- const lastPage = pages[pages.length - 1] || puppeteer_1.default.defaultPage;
32
- const screenshotBuffer = yield lastPage.screenshot({
33
- captureBeyondViewport: false,
34
- encoding: 'binary'
35
- });
36
- if (Buffer.isBuffer(screenshotBuffer))
37
- return screenshotBuffer;
38
- }
39
- catch (e) {
40
- if (count == RETRY_NUMBERS) {
41
- log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
42
- return undefined;
43
- }
44
- }
45
- count++;
46
- }
47
- }
48
- else {
49
- let count = 0;
50
- while (count <= RETRY_NUMBERS) {
51
- try {
52
- const screenshotBuffer = yield page.screenshot({
53
- captureBeyondViewport: false,
54
- encoding: 'binary'
55
- });
56
- if (Buffer.isBuffer(screenshotBuffer)) {
57
- log_service_1.default.push("When", `${i} Image`, status_of_step_1.default.FAILED, screenshotBuffer);
58
- break;
59
- }
60
- }
61
- catch (e) {
62
- if (count == RETRY_NUMBERS) {
63
- log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
64
- return undefined;
65
- }
66
- }
67
- count++;
68
- }
69
- }
70
- }
71
- return undefined;
72
- });
73
- }
74
- exports.captureScreenshot = captureScreenshot;
75
- function captureScreenshotPage(page) {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- let count = 0;
78
- while (count <= RETRY_NUMBERS) {
79
- try {
80
- const pages = yield puppeteer_1.default.defaultPage.browser().pages();
81
- log_service_1.default.push('When', `Before the screenshot the number of pages are ${pages.length}`, status_of_step_1.default.PASSED);
82
- const screenshotBuffer = yield page.screenshot({
83
- fullPage: true,
84
- captureBeyondViewport: false,
85
- encoding: 'binary'
86
- });
87
- if (Buffer.isBuffer(screenshotBuffer))
88
- return screenshotBuffer;
89
- }
90
- catch (e) {
91
- if (count == RETRY_NUMBERS) {
92
- log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
93
- return undefined;
94
- }
95
- }
96
- count++;
97
- }
98
- return undefined;
99
- });
100
- }
101
- exports.captureScreenshotPage = captureScreenshotPage;
@@ -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,31 +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
- exports.retrySuite = exports.startSuite = void 0;
13
- function startSuite(suites, reportId) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- if (suites.length === 0)
16
- return {};
17
- const next = suites.shift();
18
- return { nextSuites: suites, reportId: reportId, currentSuite: next, retries: "0" };
19
- });
20
- }
21
- exports.startSuite = startSuite;
22
- function retrySuite(suites, reportId, currentSuite, retries) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- console.log('I repeat again the current suite: ' + currentSuite);
25
- if (retries >= 2) {
26
- return false;
27
- }
28
- return { nextSuites: suites, reportId: reportId, currentSuite: currentSuite, retries: retries };
29
- });
30
- }
31
- exports.retrySuite = retrySuite;
@@ -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;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Aux2faAuth = void 0;
4
- const twofactor = require("node-2fa");
5
- class Aux2faAuth {
6
- authenticator() {
7
- const aux2fe_secret = this.getSecret();
8
- return twofactor.generateToken(aux2fe_secret).token;
9
- }
10
- verifyToken(token) {
11
- const aux2fe_secret = this.getSecret();
12
- const result = twofactor.verifyToken(aux2fe_secret, token);
13
- if (result != null) {
14
- if (result.delta == 0) {
15
- return true;
16
- }
17
- }
18
- return false;
19
- }
20
- getSecret() {
21
- const aux2fe_secret = process.env.aux2fe_secret;
22
- if (!aux2fe_secret) {
23
- throw new Error('No 2fe secret set');
24
- }
25
- return aux2fe_secret;
26
- }
27
- }
28
- exports.Aux2faAuth = Aux2faAuth;
29
- exports.default = new Aux2faAuth();
@@ -1,6 +0,0 @@
1
- export declare class ExtendDefaultPage {
2
- defaultTimeout: number;
3
- extend_page_functions(page: any, time?: number): Promise<any>;
4
- }
5
- declare const _default: ExtendDefaultPage;
6
- export default _default;
@@ -1,89 +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.ExtendDefaultPage = void 0;
16
- const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
17
- const status_of_step_1 = require("../../auxta/enums/status-of.step");
18
- const config_1 = require("../../auxta/configs/config");
19
- class ExtendDefaultPage {
20
- constructor() {
21
- this.defaultTimeout = config_1.config.timeout;
22
- }
23
- extend_page_functions(page, time = this.defaultTimeout) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- this.defaultTimeout = config_1.config.timeout;
26
- const { goto: original_goto, click: original_click, type: original_type, waitForNetworkIdle: original_waitForNetworkIdle } = page;
27
- page.goto = function goto(url, options) {
28
- log_service_1.default.push('Then', `I go to the '${url}' page`, status_of_step_1.StatusOfStep.PASSED);
29
- return original_goto.apply(page, arguments);
30
- };
31
- page.click = function click(selector, options) {
32
- return __awaiter(this, arguments, void 0, function* () {
33
- try {
34
- yield page.waitForSelector(selector, {
35
- timeout: time
36
- });
37
- let elementName = yield page.$eval(selector, (e) => e.textContent);
38
- if (!elementName || elementName === ' ')
39
- elementName = selector;
40
- yield original_click.apply(page, arguments);
41
- log_service_1.default.push('Then', `I click on the '${elementName}'`, status_of_step_1.StatusOfStep.PASSED);
42
- }
43
- catch (e) {
44
- const msg = `I click on the '${selector}'`;
45
- log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
46
- throw new Error(msg);
47
- }
48
- });
49
- };
50
- page.waitForNetworkIdle = function waitForNetworkIdle(selector, option) {
51
- return __awaiter(this, arguments, void 0, function* () {
52
- let message = 'I wait for the page to load';
53
- let result;
54
- try {
55
- result = yield original_waitForNetworkIdle.apply(page, arguments);
56
- log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
57
- }
58
- catch (e) {
59
- log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
60
- throw new Error(message);
61
- }
62
- return result;
63
- });
64
- };
65
- page.type = function type(field, value) {
66
- return __awaiter(this, arguments, void 0, function* () {
67
- try {
68
- yield page.waitForSelector(field, {
69
- timeout: time
70
- });
71
- yield original_type.apply(page, arguments);
72
- let elementName = yield page.$eval(field, (e) => e.textContent);
73
- if (!elementName || elementName === ' ')
74
- elementName = field;
75
- log_service_1.default.push('Then', `I type '${value}' into the '${elementName}' field`, status_of_step_1.StatusOfStep.PASSED);
76
- }
77
- catch (e) {
78
- const msg = `I type '${value}' into the '${field}' field`;
79
- log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
80
- throw new Error(msg);
81
- }
82
- });
83
- };
84
- return page;
85
- });
86
- }
87
- }
88
- exports.ExtendDefaultPage = ExtendDefaultPage;
89
- exports.default = new ExtendDefaultPage();