Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

protractor-image-comparison

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protractor-image-comparison - npm Package Compare versions

Comparing version 3.7.0 to 3.8.0

16

build/index.js

@@ -43,7 +43,13 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var configOptions;
return __generator(this, function (_a) {
configOptions = typeof this.config.options === 'object' ? this.config.options : {};
protractor_1.browser.imageComparison = new protractor_image_compare_1.default(configOptions);
return [2];
var configOptions, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
configOptions = typeof this.config.options === 'object' ? this.config.options : {};
_a = protractor_1.browser;
return [4, protractor_image_compare_1.default.build(configOptions)];
case 1:
_a.imageComparison = _b.sent();
return [2];
}
});

@@ -50,0 +56,0 @@ });

@@ -7,3 +7,3 @@ import { ElementFinder } from 'protractor';

export default class ProtractorImageComparison extends BaseClass {
constructor(options: ClassOptions);
static build(options: ClassOptions): Promise<ProtractorImageComparison>;
saveElement(element: ElementFinder, tag: string, saveElementOptions?: SaveElementMethodOptions): Promise<import("webdriver-image-comparison/build/helpers/afterScreenshot.interfaces").ScreenshotOutput>;

@@ -10,0 +10,0 @@ saveScreen(tag: string, saveScreenOptions?: SaveScreenMethodOptions): Promise<import("webdriver-image-comparison/build/helpers/afterScreenshot.interfaces").ScreenshotOutput>;

@@ -57,5 +57,23 @@ "use strict";

__extends(ProtractorImageComparison, _super);
function ProtractorImageComparison(options) {
return _super.call(this, options) || this;
function ProtractorImageComparison() {
return _super !== null && _super.apply(this, arguments) || this;
}
ProtractorImageComparison.build = function (options) {
return __awaiter(this, void 0, void 0, function () {
var instance, baselineFolderPath;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
instance = new ProtractorImageComparison(options);
if (!(options.baselineFolder && utils_1.isAsyncFn(options.baselineFolder))) return [3, 2];
return [4, options.baselineFolder(options)];
case 1:
baselineFolderPath = _a.sent();
instance.folders.baselineFolder = baselineFolderPath;
_a.label = 2;
case 2: return [2, instance];
}
});
});
};
ProtractorImageComparison.prototype.saveElement = function (element, tag, saveElementOptions) {

@@ -62,0 +80,0 @@ if (saveElementOptions === void 0) { saveElementOptions = {}; }

@@ -22,1 +22,2 @@ import { SaveFullPageMethodOptions } from "webdriver-image-comparison/build/commands/fullPage.interfaces";

};
export declare function isAsyncFn(fn: () => void): boolean;

@@ -135,2 +135,6 @@ "use strict";

exports.getFolders = getFolders;
function isAsyncFn(fn) {
return fn.constructor.name === 'AsyncFunction';
}
exports.isAsyncFn = isAsyncFn;
//# sourceMappingURL=utils.js.map

@@ -12,5 +12,5 @@ import {browser} from 'protractor';

browser.imageComparison = new ProtractorImageComparison(configOptions);
browser.imageComparison = await ProtractorImageComparison.build(configOptions);
}
exports.setup = setup;

@@ -20,7 +20,18 @@ import {browser, ElementFinder} from 'protractor';

getWebElements,
isAsyncFn,
} from './utils';
export default class ProtractorImageComparison extends BaseClass {
constructor(options: ClassOptions) {
super(options);
/**
* @description This method create new ProtractorImageComparison instance
* and provides to use async functions in library options
*/
static async build(options: ClassOptions): Promise<ProtractorImageComparison> {
const instance = new ProtractorImageComparison(options);
if (options.baselineFolder && isAsyncFn(options.baselineFolder)) {
const baselineFolderPath = await options.baselineFolder(options);
instance.folders.baselineFolder = baselineFolderPath;
}
return instance;
}

@@ -27,0 +38,0 @@

import {browser, ElementFinder} from "protractor";
import {SaveFullPageMethodOptions} from "webdriver-image-comparison/build/commands/fullPage.interfaces";
import {SaveElementMethodOptions} from "webdriver-image-comparison/build/commands/element.interfaces";
import {SaveScreenMethodOptions} from "webdriver-image-comparison/build/commands/screen.interfaces";

@@ -89,2 +87,9 @@

};
}
}
/**
* @description Detect if a function is asynchronous
*/
export function isAsyncFn(fn: () => void): boolean {
return fn.constructor.name === 'AsyncFunction';
}
{
"name": "protractor-image-comparison",
"version": "3.7.0",
"version": "3.8.0",
"description": "npm-module to compare images with protractor",

@@ -17,3 +17,3 @@ "main": "./build/index.js",

"watch": "npm run compile -- -w",
"release": "np",
"release": "np --no-yarn",
"precompile": "npm run clean",

@@ -20,0 +20,0 @@ "prepublish": "npm run compile",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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