eyes.selenium
Advanced tools
Comparing version 0.0.83 to 3.6.1
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; |
{ | ||
"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, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
273503
39
5645
0
4
19
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedeyes.sdk@3.8.1(transitive)
+ Addedeyes.utils@3.8.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedimmediate@3.0.6(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjszip@3.10.1(transitive)
+ Addedlie@3.3.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedpako@1.0.11(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsax@1.4.1(transitive)
+ Addedselenium-webdriver@3.6.0(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedtmp@0.0.30(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedxml2js@0.4.23(transitive)
+ Addedxmlbuilder@11.0.1(transitive)
- Removed@types/png-async@0.9.4(transitive)
- Removedeyes.sdk@0.0.73(transitive)
- Removedeyes.utils@0.0.29(transitive)
Updatedeyes.sdk@^3.6.1
Updatedeyes.utils@^3.6.1