@auxcode/auxta 1.3.24-beta.5 → 1.3.24
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 +93 -93
- package/build/cjs/AuxTA.d.ts +61 -60
- package/build/cjs/AuxTA.js +152 -150
- package/build/cjs/auxta/configs/config.d.ts +54 -54
- package/build/cjs/auxta/configs/config.js +65 -65
- package/build/cjs/auxta/enums/status-of.step.d.ts +7 -7
- package/build/cjs/auxta/enums/status-of.step.js +11 -11
- package/build/cjs/auxta/helpers/response.helper.d.ts +10 -10
- package/build/cjs/auxta/helpers/response.helper.js +15 -15
- package/build/cjs/auxta/helpers/start.helper.d.ts +1 -1
- package/build/cjs/auxta/helpers/start.helper.js +26 -26
- package/build/cjs/auxta/hooks/report.hook.d.ts +14 -14
- package/build/cjs/auxta/hooks/report.hook.js +66 -66
- package/build/cjs/auxta/models/upload.model.d.ts +32 -32
- package/build/cjs/auxta/models/upload.model.js +75 -75
- package/build/cjs/auxta/services/log.service.d.ts +26 -26
- package/build/cjs/auxta/services/log.service.js +47 -47
- package/build/cjs/auxta/services/report.service.d.ts +36 -36
- package/build/cjs/auxta/services/report.service.js +164 -164
- package/build/cjs/auxta/services/runtime.service.d.ts +16 -16
- package/build/cjs/auxta/services/runtime.service.js +41 -41
- package/build/cjs/auxta/utilities/runtime.helper.d.ts +15 -15
- package/build/cjs/auxta/utilities/runtime.helper.js +19 -19
- package/build/cjs/auxta/utilities/screenshot.helper.d.ts +2 -2
- package/build/cjs/auxta/utilities/screenshot.helper.js +36 -36
- package/build/cjs/auxta/utilities/start-suite.helper.d.ts +17 -17
- package/build/cjs/auxta/utilities/start-suite.helper.js +31 -31
- package/build/cjs/macros/helpers/Aux2faAuth.d.ts +7 -7
- package/build/cjs/macros/helpers/Aux2faAuth.js +29 -29
- package/build/cjs/macros/helpers/AuxGoogleAuth.d.ts +17 -13
- package/build/cjs/macros/helpers/AuxGoogleAuth.js +104 -104
- package/build/cjs/macros/helpers/code.helper.d.ts +21 -27
- package/build/cjs/macros/helpers/code.helper.js +201 -259
- package/build/cjs/macros/helpers/emailHelper.d.ts +23 -0
- package/build/cjs/macros/helpers/emailHelper.js +167 -0
- package/build/cjs/macros/helpers/extend-default-page.d.ts +6 -6
- package/build/cjs/macros/helpers/extend-default-page.js +89 -89
- package/build/cjs/puppeteer/puppeteer.d.ts +25 -25
- package/build/cjs/puppeteer/puppeteer.js +196 -194
- package/build/esm/AuxTA.d.ts +61 -60
- package/build/esm/AuxTA.js +123 -121
- package/build/esm/auxta/configs/config.d.ts +54 -54
- package/build/esm/auxta/configs/config.js +60 -60
- package/build/esm/auxta/enums/status-of.step.d.ts +7 -7
- package/build/esm/auxta/enums/status-of.step.js +8 -8
- package/build/esm/auxta/helpers/response.helper.d.ts +10 -10
- package/build/esm/auxta/helpers/response.helper.js +11 -11
- package/build/esm/auxta/helpers/start.helper.d.ts +1 -1
- package/build/esm/auxta/helpers/start.helper.js +24 -24
- package/build/esm/auxta/hooks/report.hook.d.ts +14 -14
- package/build/esm/auxta/hooks/report.hook.js +58 -58
- package/build/esm/auxta/models/upload.model.d.ts +32 -32
- package/build/esm/auxta/models/upload.model.js +71 -71
- package/build/esm/auxta/services/log.service.d.ts +26 -26
- package/build/esm/auxta/services/log.service.js +43 -43
- package/build/esm/auxta/services/report.service.d.ts +36 -36
- package/build/esm/auxta/services/report.service.js +150 -150
- package/build/esm/auxta/services/runtime.service.d.ts +16 -16
- package/build/esm/auxta/services/runtime.service.js +37 -37
- package/build/esm/auxta/utilities/runtime.helper.d.ts +15 -15
- package/build/esm/auxta/utilities/runtime.helper.js +15 -15
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +2 -2
- package/build/esm/auxta/utilities/screenshot.helper.js +29 -29
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +17 -17
- package/build/esm/auxta/utilities/start-suite.helper.js +26 -26
- package/build/esm/macros/helpers/Aux2faAuth.d.ts +7 -7
- package/build/esm/macros/helpers/Aux2faAuth.js +25 -25
- package/build/esm/macros/helpers/AuxGoogleAuth.d.ts +17 -13
- package/build/esm/macros/helpers/AuxGoogleAuth.js +100 -100
- package/build/esm/macros/helpers/code.helper.d.ts +21 -27
- package/build/esm/macros/helpers/code.helper.js +194 -252
- package/build/esm/macros/helpers/emailHelper.d.ts +23 -0
- package/build/esm/macros/helpers/emailHelper.js +160 -0
- package/build/esm/macros/helpers/extend-default-page.d.ts +6 -6
- package/build/esm/macros/helpers/extend-default-page.js +82 -82
- package/build/esm/puppeteer/puppeteer.d.ts +25 -25
- package/build/esm/puppeteer/puppeteer.js +188 -186
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -32
|
@@ -0,0 +1,167 @@
|
|
|
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.EmailHelper = void 0;
|
|
16
|
+
const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
|
|
17
|
+
const AuxGoogleAuth_1 = require("./AuxGoogleAuth");
|
|
18
|
+
const buffer_1 = require("buffer");
|
|
19
|
+
const AuxTA_1 = require("../../AuxTA");
|
|
20
|
+
const MailComposer = require('nodemailer/lib/mail-composer');
|
|
21
|
+
class EmailHelper {
|
|
22
|
+
verifyEmail(from_name, from_email, subject, body, link = false) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.setup();
|
|
25
|
+
const res = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.list({
|
|
26
|
+
userId: "me",
|
|
27
|
+
maxResults: 3
|
|
28
|
+
});
|
|
29
|
+
const messagesIds = res.data.messages;
|
|
30
|
+
if (!messagesIds || messagesIds.length === 0) {
|
|
31
|
+
throw new Error('No messagesIds found.');
|
|
32
|
+
}
|
|
33
|
+
let timeoutCount = 12000;
|
|
34
|
+
while (timeoutCount <= 60000) {
|
|
35
|
+
for (const messageId of messagesIds) {
|
|
36
|
+
if (messageId.id) {
|
|
37
|
+
const gmailResponse = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.get({
|
|
38
|
+
userId: "me",
|
|
39
|
+
id: messageId.id.toString(),
|
|
40
|
+
format: 'FULL'
|
|
41
|
+
});
|
|
42
|
+
if (gmailResponse.data.payload && gmailResponse.data.id && gmailResponse.data.threadId) {
|
|
43
|
+
const message_sender = this.getHeader('from', gmailResponse);
|
|
44
|
+
const message_subject = this.getHeader('subject', gmailResponse);
|
|
45
|
+
const message_body = this.getBody(subject, gmailResponse);
|
|
46
|
+
if (message_sender.toLocaleLowerCase().includes(from_email) && message_sender.toLocaleLowerCase().includes(from_name.toLocaleLowerCase()) &&
|
|
47
|
+
message_subject.toLocaleLowerCase().includes(subject.toLocaleLowerCase()) && message_body.toLocaleLowerCase().includes(body.toLocaleLowerCase())) {
|
|
48
|
+
log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.PASSED);
|
|
49
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.modify({
|
|
50
|
+
userId: "me",
|
|
51
|
+
id: gmailResponse.data.id,
|
|
52
|
+
requestBody: {
|
|
53
|
+
'addLabelIds': [],
|
|
54
|
+
'removeLabelIds': ['UNREAD']
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (link) {
|
|
58
|
+
const html_link = yield this.getUrl(message_body);
|
|
59
|
+
return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: html_link };
|
|
60
|
+
}
|
|
61
|
+
return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: undefined };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
yield new Promise(r => setTimeout(r, timeoutCount));
|
|
68
|
+
timeoutCount += 12000;
|
|
69
|
+
}
|
|
70
|
+
yield log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.FAILED);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
sendEmail(to, subject, body) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.setup();
|
|
76
|
+
const options = {
|
|
77
|
+
to: to,
|
|
78
|
+
from: this.getCurrentUserEmail(),
|
|
79
|
+
subject: subject,
|
|
80
|
+
html: body
|
|
81
|
+
};
|
|
82
|
+
yield EmailHelper.send(options);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
replyEmail(id, threadId, body) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.setup();
|
|
88
|
+
const gmailResponse = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.get({
|
|
89
|
+
userId: "me",
|
|
90
|
+
id: id,
|
|
91
|
+
format: 'FULL'
|
|
92
|
+
});
|
|
93
|
+
if (gmailResponse.data.payload) {
|
|
94
|
+
const message_subject = this.getHeader('subject', gmailResponse);
|
|
95
|
+
const message_messageID = this.getHeader('Message-ID', gmailResponse);
|
|
96
|
+
const reply_to = this.getHeader('reply-to', gmailResponse);
|
|
97
|
+
const options = {
|
|
98
|
+
to: reply_to,
|
|
99
|
+
from: this.getCurrentUserEmail(),
|
|
100
|
+
subject: `Re: ${message_subject}`,
|
|
101
|
+
references: message_messageID,
|
|
102
|
+
inReplyTo: [message_messageID],
|
|
103
|
+
html: body
|
|
104
|
+
};
|
|
105
|
+
yield EmailHelper.send(options, threadId);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
static send(options, threadId) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const mailComposer = new MailComposer(options);
|
|
112
|
+
const message = yield mailComposer.compile().build();
|
|
113
|
+
const encodeMessage = Buffer.from(message).toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
114
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.send({
|
|
115
|
+
userId: "me",
|
|
116
|
+
requestBody: {
|
|
117
|
+
threadId: threadId,
|
|
118
|
+
raw: encodeMessage
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
getHeader(value, headers) {
|
|
124
|
+
for (const header of headers.data.payload.headers) {
|
|
125
|
+
if (header.name.toLocaleLowerCase() === value.toLocaleLowerCase()) {
|
|
126
|
+
return header.value;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
getBody(subject, gmailResponse) {
|
|
131
|
+
const body = gmailResponse.data.payload.parts[0].body.data;
|
|
132
|
+
if (body) {
|
|
133
|
+
return (0, buffer_1.atob)(body);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw new Error(`Email with subject: ${subject} body is empty`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
getCurrentUserEmail() {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.setup();
|
|
142
|
+
const profile = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.getProfile({ userId: "me" });
|
|
143
|
+
return profile.data.emailAddress;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
getUrl(body) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const links = [];
|
|
149
|
+
const split = body.split('\r\n');
|
|
150
|
+
for (const splitElement of split) {
|
|
151
|
+
if (splitElement.toString().startsWith('https')) {
|
|
152
|
+
links.push(splitElement);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (links.length > 1) {
|
|
156
|
+
return links.sort(function (a, b) {
|
|
157
|
+
return b.length - a.length;
|
|
158
|
+
})[0];
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return links[0];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.EmailHelper = EmailHelper;
|
|
167
|
+
exports.default = new EmailHelper();
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
+
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 +1,89 @@
|
|
|
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();
|
|
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();
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { UploadModel } from "../auxta/models/upload.model";
|
|
2
|
-
import puppeteer = require("puppeteer");
|
|
3
|
-
export declare class Puppeteer {
|
|
4
|
-
defaultPage: puppeteer.Page;
|
|
5
|
-
private browser;
|
|
6
|
-
startBrowser(): Promise<void>;
|
|
7
|
-
close(): Promise<void>;
|
|
8
|
-
run(event: any, callback: any, featureName?: string, scenarioName?: string, uploadModel?: UploadModel): Promise<{
|
|
9
|
-
nextSuites?: undefined;
|
|
10
|
-
reportId?: undefined;
|
|
11
|
-
currentSuite?: undefined;
|
|
12
|
-
retries?: undefined;
|
|
13
|
-
} | {
|
|
14
|
-
nextSuites: string[];
|
|
15
|
-
reportId: string | undefined;
|
|
16
|
-
currentSuite: string | undefined;
|
|
17
|
-
retries: string;
|
|
18
|
-
} | {
|
|
19
|
-
statusCode: number;
|
|
20
|
-
} | undefined>;
|
|
21
|
-
runRPA(event: any, callback: any, uploadModel?: UploadModel, close?: boolean): Promise<any>;
|
|
22
|
-
private static setupHeader;
|
|
23
|
-
}
|
|
24
|
-
declare const _default: Puppeteer;
|
|
25
|
-
export default _default;
|
|
1
|
+
import { UploadModel } from "../auxta/models/upload.model";
|
|
2
|
+
import puppeteer = require("puppeteer");
|
|
3
|
+
export declare class Puppeteer {
|
|
4
|
+
defaultPage: puppeteer.Page;
|
|
5
|
+
private browser;
|
|
6
|
+
startBrowser(): Promise<void>;
|
|
7
|
+
close(): Promise<void>;
|
|
8
|
+
run(event: any, callback: any, featureName?: string, scenarioName?: string, uploadModel?: UploadModel): Promise<{
|
|
9
|
+
nextSuites?: undefined;
|
|
10
|
+
reportId?: undefined;
|
|
11
|
+
currentSuite?: undefined;
|
|
12
|
+
retries?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
nextSuites: string[];
|
|
15
|
+
reportId: string | undefined;
|
|
16
|
+
currentSuite: string | undefined;
|
|
17
|
+
retries: string;
|
|
18
|
+
} | {
|
|
19
|
+
statusCode: number;
|
|
20
|
+
} | undefined>;
|
|
21
|
+
runRPA(event: any, callback: any, uploadModel?: UploadModel, close?: boolean): Promise<any>;
|
|
22
|
+
private static setupHeader;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: Puppeteer;
|
|
25
|
+
export default _default;
|