{"action":"created","comment":{"url":"https://api.github.com/repos/paypal/nemo/pulls/comments/27838921","id":27838921,"diff_hunk":"@@ -15,102 +13,350 @@ For a holistic guide to using Nemo as an overall automation solution, [please st\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). Your choice of webdriver will influence some of your settings below.\n+[Please see here for more information about setting up a webdriver](https://github.com/paypal/nemo-docs/blob/master/driver-setup.md).\n+As long as you have the appropriate browser or browser driver (selenium-standalone, chromedriver) on your PATH, the rest of this should work\n+fine.\n+\n \n #### package.json changes\n \n add the following to package.json devDependencies (assuming mocha is already integrated to your project):\n \n ```javascript\n-\"nemo\": \"^0.4.0\",\n+\"nemo\": \"^1.0.0\",\n ```\n \n Then `npm install`\n \n-### Running Nemo\n+### Nemo and Confit in 90 seconds\n+\n+Nemo uses confit - a powerful, expressive and intuitive configuration system - to elegantly expose the Nemo and selenium-webdriver APIs.\n \n-In the directory where you've installed Nemo, create a file called \"nemoExample.js\" with the following content:\n+#### Direct configuration\n+\n+If you install this repo you'll get the following in `examples/setup.js`. Note the `Nemo()` constructor is directly accepting the needed configuration,\n+along with a callback function.\n \n ```javascript\n-var Nemo = require(\"../\");\n-\n-/*\n-process.env.nemoData = JSON.stringify({\n-\ttargetBrowser: \"firefox\",\n-\ttargetServer: \"localhost\",\n-\tlocalServer: true,\n-\tseleniumJar: \"/usr/bin/selenium-server-standalone.jar\",\n-\ttargetBaseUrl: \"https://www.paypal.com\"\n+var nemo = Nemo({\n+  \"driver\": {\n+    \"browser\": \"firefox\"\n+  },\n+  'data': {\n+    'baseUrl': 'https://www.paypal.com'\n+  }\n+}, function (err) {\n+  //always check for errors!\n+  if (!!err) {\n+    console.log('Error during Nemo setup', err);\n+  }\n+  nemo.driver.get(nemo.data.baseUrl);\n+  nemo.driver.getCapabilities().\n+    then(function (caps) {\n+      console.info(\"Nemo successfully launched\", caps.caps_.browserName);\n+    });\n+  nemo.driver.quit();\n });\n-*/\n-\n-var config = {\n-\tnemoData: {\n-\t\ttargetBrowser: \"firefox\",\n-\t\ttargetServer: \"localhost\",\n-\t\tlocalServer: true,\n-\t\tseleniumJar: \"/usr/bin/selenium-server-standalone.jar\",\n-\t\ttargetBaseUrl: \"https://www.paypal.com\"\n-\t}\n-};\n-//THE ABOVE OR BELOW WILL WORK TO SET nemoData. IN A CONTEST, SETTING VIA Nemo() WILL WIN\n-\n-(new Nemo(config)).setup().then(function(nemo) {\n-\tnemo.driver.get(nemo.props.targetBaseUrl);\n-\tnemo.driver.sleep(5000).\n-\tthen(function() {\n-\t\tconsole.info(\"Nemo was successful!!\");\n-\t\tnemo.driver.quit();\n-\t});\n+```\n+\n+\n+Run it:\n+\n+```bash\n+$ node examples/setup.js\n+Nemo successfully launched firefox\n+```\n+\n+#### Using config files\n+\n+Look 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\n+var nemo = Nemo(__dirname, function (err) {\n+  //always check for errors!\n+  if (!!err) {\n+    console.log('Error during Nemo setup', err);\n+  }\n+\n+  nemo.driver.get(nemo.data.baseUrl);\n+  nemo.driver.getCapabilities().\n+    then(function (caps) {\n+      console.info(\"Nemo successfully launched\", caps.caps_.browserName);\n+    });\n+  nemo.driver.quit();\n });\n ```\n \n-You can see this file within the nemo examples directory:\n-[https://github.com/paypal/nemo/examples/setup.js](/examples/setup.js)\n+Note the comment above that passing a filesystem path as the first argument to `Nemo()` will tell confit to look in that directory + `/config` for config files.\n+\n+Look 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 \n-Note you can set `nemoData` via an environment variable OR by passing it into the Nemo constructor.\n+That is almost the same config as the first example. But notice `\"config:BROWSER\"`. Yes, confit will resolve that to the config property `\"BROWSER\"`.\n \n-Now, assuming you've set up a driver which matches the above requirements, you can run the following, with the following result:\n+Run this and it will open the Firefox browser:\n \n ```bash\n $ node examples/setup.js\n-Nemo was successful!!\n+Nemo successfully launched firefox\n ```\n \n-## Nemo Configuration\n+Now run this command:\n+\n+```bash\n+$ node examples/setupWithConfigDir.js --BROWSER=chrome\n+Nemo successfully launched chrome\n+```\n+\n+Here, confit resolves the `--BROWSER=chrome` command line argument and overrides the `BROWSER` value from config.json\n+\n+Now this command:\n+\n+```bash\n+$ BROWSER=chrome node examples/setupWithConfigDir.js\n+Nemo successfully launched chrome\n+```\n+\n+Here, confit resolves the `BROWSER` environment variable and overrides `BROWSER` from config.json\n+\n+What if we set both?\n+\n+```bash\n+$ BROWSER=chrome node examples/setupWithConfigDir.js BROWSER=phantomjs","path":"README.md","position":182,"original_position":182,"commit_id":"841dc30e314a64baa6d5173a3ea30bfdcbc52f95","original_commit_id":"841dc30e314a64baa6d5173a3ea30bfdcbc52f95","user":{"login":"nikulkarni","id":3066339,"avatar_url":"https://avatars.githubusercontent.com/u/3066339?v=3","gravatar_id":"","url":"https://api.github.com/users/nikulkarni","html_url":"https://github.com/nikulkarni","followers_url":"https://api.github.com/users/nikulkarni/followers","following_url":"https://api.github.com/users/nikulkarni/following{/other_user}","gists_url":"https://api.github.com/users/nikulkarni/gists{/gist_id}","starred_url":"https://api.github.com/users/nikulkarni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikulkarni/subscriptions","organizations_url":"https://api.github.com/users/nikulkarni/orgs","repos_url":"https://api.github.com/users/nikulkarni/repos","events_url":"https://api.github.com/users/nikulkarni/events{/privacy}","received_events_url":"https://api.github.com/users/nikulkarni/received_events","type":"User","site_admin":false},"body":"last argument should be `--BROWSER=phantomjs`. `--` is missing","created_at":"2015-04-06T23:01:11Z","updated_at":"2015-04-06T23:01:11Z","html_url":"https://github.com/paypal/nemo/pull/56#discussion_r27838921","pull_request_url":"https://api.github.com/repos/paypal/nemo/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/paypal/nemo/pulls/comments/27838921"},"html":{"href":"https://github.com/paypal/nemo/pull/56#discussion_r27838921"},"pull_request":{"href":"https://api.github.com/repos/paypal/nemo/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/paypal/nemo/pulls/56","id":32624708,"html_url":"https://github.com/paypal/nemo/pull/56","diff_url":"https://github.com/paypal/nemo/pull/56.diff","patch_url":"https://github.com/paypal/nemo/pull/56.patch","issue_url":"https://api.github.com/repos/paypal/nemo/issues/56","number":56,"state":"open","locked":false,"title":"1.0 develop","user":{"login":"grawk","id":1031360,"avatar_url":"https://avatars.githubusercontent.com/u/1031360?v=3","gravatar_id":"","url":"https://api.github.com/users/grawk","html_url":"https://github.com/grawk","followers_url":"https://api.github.com/users/grawk/followers","following_url":"https://api.github.com/users/grawk/following{/other_user}","gists_url":"https://api.github.com/users/grawk/gists{/gist_id}","starred_url":"https://api.github.com/users/grawk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grawk/subscriptions","organizations_url":"https://api.github.com/users/grawk/orgs","repos_url":"https://api.github.com/users/grawk/repos","events_url":"https://api.github.com/users/grawk/events{/privacy}","received_events_url":"https://api.github.com/users/grawk/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-04T00:01:34Z","updated_at":"2015-04-06T23:01:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee7aed4ba5589866bede6628e817157f09051b48","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/paypal/nemo/pulls/56/commits","review_comments_url":"https://api.github.com/repos/paypal/nemo/pulls/56/comments","review_comment_url":"https://api.github.com/repos/paypal/nemo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paypal/nemo/issues/56/comments","statuses_url":"https://api.github.com/repos/paypal/nemo/statuses/841dc30e314a64baa6d5173a3ea30bfdcbc52f95","head":{"label":"paypal:1.0-develop","ref":"1.0-develop","sha":"841dc30e314a64baa6d5173a3ea30bfdcbc52f95","user":{"login":"paypal","id":476675,"avatar_url":"https://avatars.githubusercontent.com/u/476675?v=3","gravatar_id":"","url":"https://api.github.com/users/paypal","html_url":"https://github.com/paypal","followers_url":"https://api.github.com/users/paypal/followers","following_url":"https://api.github.com/users/paypal/following{/other_user}","gists_url":"https://api.github.com/users/paypal/gists{/gist_id}","starred_url":"https://api.github.com/users/paypal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paypal/subscriptions","organizations_url":"https://api.github.com/users/paypal/orgs","repos_url":"https://api.github.com/users/paypal/repos","events_url":"https://api.github.com/users/paypal/events{/privacy}","received_events_url":"https://api.github.com/users/paypal/received_events","type":"Organization","site_admin":false},"repo":{"id":19828882,"name":"nemo","full_name":"paypal/nemo","owner":{"login":"paypal","id":476675,"avatar_url":"https://avatars.githubusercontent.com/u/476675?v=3","gravatar_id":"","url":"https://api.github.com/users/paypal","html_url":"https://github.com/paypal","followers_url":"https://api.github.com/users/paypal/followers","following_url":"https://api.github.com/users/paypal/following{/other_user}","gists_url":"https://api.github.com/users/paypal/gists{/gist_id}","starred_url":"https://api.github.com/users/paypal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paypal/subscriptions","organizations_url":"https://api.github.com/users/paypal/orgs","repos_url":"https://api.github.com/users/paypal/repos","events_url":"https://api.github.com/users/paypal/events{/privacy}","received_events_url":"https://api.github.com/users/paypal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paypal/nemo","description":"Selenium-webdriver based automation in node.js","fork":false,"url":"https://api.github.com/repos/paypal/nemo","forks_url":"https://api.github.com/repos/paypal/nemo/forks","keys_url":"https://api.github.com/repos/paypal/nemo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paypal/nemo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paypal/nemo/teams","hooks_url":"https://api.github.com/repos/paypal/nemo/hooks","issue_events_url":"https://api.github.com/repos/paypal/nemo/issues/events{/number}","events_url":"https://api.github.com/repos/paypal/nemo/events","assignees_url":"https://api.github.com/repos/paypal/nemo/assignees{/user}","branches_url":"https://api.github.com/repos/paypal/nemo/branches{/branch}","tags_url":"https://api.github.com/repos/paypal/nemo/tags","blobs_url":"https://api.github.com/repos/paypal/nemo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paypal/nemo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paypal/nemo/git/refs{/sha}","trees_url":"https://api.github.com/repos/paypal/nemo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paypal/nemo/statuses/{sha}","languages_url":"https://api.github.com/repos/paypal/nemo/languages","stargazers_url":"https://api.github.com/repos/paypal/nemo/stargazers","contributors_url":"https://api.github.com/repos/paypal/nemo/contributors","subscribers_url":"https://api.github.com/repos/paypal/nemo/subscribers","subscription_url":"https://api.github.com/repos/paypal/nemo/subscription","commits_url":"https://api.github.com/repos/paypal/nemo/commits{/sha}","git_commits_url":"https://api.github.com/repos/paypal/nemo/git/commits{/sha}","comments_url":"https://api.github.com/repos/paypal/nemo/comments{/number}","issue_comment_url":"https://api.github.com/repos/paypal/nemo/issues/comments{/number}","contents_url":"https://api.github.com/repos/paypal/nemo/contents/{+path}","compare_url":"https://api.github.com/repos/paypal/nemo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paypal/nemo/merges","archive_url":"https://api.github.com/repos/paypal/nemo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paypal/nemo/downloads","issues_url":"https://api.github.com/repos/paypal/nemo/issues{/number}","pulls_url":"https://api.github.com/repos/paypal/nemo/pulls{/number}","milestones_url":"https://api.github.com/repos/paypal/nemo/milestones{/number}","notifications_url":"https://api.github.com/repos/paypal/nemo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paypal/nemo/labels{/name}","releases_url":"https://api.github.com/repos/paypal/nemo/releases{/id}","created_at":"2014-05-15T17:36:30Z","updated_at":"2015-03-10T18:08:43Z","pushed_at":"2015-04-04T00:36:02Z","git_url":"git://github.com/paypal/nemo.git","ssh_url":"git@github.com:paypal/nemo.git","clone_url":"https://github.com/paypal/nemo.git","svn_url":"https://github.com/paypal/nemo","homepage":null,"size":1237,"stargazers_count":52,"watchers_count":52,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":9,"forks":16,"open_issues":9,"watchers":52,"default_branch":"master"}},"base":{"label":"paypal:develop","ref":"develop","sha":"fb40d5829ce20d5f71cd093434ac53d105ef38b2","user":{"login":"paypal","id":476675,"avatar_url":"https://avatars.githubusercontent.com/u/476675?v=3","gravatar_id":"","url":"https://api.github.com/users/paypal","html_url":"https://github.com/paypal","followers_url":"https://api.github.com/users/paypal/followers","following_url":"https://api.github.com/users/paypal/following{/other_user}","gists_url":"https://api.github.com/users/paypal/gists{/gist_id}","starred_url":"https://api.github.com/users/paypal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paypal/subscriptions","organizations_url":"https://api.github.com/users/paypal/orgs","repos_url":"https://api.github.com/users/paypal/repos","events_url":"https://api.github.com/users/paypal/events{/privacy}","received_events_url":"https://api.github.com/users/paypal/received_events","type":"Organization","site_admin":false},"repo":{"id":19828882,"name":"nemo","full_name":"paypal/nemo","owner":{"login":"paypal","id":476675,"avatar_url":"https://avatars.githubusercontent.com/u/476675?v=3","gravatar_id":"","url":"https://api.github.com/users/paypal","html_url":"https://github.com/paypal","followers_url":"https://api.github.com/users/paypal/followers","following_url":"https://api.github.com/users/paypal/following{/other_user}","gists_url":"https://api.github.com/users/paypal/gists{/gist_id}","starred_url":"https://api.github.com/users/paypal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paypal/subscriptions","organizations_url":"https://api.github.com/users/paypal/orgs","repos_url":"https://api.github.com/users/paypal/repos","events_url":"https://api.github.com/users/paypal/events{/privacy}","received_events_url":"https://api.github.com/users/paypal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paypal/nemo","description":"Selenium-webdriver based automation in node.js","fork":false,"url":"https://api.github.com/repos/paypal/nemo","forks_url":"https://api.github.com/repos/paypal/nemo/forks","keys_url":"https://api.github.com/repos/paypal/nemo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paypal/nemo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paypal/nemo/teams","hooks_url":"https://api.github.com/repos/paypal/nemo/hooks","issue_events_url":"https://api.github.com/repos/paypal/nemo/issues/events{/number}","events_url":"https://api.github.com/repos/paypal/nemo/events","assignees_url":"https://api.github.com/repos/paypal/nemo/assignees{/user}","branches_url":"https://api.github.com/repos/paypal/nemo/branches{/branch}","tags_url":"https://api.github.com/repos/paypal/nemo/tags","blobs_url":"https://api.github.com/repos/paypal/nemo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paypal/nemo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paypal/nemo/git/refs{/sha}","trees_url":"https://api.github.com/repos/paypal/nemo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paypal/nemo/statuses/{sha}","languages_url":"https://api.github.com/repos/paypal/nemo/languages","stargazers_url":"https://api.github.com/repos/paypal/nemo/stargazers","contributors_url":"https://api.github.com/repos/paypal/nemo/contributors","subscribers_url":"https://api.github.com/repos/paypal/nemo/subscribers","subscription_url":"https://api.github.com/repos/paypal/nemo/subscription","commits_url":"https://api.github.com/repos/paypal/nemo/commits{/sha}","git_commits_url":"https://api.github.com/repos/paypal/nemo/git/commits{/sha}","comments_url":"https://api.github.com/repos/paypal/nemo/comments{/number}","issue_comment_url":"https://api.github.com/repos/paypal/nemo/issues/comments{/number}","contents_url":"https://api.github.com/repos/paypal/nemo/contents/{+path}","compare_url":"https://api.github.com/repos/paypal/nemo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paypal/nemo/merges","archive_url":"https://api.github.com/repos/paypal/nemo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paypal/nemo/downloads","issues_url":"https://api.github.com/repos/paypal/nemo/issues{/number}","pulls_url":"https://api.github.com/repos/paypal/nemo/pulls{/number}","milestones_url":"https://api.github.com/repos/paypal/nemo/milestones{/number}","notifications_url":"https://api.github.com/repos/paypal/nemo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paypal/nemo/labels{/name}","releases_url":"https://api.github.com/repos/paypal/nemo/releases{/id}","created_at":"2014-05-15T17:36:30Z","updated_at":"2015-03-10T18:08:43Z","pushed_at":"2015-04-04T00:36:02Z","git_url":"git://github.com/paypal/nemo.git","ssh_url":"git@github.com:paypal/nemo.git","clone_url":"https://github.com/paypal/nemo.git","svn_url":"https://github.com/paypal/nemo","homepage":null,"size":1237,"stargazers_count":52,"watchers_count":52,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":9,"forks":16,"open_issues":9,"watchers":52,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/paypal/nemo/pulls/56"},"html":{"href":"https://github.com/paypal/nemo/pull/56"},"issue":{"href":"https://api.github.com/repos/paypal/nemo/issues/56"},"comments":{"href":"https://api.github.com/repos/paypal/nemo/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/paypal/nemo/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/paypal/nemo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paypal/nemo/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/paypal/nemo/statuses/841dc30e314a64baa6d5173a3ea30bfdcbc52f95"}}}}