@auxcode/auxta 0.5.4 → 0.5.5
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/build/{cjs/AuxTA.d.ts → AuxTA.d.ts} +0 -0
- package/build/{esm/AuxTA.js → AuxTA.js} +0 -0
- package/build/{cjs/auxta → auxta}/configs/config.d.ts +0 -0
- package/build/{esm/auxta → auxta}/configs/config.js +0 -0
- package/build/{cjs/auxta → auxta}/enums/status-of.step.d.ts +0 -0
- package/build/{esm/auxta → auxta}/enums/status-of.step.js +0 -0
- package/build/{cjs/auxta → auxta}/helpers/response.helper.d.ts +0 -0
- package/build/{esm/auxta → auxta}/helpers/response.helper.js +0 -0
- package/build/{cjs/auxta → auxta}/helpers/start.helper.d.ts +0 -0
- package/build/{esm/auxta → auxta}/helpers/start.helper.js +0 -0
- package/build/{cjs/auxta → auxta}/hooks/report.hook.d.ts +0 -0
- package/build/{esm/auxta → auxta}/hooks/report.hook.js +0 -0
- package/build/{cjs/auxta → auxta}/models/upload.model.d.ts +0 -0
- package/build/{esm/auxta → auxta}/models/upload.model.js +0 -0
- package/build/{cjs/auxta → auxta}/services/log.service.d.ts +0 -0
- package/build/{esm/auxta → auxta}/services/log.service.js +0 -0
- package/build/{cjs/auxta → auxta}/services/report.service.d.ts +0 -0
- package/build/{esm/auxta → auxta}/services/report.service.js +0 -0
- package/build/{cjs/auxta → auxta}/services/runtime.service.d.ts +0 -0
- package/build/{esm/auxta → auxta}/services/runtime.service.js +0 -0
- package/build/{cjs/auxta → auxta}/utilities/runtime.helper.d.ts +0 -0
- package/build/{esm/auxta → auxta}/utilities/runtime.helper.js +0 -0
- package/build/{cjs/auxta → auxta}/utilities/screenshot.helper.d.ts +0 -0
- package/build/{esm/auxta → auxta}/utilities/screenshot.helper.js +0 -0
- package/build/{cjs/auxta → auxta}/utilities/start-suite.helper.d.ts +0 -0
- package/build/{esm/auxta → auxta}/utilities/start-suite.helper.js +0 -0
- package/build/{cjs/macros → macros}/helpers/code.helper.d.ts +0 -0
- package/build/{esm/macros → macros}/helpers/code.helper.js +0 -0
- package/build/{cjs/puppeteer → puppeteer}/puppeteer.d.ts +0 -0
- package/build/{esm/puppeteer → puppeteer}/puppeteer.js +0 -0
- package/package.json +3 -4
- package/build/cjs/AuxTA.js +0 -122
- package/build/cjs/auxta/configs/config.js +0 -66
- package/build/cjs/auxta/enums/status-of.step.js +0 -11
- package/build/cjs/auxta/helpers/response.helper.js +0 -15
- package/build/cjs/auxta/helpers/start.helper.js +0 -17
- package/build/cjs/auxta/hooks/report.hook.js +0 -53
- package/build/cjs/auxta/models/upload.model.js +0 -47
- package/build/cjs/auxta/services/log.service.js +0 -47
- package/build/cjs/auxta/services/report.service.js +0 -141
- package/build/cjs/auxta/services/runtime.service.js +0 -41
- package/build/cjs/auxta/utilities/runtime.helper.js +0 -19
- package/build/cjs/auxta/utilities/screenshot.helper.js +0 -25
- package/build/cjs/auxta/utilities/start-suite.helper.js +0 -21
- package/build/cjs/macros/helpers/code.helper.js +0 -165
- package/build/cjs/puppeteer/puppeteer.js +0 -143
- package/build/esm/AuxTA.d.ts +0 -43
- package/build/esm/auxta/configs/config.d.ts +0 -51
- package/build/esm/auxta/enums/status-of.step.d.ts +0 -7
- package/build/esm/auxta/helpers/response.helper.d.ts +0 -10
- package/build/esm/auxta/helpers/start.helper.d.ts +0 -1
- package/build/esm/auxta/hooks/report.hook.d.ts +0 -4
- package/build/esm/auxta/models/upload.model.d.ts +0 -20
- package/build/esm/auxta/services/log.service.d.ts +0 -26
- package/build/esm/auxta/services/report.service.d.ts +0 -36
- package/build/esm/auxta/services/runtime.service.d.ts +0 -16
- package/build/esm/auxta/utilities/runtime.helper.d.ts +0 -15
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +0 -2
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +0 -1
- package/build/esm/macros/helpers/code.helper.d.ts +0 -22
- package/build/esm/puppeteer/puppeteer.d.ts +0 -13
- package/build/tsconfig-cjs.tsbuildinfo +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -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,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.captureScreenshot = void 0;
|
|
7
|
-
const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
|
|
8
|
-
async function captureScreenshot() {
|
|
9
|
-
try {
|
|
10
|
-
const pages = await puppeteer_1.default.defaultPage.browser().pages();
|
|
11
|
-
if (!pages.length)
|
|
12
|
-
return undefined;
|
|
13
|
-
const lastPage = pages[pages.length - 1] || puppeteer_1.default.defaultPage;
|
|
14
|
-
const screenshotBuffer = await lastPage.screenshot({
|
|
15
|
-
fullPage: true,
|
|
16
|
-
encoding: 'binary'
|
|
17
|
-
});
|
|
18
|
-
if (Buffer.isBuffer(screenshotBuffer))
|
|
19
|
-
return screenshotBuffer;
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
}
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
exports.captureScreenshot = captureScreenshot;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.startSuite = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const config_1 = require("../configs/config");
|
|
9
|
-
async function startSuite(suites, reportId) {
|
|
10
|
-
if (suites.length === 0)
|
|
11
|
-
return;
|
|
12
|
-
const next = suites.shift();
|
|
13
|
-
console.log('Starting next suite: ' + next);
|
|
14
|
-
try {
|
|
15
|
-
await axios_1.default.post(`${config_1.config.netlifyPath}.netlify/functions/${next}?token=${config_1.config.token}`, { nextSuites: suites, reportId: reportId });
|
|
16
|
-
}
|
|
17
|
-
catch (e) {
|
|
18
|
-
await startSuite(suites, reportId);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.startSuite = startSuite;
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FunctionHelper = void 0;
|
|
7
|
-
const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
|
|
8
|
-
const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
|
|
9
|
-
const status_of_step_1 = require("../../auxta/enums/status-of.step");
|
|
10
|
-
const config_1 = require("../../auxta/configs/config");
|
|
11
|
-
class FunctionHelper {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.defaultTimeout = config_1.config.timeout;
|
|
14
|
-
}
|
|
15
|
-
log(keyword, name, status) {
|
|
16
|
-
log_service_1.default.push(keyword, name, status);
|
|
17
|
-
}
|
|
18
|
-
suggest(name) {
|
|
19
|
-
log_service_1.default.addSuggestion(name);
|
|
20
|
-
}
|
|
21
|
-
getEscapedText(text) {
|
|
22
|
-
const splitedQuotes = text.replace(/'/g, `', "'", '`);
|
|
23
|
-
return `concat('${splitedQuotes}', '')`;
|
|
24
|
-
}
|
|
25
|
-
async clickByText(selector, text, page = puppeteer_1.default.defaultPage, dotOrText = '.') {
|
|
26
|
-
const message = `I click on the '${text}' '${selector}'`;
|
|
27
|
-
try {
|
|
28
|
-
const [linkHandlers] = await page.$x(`//${selector}[${dotOrText} = ${this.getEscapedText(text)}]`);
|
|
29
|
-
if (linkHandlers) {
|
|
30
|
-
await linkHandlers.click();
|
|
31
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
}
|
|
37
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
|
|
38
|
-
throw new Error(message);
|
|
39
|
-
}
|
|
40
|
-
async clickByTextWithClass(class_selector, class_name, selector, text, page = puppeteer_1.default.defaultPage, dotOrText = '.') {
|
|
41
|
-
const message = `I click on the '${text}' '${selector}'`;
|
|
42
|
-
try {
|
|
43
|
-
const [linkHandlers] = await page.$x(`//${class_selector}[contains(@class,${this.getEscapedText(class_name)})]//${selector}[${dotOrText} = ${this.getEscapedText(text)}]`);
|
|
44
|
-
if (linkHandlers) {
|
|
45
|
-
await linkHandlers.click();
|
|
46
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
}
|
|
52
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
|
|
53
|
-
throw new Error(message);
|
|
54
|
-
}
|
|
55
|
-
async waitForSelectorWithText(selector, text, page = puppeteer_1.default.defaultPage, dotOrText = '.') {
|
|
56
|
-
const message = `I check for '${text}' on the current page`;
|
|
57
|
-
try {
|
|
58
|
-
await page.waitForSelector(selector, {
|
|
59
|
-
timeout: this.defaultTimeout
|
|
60
|
-
});
|
|
61
|
-
const linkHandlers = await page.$x(`//${selector}[${dotOrText} = ${this.getEscapedText(text)}]`);
|
|
62
|
-
if (linkHandlers.length > 0) {
|
|
63
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
}
|
|
69
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.FAILED);
|
|
70
|
-
throw new Error(message);
|
|
71
|
-
}
|
|
72
|
-
async goto(url, page = puppeteer_1.default.defaultPage) {
|
|
73
|
-
await page.goto(url);
|
|
74
|
-
log_service_1.default.push('Then', `I go to the '${url}' page`, status_of_step_1.StatusOfStep.PASSED);
|
|
75
|
-
}
|
|
76
|
-
async type(field, value, page = puppeteer_1.default.defaultPage) {
|
|
77
|
-
try {
|
|
78
|
-
await page.waitForSelector(field, {
|
|
79
|
-
timeout: this.defaultTimeout
|
|
80
|
-
});
|
|
81
|
-
await page.type(field, value);
|
|
82
|
-
let elementName = await page.$eval(field, (e) => e.textContent);
|
|
83
|
-
if (!elementName || elementName === ' ')
|
|
84
|
-
elementName = field;
|
|
85
|
-
log_service_1.default.push('Then', `I type '${value}' into the '${elementName}' field`, status_of_step_1.StatusOfStep.PASSED);
|
|
86
|
-
}
|
|
87
|
-
catch (e) {
|
|
88
|
-
const msg = `I type '${value}' into the '${field}' field`;
|
|
89
|
-
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
90
|
-
throw new Error(msg);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async waitForNetwork(page = puppeteer_1.default.defaultPage) {
|
|
94
|
-
let message = 'I wait for the page to load';
|
|
95
|
-
try {
|
|
96
|
-
await page.waitForNetworkIdle();
|
|
97
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
98
|
-
}
|
|
99
|
-
catch (e) {
|
|
100
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
|
|
101
|
-
throw new Error(message);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
async timeout(timeout = this.defaultTimeout, page = puppeteer_1.default.defaultPage) {
|
|
105
|
-
await page.waitForTimeout(timeout);
|
|
106
|
-
}
|
|
107
|
-
async waitForSelector(option, selector, time = this.defaultTimeout, page = puppeteer_1.default.defaultPage, log_message = true) {
|
|
108
|
-
const message = `I check for the '${selector}' element to be ${option}`;
|
|
109
|
-
try {
|
|
110
|
-
await page.waitForSelector(selector, {
|
|
111
|
-
[option]: true,
|
|
112
|
-
timeout: time
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
catch (e) {
|
|
116
|
-
if (log_message) {
|
|
117
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.FAILED);
|
|
118
|
-
}
|
|
119
|
-
throw new Error(message);
|
|
120
|
-
}
|
|
121
|
-
if (log_message) {
|
|
122
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async click(selector, logMessages = true, page = puppeteer_1.default.defaultPage) {
|
|
126
|
-
try {
|
|
127
|
-
await page.waitForSelector(selector, {
|
|
128
|
-
timeout: this.defaultTimeout
|
|
129
|
-
});
|
|
130
|
-
let elementName = await page.$eval(selector, (e) => e.textContent);
|
|
131
|
-
if (!elementName || elementName === ' ')
|
|
132
|
-
elementName = selector;
|
|
133
|
-
await page.click(selector);
|
|
134
|
-
log_service_1.default.push('Then', `I click on the '${elementName}'`, status_of_step_1.StatusOfStep.PASSED);
|
|
135
|
-
}
|
|
136
|
-
catch (e) {
|
|
137
|
-
const msg = `I click on the '${selector}'`;
|
|
138
|
-
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
139
|
-
throw new Error(msg);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async urlContains(selector, page = puppeteer_1.default.defaultPage) {
|
|
143
|
-
const url = page.url();
|
|
144
|
-
let message = `I am on the ${selector} page`;
|
|
145
|
-
if (!url.includes(selector)) {
|
|
146
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.FAILED);
|
|
147
|
-
throw new Error(message);
|
|
148
|
-
}
|
|
149
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
150
|
-
}
|
|
151
|
-
async pressEnter(page = puppeteer_1.default.defaultPage) {
|
|
152
|
-
await page.keyboard.press('Enter');
|
|
153
|
-
}
|
|
154
|
-
async clickAndWaitForPageToBeCreated(selector, page = puppeteer_1.default.defaultPage) {
|
|
155
|
-
const nav = new Promise(res => page.browser().on('targetcreated', res));
|
|
156
|
-
await this.click(selector);
|
|
157
|
-
await nav;
|
|
158
|
-
}
|
|
159
|
-
async closeLastPage(page = puppeteer_1.default.defaultPage) {
|
|
160
|
-
const pages = await page.browser().pages();
|
|
161
|
-
await pages[pages.length - 1].close();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
exports.FunctionHelper = FunctionHelper;
|
|
165
|
-
exports.default = new FunctionHelper();
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Puppeteer = void 0;
|
|
7
|
-
const chrome_aws_lambda_1 = __importDefault(require("chrome-aws-lambda"));
|
|
8
|
-
const log_service_1 = __importDefault(require("../auxta/services/log.service"));
|
|
9
|
-
const screenshot_helper_1 = require("../auxta/utilities/screenshot.helper");
|
|
10
|
-
const report_hook_1 = require("../auxta/hooks/report.hook");
|
|
11
|
-
const AuxTA_1 = __importDefault(require("../AuxTA"));
|
|
12
|
-
const status_of_step_1 = require("../auxta/enums/status-of.step");
|
|
13
|
-
const config_1 = require("./../auxta/configs/config");
|
|
14
|
-
const report_service_1 = require("../auxta/services/report.service");
|
|
15
|
-
class Puppeteer {
|
|
16
|
-
async startBrowser() {
|
|
17
|
-
let args = [
|
|
18
|
-
'--start-maximized',
|
|
19
|
-
'--no-sandbox',
|
|
20
|
-
'--disable-setuid-sandbox',
|
|
21
|
-
'--disable-dev-shm-usage',
|
|
22
|
-
'--single-process'
|
|
23
|
-
];
|
|
24
|
-
if (process.env.ENVIRONMENT != 'LOCAL')
|
|
25
|
-
args.push(`--window-size=${config_1.config.screenWidth},${config_1.config.screenHeight}`);
|
|
26
|
-
this.browser = await chrome_aws_lambda_1.default.puppeteer.launch({
|
|
27
|
-
executablePath: process.env.ENVIRONMENT === 'LOCAL' ? undefined : await chrome_aws_lambda_1.default.executablePath,
|
|
28
|
-
args,
|
|
29
|
-
ignoreDefaultArgs: ["--enable-automation"],
|
|
30
|
-
defaultViewport: process.env.ENVIRONMENT === 'LOCAL' ? null : {
|
|
31
|
-
width: config_1.config.screenWidth,
|
|
32
|
-
height: config_1.config.screenHeight
|
|
33
|
-
},
|
|
34
|
-
headless: process.env.ENVIRONMENT == 'LOCAL' ? false : chrome_aws_lambda_1.default.headless
|
|
35
|
-
});
|
|
36
|
-
this.defaultPage = (await this.browser.pages())[0];
|
|
37
|
-
await this.defaultPage.goto(config_1.config.baseURL, { waitUntil: 'networkidle0' });
|
|
38
|
-
await this.defaultPage.waitForNetworkIdle();
|
|
39
|
-
}
|
|
40
|
-
async close() {
|
|
41
|
-
if (this.browser) {
|
|
42
|
-
let pages = await this.browser.pages();
|
|
43
|
-
await Promise.all(pages.map((page) => page.close()));
|
|
44
|
-
await this.browser.close();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async run(event, callback, featureName = 'Test feature', scenarioName = 'Test scenario', uploadModel, close) {
|
|
48
|
-
try {
|
|
49
|
-
if (uploadModel === undefined)
|
|
50
|
-
uploadModel = AuxTA_1.default.getUploadModel();
|
|
51
|
-
if (close === undefined)
|
|
52
|
-
close = Puppeteer.setupHeader(event, uploadModel);
|
|
53
|
-
let screenshotBuffer;
|
|
54
|
-
let errMessage;
|
|
55
|
-
let statusCode = 200;
|
|
56
|
-
let consoleStack = [];
|
|
57
|
-
try {
|
|
58
|
-
await log_service_1.default.push('When', `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
59
|
-
await this.startBrowser();
|
|
60
|
-
this.defaultPage.on('console', message => consoleStack.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
61
|
-
.on('pageerror', ({ message }) => consoleStack.push(message))
|
|
62
|
-
.on('response', response => consoleStack.push(`${response.status()} ${response.url()}`))
|
|
63
|
-
.on('requestfailed', request => consoleStack.push(`${request.failure() !== null ? request.failure()?.errorText : ""} ${request.url()}`));
|
|
64
|
-
await callback(event);
|
|
65
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
console.log("Error", err);
|
|
69
|
-
errMessage = err;
|
|
70
|
-
statusCode = 500;
|
|
71
|
-
screenshotBuffer = await (0, screenshot_helper_1.captureScreenshot)();
|
|
72
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
73
|
-
await (0, report_service_1.postNotificationsOnFail)(uploadModel);
|
|
74
|
-
}
|
|
75
|
-
let url = this.defaultPage.url();
|
|
76
|
-
if (close)
|
|
77
|
-
await this.close();
|
|
78
|
-
await (0, report_hook_1.onTestEnd)(uploadModel, featureName, scenarioName, statusCode, screenshotBuffer, !errMessage ? undefined : {
|
|
79
|
-
currentPageUrl: url,
|
|
80
|
-
console: consoleStack,
|
|
81
|
-
error: errMessage
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
console.log("Lib error:", e);
|
|
86
|
-
}
|
|
87
|
-
finally {
|
|
88
|
-
log_service_1.default.clear();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
async runRPA(event, callback, close) {
|
|
92
|
-
let errMessage;
|
|
93
|
-
try {
|
|
94
|
-
if (close === undefined) {
|
|
95
|
-
if (event.queryStringParameters.close) {
|
|
96
|
-
close = event.queryStringParameters.close === "true";
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
close = true;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
let consoleStack = [];
|
|
103
|
-
try {
|
|
104
|
-
await log_service_1.default.push('When', `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
105
|
-
await this.startBrowser();
|
|
106
|
-
this.defaultPage.on('console', message => consoleStack.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
107
|
-
.on('pageerror', ({ message }) => consoleStack.push(message))
|
|
108
|
-
.on('response', response => consoleStack.push(`${response.status()} ${response.url()}`))
|
|
109
|
-
.on('requestfailed', request => consoleStack.push(`${request.failure() !== null ? request.failure()?.errorText : ""} ${request.url()}`));
|
|
110
|
-
await callback(event);
|
|
111
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
errMessage = err;
|
|
115
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
116
|
-
return errMessage;
|
|
117
|
-
}
|
|
118
|
-
if (close)
|
|
119
|
-
await this.close();
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
console.log("Lib error:", e);
|
|
123
|
-
}
|
|
124
|
-
finally {
|
|
125
|
-
log_service_1.default.clear();
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
static setupHeader(event, uploadModel) {
|
|
130
|
-
let close = true;
|
|
131
|
-
if (process.env.ENVIRONMENT !== 'LOCAL' && event.body) {
|
|
132
|
-
const body = JSON.parse(event.body);
|
|
133
|
-
uploadModel.reportId = body.reportId;
|
|
134
|
-
uploadModel.nextSuites = body.nextSuites;
|
|
135
|
-
}
|
|
136
|
-
else if (event.queryStringParameters.close) {
|
|
137
|
-
close = event.queryStringParameters.close === "true";
|
|
138
|
-
}
|
|
139
|
-
return close;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
exports.Puppeteer = Puppeteer;
|
|
143
|
-
exports.default = new Puppeteer();
|
package/build/esm/AuxTA.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Puppeteer } from "./puppeteer/puppeteer";
|
|
2
|
-
import { FunctionHelper } from "./macros/helpers/code.helper";
|
|
3
|
-
import StatusOfStep from "./auxta/enums/status-of.step";
|
|
4
|
-
import { UploadModel } from "./auxta/models/upload.model";
|
|
5
|
-
declare class AuxTA extends FunctionHelper {
|
|
6
|
-
puppeteer: Puppeteer;
|
|
7
|
-
config: {
|
|
8
|
-
auxtaURL: string;
|
|
9
|
-
baseURL: string;
|
|
10
|
-
siteURL: string;
|
|
11
|
-
organization: string;
|
|
12
|
-
netlifyPath: string;
|
|
13
|
-
digitalProduct: string;
|
|
14
|
-
token: string;
|
|
15
|
-
screenWidth: number;
|
|
16
|
-
screenHeight: number;
|
|
17
|
-
timeout: number;
|
|
18
|
-
suitesList: never[];
|
|
19
|
-
auxtaCredentials: {
|
|
20
|
-
email: string;
|
|
21
|
-
password: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
private readonly uploadModel;
|
|
25
|
-
constructor();
|
|
26
|
-
run(event: any, overrideConfig?: any): Promise<{
|
|
27
|
-
statusCode: number;
|
|
28
|
-
message: string;
|
|
29
|
-
} | {
|
|
30
|
-
statusCode: number;
|
|
31
|
-
message?: undefined;
|
|
32
|
-
}>;
|
|
33
|
-
private changeModelData;
|
|
34
|
-
startBrowser(event: any, callback: any, feature: string, scenario: string, overrideConfig?: any, singleFeature?: boolean): Promise<void | {
|
|
35
|
-
statusCode: number;
|
|
36
|
-
message: string;
|
|
37
|
-
}>;
|
|
38
|
-
startBrowserRPA(event: any, callback: any, baseURL: string): Promise<any>;
|
|
39
|
-
getUploadModel(): UploadModel;
|
|
40
|
-
}
|
|
41
|
-
export declare const StepStatus: typeof StatusOfStep;
|
|
42
|
-
declare const auxta: AuxTA;
|
|
43
|
-
export default auxta;
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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,20 +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
|
-
constructor(org: string, baseUrl: string, digitalProduct: string, environment: string);
|
|
9
|
-
get reportId(): string;
|
|
10
|
-
set reportId(value: string);
|
|
11
|
-
get nextSuites(): [];
|
|
12
|
-
set nextSuites(value: []);
|
|
13
|
-
get digitalProduct(): string;
|
|
14
|
-
set digitalProduct(value: string);
|
|
15
|
-
get organization(): string;
|
|
16
|
-
get baseUrl(): string;
|
|
17
|
-
set baseUrl(value: string);
|
|
18
|
-
get environment(): string;
|
|
19
|
-
set environment(value: string);
|
|
20
|
-
}
|
|
@@ -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,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,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,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 +0,0 @@
|
|
|
1
|
-
export declare function startSuite(suites: string[], reportId?: string): Promise<void>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { StatusOfStep } from "../../auxta/enums/status-of.step";
|
|
2
|
-
export declare class FunctionHelper {
|
|
3
|
-
readonly defaultTimeout: number;
|
|
4
|
-
log(keyword: string, name: string, status: StatusOfStep): void;
|
|
5
|
-
suggest(name: string): void;
|
|
6
|
-
private getEscapedText;
|
|
7
|
-
clickByText(selector: string, text: string, page?: import("puppeteer-core").Page, dotOrText?: string): Promise<void>;
|
|
8
|
-
clickByTextWithClass(class_selector: string, class_name: string, selector: string, text: string, page?: import("puppeteer-core").Page, dotOrText?: string): Promise<void>;
|
|
9
|
-
waitForSelectorWithText(selector: string, text: string, page?: import("puppeteer-core").Page, dotOrText?: string): Promise<boolean>;
|
|
10
|
-
goto(url: string, page?: import("puppeteer-core").Page): Promise<void>;
|
|
11
|
-
type(field: string, value: string, page?: import("puppeteer-core").Page): Promise<void>;
|
|
12
|
-
waitForNetwork(page?: import("puppeteer-core").Page): Promise<void>;
|
|
13
|
-
timeout(timeout?: number, page?: import("puppeteer-core").Page): Promise<void>;
|
|
14
|
-
waitForSelector(option: string, selector: string, time?: number, page?: import("puppeteer-core").Page, log_message?: boolean): Promise<void>;
|
|
15
|
-
click(selector: string, logMessages?: boolean, page?: import("puppeteer-core").Page): Promise<void>;
|
|
16
|
-
urlContains(selector: string, page?: import("puppeteer-core").Page): Promise<void>;
|
|
17
|
-
pressEnter(page?: import("puppeteer-core").Page): Promise<void>;
|
|
18
|
-
clickAndWaitForPageToBeCreated(selector: string, page?: import("puppeteer-core").Page): Promise<void>;
|
|
19
|
-
closeLastPage(page?: import("puppeteer-core").Page): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
declare const _default: FunctionHelper;
|
|
22
|
-
export default _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UploadModel } from "../auxta/models/upload.model";
|
|
2
|
-
import puppeteer_core from 'puppeteer-core';
|
|
3
|
-
export declare class Puppeteer {
|
|
4
|
-
defaultPage: puppeteer_core.Page;
|
|
5
|
-
private browser;
|
|
6
|
-
startBrowser(): Promise<void>;
|
|
7
|
-
close(): Promise<void>;
|
|
8
|
-
run(event: any, callback: any, featureName?: string, scenarioName?: string, uploadModel?: UploadModel, close?: boolean): Promise<void>;
|
|
9
|
-
runRPA(event: any, callback: any, close?: boolean): Promise<any>;
|
|
10
|
-
private static setupHeader;
|
|
11
|
-
}
|
|
12
|
-
declare const _default: Puppeteer;
|
|
13
|
-
export default _default;
|