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

eyes.selenium

Package Overview
Dependencies
Maintainers
3
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eyes.selenium - npm Package Compare versions

Comparing version 0.0.83 to 3.6.1

src/capture/EyesWebDriverScreenshot.js

10

index.js
'use strict';
exports.EyesWebDriverScreenshot = require('./src/capture/EyesWebDriverScreenshot').EyesWebDriverScreenshot;
exports.FirefoxScreenshotImageProvider = require('./src/capture/FirefoxScreenshotImageProvider').FirefoxScreenshotImageProvider;
exports.ImageProviderFactory = require('./src/capture/ImageProviderFactory').ImageProviderFactory;
exports.SafariScreenshotImageProvider = require('./src/capture/SafariScreenshotImageProvider').SafariScreenshotImageProvider;
exports.TakesScreenshotImageProvider = require('./src/capture/TakesScreenshotImageProvider').TakesScreenshotImageProvider;
exports.CssTranslatePositionProvider = require('./src/CssTranslatePositionProvider').CssTranslatePositionProvider;

@@ -12,3 +17,2 @@ exports.ElementPositionProvider = require('./src/ElementPositionProvider').ElementPositionProvider;

exports.EyesWebDriver = require('./src/EyesWebDriver').EyesWebDriver;
exports.EyesWebDriverScreenshot = require('./src/EyesWebDriverScreenshot').EyesWebDriverScreenshot;
exports.Frame = require('./src/Frame').Frame;

@@ -33,2 +37,3 @@ exports.FrameChain = require('./src/FrameChain').FrameChain;

exports.FixedScaleProviderFactory = EyesSDK.FixedScaleProviderFactory;
exports.ImageProvider = EyesSDK.ImageProvider;
exports.Logger = EyesSDK.Logger;

@@ -66,1 +71,4 @@ exports.LogHandler = EyesSDK.LogHandler;

exports.StreamUtils = EyesUtils.StreamUtils;
exports.UserAgent = EyesUtils.UserAgent;
exports.OSNames = EyesUtils.OSNames;
exports.BrowserNames = EyesUtils.BrowserNames;

32

package.json
{
"name": "eyes.selenium",
"version": "0.0.83",
"version": "3.6.1",
"description": "Applitools Eyes SDK For Selenium JavaScript WebDriver",

@@ -27,6 +27,6 @@ "keywords": [

"type": "git",
"url": "git://github.com/applitools/Eyes.Selenium.JavaScript.git"
"url": "git://github.com/applitools/eyes.sdk.javascript.git"
},
"bugs": {
"url": "https://github.com/applitools/Eyes.Selenium.JavaScript/issues"
"url": "https://github.com/applitools/eyes.sdk.javascript/issues"
},

@@ -50,4 +50,4 @@ "directories": {

"@types/node": "*",
"eyes.utils": "0.0.29",
"eyes.sdk": "0.0.73"
"eyes.sdk": "^3.6.1",
"eyes.utils": "^3.6.1"
},

@@ -57,15 +57,21 @@ "devDependencies": {

"mocha": "^5.2.0",
"protractor": "^4.0.0 || ^5.3.0",
"selenium-webdriver": "^2.53.0 || ^3.6.0"
"protractor": "^5.4.0",
"selenium-webdriver": "^3.6.0"
},
"peerDependencies": {
"selenium-webdriver": "< 4.0.0"
},
"scripts": {
"test": "npm run test-selenium",
"test-appium": "mocha ./test/appium/**/*.js",
"test-selenium": "mocha ./test/selenium/**/*.js",
"test-protractor": "protractor protractor.conf.js"
"test": "npm run test:unit && npm run test:e2e",
"test:e2e": "npm run test:selenium",
"test:unit": "mocha \"test/unit/**/*.js\"",
"test:appium": "mocha \"test/e2e/appium/**/*.js\"",
"test:selenium": "mocha \"test/e2e/selenium/**/*.js\"",
"test:protractor": "protractor test/e2e/protractor/protractor.conf.js"
},
"license": "SEE LICENSE IN LICENSE",
"engines": {
"node": ">= 4.2.0"
}
"node": ">= 6.9.0"
},
"gitHead": "509409aa04b8db9caf8590da5d0181b2c12dad2c"
}
(function () {
'use strict';
var webdriver = require('selenium-webdriver'),
EyesSDK = require('eyes.sdk'),
EyesUtils = require('eyes.utils'),
EyesWebDriver = require('./EyesWebDriver').EyesWebDriver,
var webdriver = require('selenium-webdriver');
var { EyesBase, ContextBasedScaleProviderFactory, FixedScaleProviderFactory, NullScaleProvider, Logger,
CoordinatesType, MutableImage, ScaleProviderIdentityFactory } = require('eyes.sdk');
var { PromiseFactory, ArgumentGuard, SimplePropertyHandler, GeometryUtils, UserAgent } = require('eyes.utils');
var EyesWebDriver = require('./EyesWebDriver').EyesWebDriver,
ImageProviderFactory = require('./capture/ImageProviderFactory').ImageProviderFactory,
EyesSeleniumUtils = require('./EyesSeleniumUtils').EyesSeleniumUtils,
EyesRemoteWebElement = require('./EyesRemoteWebElement').EyesRemoteWebElement,
EyesWebDriverScreenshot = require('./EyesWebDriverScreenshot').EyesWebDriverScreenshot,
EyesWebDriverScreenshot = require('./capture/EyesWebDriverScreenshot').EyesWebDriverScreenshot,
ElementFinderWrapper = require('./ElementFinderWrappers').ElementFinderWrapper,

@@ -18,14 +20,2 @@ ElementArrayFinderWrapper = require('./ElementFinderWrappers').ElementArrayFinderWrapper,

Target = require('./Target').Target;
var EyesBase = EyesSDK.EyesBase,
ContextBasedScaleProviderFactory = EyesSDK.ContextBasedScaleProviderFactory,
FixedScaleProviderFactory = EyesSDK.FixedScaleProviderFactory,
NullScaleProvider = EyesSDK.NullScaleProvider,
Logger = EyesSDK.Logger,
CoordinatesType = EyesSDK.CoordinatesType,
MutableImage = EyesSDK.MutableImage,
ScaleProviderIdentityFactory = EyesSDK.ScaleProviderIdentityFactory,
PromiseFactory = EyesUtils.PromiseFactory,
ArgumentGuard = EyesUtils.ArgumentGuard,
SimplePropertyHandler = EyesUtils.SimplePropertyHandler,
GeometryUtils = EyesUtils.GeometryUtils;

@@ -68,3 +58,5 @@ var VERSION = require('../package.json').version;

this._stitchMode = StitchMode.Scroll;
this._promiseFactory = new PromiseFactory();
this._promiseFactory = new PromiseFactory(function (asyncAction) {
return new Promise(asyncAction);
}, undefined);
this._waitBeforeScreenshots = DEFAULT_WAIT_BEFORE_SCREENSHOTS;

@@ -181,2 +173,10 @@

}).then(function () {
return that._driver.getUserAgent().then(function (uaString) {
if (uaString) {
that._userAgent = UserAgent.parseUserAgentString(uaString, true);
}
that._imageProvider = ImageProviderFactory.getImageProvider(that._userAgent, that, that._logger, that._driver);
});
}).then(function () {
return EyesBase.prototype.open.call(that, appName, testName, viewportSize);

@@ -650,6 +650,7 @@ }).then(function () {

* Get an updated screenshot.
* @return {Promise<MutableImage>} - The image of the new screenshot.
* @return {Promise<EyesScreenshot>} - The image of the new screenshot.
*/
Eyes.prototype.getScreenShot = function () {
var that = this;
var result;
return that.updateScalingParams().then(function (scaleProviderFactory) {

@@ -659,2 +660,3 @@ return EyesSeleniumUtils.getScreenshot(

that._promiseFactory,
that._imageProvider,
that._viewportSize,

@@ -678,2 +680,8 @@ that._positionProvider,

);
}).then(function (screenshot) {
var eyesWebDriverScreenshot = new EyesWebDriverScreenshot(that._logger, that._driver, screenshot, that._promiseFactory);
result = eyesWebDriverScreenshot;
return eyesWebDriverScreenshot.buildScreenshot();
}).then(function () {
return result;
});

@@ -718,3 +726,3 @@ };

* Get the viewport size.
* @return {*} The viewport size.
* @return {Promise<{width: number, height: number}>} The viewport size.
*/

@@ -807,2 +815,11 @@ Eyes.prototype.getViewportSize = function () {

/**
* @return {number} The device pixel ratio, or {@link #UNKNOWN_DEVICE_PIXEL_RATIO} if the DPR is not known yet or if
* it wasn't possible to extract it.
*/
Eyes.prototype.getDevicePixelRatio = function () {
return this._devicePixelRatio;
};
//noinspection JSUnusedGlobalSymbols
/**
* Receives a selector and when doing hideScrollbars, it will set the overflow to hidden on that element.

@@ -809,0 +826,0 @@ * @param {webdriver.WebElement|webdriver.By|EyesRemoteWebElement} element - The element to hide scrollbars.

@@ -6,3 +6,3 @@ (function () {

EyesSDK = require('eyes.sdk'),
EyesWebDriverScreenshot = require('./EyesWebDriverScreenshot').EyesWebDriverScreenshot;
EyesWebDriverScreenshot = require('./capture/EyesWebDriverScreenshot').EyesWebDriverScreenshot;
var RegionProvider = EyesSDK.RegionProvider,

@@ -9,0 +9,0 @@ GeometryUtils = EyesUtils.GeometryUtils;

@@ -689,2 +689,3 @@ (function () {

* @param {PromiseFactory} promiseFactory
* @param {ImageProvider} imageProvider
* @param {{width: number, height: number}} viewportSize

@@ -713,2 +714,3 @@ * @param {PositionProvider} positionProvider

promiseFactory,
imageProvider,
viewportSize,

@@ -747,3 +749,3 @@ positionProvider,

}).then(function (currentPosition) {
return _captureViewport(browser, promiseFactory, viewportSize, scaleProviderFactory, cutProvider, entirePageSize,
return _captureViewport(browser, promiseFactory, imageProvider, viewportSize, scaleProviderFactory, cutProvider, entirePageSize,
pixelRatio, rotationDegrees, automaticRotation, automaticRotationDegrees, isLandscape,

@@ -770,2 +772,3 @@ waitBeforeScreenshots, regionInScreenshot, saveDebugScreenshots, debugScreenshotsPath).then(function (partImage) {

* @param {PromiseFactory} promiseFactory
* @param {ImageProvider} imageProvider
* @param {{width: number, height: number}} viewportSize

@@ -789,2 +792,3 @@ * @param {ScaleProviderFactory} scaleProviderFactory

promiseFactory,
imageProvider,
viewportSize,

@@ -806,5 +810,3 @@ scaleProviderFactory,

return GeneralUtils.sleep(waitBeforeScreenshots, promiseFactory).then(function () {
return browser.takeScreenshot().then(function (screenshot64) {
return new MutableImage(new Buffer(screenshot64, 'base64'), promiseFactory);
}).then(function (image) {
return imageProvider.getImage().then(function (image) {
mutableImage = image;

@@ -816,4 +818,3 @@ if (saveDebugScreenshots) {

}).then(function () {
return mutableImage.getSize();
}).then(function (imageSize) {
var imageSize = mutableImage.getSize();
if (isLandscape && automaticRotation && imageSize.height > imageSize.width) {

@@ -858,4 +859,3 @@ rotationDegrees = automaticRotationDegrees;

}).then(function () {
return mutableImage.getSize();
}).then(function (imageSize) {
var imageSize = mutableImage.getSize();
// If the image is a viewport screenshot, we want to save the current scroll position (we'll need it for check region).

@@ -881,2 +881,3 @@ if (imageSize.width <= viewportSize.width && imageSize.height <= viewportSize.height) {

* @param {PromiseFactory} promiseFactory
* @param {ImageProvider} imageProvider
* @param {{width: number, height: number}} viewportSize

@@ -904,2 +905,3 @@ * @param {PositionProvider} positionProvider

promiseFactory,
imageProvider,
viewportSize,

@@ -983,3 +985,3 @@ positionProvider,

if (regionProvider) {
return _captureViewport(browser, promiseFactory, viewportSize, scaleProviderFactory, cutProvider, entirePageSize, pixelRatio,
return _captureViewport(browser, promiseFactory, imageProvider, viewportSize, scaleProviderFactory, cutProvider, entirePageSize, pixelRatio,
rotationDegrees, automaticRotation, automaticRotationDegrees, isLandscape, waitBeforeScreenshots).then(function (image) {

@@ -993,3 +995,3 @@ return regionProvider.getRegionInLocation(image, CoordinatesType.SCREENSHOT_AS_IS, promiseFactory);

// step #5 - Take screenshot of the 0,0 tile / current viewport
return _captureViewport(browser, promiseFactory, viewportSize, scaleProviderFactory, cutProvider, entirePageSize, pixelRatio, rotationDegrees,
return _captureViewport(browser, promiseFactory, imageProvider, viewportSize, scaleProviderFactory, cutProvider, entirePageSize, pixelRatio, rotationDegrees,
automaticRotation, automaticRotationDegrees, isLandscape, waitBeforeScreenshots,

@@ -1034,3 +1036,3 @@ checkFrameOrElement ? regionInScreenshot : null, saveDebugScreenshots, debugScreenshotsPath)

screenshotParts.forEach(function (part) {
promise = _processPart(part, parts, imageObject, browser, promise, promiseFactory,
promise = _processPart(part, parts, imageObject, browser, promise, promiseFactory, imageProvider,
viewportSize, positionProvider, scaleProviderFactory, cutProvider, entirePageSize, pixelRatio, rotationDegrees, automaticRotation,

@@ -1037,0 +1039,0 @@ automaticRotationDegrees, isLandscape, waitBeforeScreenshots, checkFrameOrElement ? regionInScreenshot : null, saveDebugScreenshots, debugScreenshotsPath);

@@ -12,5 +12,5 @@ /* Type definitions for eyes.selenium 0.0.1 */

import { PromiseFactory, Location, Region, RectangleSize } from 'eyes.utils';
import {PromiseFactory, Location, Region, RectangleSize, UserAgent} from 'eyes.utils';
import { PositionProvider, RegionProvider, Logger, CutProvider, ScaleProviderFactory, MatchSettings, CoordinatesType,
EyesScreenshot, EyesBase, MutableImage, TestResults } from 'eyes.sdk';
EyesScreenshot, EyesBase, MutableImage, TestResults, ImageProvider } from 'eyes.sdk';

@@ -491,2 +491,25 @@

export declare class FirefoxScreenshotImageProvider implements ImageProvider {
constructor(eyes: Eyes, logger: Logger, tsInstance: EyesWebDriver);
getImage(): Promise<MutableImage>;
}
export declare class SafariScreenshotImageProvider implements ImageProvider {
constructor(eyes: Eyes, logger: Logger, tsInstance: EyesWebDriver, userAgent: UserAgent);
getImage(): Promise<MutableImage>;
}
export declare class TakesScreenshotImageProvider implements ImageProvider {
constructor(logger: Logger, tsInstance: EyesWebDriver);
getImage(): Promise<MutableImage>;
}
export declare class ImageProviderFactory {
static getImageProvider(userAgent: UserAgent, eyes: Eyes, logger: Logger, driver: EyesWebDriver): ImageProvider;
}
export declare class EyesWebDriverScreenshot extends EyesScreenshot {

@@ -833,2 +856,3 @@ /**

promiseFactory: PromiseFactory,
imageProvider: ImageProvider,
viewportSize: RectangleSize,

@@ -835,0 +859,0 @@ positionProvider: PositionProvider,

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