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

nemo

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nemo - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

25

examples/setup.js
var Nemo = require("../");
/*
process.env.nemoData = JSON.stringify({

@@ -10,10 +11,24 @@ targetBrowser: "firefox",

});
*/
(new Nemo()).setup().then(function (nemo) {
var config = {
nemoData: {
targetBrowser: "firefox",
targetServer: "localhost",
serverProps: {
"port": 4444
},
seleniumJar: "/usr/bin/selenium-server-standalone.jar",
targetBaseUrl: "https://www.paypal.com"
}
};
//THE ABOVE OR BELOW WILL WORK TO SET nemoData. IN A CONTEST, SETTING VIA Nemo() WILL WIN
(new Nemo(config)).setup().then(function(nemo) {
nemo.driver.get(nemo.props.targetBaseUrl);
nemo.driver.sleep(5000).
then(function () {
console.info("Nemo was successful!!");
nemo.driver.quit();
});
then(function() {
console.info("Nemo was successful!!");
nemo.driver.quit();
});
});

48

index.js

@@ -19,6 +19,3 @@ /*───────────────────────────────────────────────────────────────────────────*\

Setup = require('./setup'),
nemoData = {},
waterFallArray = [],
preDriverArray = [],
postDriverArray = [],
_ = require('lodash'),

@@ -30,3 +27,3 @@ webdriver = require('selenium-webdriver');

* @constructor
* @param {Object} config - Object which contains any plugin registration
* @param {Object} config - Object which contains any plugin registration and optionally nemoData
*

@@ -36,3 +33,6 @@ */

function Nemo(config) {
this.nemoData = (config && config.nemoData) ? config.nemoData : undefined,
this.waterFallArray = [],
this.preDriverArray = [],
this.postDriverArray = [],
this.plugins = {};

@@ -65,7 +65,7 @@ //config is for registering plugins

setup: function(config) {
nemoData = JSON.parse(process.env.nemoData);
this.nemoData = (this.nemoData) ? this.nemoData : JSON.parse(process.env.nemoData);
config = config || {};
var that = this,
var me = this,
returnObj = {
'props': nemoData,
'props': this.nemoData,
'view': {},

@@ -75,7 +75,7 @@ 'locator': {},

'wd': {}
},
d = webdriver.promise.defer(),
preDriverArray = [datasetup];
};
var d = webdriver.promise.defer();
me.preDriverArray = [datasetup];
Object.keys(that.plugins).forEach(function(key) {
Object.keys(me.plugins).forEach(function(key) {
var modulePath,

@@ -85,22 +85,22 @@ pluginConfig,

if ((that.plugins[key].register || config[key]) && key !== 'view') {
if ((me.plugins[key].register || config[key]) && key !== 'view') {
//register this plugin
pluginConfig = that.plugins[key];
pluginConfig = me.plugins[key];
modulePath = pluginConfig.module;
pluginModule = require(modulePath);
if (that.plugins[key].priority && that.plugins[key].priority < 100) {
preDriverArray.push(pluginModule.setup);
if (me.plugins[key].priority && me.plugins[key].priority < 100) {
me.preDriverArray.push(pluginModule.setup);
} else {
postDriverArray.push(pluginModule.setup);
me.postDriverArray.push(pluginModule.setup);
}
}
});
waterFallArray = preDriverArray.concat([driversetup], postDriverArray);
me.waterFallArray = me.preDriverArray.concat([driversetup], me.postDriverArray);
if (config.view) {
waterFallArray.push(viewsetup);
me.waterFallArray.push(viewsetup);
}
if (config.locator) {
waterFallArray.push(locatorsetup);
me.waterFallArray.push(locatorsetup);
}
async.waterfall(waterFallArray, function(err, result) {
async.waterfall(me.waterFallArray, function(err, result) {
if (err) {

@@ -144,5 +144,5 @@ d.reject(err);

config.view.forEach(function(key) {
if (that.plugins.view) {
if (me.plugins.view) {
//process with the view interface
returnObj.view[(key.constructor === String) ? key : key.name] = require(that.plugins.view.module).addView(key, result);
returnObj.view[(key.constructor === String) ? key : key.name] = require(me.plugins.view.module).addView(key, result);
} else {

@@ -149,0 +149,0 @@ var viewMod = require(returnObj.props.autoBaseDir + '/view/' + key);

{
"name": "nemo",
"version": "0.1.2",
"version": "0.1.3",
"description": "Abstraction for automation test components",

@@ -5,0 +5,0 @@ "scripts": {

@@ -27,3 +27,3 @@ # Nemo

```javascript
"nemo": "^0.1.0",
"nemo": "^0.1.2",
```

@@ -40,17 +40,32 @@

/*
process.env.nemoData = JSON.stringify({
targetBrowser: "firefox",
targetServer: "localhost",
serverProps: {"port": 4444},
serverProps: {"port": 4444},
seleniumJar: "/usr/bin/selenium-server-standalone.jar",
targetBaseUrl: "https://www.paypal.com"
});
*/
(new Nemo()).setup().then(function (nemo) {
var config = {
nemoData: {
targetBrowser: "firefox",
targetServer: "localhost",
serverProps: {
"port": 4444
},
seleniumJar: "/usr/bin/selenium-server-standalone.jar",
targetBaseUrl: "https://www.paypal.com"
}
};
//THE ABOVE OR BELOW WILL WORK TO SET nemoData. IN A CONTEST, SETTING VIA Nemo() WILL WIN
(new Nemo(config)).setup().then(function(nemo) {
nemo.driver.get(nemo.props.targetBaseUrl);
nemo.driver.sleep(5000).
then(function () {
console.info("Nemo was successful!!");
nemo.driver.quit();
});
then(function() {
console.info("Nemo was successful!!");
nemo.driver.quit();
});
});

@@ -62,2 +77,4 @@ ```

Note you can set `nemoData` via an environment variable OR by passing it into the Nemo constructor.
Now, assuming you've set up a driver which matches the above requirements, you can run the following, with the following result:

@@ -72,3 +89,3 @@

Nemo will look for an environment variable named `nemoData`. `nemoData` should be in stringified JSON format. Depending on
Nemo will look for a JSON object in the constructor config argument. As a fallback, it will look for an environment variable named `nemoData`. `nemoData` should be in stringified JSON format. Depending on
the values therein, Nemo will start a variety of webdrivers and test on a variety of targets.

@@ -98,2 +115,4 @@

If you are using sauce labs, make sure `targetServer` is set to correct url like `"http://yourkey:yoursecret@ondemand.saucelabs.com:80/wd/hub"`
### serverProps (optional/conditional)

@@ -127,3 +146,5 @@

"username": "medelman",
"accessKey": "b38e179e-079a-417d-beb8-xyz" //not my real access key
"accessKey": "b38e179e-079a-417d-beb8-xyz", //not my real access key
"name": "Test Suite Name", //sauce labs session name
"tags": ['tag1','tag2'] //sauce labs tag names
}

@@ -184,3 +205,3 @@ ```

* @constructor
* @param {Object} config - Object which contains any plugin registration
* @param {Object} config - Object which contains any plugin registration and optionally the nemoData object
*

@@ -187,0 +208,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