@auxcode/auxta 1.3.96 → 1.3.98
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/auxta/hooks/report.hook.js +1 -1
- package/build/auxta/services/log.service.d.ts +5 -1
- package/build/auxta/services/log.service.js +14 -3
- package/build/auxta/services/report.service.d.ts +1 -1
- package/build/auxta/services/report.service.js +1 -1
- package/build/auxta/utilities/screenshot.helper.js +5 -5
- package/build/macros/helpers/code.helper.d.ts +2 -0
- package/build/macros/helpers/code.helper.js +21 -15
- package/build/macros/helpers/emailHelper.js +4 -4
- package/build/macros/helpers/extend-default-page.js +7 -7
- package/build/puppeteer/puppeteer.js +6 -6
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer
|
|
|
33
33
|
scenarioUri: scenarioRes.uri,
|
|
34
34
|
status: scenarioRes.status,
|
|
35
35
|
scenariosCount: scenarioRes.scenariosCount,
|
|
36
|
-
|
|
36
|
+
lastTag: scenarioRes.lastTag
|
|
37
37
|
};
|
|
38
38
|
const stepCounts = {
|
|
39
39
|
failedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.FAILED),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StatusOfStep } from "../enums/status-of.step";
|
|
2
2
|
export interface Step {
|
|
3
3
|
keyword: string;
|
|
4
|
+
tag: string;
|
|
4
5
|
name: string;
|
|
5
6
|
imageCompareKey: string;
|
|
6
7
|
result: {
|
|
@@ -22,12 +23,15 @@ export declare class LogSteps {
|
|
|
22
23
|
};
|
|
23
24
|
private stepLog;
|
|
24
25
|
private lastStepTime;
|
|
26
|
+
private _tag;
|
|
25
27
|
addSuggestion(text: string): void;
|
|
26
28
|
addPerformanceFail(text: string, screenshot?: ArrayBuffer): void;
|
|
27
29
|
clear(): void;
|
|
28
|
-
push(keyword: string, name: string, status: StatusOfStep, screenshot?: ArrayBuffer, imageCompareKey?: string): void;
|
|
30
|
+
push(keyword: string, tag: string, name: string, status: StatusOfStep, screenshot?: ArrayBuffer, imageCompareKey?: string): void;
|
|
29
31
|
returnScenarioReport(): Step[];
|
|
30
32
|
getStatusCount(status: StatusOfStep): number;
|
|
33
|
+
get tag(): string;
|
|
34
|
+
set tag(value: string);
|
|
31
35
|
}
|
|
32
36
|
declare const log: LogSteps;
|
|
33
37
|
export default log;
|
|
@@ -13,11 +13,12 @@ class LogSteps {
|
|
|
13
13
|
};
|
|
14
14
|
this.stepLog = [];
|
|
15
15
|
this.lastStepTime = new Date().getTime();
|
|
16
|
+
this._tag = 'default';
|
|
16
17
|
}
|
|
17
18
|
addSuggestion(text) {
|
|
18
19
|
this.statusCounter[status_of_step_1.StatusOfStep.SUGGESTION]++;
|
|
19
20
|
this.stepLog.push({
|
|
20
|
-
keyword: 'Suggestion', name: text, imageCompareKey: '', result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
|
|
21
|
+
keyword: 'Suggestion', tag: this._tag, name: text, imageCompareKey: '', result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
addPerformanceFail(text, screenshot = new ArrayBuffer(0)) {
|
|
@@ -30,6 +31,7 @@ class LogSteps {
|
|
|
30
31
|
};
|
|
31
32
|
this.stepLog.push({
|
|
32
33
|
keyword: 'PerformanceFail',
|
|
34
|
+
tag: this._tag,
|
|
33
35
|
name: text,
|
|
34
36
|
imageCompareKey: '',
|
|
35
37
|
result: { status: status_of_step_1.StatusOfStep.PERFORMANCE_FAIL, duration: currentStep - this.lastStepTime, embedding: embedding }
|
|
@@ -38,6 +40,7 @@ class LogSteps {
|
|
|
38
40
|
else {
|
|
39
41
|
this.stepLog.push({
|
|
40
42
|
keyword: 'PerformanceFail',
|
|
43
|
+
tag: this._tag,
|
|
41
44
|
name: text,
|
|
42
45
|
imageCompareKey: '',
|
|
43
46
|
result: { status: status_of_step_1.StatusOfStep.PERFORMANCE_FAIL, duration: currentStep - this.lastStepTime }
|
|
@@ -55,8 +58,8 @@ class LogSteps {
|
|
|
55
58
|
[status_of_step_1.StatusOfStep.PERFORMANCE_FAIL]: 0
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
|
-
push(keyword, name, status, screenshot = new ArrayBuffer(0), imageCompareKey = '') {
|
|
59
|
-
console.log(`System log -- status: ${status} -- : ${name} `);
|
|
61
|
+
push(keyword, tag, name, status, screenshot = new ArrayBuffer(0), imageCompareKey = '') {
|
|
62
|
+
console.log(`System log -- status: ${status} -- tag: ${tag} -- : ${name} `);
|
|
60
63
|
this.statusCounter[status]++;
|
|
61
64
|
const currentStep = new Date().getTime();
|
|
62
65
|
if (screenshot.byteLength != 0) {
|
|
@@ -66,6 +69,7 @@ class LogSteps {
|
|
|
66
69
|
};
|
|
67
70
|
this.stepLog.push({
|
|
68
71
|
keyword,
|
|
72
|
+
tag,
|
|
69
73
|
name,
|
|
70
74
|
imageCompareKey,
|
|
71
75
|
result: { status, duration: currentStep - this.lastStepTime, embedding: embedding }
|
|
@@ -74,6 +78,7 @@ class LogSteps {
|
|
|
74
78
|
else {
|
|
75
79
|
this.stepLog.push({
|
|
76
80
|
keyword,
|
|
81
|
+
tag,
|
|
77
82
|
name,
|
|
78
83
|
imageCompareKey,
|
|
79
84
|
result: { status, duration: currentStep - this.lastStepTime }
|
|
@@ -87,6 +92,12 @@ class LogSteps {
|
|
|
87
92
|
getStatusCount(status) {
|
|
88
93
|
return this.statusCounter[status];
|
|
89
94
|
}
|
|
95
|
+
get tag() {
|
|
96
|
+
return this._tag;
|
|
97
|
+
}
|
|
98
|
+
set tag(value) {
|
|
99
|
+
this._tag = value;
|
|
100
|
+
}
|
|
90
101
|
}
|
|
91
102
|
exports.LogSteps = LogSteps;
|
|
92
103
|
const log = new LogSteps();
|
|
@@ -132,7 +132,7 @@ function updateReport(reportId, scenario, steps, isFinal) {
|
|
|
132
132
|
uri: scenario.scenarioUri,
|
|
133
133
|
status: scenario.status,
|
|
134
134
|
scenariosCount: scenario.scenariosCount,
|
|
135
|
-
|
|
135
|
+
lastTag: scenario.lastTag
|
|
136
136
|
} }, steps)
|
|
137
137
|
}, headers(token));
|
|
138
138
|
});
|
|
@@ -38,7 +38,7 @@ function captureScreenshot() {
|
|
|
38
38
|
}
|
|
39
39
|
catch (e) {
|
|
40
40
|
if (count == RETRY_NUMBERS) {
|
|
41
|
-
log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
|
|
41
|
+
log_service_1.default.push('When', log_service_1.default.tag, e.toString(), status_of_step_1.default.FAILED);
|
|
42
42
|
return undefined;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -54,13 +54,13 @@ function captureScreenshot() {
|
|
|
54
54
|
encoding: 'binary'
|
|
55
55
|
});
|
|
56
56
|
if (Buffer.isBuffer(screenshotBuffer)) {
|
|
57
|
-
log_service_1.default.push("When", `${i} Image`, status_of_step_1.default.FAILED, screenshotBuffer);
|
|
57
|
+
log_service_1.default.push("When", log_service_1.default.tag, `${i} Image`, status_of_step_1.default.FAILED, screenshotBuffer);
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
catch (e) {
|
|
62
62
|
if (count == RETRY_NUMBERS) {
|
|
63
|
-
log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
|
|
63
|
+
log_service_1.default.push('When', log_service_1.default.tag, e.toString(), status_of_step_1.default.FAILED);
|
|
64
64
|
return undefined;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -78,7 +78,7 @@ function captureScreenshotPage(page) {
|
|
|
78
78
|
while (count <= RETRY_NUMBERS) {
|
|
79
79
|
try {
|
|
80
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);
|
|
81
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Before the screenshot the number of pages are ${pages.length}`, status_of_step_1.default.PASSED);
|
|
82
82
|
const screenshotBuffer = yield page.screenshot({
|
|
83
83
|
fullPage: true,
|
|
84
84
|
captureBeyondViewport: false,
|
|
@@ -89,7 +89,7 @@ function captureScreenshotPage(page) {
|
|
|
89
89
|
}
|
|
90
90
|
catch (e) {
|
|
91
91
|
if (count == RETRY_NUMBERS) {
|
|
92
|
-
log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
|
|
92
|
+
log_service_1.default.push('When', log_service_1.default.tag, e.toString(), status_of_step_1.default.FAILED);
|
|
93
93
|
return undefined;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -5,6 +5,8 @@ import { CDPSession } from "puppeteer";
|
|
|
5
5
|
export declare class FunctionHelper extends ExtendDefaultPage {
|
|
6
6
|
cdp: CDPSession | undefined;
|
|
7
7
|
log(keyword: string, name: string, status: StatusOfStep, screenshot?: ArrayBuffer): void;
|
|
8
|
+
setTag(tag: string): void;
|
|
9
|
+
clearTag(): void;
|
|
8
10
|
screenshot(page?: import("puppeteer").Page): Promise<Buffer | undefined>;
|
|
9
11
|
screenshotCompare(key: string, threshold?: number, page?: import("puppeteer").Page): Promise<void>;
|
|
10
12
|
suggest(name: string): void;
|
|
@@ -23,7 +23,13 @@ const screenshot_helper_1 = require("../../auxta/utilities/screenshot.helper");
|
|
|
23
23
|
const report_service_1 = require("../../auxta/services/report.service");
|
|
24
24
|
class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
25
25
|
log(keyword, name, status, screenshot) {
|
|
26
|
-
log_service_1.default.push(keyword, name, status, screenshot);
|
|
26
|
+
log_service_1.default.push(keyword, log_service_1.default.tag, name, status, screenshot);
|
|
27
|
+
}
|
|
28
|
+
setTag(tag) {
|
|
29
|
+
log_service_1.default.tag = tag;
|
|
30
|
+
}
|
|
31
|
+
clearTag() {
|
|
32
|
+
log_service_1.default.tag = '';
|
|
27
33
|
}
|
|
28
34
|
screenshot(page = puppeteer_1.default.defaultPage) {
|
|
29
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41,15 +47,15 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
41
47
|
const screenshot = screenshotBuffer;
|
|
42
48
|
const result = yield (0, report_service_1.compareScreenshots)(key, screenshot);
|
|
43
49
|
if (result.presentDifference && Number(result.presentDifference) > threshold) {
|
|
44
|
-
log_service_1.default.push('Then', `I compare screenshots with key ${key}, and difference is: ${result.presentDifference}%`, status_of_step_1.StatusOfStep.FAILED, screenshot, key);
|
|
50
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `I compare screenshots with key ${key}, and difference is: ${result.presentDifference}%`, status_of_step_1.StatusOfStep.FAILED, screenshot, key);
|
|
45
51
|
}
|
|
46
52
|
else {
|
|
47
|
-
log_service_1.default.push('Then', `I compare screenshots with key ${key}`, status_of_step_1.StatusOfStep.PASSED, screenshot, key);
|
|
53
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `I compare screenshots with key ${key}`, status_of_step_1.StatusOfStep.PASSED, screenshot, key);
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
else {
|
|
52
|
-
log_service_1.default.push('Then', `I compare screenshots with key ${key}`, status_of_step_1.StatusOfStep.PASSED, undefined, key);
|
|
58
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `I compare screenshots with key ${key}`, status_of_step_1.StatusOfStep.PASSED, undefined, key);
|
|
53
59
|
}
|
|
54
60
|
});
|
|
55
61
|
}
|
|
@@ -74,17 +80,17 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
74
80
|
const [linkHandlers] = yield page.$$(`xpath/.//${selector}[contains(${dotOrText},"${text}")]`);
|
|
75
81
|
if (linkHandlers) {
|
|
76
82
|
yield linkHandlers.click(options);
|
|
77
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
83
|
+
log_service_1.default.push('Then', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.PASSED);
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
86
|
catch (e) {
|
|
81
87
|
if (log_message) {
|
|
82
|
-
log_service_1.default.push('And', `${message}, but it didn't appear in ${time / 1000} seconds.`, status_of_step_1.StatusOfStep.FAILED);
|
|
88
|
+
log_service_1.default.push('And', log_service_1.default.tag, `${message}, but it didn't appear in ${time / 1000} seconds.`, status_of_step_1.StatusOfStep.FAILED);
|
|
83
89
|
}
|
|
84
90
|
throw new Error(message);
|
|
85
91
|
}
|
|
86
92
|
if (log_message) {
|
|
87
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
93
|
+
log_service_1.default.push('And', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.PASSED);
|
|
88
94
|
}
|
|
89
95
|
});
|
|
90
96
|
}
|
|
@@ -95,13 +101,13 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
95
101
|
const [linkHandlers] = yield page.$$(`xpath/.//${class_selector}[contains(@class,${this.getEscapedText(class_name)})]//${selector}[contains(${dotOrText},"${text}")]`);
|
|
96
102
|
if (linkHandlers) {
|
|
97
103
|
yield linkHandlers.click();
|
|
98
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
104
|
+
log_service_1.default.push('Then', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.PASSED);
|
|
99
105
|
return;
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
catch (e) {
|
|
103
109
|
}
|
|
104
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
|
|
110
|
+
log_service_1.default.push('Then', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.FAILED);
|
|
105
111
|
throw new Error(message);
|
|
106
112
|
});
|
|
107
113
|
}
|
|
@@ -114,13 +120,13 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
114
120
|
});
|
|
115
121
|
const linkHandlers = yield page.$$(`xpath/.//${selector}[contains(${dotOrText},"${text}")]`);
|
|
116
122
|
if (linkHandlers.length > 0) {
|
|
117
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
123
|
+
log_service_1.default.push('And', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.PASSED);
|
|
118
124
|
return true;
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
catch (e) {
|
|
122
128
|
}
|
|
123
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.FAILED);
|
|
129
|
+
log_service_1.default.push('And', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.FAILED);
|
|
124
130
|
throw new Error(message);
|
|
125
131
|
});
|
|
126
132
|
}
|
|
@@ -140,12 +146,12 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
140
146
|
}
|
|
141
147
|
catch (e) {
|
|
142
148
|
if (log_message) {
|
|
143
|
-
log_service_1.default.push('And', `${message}, but it didn't appear in ${time / 1000} seconds.`, status_of_step_1.StatusOfStep.FAILED);
|
|
149
|
+
log_service_1.default.push('And', log_service_1.default.tag, `${message}, but it didn't appear in ${time / 1000} seconds.`, status_of_step_1.StatusOfStep.FAILED);
|
|
144
150
|
}
|
|
145
151
|
throw new Error(message);
|
|
146
152
|
}
|
|
147
153
|
if (log_message) {
|
|
148
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
154
|
+
log_service_1.default.push('And', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.PASSED);
|
|
149
155
|
}
|
|
150
156
|
});
|
|
151
157
|
}
|
|
@@ -154,10 +160,10 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
154
160
|
const url = page.url();
|
|
155
161
|
let message = `I am on the ${selector} page`;
|
|
156
162
|
if (!url.includes(selector)) {
|
|
157
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.FAILED);
|
|
163
|
+
log_service_1.default.push('And', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.FAILED);
|
|
158
164
|
throw new Error(message);
|
|
159
165
|
}
|
|
160
|
-
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
166
|
+
log_service_1.default.push('And', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.PASSED);
|
|
161
167
|
});
|
|
162
168
|
}
|
|
163
169
|
forceState(selector, state, index = 0, page = puppeteer_1.default.defaultPage) {
|
|
@@ -20,13 +20,13 @@ class EmailHelper {
|
|
|
20
20
|
verifyEmail(from_name, from_email, subject, body, link = false) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
try {
|
|
23
|
-
log_service_1.default.push('Then', `waiting 35 seconds`, AuxTA_1.StepStatus.PASSED);
|
|
23
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `waiting 35 seconds`, AuxTA_1.StepStatus.PASSED);
|
|
24
24
|
yield new Promise(r => setTimeout(r, 35000));
|
|
25
25
|
let timeoutCount = 12000;
|
|
26
26
|
while (timeoutCount <= 60000) {
|
|
27
27
|
try {
|
|
28
28
|
const links = yield (0, report_service_1.getVerifyReceivedEmail)(from_name, from_email, subject, body, link);
|
|
29
|
-
log_service_1.default.push('Then', `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.PASSED);
|
|
29
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.PASSED);
|
|
30
30
|
if (links) {
|
|
31
31
|
return {
|
|
32
32
|
link: links.data.link
|
|
@@ -38,11 +38,11 @@ class EmailHelper {
|
|
|
38
38
|
}
|
|
39
39
|
catch (e) {
|
|
40
40
|
}
|
|
41
|
-
log_service_1.default.push('Then', `Failed two get the email with the given criteria and waiting 12 seconds`, AuxTA_1.StepStatus.PASSED);
|
|
41
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `Failed two get the email with the given criteria and waiting 12 seconds`, AuxTA_1.StepStatus.PASSED);
|
|
42
42
|
yield new Promise(r => setTimeout(r, timeoutCount));
|
|
43
43
|
timeoutCount += 12000;
|
|
44
44
|
}
|
|
45
|
-
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);
|
|
45
|
+
yield log_service_1.default.push('Then', log_service_1.default.tag, `Email from: ${from_name} ${from_email} with subject: ${subject} and body: ${body} is found`, AuxTA_1.StepStatus.FAILED);
|
|
46
46
|
}
|
|
47
47
|
catch (e) {
|
|
48
48
|
throw new Error(e);
|
|
@@ -25,7 +25,7 @@ class ExtendDefaultPage {
|
|
|
25
25
|
this.defaultTimeout = config_1.config.timeout;
|
|
26
26
|
const { goto: original_goto, click: original_click, type: original_type, waitForNetworkIdle: original_waitForNetworkIdle } = page;
|
|
27
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);
|
|
28
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `I go to the '${url}' page`, status_of_step_1.StatusOfStep.PASSED);
|
|
29
29
|
return original_goto.apply(page, arguments);
|
|
30
30
|
};
|
|
31
31
|
page.click = function click(selector, options) {
|
|
@@ -38,11 +38,11 @@ class ExtendDefaultPage {
|
|
|
38
38
|
if (!elementName || elementName === ' ')
|
|
39
39
|
elementName = selector;
|
|
40
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);
|
|
41
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `I click on the '${elementName}'`, status_of_step_1.StatusOfStep.PASSED);
|
|
42
42
|
}
|
|
43
43
|
catch (e) {
|
|
44
44
|
const msg = `I click on the '${selector}'`;
|
|
45
|
-
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
45
|
+
log_service_1.default.push('Then', log_service_1.default.tag, msg, status_of_step_1.StatusOfStep.FAILED);
|
|
46
46
|
throw new Error(msg);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -53,10 +53,10 @@ class ExtendDefaultPage {
|
|
|
53
53
|
let result;
|
|
54
54
|
try {
|
|
55
55
|
result = yield original_waitForNetworkIdle.apply(page, arguments);
|
|
56
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
56
|
+
log_service_1.default.push('Then', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.PASSED);
|
|
57
57
|
}
|
|
58
58
|
catch (e) {
|
|
59
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
|
|
59
|
+
log_service_1.default.push('Then', log_service_1.default.tag, message, status_of_step_1.StatusOfStep.FAILED);
|
|
60
60
|
throw new Error(message);
|
|
61
61
|
}
|
|
62
62
|
return result;
|
|
@@ -72,11 +72,11 @@ class ExtendDefaultPage {
|
|
|
72
72
|
let elementName = yield page.$eval(field, (e) => e.textContent);
|
|
73
73
|
if (!elementName || elementName === ' ')
|
|
74
74
|
elementName = field;
|
|
75
|
-
log_service_1.default.push('Then', `I type '${value}' into the '${elementName}' field`, status_of_step_1.StatusOfStep.PASSED);
|
|
75
|
+
log_service_1.default.push('Then', log_service_1.default.tag, `I type '${value}' into the '${elementName}' field`, status_of_step_1.StatusOfStep.PASSED);
|
|
76
76
|
}
|
|
77
77
|
catch (e) {
|
|
78
78
|
const msg = `I type '${value}' into the '${field}' field`;
|
|
79
|
-
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
79
|
+
log_service_1.default.push('Then', log_service_1.default.tag, msg, status_of_step_1.StatusOfStep.FAILED);
|
|
80
80
|
throw new Error(msg);
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -97,14 +97,14 @@ class Puppeteer {
|
|
|
97
97
|
let consoleMessage = [];
|
|
98
98
|
let httpsMessage = [];
|
|
99
99
|
try {
|
|
100
|
-
log_service_1.default.push('When', `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
100
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
101
101
|
yield this.startBrowser();
|
|
102
102
|
this.defaultPage.on('console', (message) => consoleMessage.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
103
103
|
.on('pageerror', ({ message }) => consoleMessage.push(message))
|
|
104
104
|
.on('response', (response) => httpsMessage.push(`${response.status()} ${response.url()}`))
|
|
105
105
|
.on('requestfailed', (request) => { var _a; return httpsMessage.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
106
106
|
yield callback(event);
|
|
107
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
107
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
108
108
|
}
|
|
109
109
|
catch (err) {
|
|
110
110
|
console.log("Error message: \n", err);
|
|
@@ -127,7 +127,7 @@ class Puppeteer {
|
|
|
127
127
|
errMessage = err;
|
|
128
128
|
statusCode = 500;
|
|
129
129
|
screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshot)();
|
|
130
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
130
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
131
131
|
yield (0, report_service_1.postNotificationsOnFail)(uploadModel);
|
|
132
132
|
}
|
|
133
133
|
let url = this.defaultPage.url();
|
|
@@ -172,14 +172,14 @@ class Puppeteer {
|
|
|
172
172
|
}
|
|
173
173
|
let consoleStack = [];
|
|
174
174
|
try {
|
|
175
|
-
yield log_service_1.default.push('When', `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
175
|
+
yield log_service_1.default.push('When', log_service_1.default.tag, `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
176
176
|
yield this.startBrowser();
|
|
177
177
|
this.defaultPage.on('console', (message) => consoleStack.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
178
178
|
.on('pageerror', ({ message }) => consoleStack.push(message))
|
|
179
179
|
.on('response', (response) => consoleStack.push(`${response.status()} ${response.url()}`))
|
|
180
180
|
.on('requestfailed', (request) => { var _a; return consoleStack.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
181
181
|
yield callback(event);
|
|
182
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
182
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
183
183
|
}
|
|
184
184
|
catch (err) {
|
|
185
185
|
console.log("Error message: \n", err);
|
|
@@ -189,7 +189,7 @@ class Puppeteer {
|
|
|
189
189
|
return { statusCode: 204 };
|
|
190
190
|
}
|
|
191
191
|
errMessage = err;
|
|
192
|
-
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
192
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
193
193
|
return errMessage;
|
|
194
194
|
}
|
|
195
195
|
if (close)
|