{"id":13494415,"url":"https://github.com/paypal/nemo-core","last_synced_at":"2025-04-04T14:10:19.234Z","repository":{"id":17064152,"uuid":"19828882","full_name":"paypal/nemo-core","owner":"paypal","description":"Selenium-webdriver based automation in node.js","archived":false,"fork":false,"pushed_at":"2023-11-23T19:42:37.000Z","size":1412,"stargazers_count":262,"open_issues_count":15,"forks_count":74,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-28T13:06:48.168Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paypal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-05-15T17:36:30.000Z","updated_at":"2025-02-10T22:37:48.000Z","dependencies_parsed_at":"2024-01-16T09:52:26.956Z","dependency_job_id":"f1f3e57c-703a-469b-b23e-613df2c80141","html_url":"https://github.com/paypal/nemo-core","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fnemo-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fnemo-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fnemo-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fnemo-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paypal","download_url":"https://codeload.github.com/paypal/nemo-core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190224,"owners_count":20898699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:24.863Z","updated_at":"2025-04-04T14:10:19.212Z","avatar_url":"https://github.com/paypal.png","language":"JavaScript","funding_links":["https://www.paypal.com"],"categories":["JavaScript"],"sub_categories":[],"readme":"# Nemo-core [![Build Status](https://travis-ci.org/paypal/nemo-core.svg)](https://travis-ci.org/paypal/nemo-core)\n\n[![Join the chat at https://gitter.im/paypal/nemo-core](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/paypal/nemo-core?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![JS.ORG](https://img.shields.io/badge/js.org-nemo-ffb400.svg?style=flat-square)](http://js.org)\n[![Dependency Status](https://david-dm.org/paypal/nemo-core.svg)](https://david-dm.org/paypal/nemo-core)\n[![devDependency Status](https://david-dm.org/paypal/nemo-core/dev-status.svg)](https://david-dm.org/paypal/nemo-core#info=devDependencies)\n\nNemo-core provides a simple way to add selenium automation to your NodeJS web projects. With a powerful configuration\nability provided by [krakenjs/confit](https://github.com/krakenjs/confit), and plugin\narchitecture, Nemo-core is flexible enough to handle any browser/device automation need.\n\nNemo-core is built to easily plug into any task runner and test runner. But in this README we will only cover setup and architecture of Nemo-core\nas a standalone entity.\n\n## Getting started\n\n### Install\n\n```\nnpm install --save-dev nemo-core\n```\n\n### Pre-requisites\n\n#### Webdriver\n\n[Please see here for more information about setting up a webdriver](https://github.com/paypal/nemo-docs/blob/master/driver-setup.md).\nAs long as you have the appropriate browser or browser driver (selenium-standalone, chromedriver) on your PATH, the rest of this should work\nfine.\n\n\n\n### Nemo-core and Confit in 90 seconds\n\nNemo-core uses confit - a powerful, expressive and intuitive configuration system - to elegantly expose the Nemo-core and selenium-webdriver APIs.\n\n#### Direct configuration\n\nIf you install this repo you'll get the following in `examples/setup.js`. Note the `NemoCore()` constructor is directly accepting the needed configuration,\nalong with a callback function.\n\n```javascript\nNemoCore({\n  \"driver\": {\n    \"browser\": \"firefox\"\n  },\n  'data': {\n    'baseUrl': 'https://www.paypal.com'\n  }\n}, function (err, nemo) {\n  //always check for errors!\n  if (!!err) {\n    console.log('Error during Nemo-core setup', err);\n  }\n  nemo.driver.get(nemo.data.baseUrl);\n  nemo.driver.getCapabilities().\n    then(function (caps) {\n      console.info(\"Nemo-core successfully launched\", caps.caps_.browserName);\n    });\n  nemo.driver.quit();\n});\n```\n\n##### you can use async/await as well\n```javascript\nconst Nemo = require('nemo-core');\n(async () =\u003e {\n  const nemo = await Nemo({\n    driver: {\n      browser: 'firefox'\n    },\n    data: {\n      baseUrl: 'https://www.paypal.com'\n    }\n  });\n  await nemo.driver.get(nemo.data.baseUrl);\n  const caps = await nemo.driver.getCapabilities();\n  console.log(`nemo-core successfully launched with ${caps.get('browserName')}`);\n  await nemo.driver.quit();\n})();\n```\n\n##### make sure to handle errors when using async/await\nYou can modify the example above to handle errors.  Make sure to define nemo outside of your try block, so you can \"quit\" the driver if an error occurs after nemo has been successfully created\n```javascript\nconst Nemo = require('nemo-core');\nlet nemo;\n(async () =\u003e {\n  try {\n    nemo = await Nemo({\n      driver: {\n        browser: 'firefox'\n      },\n      data: {\n        baseUrl: 'https://www.paypal.com'\n      }\n    });\n    await nemo.driver.get(nemo.data.baseUrl);\n    throw new Error('artificial error to test error handling!');\n    nemo.driver.quit(); // this is not called, but we can call it in our catch block\n  } catch (err) {\n    console.log(err);\n    // attempt to quit the driver in error scenarios\n    if (nemo) {\n      nemo.driver.quit();\n    }\n  }\n})();\n```\n\nRun it:\n\n```bash\n$ node examples/setup.js\nNemo-core successfully launched firefox\n```\n\n#### Using config files\n\nLook at `examples/setupWithConfigFiles.js`\n\n```javascript\n//passing __dirname as the first argument tells confit to\n//look in __dirname + '/config' for config files\nNemoCore(__dirname, function (err, nemo) {\n  //always check for errors!\n  if (!!err) {\n    console.log('Error during Nemo-core setup', err);\n  }\n\n  nemo.driver.get(nemo.data.baseUrl);\n  nemo.driver.getCapabilities().\n    then(function (caps) {\n      console.info(\"Nemo-core successfully launched\", caps.caps_.browserName);\n    });\n  nemo.driver.quit();\n});\n```\n\nNote the comment above that passing a filesystem path as the first argument to `NemoCore()` will tell confit to look in that directory + `/config` for config files.\n\nLook at `examples/config/config.json`\n\n```javascript\n{\n  \"driver\": {\n    \"browser\": \"config:BROWSER\"\n  },\n  \"data\": {\n    \"baseUrl\": \"https://www.paypal.com\"\n  },\n  \"BROWSER\": \"firefox\"\n}\n```\n\nThat is almost the same config as the first example. But notice `\"config:BROWSER\"`. Yes, confit will resolve that to the config property `\"BROWSER\"`.\n\nRun this and it will open the Firefox browser:\n\n```bash\n$ node examples/setup.js\nNemo-core successfully launched firefox\n```\n\nNow run this command:\n\n```bash\n$ node examples/setupWithConfigDir.js --BROWSER=chrome\nNemo-core successfully launched chrome\n```\n\nHere, confit resolves the `--BROWSER=chrome` command line argument and overrides the `BROWSER` value from config.json\n\nNow this command:\n\n```bash\n$ BROWSER=chrome node examples/setupWithConfigDir.js\nNemo-core successfully launched chrome\n```\n\nHere, confit resolves the `BROWSER` environment variable and overrides `BROWSER` from config.json\n\nWhat if we set both?\n\n```bash\n$ BROWSER=chrome node examples/setupWithConfigDir.js --BROWSER=phantomjs\nNemo-core successfully launched chrome\n```\n\nYou can see that the environment variable wins.\n\nNow try this command:\n\n```\n$ NODE_ENV=special node examples/setupWithConfigDir.js\nNemo-core successfully launched phantomjs\n```\n\nNote that confit uses the value of NODE_ENV to look for an override config file. In this case `config/special.json`:\n\n```javascript\n{\n  \"driver\": {\n    \"browser\": \"phantomjs\"\n  },\n  \"data\": {\n    \"baseUrl\": \"https://www.paypal.com\"\n  }\n}\n```\n\nHopefully this was an instructive dive into the possibilities of Nemo-core + confit. There is more to learn but hopefully this is enough to whet your appetite for now!\n\n## Nemo-core and Plugins in 60 Seconds\n\nLook at the `example/setupWithPlugin.js` file:\n\n```javascript\nNemoCore(basedir, function (err, nemo) {\n  //always check for errors!\n  if (!!err) {\n    console.log('Error during Nemo-core setup', err);\n  }\n  nemo.driver.getCapabilities().\n    then(function (caps) {\n      console.info(\"Nemo-core successfully launched\", caps.caps_.browserName);\n    });\n  nemo.driver.get(nemo.data.baseUrl);\n  nemo.cookie.deleteAll();\n  nemo.cookie.set('foo', 'bar');\n  nemo.cookie.getAll().then(function (cookies) {\n    console.log('cookies', cookies);\n    console.log('=======================');\n  });\n  nemo.cookie.deleteAll();\n  nemo.cookie.getAll().then(function (cookies) {\n    console.log('cookies', cookies);\n  });\n  nemo.driver.quit();\n});\n```\n\nNotice the `nemo.cookie` namespace. This is actually a plugin, and if you look at the config for this setup:\n```javascript\n{\n  \"driver\": {\n    \"browser\": \"firefox\"\n  },\n  \"data\": {\n    \"baseUrl\": \"https://www.paypal.com\"\n  },\n  \"plugins\": {\n    \"cookie\": {\n      \"module\": \"path:./nemo-cookie\"\n    }\n  }\n}\n```\nYou'll see the `plugins.cookie` section, which is loading `examples/plugin/nemo-cookie.js` as a plugin:\n```javascript\n'use strict';\n\nmodule.exports = {\n  \"setup\": function (nemo, callback) {\n    nemo.cookie = {};\n    nemo.cookie.delete = function (name) {\n      return nemo.driver.manage().deleteCookie(name);\n    };\n    nemo.cookie.deleteAll = function () {\n      return nemo.driver.manage().deleteAllCookies();\n    };\n    nemo.cookie.set = function (name, value, path, domain, isSecure, expiry) {\n      return nemo.driver.manage().addCookie(name, value, path, domain, isSecure, expiry)\n    };\n    nemo.cookie.get = function (name) {\n      return nemo.driver.manage().getCookie(name);\n    };\n    nemo.cookie.getAll = function () {\n      return nemo.driver.manage().getCookies();\n    };\n    callback(null);\n\n  }\n};\n```\n\nRunning this example:\n\n```bash\n$ node examples/setupWithPlugin.js\nNemo-core successfully launched firefox\ncookies [ { name: 'foo',\n   value: 'bar',\n   path: '',\n   domain: 'www.paypal.com',\n   secure: false,\n   expiry: null } ]\n=======================\ncookies []\n$\n```\n\nThis illustrates how you can create a plugin, and the sorts of things you might want to do with a plugin.\n\n## API\n\n### Nemo-core\n\n`var nemo = NemoCore([[nemoBaseDir, ][config, ][callback]] | [Confit object]);`\n\n`@argument nemoBaseDir {String}` (optional) - If provided, should be a filesystem path to your test suite. Nemo-core will expect to find a `/config` directory beneath that.\n`\u003cnemoBaseDir\u003e/config/config.json` should have your default configuration (described below). `nemoBaseDir` can alternatively be set as an environment variable. If it is\nnot set, you need to pass your configuration as the `config` parameter (see below).\n\n`@argument config {Object}` (optional) - Can be a full configuration (if `nemoBaseDir` not provided) or additional/override configuration to what's in your config files.\n\n`@argument callback {Function}` (optional) - This function will be called once the `nemo` object is fully resolved. It may be called with an error as the first argument which has important debugging information. So make sure to check for an error. The second argument is the resolved `nemo` object.\n\n`@argument Confit object {Object}` (optional) - If a Confit object is passed, the configuration step is skipped and the passed object is used directly.\n\n`@returns nemo {Object|Promise}` - Promise returned if no callback provided. Promise resolves with the same nemo object as would be given to the callback.\n The nemo object has the following properties:\n\n* **driver** The live `selenium-webdriver` API. See WebDriver API Doc: http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html\n\n* **wd** This is a reference to the `selenium-webdriver` module: http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index.html\n\n* **data** Pass through of any data included in the `data` property of the configuration\n\n* **_config** This is the confit configuration object. Documented here: https://github.com/krakenjs/confit#config-api\n\n* **plugin namespace(s)** Plugins are responsible for registering their own namespace under nemo. The convention is that the plugin should register the same namespace\nas is specified in the plugin configuration. E.g. the `nemo-view` module registers itself as `nemo.view` and is configured like this:\n\n```javascript\n{\n  \"driver\": ...\n  \"plugins\": {\n    \"view\": {\n      \"module\": \"nemo-view\"\n    }\n  }\n```\n\nYou could also have a config that looks like this, and `nemo-view` will still register itself as `nemo.view`\n\n```javascript\n{\n  \"driver\": ...\n  \"plugins\": {\n    \"cupcakes\": {\n      \"module\": \"nemo-view\"\n    }\n  }\n```\n\nBut that's confusing. So please stick to the convention.\n\n#### Typical usage of Nemo-core constructor\n\nA typical pattern would be to use `mocha` as a test runner, resolve `nemo` in the context of the mocha `before` function, and use\nthe mocha `done` function as the callback:\n\n```javascript\nvar nemo;\ndescribe('my nemo suite', function () {\n  before(function (done) {\n    NemoCore(config, function (err, resolvedNemo-core) {\n        nemo = resolvedNemo-core;\n        done(err)\n    });\n  });\n  it('will launch browsers!', function (done) {\n    nemo.driver.get('https://www.paypal.com');\n    nemo.driver.quit().then(function () {\n       done();\n    });\n  });\n});\n\n```\n\n### Configure\n\nCalling `Configure` will return a promise which resolves as a Confit object. This is the same method Nemo-core calls internally in the basic use case. You might want to call `Configure` if\nyou are interested in the resolved configuration object but not yet ready to start the webdriver. An example would be if you want to make further\nchanges to the configuration based on what gets resolved, prior to starting the webdriver.\n\n`function Configure([nemoBaseDir, ][configOverride])`\n\n`@argument nemoBaseDir {String}` (optional) - If provided, should be a filesystem path. There should be a `/config` directory beneath that.\n`\u003cnemoBaseDir\u003e/config/config.json` should have your default configuration. `nemoBaseDir` can alternatively be set as an environment variable. If it is\nnot set, you need to pass your configuration as the `config` parameter (see below).\n\n`@argument config {Object}` (optional) - Can be a full configuration (if `nemoBaseDir` not provided) or additional/override configuration to what's in your config files.\n\n`@returns {Promise}` - Promise resolves as a confit object:\n\n\n## Configuration Input\n\n```javascript\n{\n  \"driver\": { /** properties used by Nemo-core to setup the driver instance **/ },\n  \"plugins\": { /** plugins to initialize **/},\n  \"data\": { /** arbitrary data to pass through to nemo instance **/ }\n}\n```\n\nThis configuration object is optional, as long as you've got `nemoData` set as an environment variable (see below).\n\n### driver\n\nHere are the `driver` properties recognized by Nemo-core. This is ALL of them. Please be aware that you really only need to supply \"browser\" to get things working initially.\n\n#### browser (optional)\n\nBrowser you wish to automate. Make sure that your chosen webdriver has this browser option available. While this is \"optional\" you must choose a browser. Either use this property or the `builders.forBrowser` option (see below).\nIf both are specified, `builders.forBrowser` takes precedence.\n\n#### local (optional, defaults to false)\n\nSet local to true if you want Nemo-core to attempt to start a standalone binary on your system (like selenium-standalone-server) or use a local browser/driver like Chrome/chromedriver or PhantomJS.\n\n#### server (optional)\n\nWebdriver server URL you wish to use. This setting will be overridden if you are using `builders.usingServer`\n\n#### serverProps (optional/conditional)\n\nAdditional server properties required of the 'targetServer'\n\nYou can also set args and jvmArgs to the selenium jar process as follows:\n\n```javascript\n\"serverProps\": {\n  \"port\": 4444,\n  \"args\": [\"-firefoxProfileTemplate\",\"/Users/medelman/Desktop/ffprofiles\"],\n  \"jvmArgs\": [\"-someJvmArg\", \"someJvmArgValue\"]\n}\n```\n\n#### jar (optional/conditional)\n\nPath to your webdriver server Jar file. Leave unset if you aren't using a local selenium-standalone Jar (or similar).\n\n#### serverCaps (optional)\n\nserverCaps would map to the capabilities here: http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Capabilities.html\n\nSome webdrivers (for instance ios-driver, or appium) would have additional capabilities which can be set via this variable. As an example, you can connect to saucelabs by adding this serverCaps:\n\n```javascript\n\"serverCaps\": {\n\t\"username\": \"medelman\",\n\t\"accessKey\": \"b38e179e-079a-417d-beb8-xyz\", //not my real access key\n\t\"name\": \"Test Suite Name\", //sauce labs session name\n\t\"tags\": ['tag1','tag2'] //sauce labs tag names\n}\n```\n#### proxyDetails (optional)\nIf you want to run test by setting proxy in the browser, you can use 'proxyDetails' configuration. Following options are available: direct, manual, pac and system.\nDefault is 'direct'. For more information refer : http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/proxy.html\n\n```javascript\n\"proxyDetails\" : {\n    \"method\": \"manual\",\n    \"args\": [{\"http\": \"localhost:9001\",\"ftp\":\"localhost:9001\",\"https\":\"localhost:9001\"}]\n}\n```\n\n#### builders (optional)\n\nThis is a JSON interface to any of the Builder methods which take simple arguments and return the builder. See the Builder class here: http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Builder.html\n\nUseful such functions are:\n* forBrowser (can take the place of \"browser\", \"local\" and \"jar\" properties above)\n* withCapabilities (can take the place of \"serverCaps\" above)\n\nThe nemo setup routine will prefer these \"builder\" properties over other abstracted properties above, if there is a conflict.\n\n#### selenium.version (optional)\n\nSince nemo requires a narrow range of versions of selenium-webdriver, you may have a need to upgrade selenium-webdriver (or downgrade) outside of the supported versions that nemo uses.\nYou can do that by using `selenium.version`. E.g.\n\n```js\n\"driver\": {\n  \"browser\": \"firefox\",\n  \"selenium.version\": \"^2.53.1\"\n}\n```\n\nNemo-core will upgrade its internal dependency to what is set in this property. The `npm install` will only run if the version specified is not already installed.\n\n#### custom driver\n\nYou can also provide a module, which exports a function that returns a fully formed `WebDriver` object. To do so, follow\n this example: https://github.com/paypal/nemo-core/pull/177#issue-199917000\n\n### plugins\n\nPlugins are registered with JSON like the following (will vary based on your plugins)\n\n```javascript\n{\n\t\"plugins\": {\n\t\t\"samplePlugin\": {\n\t\t\t\"module\": \"path:plugin/sample-plugin\",\n\t\t\t\"arguments\": [...],\n\t\t\t\"priority\": 99\n\t\t},\n\t\t\"view\": {\n\t\t\t\"module\": \"nemo-view\"\n\t\t}\n\t}\n}\n```\n\nPlugin.pluginName parameters:\n\n* **module {String}** - Module must resolve to a require'able module, either via name (in the case it is in your dependency tree) or via path to the file or directory.\n\n* **arguments {Array}** (optional, depending on plugin) - Your plugin will be called via its setup method with these arguments: `[configArg1, configArg2, ..., ]nemo, callback`.\nPlease note that the braces there indicate \"optional\". The arguments will be applied via `Function.apply`\n\n* **priority {Number}** (optional, depending on plugin) - A `priority` value of \u003c 100 will register this plugin BEFORE the selenium driver object is created.\nThis means that such a plugin can modify `config` properties prior to driver setup. Leaving `priority` unset will register the plugin after the driver object is created.\n\n### data\n\nData will be arbitrary stuff that you might like to use in your tests. In a lot of the examples we set `data.baseUrl` but again, that's arbitrary and not required. You could\npass and use `data.cupcakes` if you want. Cupcakes are awesome.\n\n## Shortstop handlers\n\nShortstop handlers are data processors that key off of directives in the JSON data. Ones that are enabled in nemo are:\n\n### path\n\nuse path to prepend the `nemoBaseDir` (or `process.cwd()`) to a value. E.g. if `nemoBaseDir` is `.../myApp/tests` then\na config value of `'path:plugin/myPlugin'` will resolve to `.../myApp/tests/plugin/myPlugin`\n\n### env\n\nuse env to reference environment variables. E.g. a config value of `'env:PATH'` will resolve to\n`/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:...`\n\n### argv\n\nuse argv to reference argv variables. E.g. a config value of `'argv:browser'` will resolve to `firefox` if you\nset `--browser firefox` as an argv on the command line\n\n### config\n\nUse config to reference data in other parts of the JSON configuration. E.g. in the following config.json:\n\n```javascript\n{\n  \"driver\": {\n    ...\n  },\n  \"plugins\": {\n    \"myPlugin\": {\n      \"module\": \"nemo-some-plugin\",\n      \"arguments\": [\"config:data.someProp\"]\n    }\n  },\n  \"data\": {\n    \"someProp\": \"someVal\"\n  }\n}\n```\n\nThe value of `plugins.myPlugin.arguments[0]` will be `someVal`\n\n\n### file\n\nPlease see [https://github.com/krakenjs/shortstop-handlers#handlersfilebasedir-options](https://github.com/krakenjs/shortstop-handlers#handlersfilebasedir-options)\n\n### base64\n\nPlease see [https://github.com/krakenjs/shortstop-handlers#handlersbase64](https://github.com/krakenjs/shortstop-handlers#handlersbase64)\n\n### require\n\nPlease see [https://github.com/krakenjs/shortstop-handlers#handlersrequirebasedir](https://github.com/krakenjs/shortstop-handlers#handlersrequirebasedir)\n\n### exec\n\nPlease see [https://github.com/krakenjs/shortstop-handlers#handlersexecbasedir](https://github.com/krakenjs/shortstop-handlers#handlersexecbasedir)\n\n### glob\n\nPlease see [https://github.com/krakenjs/shortstop-handlers#handlersglobbasediroptions](https://github.com/krakenjs/shortstop-handlers#handlersglobbasediroptions)\n\n## Plugins\n\nAuthoring a plugin, or using an existing plugin, is a great way to increase the power and usefulness of your Nemo-core installation. A plugin should add\nits API to the `nemo` object it receives and passes on in its constructor (see \"plugin interface\" below)\n\n### plugin interface\n\nA plugin should export a setup function with the following interface:\n\n```javascript\nmodule.exports.setup = function myPlugin([arg1, arg2, ..., ]nemo, callback) {\n  ...\n  //add your plugin to the nemo namespace\n  nemo.myPlugin = myPluginFactory([arg1, arg2, ...]); //adds myMethod1, myMethod2\n\n  //error in your plugin setup\n  if (err) {\n    callback(err);\n    return;\n  }\n  //continue\n  callback(null);\n};\n```\n\nWhen nemo initializes your plugin, it will call the setup method with any arguments supplied in the config plus the nemo object,\nplus the callback function to continue plugin initialization.\n\nThen in your module where you use Nemo-core, you will be able to access the plugin functionality:\n\n```javascript\nvar Nemo-core = require('nemo');\nNemoCore({\n  'driver': {\n    'browser': 'firefox',\n    'local': true,\n    'jar': '/usr/local/bin/selenium-server-standalone.jar'\n  },\n  'data': {\n    'baseUrl': 'https://www.paypal.com'\n  },\n  'plugins': {\n    'myPlugin': {\n      'module': 'path:plugin/my-plugin',\n      'arguments': [...]\n      'priority': 99\n    },\n  }\n}, function (err, nemo) {\n  nemo.driver.get(nemo.data.baseUrl);\n  nemo.myPlugin.myMethod1();\n  nemo.myPlugin.myMethod2();\n  nemo.driver.sleep(5000).\n    then(function() {\n      console.info('Nemo-core was successful!!');\n      nemo.driver.quit();\n    });\n});\n```\n\n\n\n\n## Logging and debugging\n\nNemo-core uses the [debug](https://github.com/visionmedia/debug.git) module for console logging and error output. There are two classes of logging, `nemo:log` and `nemo:error`\n\nIf you want to see both classes of output, simply use the appropriate value of the DEBUG environment variable when you run nemo:\n\n```bash\n$ DEBUG=nemo:* \u003cnemo command\u003e\n```\n\nTo see just one:\n\n```bash\n$ DEBUG=nemo:error \u003cnemo command\u003e\n```\n\n\n## Why Nemo-core?\n\nBecause we NEed MOre automation testing!\n\n[![NPM](https://nodei.co/npm/nemo.png?downloads=true\u0026stars=true)](https://nodei.co/npm/nemo/)\n\n## Unit Tests\n\n* Unit tests run by default using headless browser [PhantomJS](http://phantomjs.org/). To run unit tests out of box, You must have PhantomJS installed on your system and must be present in the path\n    * Download PhantomJS from [here](http://phantomjs.org/download.html)\n    * On OSX, you can optionally use `brew` to install PhantomJS like `brew install phantomjs`\n    * PhantomJS installation detailed guide on Ubuntu can be found [here](https://gist.github.com/julionc/7476620)\n\n* If you want to run unit tests on your local browser, like lets say Firefox/Chrome (make sure ChromeDriver is in current path), you need to update browser in unit test\nconfiguration, for example the browser section under `test/config/config.json` like [here](https://github.com/paypal/nemo-core/blob/master/test/config/config.json#L19)\n\n* How to run unit tests?\n  * `npm test` will run unit tests as well as lint task\n  * `grunt simplemocha` will just run unit tests\n  * `grunt` - default grunt task will run linting as well as unit tests\n  * To run directly using mocha assuming its globally installed on your system `mocha -t 60s`\n  * Or a specific test,  `mocha --grep @allArgs@ -t 60s`\n  * Or post `npm install` on nemo module, you can run `node_modules/.bin/mocha --grep @allArgs@ -t 60s`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fnemo-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaypal%2Fnemo-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fnemo-core/lists"}