Socket
Socket
Sign inDemoInstall

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.81 to 0.0.82

test/appium/android-native-sause-test.js

4

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

@@ -50,3 +50,3 @@ "keywords": [

"eyes.utils": "0.0.29",
"eyes.sdk": "0.0.71"
"eyes.sdk": "0.0.72"
},

@@ -53,0 +53,0 @@ "devDependencies": {

@@ -63,3 +63,4 @@ (function () {

this._isLandscape = false;
this._hideScrollbars = null;
this._hideScrollbars = undefined;
this._scrollRootElement = undefined;
this._checkFrameOrElement = false;

@@ -152,4 +153,4 @@ this._stitchMode = StitchMode.Scroll;

} else {
platformName = capabilities.get('platform') || capabilities.get('platformName');
platformVersion = capabilities.get('version') || capabilities.get('platformVersion');
platformName = capabilities.get('platformName') || capabilities.get('platform');
platformVersion = capabilities.get('platformVersion') || capabilities.get('version');
orientation = capabilities.get('orientation') || capabilities.get('deviceOrientation');

@@ -662,2 +663,3 @@ }

that._hideScrollbars,
that._scrollRootElement,
that._stitchMode === StitchMode.CSS,

@@ -689,9 +691,7 @@ that._imageRotationDegrees,

Eyes.prototype.getInferredEnvironment = function () {
var res = 'useragent:';
return this._driver.executeScript('return navigator.userAgent')
.then(function (userAgent) {
return res + userAgent;
}, function () {
return res;
});
return this._driver.executeScript('return navigator.userAgent').then(function (userAgent) {
return 'useragent:' + userAgent;
}, function () {
return undefined;
});
};

@@ -804,2 +804,20 @@

/**
* Receives a selector and when doing hideScrollbars, it will set the overflow to hidden on that element.
* @param {webdriver.WebElement|webdriver.By|EyesRemoteWebElement} element - The element to hide scrollbars.
*/
Eyes.prototype.setScrollRootElement = function (element) {
this._scrollRootElement = findElementByLocator(this, element);
};
//noinspection JSUnusedGlobalSymbols
/**
* Receives a selector and when doing hideScrollbars, it will set the overflow to hidden on that element.
* @return {webdriver.WebElement} - The element to hide scrollbars.
*/
Eyes.prototype.getScrollRootElement = function () {
return this._scrollRootElement;
};
//noinspection JSUnusedGlobalSymbols
/**
* Set the stitch mode.

@@ -806,0 +824,0 @@ * @param {StitchMode} mode - The desired stitch mode settings.

@@ -76,2 +76,13 @@ (function () {

*/
var JS_GET_SET_OVERFLOW_STR = function (elementName, overflowValue) {
return "var element = " + elementName + ";" +
"var overflowValue = \"" + overflowValue + "\";" +
"var origOverflow = element.style.overflow;" +
"element.style.overflow = overflowValue;" +
"return origOverflow;";
};
/**
* @return {string}
*/
var JS_GET_IS_BODY_OVERFLOW_HIDDEN =

@@ -98,6 +109,7 @@ "var styles = window.getComputedStyle(document.body, null);" +

* let the browser a chance to stabilize (e.g., finish rendering).
* @param {WebElement} element
* @return {Promise<void>} A promise which resolves to the result of the script's execution on the tab.
*/
EyesSeleniumUtils.executeScript = function executeScript(browser, script, promiseFactory, stabilizationTimeMs) {
return browser.executeScript(script).then(function (result) {
EyesSeleniumUtils.executeScript = function executeScript(browser, script, promiseFactory, stabilizationTimeMs, element) {
return browser.executeScript(script, element).then(function (result) {
if (stabilizationTimeMs) {

@@ -353,20 +365,12 @@ return GeneralUtils.sleep(stabilizationTimeMs, promiseFactory)

* @param {string} overflowValue The values of the overflow to set.
* @param {WebElement} scrollRootElement
* @param {PromiseFactory} promiseFactory
* @return {Promise<string>} A promise which resolves to the original overflow of the document.
*/
EyesSeleniumUtils.setOverflow = function setOverflow(browser, overflowValue, promiseFactory) {
var script;
if (overflowValue === null) {
script =
"var origOverflow = document.documentElement.style.overflow; " +
"document.documentElement.style.overflow = undefined; " +
"return origOverflow";
} else {
script =
"var origOverflow = document.documentElement.style.overflow; " +
"document.documentElement.style.overflow = \"" + overflowValue + "\"; " +
"return origOverflow";
}
return EyesSeleniumUtils.executeScript(browser, script, promiseFactory, 100);
EyesSeleniumUtils.setOverflow = function setOverflow(browser, overflowValue, scrollRootElement, promiseFactory) {
var script = JS_GET_SET_OVERFLOW_STR(
scrollRootElement ? "arguments[0]" : "document.documentElement",
overflowValue === null ? "undefined" : overflowValue
);
return EyesSeleniumUtils.executeScript(browser, script, promiseFactory, 100, scrollRootElement);
};

@@ -382,16 +386,4 @@

*/
EyesSeleniumUtils.setBodyOverflow = function setOverflow(browser, overflowValue, promiseFactory) {
var script;
if (overflowValue === null) {
script =
"var origOverflow = document.body.style.overflow; " +
"document.body.style.overflow = undefined; " +
"return origOverflow";
} else {
script =
"var origOverflow = document.body.style.overflow; " +
"document.body.style.overflow = \"" + overflowValue + "\"; " +
"return origOverflow";
}
EyesSeleniumUtils.setBodyOverflow = function setBodyOverflow(browser, overflowValue, promiseFactory) {
var script = JS_GET_SET_OVERFLOW_STR("document.body", overflowValue === null ? "undefined" : overflowValue);
return EyesSeleniumUtils.executeScript(browser, script, promiseFactory, 100);

@@ -408,3 +400,3 @@ };

EyesSeleniumUtils.hideScrollbars = function (browser, promiseFactory) {
return EyesSeleniumUtils.setOverflow(browser, "hidden", promiseFactory);
return EyesSeleniumUtils.setOverflow(browser, "hidden", undefined, promiseFactory);
};

@@ -892,2 +884,3 @@

* @param {boolean} hideScrollbars
* @param {?WebElement} scrollRootElement
* @param {boolean} useCssTransition

@@ -900,5 +893,5 @@ * @param {number} rotationDegrees

* @param {boolean} checkFrameOrElement
* @param {RegionProvider} [regionProvider]
* @param {boolean} [saveDebugScreenshots=false]
* @param {string} [debugScreenshotsPath=null]
* @param {?RegionProvider} [regionProvider]
* @param {?boolean} [saveDebugScreenshots=false]
* @param {?string} [debugScreenshotsPath]
* @return {Promise<MutableImage>}

@@ -915,2 +908,3 @@ */

hideScrollbars,
scrollRootElement,
useCssTransition,

@@ -957,3 +951,3 @@ rotationDegrees,

if (hideScrollbars) {
return EyesSeleniumUtils.setOverflow(browser, "hidden", promiseFactory).then(function (originalVal) {
return EyesSeleniumUtils.setOverflow(browser, "hidden", scrollRootElement, promiseFactory).then(function (originalVal) {
originalOverflow = originalVal;

@@ -1050,3 +1044,3 @@

if (hideScrollbars) {
return EyesSeleniumUtils.setOverflow(browser, originalOverflow, promiseFactory);
return EyesSeleniumUtils.setOverflow(browser, originalOverflow, scrollRootElement, promiseFactory);
}

@@ -1053,0 +1047,0 @@ }).then(function () {

'use strict';
var assert = require('assert');
var webdriver = require('selenium-webdriver');
var EyesSDK = require('../index');
var assert = require('assert');

@@ -30,3 +30,3 @@ var driver, eyes;

}).then(function (driver) {
assert.equal(driver instanceof EyesSDK.EyesWebDriver, true);
assert.strictEqual(driver instanceof EyesSDK.EyesWebDriver, true);
return eyes.close();

@@ -38,3 +38,3 @@ });

return eyes.check('test', EyesSDK.Target.window()).catch(function (error) {
assert.equal(error.message, 'checkWindow called with Eyes not open');
assert.strictEqual(error.message, 'checkWindow called with Eyes not open');
});

@@ -46,6 +46,6 @@ });

it('type should be return thenableWebDriverProxy', function () {
assert.equal(driver.constructor.name, "thenableWebDriverProxy");
assert.strictEqual(driver.constructor.name, "thenableWebDriverProxy");
return eyes._promiseFactory.resolve(driver).then(function (value) {
assert.equal(value.constructor.name, "Driver");
assert.strictEqual(value.constructor.name, "Driver");
});

@@ -56,6 +56,6 @@ });

var eyesDriver = new EyesSDK.EyesWebDriver(driver, eyes, eyes._logger);
assert.equal(eyesDriver.constructor.name, "EyesWebDriver");
assert.strictEqual(eyesDriver.constructor.name, "EyesWebDriver");
return eyes._promiseFactory.resolve(eyesDriver).then(function (value) {
assert.equal(value.constructor.name, "EyesWebDriver");
assert.strictEqual(value.constructor.name, "EyesWebDriver");
});

@@ -81,7 +81,7 @@ });

it('type should be return WebElement', function () {
driver.get('https://astappev.github.io/test-html-pages/');
driver.get('https://astappiev.github.io/test-html-pages/');
var element = driver.findElement(webdriver.By.css("body > h1"));
return element.then(function (value) {
assert.equal(value.constructor.name, "WebElement");
assert.strictEqual(value.constructor.name, "WebElement");
})

@@ -91,7 +91,7 @@ });

it('type should be return WebElement (due to WebElementPromise)', function () {
eyesDriver.get('https://astappev.github.io/test-html-pages/');
eyesDriver.get('https://astappiev.github.io/test-html-pages/');
var element = eyesDriver.findElementByCssSelector("body > h1");
return element.then(function (value) {
assert.equal(value.constructor.name, "WebElement");
assert.strictEqual(value.constructor.name, "WebElement");
})

@@ -98,0 +98,0 @@ });

@@ -28,3 +28,3 @@ var SeleniumSDK = require('../../index');

it("check interface", function(done) {
browser.get("https://astappev.github.io/test-html-pages/");
browser.get("https://astappiev.github.io/test-html-pages/");

@@ -31,0 +31,0 @@ // Entire window, equivalent to eyes.checkWindow()

@@ -24,3 +24,3 @@ var SeleniumSDK = require('../../index');

it("simple protractor", function(done) {
browser.get("https://astappev.github.io/test-html-pages/");
browser.get("https://astappiev.github.io/test-html-pages/");

@@ -27,0 +27,0 @@ eyes.addProperty("MyProp", "I'm correct!");

@@ -41,3 +41,3 @@ require('chromedriver');

it("check interface", function () {
driver.get("https://astappev.github.io/test-html-pages/");
driver.get("https://astappiev.github.io/test-html-pages/");

@@ -44,0 +44,0 @@ // Entire window, equivalent to eyes.checkWindow()

@@ -40,3 +40,3 @@ require('chromedriver');

it("scaling methods", function () {
driver.get("https://astappev.github.io/test-html-pages/");
driver.get("https://astappiev.github.io/test-html-pages/");

@@ -43,0 +43,0 @@ eyes.checkWindow("Initial");

@@ -36,3 +36,3 @@ require('chromedriver');

it("simple selenium", function () {
driver.get('https://astappev.github.io/test-html-pages/');
driver.get('https://astappiev.github.io/test-html-pages/');

@@ -39,0 +39,0 @@ eyes.addProperty("MyProp", "I'm correct!");

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

/**
* Receives a selector and when doing hideScrollbars, it will set the overflow to hidden on that element.
* @param element The element to hide scrollbars.
*/
setScrollRootElement(element: WebElement|By|EyesRemoteWebElement): void;
/**
* Receives a selector and when doing hideScrollbars, it will set the overflow to hidden on that element.
* @return The element to hide scrollbars.
*/
getScrollRootElement(): WebElement;
/**
* Set the stitch mode.

@@ -759,6 +769,7 @@ * @param mode The desired stitch mode settings.

* @param overflowValue The values of the overflow to set.
* @param scrollRootElement
* @param promiseFactory
* @return A promise which resolves to the original overflow of the document.
*/
static setOverflow(browser: WebDriver, overflowValue: string, promiseFactory: PromiseFactory): Promise<string>;
static setOverflow(browser: WebDriver, overflowValue: string, scrollRootElement: WebElement, promiseFactory: PromiseFactory): Promise<string>;
/**

@@ -819,3 +830,3 @@ * Updates the document's body "overflow" value

*/
static setViewportSize(
static getScreenshot(
browser: WebDriver,

@@ -829,2 +840,3 @@ promiseFactory: PromiseFactory,

hideScrollbars: boolean,
scrollRootElement: WebElement,
useCssTransition: boolean,

@@ -831,0 +843,0 @@ rotationDegrees: number,

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