You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

webdriver-image-comparison

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webdriver-image-comparison - npm Package Compare versions

Comparing version

to
0.7.0

5

build/commands/saveElement.js

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

base64Image: croppedBase64Image,
disableCSSAnimation: disableCSSAnimation,
hideElements: hideElements,

@@ -102,2 +103,3 @@ hideScrollBars: hideScrollBars,

browserName: enrichedInstanceData.browserName,
browserVersion: enrichedInstanceData.browserVersion,
deviceName: enrichedInstanceData.deviceName,

@@ -112,2 +114,4 @@ devicePixelRatio: enrichedInstanceData.dimensions.window.devicePixelRatio,

outerWidth: enrichedInstanceData.dimensions.window.outerWidth,
platformName: enrichedInstanceData.platformName,
platformVersion: enrichedInstanceData.platformVersion,
screenHeight: enrichedInstanceData.dimensions.window.screenHeight,

@@ -117,2 +121,3 @@ screenWidth: enrichedInstanceData.dimensions.window.screenWidth,

},
platformName: instanceData.platformName,
removeElements: removeElements,

@@ -119,0 +124,0 @@ };

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

base64Image: fullPageBase64Image,
disableCSSAnimation: disableCSSAnimation,
hideElements: hideElements,

@@ -106,2 +107,3 @@ hideScrollBars: hideScrollBars,

browserName: enrichedInstanceData.browserName,
browserVersion: enrichedInstanceData.browserVersion,
deviceName: enrichedInstanceData.deviceName,

@@ -116,2 +118,4 @@ devicePixelRatio: enrichedInstanceData.dimensions.window.devicePixelRatio,

outerWidth: enrichedInstanceData.dimensions.window.outerWidth,
platformName: enrichedInstanceData.platformName,
platformVersion: enrichedInstanceData.platformVersion,
screenHeight: enrichedInstanceData.dimensions.window.screenHeight,

@@ -121,2 +125,3 @@ screenWidth: enrichedInstanceData.dimensions.window.screenWidth,

},
platformName: instanceData.platformName,
removeElements: removeElements,

@@ -123,0 +128,0 @@ };

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

base64Image: croppedBase64Image,
disableCSSAnimation: disableCSSAnimation,
hideElements: hideElements,

@@ -99,2 +100,3 @@ hideScrollBars: hideScrollBars,

browserName: enrichedInstanceData.browserName,
browserVersion: enrichedInstanceData.browserVersion,
deviceName: enrichedInstanceData.deviceName,

@@ -109,2 +111,4 @@ devicePixelRatio: enrichedInstanceData.dimensions.window.devicePixelRatio,

outerWidth: enrichedInstanceData.dimensions.window.outerWidth,
platformName: enrichedInstanceData.platformName,
platformVersion: enrichedInstanceData.platformVersion,
screenHeight: enrichedInstanceData.dimensions.window.screenHeight,

@@ -114,2 +118,3 @@ screenWidth: enrichedInstanceData.dimensions.window.screenWidth,

},
platformName: instanceData.platformName,
removeElements: removeElements,

@@ -116,0 +121,0 @@ };

@@ -9,2 +9,3 @@ export interface ScreenshotOutput {

base64Image: string;
disableCSSAnimation: boolean;
hideScrollBars: boolean;

@@ -14,2 +15,3 @@ filePath: ScreenshotFilePathOptions;

hideElements: HTMLElement[];
platformName: string;
removeElements: HTMLElement[];

@@ -25,2 +27,3 @@ }

browserName: string;
browserVersion: string;
deviceName: string;

@@ -35,2 +38,4 @@ devicePixelRatio: number;

outerWidth: number;
platformName: string;
platformVersion: string;
screenHeight: number;

@@ -37,0 +42,0 @@ screenWidth: number;

28

build/helpers/afterScreenshot.js

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

return __awaiter(this, void 0, void 0, function () {
var actualFolder, base64Image, fileNameOptions, filePath, hideElements, noScrollBars, removeElements, path, fileName;
var actualFolder, base64Image, disableCSSAnimation, fileNameOptions, filePath, hideElements, noScrollBars, platformName, removeElements, path, fileName;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
actualFolder = options.actualFolder, base64Image = options.base64Image, fileNameOptions = options.fileName, filePath = options.filePath, hideElements = options.hideElements, noScrollBars = options.hideScrollBars, removeElements = options.removeElements;
actualFolder = options.actualFolder, base64Image = options.base64Image, disableCSSAnimation = options.disableCSSAnimation, fileNameOptions = options.fileName, filePath = options.filePath, hideElements = options.hideElements, noScrollBars = options.hideScrollBars, platformName = options.platformName, removeElements = options.removeElements;
path = utils_1.getAndCreatePath(actualFolder, filePath);

@@ -58,18 +58,24 @@ fileName = utils_1.formatFileName(fileNameOptions);

_a.sent();
if (!noScrollBars) return [3, 3];
return [4, executor(hideScrollbars_1.default, !noScrollBars)];
case 2:
_a.sent();
if (!(hideElements.length > 0 || removeElements.length > 0)) return [3, 4];
_a.label = 3;
case 3:
if (!(hideElements.length > 0 || removeElements.length > 0)) return [3, 5];
return [4, executor(hideRemoveElements_1.default, { hide: hideElements, remove: removeElements }, false)];
case 3:
case 4:
_a.sent();
_a.label = 4;
case 4: return [4, executor(removeCustomCss_1.default, constants_1.CUSTOM_CSS_ID)];
_a.label = 5;
case 5:
if (!(disableCSSAnimation || utils_1.checkIsMobile(platformName))) return [3, 7];
return [4, executor(removeCustomCss_1.default, constants_1.CUSTOM_CSS_ID)];
case 6:
_a.sent();
return [2, {
fileName: fileName,
path: path,
devicePixelRatio: fileNameOptions.devicePixelRatio,
}];
_a.label = 7;
case 7: return [2, {
fileName: fileName,
path: path,
devicePixelRatio: fileNameOptions.devicePixelRatio,
}];
}

@@ -76,0 +82,0 @@ });

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

base64Image: 'string',
disableCSSAnimation: false,
hideScrollBars: true,

@@ -64,2 +65,3 @@ filePath: {

browserName: 'browserName',
browserVersion: 'browserVersion',
deviceName: 'deviceName',

@@ -74,2 +76,4 @@ devicePixelRatio: 2,

outerWidth: 1400,
platformName: 'platformName',
platformVersion: 'platformVersion',
screenHeight: 900,

@@ -80,2 +84,3 @@ screenWidth: 1440,

hideElements: ['<div></div>'],
platformName: '',
removeElements: ['<div></div>'],

@@ -82,0 +87,0 @@ };

@@ -72,13 +72,20 @@ "use strict";

toolBarPadding = utils_1.getToolBarShadowPadding({ platformName: platformName, browserName: browserName, toolBarShadowPadding: toolBarShadowPadding, addShadowPadding: addShadowPadding });
if (!noScrollBars) return [3, 2];
return [4, executor(hideScrollbars_1.default, noScrollBars)];
case 1:
_b.sent();
if (!(hideElements.length > 0 || removeElements.length > 0)) return [3, 3];
_b.label = 2;
case 2:
if (!(hideElements.length > 0 || removeElements.length > 0)) return [3, 4];
return [4, executor(hideRemoveElements_1.default, { hide: hideElements, remove: removeElements }, true)];
case 2:
case 3:
_b.sent();
_b.label = 3;
case 3: return [4, executor(setCustomCss_1.default, { addressBarPadding: addressBarPadding, disableCSSAnimation: disableCSSAnimation, id: constants_1.CUSTOM_CSS_ID, toolBarPadding: toolBarPadding })];
_b.label = 4;
case 4:
if (!(disableCSSAnimation || utils_1.checkIsMobile(platformName))) return [3, 6];
return [4, executor(setCustomCss_1.default, { addressBarPadding: addressBarPadding, disableCSSAnimation: disableCSSAnimation, id: constants_1.CUSTOM_CSS_ID, toolBarPadding: toolBarPadding })];
case 5:
_b.sent();
_b.label = 6;
case 6:
instanceOptions = __assign({ addressBarShadowPadding: options.addressBarShadowPadding, toolBarShadowPadding: options.toolBarShadowPadding }, (options.instanceData));

@@ -85,0 +92,0 @@ return [2, instanceData_1.default(executor, instanceOptions, addShadowPadding)];

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

browserName: 'browserName',
browserVersion: 'browserVersion',
deviceName: 'deviceName',

@@ -56,2 +57,3 @@ logName: 'logName',

platformName: 'platformName',
platformVersion: 'platformVersion',
},

@@ -82,2 +84,3 @@ addressBarShadowPadding: 6,

browserName: 'browserName',
browserVersion: 'browserVersion',
deviceName: 'deviceName',

@@ -88,2 +91,3 @@ logName: 'logName',

platformName: 'platformName',
platformVersion: 'platformVersion',
},

@@ -90,0 +94,0 @@ addressBarShadowPadding: 6,

@@ -9,2 +9,3 @@ export interface GetAndCreatePathOptions {

browserName: string;
browserVersion: string;
deviceName: string;

@@ -19,2 +20,4 @@ devicePixelRatio: number;

outerWidth: number;
platformName: string;
platformVersion: string;
screenHeight: number;

@@ -26,2 +29,3 @@ screenWidth: number;

browserName: string;
browserVersion: string;
deviceName: string;

@@ -33,2 +37,4 @@ dpr: number;

name: string;
platformName: string;
platformVersion: string;
tag: string;

@@ -35,0 +41,0 @@ width: number;

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

browserName: options.browserName,
browserVersion: options.browserVersion,
deviceName: options.deviceName,

@@ -60,2 +61,4 @@ dpr: options.devicePixelRatio,

name: options.name,
platformName: options.platformName,
platformVersion: options.platformVersion,
tag: options.tag,

@@ -62,0 +65,0 @@ width: options.isMobile ? options.screenWidth : options.outerWidth

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

browserName: '',
browserVersion: '',
deviceName: '',

@@ -60,2 +61,4 @@ devicePixelRatio: 2,

outerWidth: 1366,
platformName: '',
platformVersion: '',
screenHeight: 900,

@@ -66,6 +69,9 @@ screenWidth: 1400,

it('should format a string with all options provided', function () {
formatFileOptions.formatImageName = '{browserName}-{dpr}-{height}-{logName}-{name}-{tag}-{width}';
formatFileOptions.formatImageName = 'browser.{browserName}-{browserVersion}-platform.{platformName}-{platformVersion}-dpr.{dpr}-{height}-{logName}-{name}-{tag}-{width}';
formatFileOptions.browserName = 'chrome';
formatFileOptions.browserVersion = '74';
formatFileOptions.logName = 'chrome-latest';
formatFileOptions.name = 'chrome-name';
formatFileOptions.platformName = 'osx';
formatFileOptions.platformVersion = '12';
expect(utils_1.formatFileName(formatFileOptions)).toMatchSnapshot();

@@ -72,0 +78,0 @@ });

import { ScreenDimensions } from '../clientSideScripts/screenDimensions.interfaces';
export interface InstanceData {
browserName: string;
browserVersion: string;
deviceName: string;

@@ -9,2 +10,3 @@ logName: string;

platformName: string;
platformVersion: string;
}

@@ -15,2 +17,3 @@ export interface InstanceOptions {

browserName: string;
browserVersion: string;
deviceName: string;

@@ -21,2 +24,3 @@ logName: string;

platformName: string;
platformVersion: string;
}

@@ -23,0 +27,0 @@ export interface EnrichedInstanceData extends ScreenDimensions, InstanceOptions {

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

browserName: 'browserName',
browserVersion: 'browserVersion',
deviceName: 'deviceName',

@@ -56,2 +57,3 @@ logName: 'logName',

platformName: 'platformName',
platformVersion: 'platformVersion',
};

@@ -98,2 +100,3 @@ MOCKED_EXECUTOR = jest.fn()

browserName: 'browserName',
browserVersion: 'browserVersion',
deviceName: 'deviceName',

@@ -104,2 +107,3 @@ logName: 'logName',

platformName: 'Android',
platformVersion: '8.0',
};

@@ -146,2 +150,3 @@ MOCKED_EXECUTOR = jest.fn()

browserName: 'browserName',
browserVersion: 'browserVersion',
deviceName: 'deviceName',

@@ -152,2 +157,3 @@ logName: 'logName',

platformName: 'Android',
platformVersion: '8.0',
};

@@ -194,2 +200,3 @@ MOCKED_EXECUTOR = jest.fn()

browserName: 'browserName',
browserVersion: 'browserVersion',
deviceName: 'deviceName',

@@ -200,2 +207,3 @@ logName: 'logName',

platformName: 'iOS',
platformVersion: '12.4',
};

@@ -202,0 +210,0 @@ MOCKED_EXECUTOR = jest.fn()

{
"name": "webdriver-image-comparison",
"version": "0.6.0",
"version": "0.7.0",
"description": "An image compare module that can be used for different NodeJS Test automation frameworks that support the webdriver protocol",

@@ -40,15 +40,15 @@ "main": "./build/index.js",

"@types/fs-extra": "^5.1.0",
"@types/jest": "^24.0.13",
"@types/node": "^10.14.7",
"@types/jest": "^24.0.15",
"@types/node": "^10.14.13",
"awesome-typescript-loader": "^5.2.1",
"coveralls": "^3.0.3",
"coveralls": "^3.0.5",
"husky": "^1.3.1",
"jest": "^24.8.0",
"np": "^5.0.2",
"np": "^5.0.3",
"rimraf": "^2.6.3",
"source-map-loader": "^0.2.4",
"ts-jest": "^23.10.5",
"tslint": "^5.16.0",
"tslint": "^5.18.0",
"tslint-eslint-rules": "^5.4.0",
"typescript": "^3.4.5",
"typescript": "^3.5.3",
"validate-commit-msg": "^2.14.0",

@@ -55,0 +55,0 @@ "vrsource-tslint-rules": "^6.0.0"

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

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet