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

eyes.selenium

Package Overview
Dependencies
Maintainers
1
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.11 to 0.0.12

index.js

9

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

@@ -26,6 +26,7 @@ "author": "Applitools Team <team@applitools.com> (http://www.applitools.com/)",

"license": "Apache-2.0",
"main": "./src/Eyes",
"main": "index",
"dependencies": {
"eyes.sdk": "0.0.8",
"selenium-webdriver": "~2.42.1"
"eyes.sdk": "0.0.9",
"selenium-webdriver": "~2.42.1",
"winston": "*"
},

@@ -32,0 +33,0 @@ "devDependencies": {

@@ -21,3 +21,3 @@ eyes.selenium

var Eyes = require('eyes.selenium');
var Eyes = require('eyes.selenium').Eyes;
var eyes = new Eyes();

@@ -31,5 +31,5 @@ eyes.setApiKey("<YOUR_API_KEY>");

eyes.checkWindow("NBA");
eyes.close(true);
eyes.close();
driver.quit();
});
```

@@ -41,3 +41,3 @@ /*

Eyes.prototype._getBaseAgentId = function () {
return 'selenium-js/0.0.8';
return 'selenium-js/0.0.12';
};

@@ -58,7 +58,5 @@

var deferred = webdriver.promise.defer();
console.log('execution began for eyes open');
try {
EyesBase.prototype.open.call(this, appName, testName, viewportSize)
.then(function () {
console.log('inner eyes open returned - fulfilling');
this._driver = driver; //TODO: new EyesWebDriver(driver, this);

@@ -70,3 +68,3 @@ // this._driver.init().then(function () {

} catch (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);

@@ -80,14 +78,24 @@ }

Eyes.prototype.close = function (throwEx) {
if (typeof throwEx === 'undefined') {
throwEx = true;
}
return this._flow.execute(function () {
var deferred = webdriver.promise.defer();
console.log('execution began for eyes close');
EyesBase.prototype.close.call(this, throwEx)
.then(function (results) {
console.log('inner eyes close returned - fulfilling');
deferred.fulfill(results);
}.bind(this), function (err) {
deferred.reject(err);
});
try {
EyesBase.prototype.close.call(this, throwEx)
.then(function (results) {
deferred.fulfill(results);
}.bind(this), function (err) {
deferred.reject(err);
});
} catch (err) {
deferred.reject(err);
if (throwEx) {
throw new Error(err.message);
}
}
return deferred.promise;
}.bind(this));

@@ -99,18 +107,15 @@ };

var deferred = webdriver.promise.defer();
console.log('execution began for eyes check window');
try {
EyesBase.prototype.checkWindow.call(this, tag, false, matchTimeout).then(function () {
console.log('inner eyes check window returned - fulfilling');
deferred.fulfill();
}.bind(this),
function (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
});
}.bind(this));
} catch (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
}
console.log('returning check window promise');
return deferred.promise;

@@ -123,18 +128,15 @@ }.bind(this));

var deferred = webdriver.promise.defer();
console.log('execution began for eyes check region');
try {
EyesBase.prototype.checkWindow.call(this, tag, false, matchTimeout, region).then(function () {
console.log('inner eyes check region returned - fulfilling');
deferred.fulfill();
}.bind(this),
function (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
});
}.bind(this));
} catch (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
}
console.log('returning check window promise');
return deferred.promise;

@@ -147,3 +149,2 @@ }.bind(this));

var deferred = webdriver.promise.defer();
console.log('execution began for eyes check region');
try {

@@ -154,17 +155,15 @@ element.getSize().then(function(size) {

EyesBase.prototype.checkWindow.call(this, tag, false, matchTimeout, region).then(function () {
console.log('inner eyes check region returned - fulfilling');
deferred.fulfill();
}.bind(this),
function (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
});
}.bind(this));
}.bind(this));
}.bind(this));
} catch (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
}
console.log('returning check window promise');
return deferred.promise;

@@ -177,3 +176,2 @@ }.bind(this));

var deferred = webdriver.promise.defer();
console.log('execution began for eyes check region');
try {

@@ -185,9 +183,8 @@ this._driver.findElement(by).then(function(element) {

EyesBase.prototype.checkWindow.call(this, tag, false, matchTimeout, region).then(function () {
console.log('inner eyes check region returned - fulfilling');
deferred.fulfill();
}.bind(this),
function (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
});
}.bind(this));
}.bind(this));

@@ -197,7 +194,6 @@ }.bind(this));

} catch (err) {
console.log(err);
this._logger.log(err.toString());
deferred.reject(err);
}
console.log('returning check window promise');
return deferred.promise;

@@ -204,0 +200,0 @@ }.bind(this));

@@ -40,10 +40,6 @@ /*

ViewportSize.getViewportSize = function (driver) {
console.log('ViewportSize.getViewportSize called');
return PromiseFactory.makePromise(function (resolve, reject) {
try {
console.log('ViewportSize.getViewportSize - executing scripts');
driver.executeScript(_GET_VIEWPORT_SIZE_JAVASCRIPT_FOR_NORMAL_BROWSER).then(function(size) {
if (size.width > 0 && size.height > 0) {
console.log('ViewportSize.getViewportSize - normal script returned size: w', size.width,
' h', size.height);
resolve(size);

@@ -53,16 +49,8 @@ return;

console.log('ViewportSize.getViewportSize - normal script returned bad size - calling old script');
driver.executeScript(_GET_VIEWPORT_SIZE_JAVASCRIPT_FOR_BAD_BROWSERS).then(function(size) {
console.log('ViewportSize.getViewportSize - old script returned size: w', size.width,
' h', size.height);
resolve(size);
});
},
function(err){
console.log('ViewportSize.getViewportSize - error while getting viewport size - ' +
'attempting old browser script', err);
function(){
driver.executeScript(_GET_VIEWPORT_SIZE_JAVASCRIPT_FOR_BAD_BROWSERS).then(function(size) {
console.log('ViewportSize.getViewportSize - old script returned size: w', size.width,
' h', size.height);
resolve(size);

@@ -72,6 +60,3 @@ });

} catch (err) {
console.log('ViewportSize.getViewportSize - exception - so using window size', err);
new Window(driver).getSize().then(function(size){
console.log('ViewportSize.getViewportSize - window returned size: w', size.width,
' h', size.height);
resolve(size);

@@ -85,3 +70,2 @@ });

ViewportSize.setViewportSize = function (driver, size) {
console.log('ViewportSize.setViewportSize called for size', size);
// first we will set the window size to the required size. Then we'll check the viewport size and increase the

@@ -99,3 +83,2 @@ // window size accordingly.

height: ((2 * size.height) - viewportSize.height)};
console.log('initial viewport size:', viewportSize, 'setting to:', computedSize);
driver.manage().window().setSize(computedSize.width, computedSize.height)

@@ -107,4 +90,3 @@ .then(function () {

}, function (err) {
console.error('Failed to set browser size!');
reject(Error(err));
reject(err);
});

@@ -114,8 +96,6 @@ });

}, function (err) {
console.error('Failed to set browser size!');
reject(Error(err));
reject(err);
});
});
} catch (err) {
console.log('ViewportSize.setViewportSize - exception:', err);
reject(Error(err));

@@ -131,3 +111,2 @@ }

if (winSize.width == size.width && winSize.height == size.height) {
console.log('window size successfully set');
resolve(retries);

@@ -138,3 +117,2 @@ return;

if (retries == 0) {
console.error('no more retries to set window size');
reject(Error('no more retries to set window size'));

@@ -144,3 +122,2 @@ return;

console.log('window size still not set - timeout and rechecking');
driver.controlFlow().timeout(1000).then(function() {

@@ -150,3 +127,3 @@ _retryCheckWindowSize(driver, size, retries - 1).then(function (retriesLeft){

}, function(err) {
reject(Error(err));
reject(err);
});

@@ -163,3 +140,2 @@ });

if (viewportSize.width == size.width && viewportSize.height == size.height) {
console.log('viewport size successfully set');
resolve(retries);

@@ -170,3 +146,2 @@ return;

if (retries == 0) {
console.error('no more retries to set viewport size');
reject(Error('no more retries to set viewport size'));

@@ -176,3 +151,2 @@ return;

console.log('viewport size still not set - timeout and rechecking');
driver.controlFlow().timeout(1000).then(function() {

@@ -182,3 +156,3 @@ _retryCheckViewportSize(driver, size, retries - 1).then(function (retriesLeft){

}, function(err) {
reject(Error(err));
reject(err);
});

@@ -185,0 +159,0 @@ });

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