@auxcode/auxta 1.3.49 → 1.3.51-beta.0
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/configs/config.js +1 -1
- package/build/cjs/auxta/services/log.service.d.ts +2 -1
- package/build/cjs/auxta/services/log.service.js +4 -3
- package/build/cjs/auxta/services/report.service.d.ts +1 -0
- package/build/cjs/auxta/services/report.service.js +16 -1
- package/build/cjs/macros/helpers/code.helper.d.ts +1 -0
- package/build/cjs/macros/helpers/code.helper.js +12 -1
- package/build/esm/auxta/configs/config.js +1 -1
- package/build/esm/auxta/services/log.service.d.ts +2 -1
- package/build/esm/auxta/services/log.service.js +4 -3
- package/build/esm/auxta/services/report.service.d.ts +1 -0
- package/build/esm/auxta/services/report.service.js +14 -0
- package/build/esm/macros/helpers/code.helper.d.ts +1 -0
- package/build/esm/macros/helpers/code.helper.js +12 -1
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ function setupOverrideConfig(overrideConfig) {
|
|
|
49
49
|
}
|
|
50
50
|
exports.setupOverrideConfig = setupOverrideConfig;
|
|
51
51
|
exports.config = {
|
|
52
|
-
auxtaURL: "
|
|
52
|
+
auxtaURL: "http://localhost:8888/.netlify/functions/",
|
|
53
53
|
baseURL: "",
|
|
54
54
|
siteURL: "",
|
|
55
55
|
organization: "",
|
|
@@ -2,6 +2,7 @@ import { StatusOfStep } from "../enums/status-of.step";
|
|
|
2
2
|
export interface Step {
|
|
3
3
|
keyword: string;
|
|
4
4
|
name: string;
|
|
5
|
+
imageCompareKey: string;
|
|
5
6
|
result: {
|
|
6
7
|
status: StatusOfStep;
|
|
7
8
|
duration: number;
|
|
@@ -22,7 +23,7 @@ export declare class LogSteps {
|
|
|
22
23
|
};
|
|
23
24
|
addSuggestion(text: string): void;
|
|
24
25
|
clear(): void;
|
|
25
|
-
push(keyword: string, name: string, status: StatusOfStep, screenshot?: string): void;
|
|
26
|
+
push(keyword: string, name: string, status: StatusOfStep, screenshot?: string, imageCompareKey?: string): void;
|
|
26
27
|
returnScenarioReport(): Step[];
|
|
27
28
|
getStatusCount(status: StatusOfStep): number;
|
|
28
29
|
}
|
|
@@ -16,7 +16,7 @@ class LogSteps {
|
|
|
16
16
|
addSuggestion(text) {
|
|
17
17
|
this.statusCounter[status_of_step_1.StatusOfStep.SUGGESTION]++;
|
|
18
18
|
this.stepLog.push({
|
|
19
|
-
keyword: 'Suggestion', name: text, result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
|
|
19
|
+
keyword: 'Suggestion', name: text, imageCompareKey: '', result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
clear() {
|
|
@@ -28,7 +28,7 @@ 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 = '', imageCompareKey = '') {
|
|
32
32
|
console.log(`System log -- status: ${status} -- : ${name} `);
|
|
33
33
|
this.statusCounter[status]++;
|
|
34
34
|
const currentStep = new Date().getTime();
|
|
@@ -40,11 +40,12 @@ class LogSteps {
|
|
|
40
40
|
this.stepLog.push({
|
|
41
41
|
keyword,
|
|
42
42
|
name,
|
|
43
|
+
imageCompareKey,
|
|
43
44
|
result: { status, duration: currentStep - this.lastStepTime, embedding: embedding }
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
47
|
-
this.stepLog.push({ keyword, name, result: { status, duration: currentStep - this.lastStepTime } });
|
|
48
|
+
this.stepLog.push({ keyword, name, imageCompareKey, result: { status, duration: currentStep - this.lastStepTime } });
|
|
48
49
|
}
|
|
49
50
|
this.lastStepTime = currentStep;
|
|
50
51
|
}
|
|
@@ -26,5 +26,6 @@ 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: string): Promise<any>;
|
|
29
30
|
export declare function postNotifications(body: UploadModel): Promise<void>;
|
|
30
31
|
export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.postNotificationsOnFail = exports.postNotifications = exports.getLastDayResults = exports.getReport = exports.updateReport = exports.uploadScenario = exports.uploadStep = exports.createEmptyReport = void 0;
|
|
15
|
+
exports.postNotificationsOnFail = exports.postNotifications = exports.compareScreenshots = exports.getLastDayResults = exports.getReport = exports.updateReport = exports.uploadScenario = exports.uploadStep = exports.createEmptyReport = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const config_1 = require("../configs/config");
|
|
18
18
|
function headers(token) {
|
|
@@ -138,6 +138,21 @@ function getLastDayResults() {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
exports.getLastDayResults = getLastDayResults;
|
|
141
|
+
function compareScreenshots(key, screenshot) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
let token = yield auth();
|
|
144
|
+
const embedding = {
|
|
145
|
+
data: screenshot,
|
|
146
|
+
mime_type: "image/png"
|
|
147
|
+
};
|
|
148
|
+
yield axios_1.default.post(`${config_1.config.auxtaURL}save-compared-screenshot`, {
|
|
149
|
+
organization: config_1.config.organization,
|
|
150
|
+
key: key,
|
|
151
|
+
embedding: embedding,
|
|
152
|
+
}, headers(token));
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
exports.compareScreenshots = compareScreenshots;
|
|
141
156
|
function postNotifications(body) {
|
|
142
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
158
|
let token = yield auth();
|
|
@@ -3,6 +3,7 @@ import { ExtendDefaultPage } from "./extend-default-page";
|
|
|
3
3
|
export declare class FunctionHelper extends ExtendDefaultPage {
|
|
4
4
|
log(keyword: string, name: string, status: StatusOfStep, screenshot?: string): void;
|
|
5
5
|
screenshot(page?: import("puppeteer").Page): Promise<string | undefined>;
|
|
6
|
+
screenshotCompare(key: string, page?: import("puppeteer").Page): Promise<void>;
|
|
6
7
|
suggest(name: string): void;
|
|
7
8
|
private getEscapedText;
|
|
8
9
|
clickByText(selector: string, text: string, dotOrText?: string, options?: {}, page?: import("puppeteer").Page, time?: number, log_message?: boolean): Promise<void>;
|
|
@@ -20,6 +20,7 @@ const AuxTA_1 = require("../../AuxTA");
|
|
|
20
20
|
const extend_default_page_1 = require("./extend-default-page");
|
|
21
21
|
const puppeteer_2 = require("puppeteer");
|
|
22
22
|
const screenshot_helper_1 = require("../../auxta/utilities/screenshot.helper");
|
|
23
|
+
const report_service_1 = require("../../auxta/services/report.service");
|
|
23
24
|
class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
24
25
|
log(keyword, name, status, screenshot) {
|
|
25
26
|
log_service_1.default.push(keyword, name, status, screenshot);
|
|
@@ -32,6 +33,16 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
}
|
|
36
|
+
screenshotCompare(key, page = puppeteer_1.default.defaultPage) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshotPage)(page);
|
|
39
|
+
if (screenshotBuffer) {
|
|
40
|
+
const screenshot = screenshotBuffer.toString('base64');
|
|
41
|
+
log_service_1.default.push('Then', `compare screenshots with key ${key}`, status_of_step_1.StatusOfStep.PASSED, undefined, key);
|
|
42
|
+
yield (0, report_service_1.compareScreenshots)(key, screenshot);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
35
46
|
suggest(name) {
|
|
36
47
|
log_service_1.default.addSuggestion(name);
|
|
37
48
|
}
|
|
@@ -170,7 +181,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
170
181
|
const next_button = 'input[value="Next"]';
|
|
171
182
|
const sign_in_button = 'input[value="Sign in"]';
|
|
172
183
|
const no_button = 'input.ext-secondary';
|
|
173
|
-
yield this.clickAndWaitForPageToBeCreated(button);
|
|
184
|
+
yield this.clickAndWaitForPageToBeCreated(button, page);
|
|
174
185
|
const pages = yield page.browser().pages();
|
|
175
186
|
const loginPage = pages[pages.length - 1];
|
|
176
187
|
yield this.extend_page_functions(loginPage);
|
|
@@ -44,7 +44,7 @@ export function setupOverrideConfig(overrideConfig) {
|
|
|
44
44
|
return config;
|
|
45
45
|
}
|
|
46
46
|
export let config = {
|
|
47
|
-
auxtaURL: "
|
|
47
|
+
auxtaURL: "http://localhost:8888/.netlify/functions/",
|
|
48
48
|
baseURL: "",
|
|
49
49
|
siteURL: "",
|
|
50
50
|
organization: "",
|
|
@@ -2,6 +2,7 @@ import { StatusOfStep } from "../enums/status-of.step";
|
|
|
2
2
|
export interface Step {
|
|
3
3
|
keyword: string;
|
|
4
4
|
name: string;
|
|
5
|
+
imageCompareKey: string;
|
|
5
6
|
result: {
|
|
6
7
|
status: StatusOfStep;
|
|
7
8
|
duration: number;
|
|
@@ -22,7 +23,7 @@ export declare class LogSteps {
|
|
|
22
23
|
};
|
|
23
24
|
addSuggestion(text: string): void;
|
|
24
25
|
clear(): void;
|
|
25
|
-
push(keyword: string, name: string, status: StatusOfStep, screenshot?: string): void;
|
|
26
|
+
push(keyword: string, name: string, status: StatusOfStep, screenshot?: string, imageCompareKey?: string): void;
|
|
26
27
|
returnScenarioReport(): Step[];
|
|
27
28
|
getStatusCount(status: StatusOfStep): number;
|
|
28
29
|
}
|
|
@@ -13,7 +13,7 @@ export class LogSteps {
|
|
|
13
13
|
addSuggestion(text) {
|
|
14
14
|
this.statusCounter[StatusOfStep.SUGGESTION]++;
|
|
15
15
|
this.stepLog.push({
|
|
16
|
-
keyword: 'Suggestion', name: text, result: { status: StatusOfStep.SUGGESTION, duration: 0 }
|
|
16
|
+
keyword: 'Suggestion', name: text, imageCompareKey: '', result: { status: StatusOfStep.SUGGESTION, duration: 0 }
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
clear() {
|
|
@@ -25,7 +25,7 @@ export class LogSteps {
|
|
|
25
25
|
[StatusOfStep.SUGGESTION]: 0,
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
push(keyword, name, status, screenshot = '') {
|
|
28
|
+
push(keyword, name, status, screenshot = '', imageCompareKey = '') {
|
|
29
29
|
console.log(`System log -- status: ${status} -- : ${name} `);
|
|
30
30
|
this.statusCounter[status]++;
|
|
31
31
|
const currentStep = new Date().getTime();
|
|
@@ -37,11 +37,12 @@ export class LogSteps {
|
|
|
37
37
|
this.stepLog.push({
|
|
38
38
|
keyword,
|
|
39
39
|
name,
|
|
40
|
+
imageCompareKey,
|
|
40
41
|
result: { status, duration: currentStep - this.lastStepTime, embedding: embedding }
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
else {
|
|
44
|
-
this.stepLog.push({ keyword, name, result: { status, duration: currentStep - this.lastStepTime } });
|
|
45
|
+
this.stepLog.push({ keyword, name, imageCompareKey, result: { status, duration: currentStep - this.lastStepTime } });
|
|
45
46
|
}
|
|
46
47
|
this.lastStepTime = currentStep;
|
|
47
48
|
}
|
|
@@ -26,5 +26,6 @@ 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: string): Promise<any>;
|
|
29
30
|
export declare function postNotifications(body: UploadModel): Promise<void>;
|
|
30
31
|
export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;
|
|
@@ -126,6 +126,20 @@ export function getLastDayResults() {
|
|
|
126
126
|
return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
+
export function compareScreenshots(key, screenshot) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
let token = yield auth();
|
|
132
|
+
const embedding = {
|
|
133
|
+
data: screenshot,
|
|
134
|
+
mime_type: "image/png"
|
|
135
|
+
};
|
|
136
|
+
yield axios.post(`${config.auxtaURL}save-compared-screenshot`, {
|
|
137
|
+
organization: config.organization,
|
|
138
|
+
key: key,
|
|
139
|
+
embedding: embedding,
|
|
140
|
+
}, headers(token));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
129
143
|
export function postNotifications(body) {
|
|
130
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
145
|
let token = yield auth();
|
|
@@ -3,6 +3,7 @@ import { ExtendDefaultPage } from "./extend-default-page";
|
|
|
3
3
|
export declare class FunctionHelper extends ExtendDefaultPage {
|
|
4
4
|
log(keyword: string, name: string, status: StatusOfStep, screenshot?: string): void;
|
|
5
5
|
screenshot(page?: import("puppeteer").Page): Promise<string | undefined>;
|
|
6
|
+
screenshotCompare(key: string, page?: import("puppeteer").Page): Promise<void>;
|
|
6
7
|
suggest(name: string): void;
|
|
7
8
|
private getEscapedText;
|
|
8
9
|
clickByText(selector: string, text: string, dotOrText?: string, options?: {}, page?: import("puppeteer").Page, time?: number, log_message?: boolean): Promise<void>;
|
|
@@ -14,6 +14,7 @@ import { StepStatus } from "../../AuxTA";
|
|
|
14
14
|
import { ExtendDefaultPage } from "./extend-default-page";
|
|
15
15
|
import { KnownDevices } from "puppeteer";
|
|
16
16
|
import { captureScreenshotPage } from "../../auxta/utilities/screenshot.helper";
|
|
17
|
+
import { compareScreenshots } from "../../auxta/services/report.service";
|
|
17
18
|
export class FunctionHelper extends ExtendDefaultPage {
|
|
18
19
|
log(keyword, name, status, screenshot) {
|
|
19
20
|
log.push(keyword, name, status, screenshot);
|
|
@@ -26,6 +27,16 @@ export class FunctionHelper extends ExtendDefaultPage {
|
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
}
|
|
30
|
+
screenshotCompare(key, page = puppeteer.defaultPage) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const screenshotBuffer = yield captureScreenshotPage(page);
|
|
33
|
+
if (screenshotBuffer) {
|
|
34
|
+
const screenshot = screenshotBuffer.toString('base64');
|
|
35
|
+
log.push('Then', `compare screenshots with key ${key}`, StatusOfStep.PASSED, undefined, key);
|
|
36
|
+
yield compareScreenshots(key, screenshot);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
29
40
|
suggest(name) {
|
|
30
41
|
log.addSuggestion(name);
|
|
31
42
|
}
|
|
@@ -164,7 +175,7 @@ export class FunctionHelper extends ExtendDefaultPage {
|
|
|
164
175
|
const next_button = 'input[value="Next"]';
|
|
165
176
|
const sign_in_button = 'input[value="Sign in"]';
|
|
166
177
|
const no_button = 'input.ext-secondary';
|
|
167
|
-
yield this.clickAndWaitForPageToBeCreated(button);
|
|
178
|
+
yield this.clickAndWaitForPageToBeCreated(button, page);
|
|
168
179
|
const pages = yield page.browser().pages();
|
|
169
180
|
const loginPage = pages[pages.length - 1];
|
|
170
181
|
yield this.extend_page_functions(loginPage);
|