Socket
Socket
Sign inDemoInstall

@applitools/core-base

Package Overview
Dependencies
Maintainers
34
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/core-base - npm Package Compare versions

Comparing version 1.1.27 to 1.1.28

dist/utils/to-self-healing-report.js

4

dist/abort.js

@@ -7,4 +7,4 @@ "use strict";

return async function abort({ settings, logger = defaultLogger, } = {}) {
logger.log('Command "close" is called with settings', settings);
results !== null && results !== void 0 ? results : (results = await requests.abort({ logger }));
logger.log('Command "abort" is called with settings', settings);
results !== null && results !== void 0 ? results : (results = await requests.abort({ settings, logger }));
return results;

@@ -11,0 +11,0 @@ };

@@ -31,2 +31,3 @@ "use strict";

const utils = __importStar(require("@applitools/utils"));
const to_self_healing_report_1 = require("../utils/to-self-healing-report");
function makeCoreRequests({ agentId: defaultAgentId, fetch, logger: defaultLogger, }) {

@@ -50,3 +51,3 @@ defaultLogger !== null && defaultLogger !== void 0 ? defaultLogger : (defaultLogger = (0, logger_1.makeLogger)());

async function openEyes({ settings, logger = defaultLogger }) {
var _a;
var _a, _b, _c;
const agentId = `${defaultAgentId} ${settings.agentId ? `[${settings.agentId}]` : ''}`.trim();

@@ -77,4 +78,5 @@ const req = (0, req_eyes_1.makeReqEyes)({ config: { ...settings, agentId }, fetch, logger });

},
egSessionId: (_b = (_a = settings.environment) === null || _a === void 0 ? void 0 : _a.egSessionId) !== null && _b !== void 0 ? _b : null,
environment: settings.environment &&
((_a = settings.environment.rawEnvironment) !== null && _a !== void 0 ? _a : {
((_c = settings.environment.rawEnvironment) !== null && _c !== void 0 ? _c : {
os: settings.environment.os,

@@ -388,2 +390,3 @@ osInfo: settings.environment.osInfo,

}
const sendSelfHealingReport = reportSelfHealing({ settings, logger });
closed = true;

@@ -407,6 +410,7 @@ const response = await req(`/api/sessions/running/${encodeURIComponent(test.testId)}`, {

logger.log('Request "close" finished successfully with body', result);
await sendSelfHealingReport;
return [result];
}
async function abort({ logger = defaultLogger } = {}) {
logger.log(`Request "abort" called for test ${test.testId}`);
async function abort({ settings, logger = defaultLogger, } = {}) {
logger.log(`Request "abort" called for test ${test.testId} with settings`, settings);
if (aborted || closed) {

@@ -416,2 +420,3 @@ logger.log(`Request "abort" called for test ${test.testId} that was already stopped`);

}
const sendSelfHealingReport = reportSelfHealing({ settings, logger });
aborted = true;

@@ -430,4 +435,22 @@ const response = await req(`/api/sessions/running/${encodeURIComponent(test.testId)}`, {

logger.log('Request "abort" finished successfully with body', result);
await sendSelfHealingReport;
return [result];
}
async function reportSelfHealing({ settings, logger = defaultLogger, }) {
try {
if (utils.types.isNull(settings === null || settings === void 0 ? void 0 : settings.testMetadata) || utils.types.isEmpty(settings === null || settings === void 0 ? void 0 : settings.testMetadata))
return;
logger.log('Request "reportSelfHealing" called');
await req(`/api/sessions/running/${encodeURIComponent(test.testId)}/selfhealdata`, {
name: 'reportSelfHealing',
method: 'PUT',
body: (0, to_self_healing_report_1.toSelfHealingReport)(settings.testMetadata),
expected: 200,
logger,
});
}
catch (error) {
logger.warn(error);
}
}
}

@@ -434,0 +457,0 @@ exports.makeEyesRequests = makeEyesRequests;

{
"name": "@applitools/core-base",
"version": "1.1.27",
"version": "1.1.28",
"homepage": "https://applitools.com",

@@ -58,11 +58,11 @@ "bugs": {

"dependencies": {
"@applitools/image": "1.0.19",
"@applitools/logger": "1.1.38",
"@applitools/req": "1.1.25",
"@applitools/utils": "1.3.24"
"@applitools/image": "1.0.20",
"@applitools/logger": "1.1.39",
"@applitools/req": "1.1.26",
"@applitools/utils": "1.3.25"
},
"devDependencies": {
"@applitools/bongo": "^2.2.0",
"@applitools/test-server": "^1.1.18",
"@applitools/test-utils": "^1.5.7",
"@applitools/test-server": "^1.1.19",
"@applitools/test-utils": "^1.5.8",
"@types/mocha": "^9.1.1",

@@ -69,0 +69,0 @@ "@types/node": "12",

@@ -69,5 +69,2 @@ import type { MaybeArray } from '@applitools/utils';

}): Promise<TestResult[]>;
abort(options?: {
logger?: Logger;
}): Promise<TestResult[]>;
}

@@ -74,0 +71,0 @@ export declare function makeCoreRequests({ agentId: defaultAgentId, fetch, logger: defaultLogger, }: {

@@ -131,2 +131,3 @@ /// <reference types="node" />

};
egSessionId?: string;
};

@@ -192,2 +193,3 @@ export interface OpenSettings extends ServerSettings {

maxImageArea: number;
selfHealingEnabled: boolean;
}

@@ -289,3 +291,20 @@ declare type ImageRotation = -270 | -180 | -90 | 0 | 90 | 180 | 270;

}
export interface CloseSettings {
export declare type SelfHealingReport = {
operations: {
timestamp: string;
old: {
using: string;
value: string;
};
new: {
using: string;
value: string;
};
}[];
};
export declare type TestMetadata = Record<string, any>[];
export interface ReportSelfHealingSettings {
testMetadata?: TestMetadata;
}
export interface CloseSettings extends ReportSelfHealingSettings {
updateBaselineIfNew?: boolean;

@@ -296,3 +315,3 @@ updateBaselineIfDifferent?: boolean;

}
export interface AbortSettings {
export interface AbortSettings extends ReportSelfHealingSettings {
/** @internal */

@@ -299,0 +318,0 @@ userCommandId?: string;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc