@auxcode/auxta 1.3.66 → 1.3.67
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.
|
@@ -18,22 +18,28 @@ const log_service_1 = __importDefault(require("../services/log.service"));
|
|
|
18
18
|
const status_of_step_1 = __importDefault(require("../enums/status-of.step"));
|
|
19
19
|
function captureScreenshot() {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
let count = 0;
|
|
22
|
+
while (count <= 10) {
|
|
23
|
+
try {
|
|
24
|
+
const pages = yield puppeteer_1.default.defaultPage.browser().pages();
|
|
25
|
+
if (!pages.length)
|
|
26
|
+
return undefined;
|
|
27
|
+
const lastPage = pages[pages.length - 1] || puppeteer_1.default.defaultPage;
|
|
28
|
+
const screenshotBuffer = yield lastPage.screenshot({
|
|
29
|
+
fullPage: true,
|
|
30
|
+
captureBeyondViewport: false,
|
|
31
|
+
encoding: 'binary'
|
|
32
|
+
});
|
|
33
|
+
if (Buffer.isBuffer(screenshotBuffer))
|
|
34
|
+
return screenshotBuffer;
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
if (count == 10) {
|
|
38
|
+
log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
count++;
|
|
37
43
|
}
|
|
38
44
|
return undefined;
|
|
39
45
|
});
|
|
@@ -37,58 +37,57 @@ class EmailHelper {
|
|
|
37
37
|
if (!messagesIds || messagesIds.length === 0) {
|
|
38
38
|
throw new Error('No messagesIds found.');
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
let count = 0;
|
|
40
|
+
log_service_1.default.push('Then', `Getting the full details of the emails`, AuxTA_1.StepStatus.PASSED);
|
|
42
41
|
for (const messageId of messagesIds) {
|
|
43
42
|
if (messageId.id) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.modify({
|
|
69
|
-
userId: "me",
|
|
70
|
-
id: gmailResponse.data.id,
|
|
71
|
-
requestBody: {
|
|
72
|
-
'addLabelIds': [],
|
|
73
|
-
'removeLabelIds': ['UNREAD']
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
log_service_1.default.push('Then', `I got modify email`, AuxTA_1.StepStatus.PASSED);
|
|
77
|
-
if (link) {
|
|
78
|
-
const html_link = yield this.getUrl(message_body);
|
|
79
|
-
log_service_1.default.push('Then', `I get html lik`, AuxTA_1.StepStatus.PASSED);
|
|
80
|
-
yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.delete({
|
|
43
|
+
let gmailResponse;
|
|
44
|
+
try {
|
|
45
|
+
gmailResponse = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.get({
|
|
46
|
+
userId: "me",
|
|
47
|
+
id: messageId.id.toString(),
|
|
48
|
+
format: 'FULL'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (gmailResponse) {
|
|
55
|
+
log_service_1.default.push('Then', `I check payload && id && threadId`, AuxTA_1.StepStatus.PASSED);
|
|
56
|
+
if (gmailResponse.data.payload && gmailResponse.data.id && gmailResponse.data.threadId) {
|
|
57
|
+
const message_sender = this.getHeader('from', gmailResponse);
|
|
58
|
+
log_service_1.default.push('Then', `I got message_sender`, AuxTA_1.StepStatus.PASSED);
|
|
59
|
+
const message_subject = this.getHeader('subject', gmailResponse);
|
|
60
|
+
log_service_1.default.push('Then', `I got message_body`, AuxTA_1.StepStatus.PASSED);
|
|
61
|
+
const message_body = this.getBody(subject, gmailResponse);
|
|
62
|
+
log_service_1.default.push('Then', `I got message_body`, AuxTA_1.StepStatus.PASSED);
|
|
63
|
+
if (message_sender.toLocaleLowerCase().includes(from_email) && message_sender.toLocaleLowerCase().includes(from_name.toLocaleLowerCase()) &&
|
|
64
|
+
message_subject.toLocaleLowerCase().includes(subject.toLocaleLowerCase()) && message_body.toLocaleLowerCase().includes(body.toLocaleLowerCase())) {
|
|
65
|
+
log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.PASSED);
|
|
66
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.modify({
|
|
81
67
|
userId: "me",
|
|
82
68
|
id: gmailResponse.data.id,
|
|
69
|
+
requestBody: {
|
|
70
|
+
'addLabelIds': [],
|
|
71
|
+
'removeLabelIds': ['UNREAD']
|
|
72
|
+
}
|
|
83
73
|
});
|
|
84
|
-
log_service_1.default.push('Then', `I
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
74
|
+
log_service_1.default.push('Then', `I got modify email`, AuxTA_1.StepStatus.PASSED);
|
|
75
|
+
if (link) {
|
|
76
|
+
const html_link = yield this.getUrl(message_body);
|
|
77
|
+
log_service_1.default.push('Then', `I get html lik`, AuxTA_1.StepStatus.PASSED);
|
|
78
|
+
yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.delete({
|
|
79
|
+
userId: "me",
|
|
80
|
+
id: gmailResponse.data.id,
|
|
81
|
+
});
|
|
82
|
+
log_service_1.default.push('Then', `I deleted email`, AuxTA_1.StepStatus.PASSED);
|
|
83
|
+
return {
|
|
84
|
+
id: gmailResponse.data.id,
|
|
85
|
+
threadId: gmailResponse.data.threadId,
|
|
86
|
+
link: html_link
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: '' };
|
|
90
90
|
}
|
|
91
|
-
return { id: gmailResponse.data.id, threadId: gmailResponse.data.threadId, link: '' };
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
}
|
|
@@ -42,7 +42,6 @@ class Puppeteer {
|
|
|
42
42
|
this.browser = yield puppeteer.default.launch({
|
|
43
43
|
slowMo: process.env.slowMo ? Number(process.env.slowMo) : 0,
|
|
44
44
|
executablePath: puppeteer.default.executablePath(),
|
|
45
|
-
protocolTimeout: 50000,
|
|
46
45
|
args,
|
|
47
46
|
env,
|
|
48
47
|
ignoreDefaultArgs: ["--enable-automation"],
|