@auxcode/auxta 1.3.85 → 1.3.87
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/helpers/response.helper.d.ts +1 -1
- package/build/auxta/helpers/response.helper.js +1 -1
- package/build/auxta/services/log.service.d.ts +2 -2
- package/build/auxta/services/log.service.js +2 -2
- 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 +1 -1
- package/build/macros/helpers/code.helper.d.ts +4 -2
- package/build/macros/helpers/code.helper.js +17 -3
- package/package.json +4 -4
|
@@ -7,7 +7,7 @@ export interface Step {
|
|
|
7
7
|
status: StatusOfStep;
|
|
8
8
|
duration: number;
|
|
9
9
|
embedding?: {
|
|
10
|
-
data:
|
|
10
|
+
data: ArrayBuffer;
|
|
11
11
|
mime_type: string;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
@@ -23,7 +23,7 @@ export declare class LogSteps {
|
|
|
23
23
|
private lastStepTime;
|
|
24
24
|
addSuggestion(text: string): void;
|
|
25
25
|
clear(): void;
|
|
26
|
-
push(keyword: string, name: string, status: StatusOfStep, screenshot?:
|
|
26
|
+
push(keyword: string, name: string, status: StatusOfStep, screenshot?: ArrayBuffer, imageCompareKey?: string): void;
|
|
27
27
|
returnScenarioReport(): Step[];
|
|
28
28
|
getStatusCount(status: StatusOfStep): number;
|
|
29
29
|
}
|
|
@@ -28,11 +28,11 @@ class LogSteps {
|
|
|
28
28
|
[status_of_step_1.StatusOfStep.SUGGESTION]: 0,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
push(keyword, name, status, screenshot =
|
|
31
|
+
push(keyword, name, status, screenshot = new ArrayBuffer(0), imageCompareKey = '') {
|
|
32
32
|
console.log(`System log -- status: ${status} -- : ${name} `);
|
|
33
33
|
this.statusCounter[status]++;
|
|
34
34
|
const currentStep = new Date().getTime();
|
|
35
|
-
if (screenshot !=
|
|
35
|
+
if (screenshot.byteLength != 0) {
|
|
36
36
|
const embedding = {
|
|
37
37
|
data: screenshot,
|
|
38
38
|
mime_type: "image/png"
|
|
@@ -26,7 +26,7 @@ export declare function uploadScenario(stepRes: any[], scenarioName: string, uri
|
|
|
26
26
|
export declare function updateReport(reportId: string, scenario: Scenarios, steps: Steps, isFinal: boolean): Promise<void>;
|
|
27
27
|
export declare function getReport(reportId: string): Promise<any>;
|
|
28
28
|
export declare function getLastDayResults(): Promise<any>;
|
|
29
|
-
export declare function compareScreenshots(key: string, screenshot:
|
|
29
|
+
export declare function compareScreenshots(key: string, screenshot: ArrayBuffer): Promise<any>;
|
|
30
30
|
export declare function postNotifications(body: UploadModel): Promise<void>;
|
|
31
31
|
export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;
|
|
32
32
|
export declare function getVerifyReceivedEmail(from_name: string, from_email: string, subject: string, body: string, link: boolean): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -54,7 +54,7 @@ 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", `${i} Image`, status_of_step_1.default.FAILED, screenshotBuffer);
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { StatusOfStep } from "../../auxta/enums/status-of.step";
|
|
2
3
|
import { ExtendDefaultPage } from "./extend-default-page";
|
|
3
4
|
export declare class FunctionHelper extends ExtendDefaultPage {
|
|
4
|
-
log(keyword: string, name: string, status: StatusOfStep, screenshot?:
|
|
5
|
-
screenshot(page?: import("puppeteer").Page): Promise<
|
|
5
|
+
log(keyword: string, name: string, status: StatusOfStep, screenshot?: ArrayBuffer): void;
|
|
6
|
+
screenshot(page?: import("puppeteer").Page): Promise<Buffer | undefined>;
|
|
6
7
|
screenshotCompare(key: string, threshold?: number, page?: import("puppeteer").Page): Promise<void>;
|
|
7
8
|
suggest(name: string): void;
|
|
8
9
|
clickByText(selector: string, text: string, dotOrText?: string, options?: {}, page?: import("puppeteer").Page, time?: number, log_message?: boolean): Promise<void>;
|
|
@@ -11,6 +12,7 @@ export declare class FunctionHelper extends ExtendDefaultPage {
|
|
|
11
12
|
timeout(timeout?: number): Promise<void>;
|
|
12
13
|
waitForSelector(option: string, selector: string, time?: number, page?: import("puppeteer").Page, log_message?: boolean): Promise<void>;
|
|
13
14
|
urlContains(selector: string, page?: import("puppeteer").Page): Promise<void>;
|
|
15
|
+
forceState(selector: string, state: string, page?: import("puppeteer").Page): Promise<void>;
|
|
14
16
|
pressEnter(page?: import("puppeteer").Page): Promise<void>;
|
|
15
17
|
emulate(phone_name: string, page?: import("puppeteer").Page): Promise<void>;
|
|
16
18
|
restartBrowser(): Promise<void>;
|
|
@@ -29,7 +29,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshotPage)(page);
|
|
31
31
|
if (screenshotBuffer) {
|
|
32
|
-
return screenshotBuffer
|
|
32
|
+
return screenshotBuffer;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -38,7 +38,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
38
38
|
if (process.env.ENVIRONMENT !== 'LOCAL') {
|
|
39
39
|
const screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshotPage)(page);
|
|
40
40
|
if (screenshotBuffer) {
|
|
41
|
-
const screenshot = screenshotBuffer
|
|
41
|
+
const screenshot = screenshotBuffer;
|
|
42
42
|
const result = yield (0, report_service_1.compareScreenshots)(key, screenshot);
|
|
43
43
|
if (result.presentDifference && Number(result.presentDifference) > threshold) {
|
|
44
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);
|
|
@@ -149,6 +149,21 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
149
149
|
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
forceState(selector, state, page = puppeteer_1.default.defaultPage) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const cdp = yield page.target().createCDPSession();
|
|
155
|
+
const docNodeId = (yield cdp.send('DOM.getDocument')).root.nodeId;
|
|
156
|
+
const nodeId = (yield cdp.send('DOM.querySelector', {
|
|
157
|
+
nodeId: docNodeId,
|
|
158
|
+
selector: selector,
|
|
159
|
+
})).nodeId;
|
|
160
|
+
yield cdp.send('CSS.enable');
|
|
161
|
+
yield cdp.send('CSS.forcePseudoState', {
|
|
162
|
+
nodeId: nodeId,
|
|
163
|
+
forcedPseudoClasses: [state],
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
152
167
|
pressEnter(page = puppeteer_1.default.defaultPage) {
|
|
153
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
169
|
yield page.keyboard.press('Enter');
|
|
@@ -212,7 +227,6 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
212
227
|
yield this.waitForResponse('microsoft_logo', true, loginPage);
|
|
213
228
|
}
|
|
214
229
|
try {
|
|
215
|
-
yield this.timeout(1000);
|
|
216
230
|
(_a = (yield loginPage.$(password_input))) === null || _a === void 0 ? void 0 : _a.type(password);
|
|
217
231
|
yield this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.PASSED);
|
|
218
232
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auxcode/auxta",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.87",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/AuxTA.js",
|
|
6
6
|
"types": "./build/AuxTA.d.ts",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"googleapis": "^118.0.0",
|
|
24
24
|
"js-base64": "^3.7.5",
|
|
25
25
|
"node-2fa": "^2.0.3",
|
|
26
|
-
"nodemailer": "^6.9.
|
|
26
|
+
"nodemailer": "^6.9.9",
|
|
27
27
|
"puppeteer": "^22.0.0",
|
|
28
28
|
"readline": "^1.3.0",
|
|
29
|
-
"typescript": "^5.
|
|
29
|
+
"typescript": "^5.3.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/preset-typescript": "^7.
|
|
32
|
+
"@babel/preset-typescript": "^7.23.3"
|
|
33
33
|
}
|
|
34
34
|
}
|