{"action":"created","comment":{"url":"https://api.github.com/repos/garris/BackstopJS/pulls/comments/75547945","id":75547945,"diff_hunk":"@@ -1,251 +1,260 @@\n-\n var fs = require('fs');\n+var cwd = fs.workingDirectory;\n+var __dirname = null;\n+var searchString = \"genBitmaps.js\";\n+require('system').args.forEach(function (arg, i) {\n+  var position = arg.length - searchString.length;\n+  var lastIndex = arg.indexOf(searchString, position);\n+  if (lastIndex !== -1 && lastIndex === position) {\n+    __dirname = arg.replace(fs.separator + 'genBitmaps.js', '');\n+  }\n+});\n \n-var selectorNotFoundPath = 'capture/resources/selectorNotFound_noun_164558_cc.png'\n-var hiddenSelectorPath = 'capture/resources/hiddenSelector_noun_63405.png'\n-var genConfigPath = 'capture/config.json'\n+if (!__dirname) {\n+  console.log(\"Could not find dirname\");\n+}\n \n+var selectorNotFoundPath = __dirname + '/resources/selectorNotFound_noun_164558_cc.png'\n+var hiddenSelectorPath = __dirname + '/resources/hiddenSelector_noun_63405.png'\n+var genConfigPath = __dirname + '/config.json'; // TODO :: find a way to use that directly from the main configuration\n \n-var configJSON = fs.read(genConfigPath);\n-var config = JSON.parse(configJSON);\n+var config = require(genConfigPath);\n if (!config.paths) {\n   config.paths = {};\n }\n \n var bitmaps_reference = config.paths.bitmaps_reference || 'bitmaps_reference';\n var bitmaps_test = config.paths.bitmaps_test || 'bitmaps_test';\n var casper_scripts = config.paths.casper_scripts || null;\n-var compareConfigFileName = config.paths.compare_data || 'compare/config.json';\n+var comparePairsFileName = config.paths.tempCompareConfigFileName;\n var viewports = config.viewports;\n-var scenarios = config.scenarios||config.grabConfigs;\n+var scenarios = config.scenarios || config.grabConfigs;\n \n-var compareConfig = {testPairs:[]};\n+var compareConfig = {testPairs: []};\n \n var casper = require(\"casper\").create({\n-  // clientScripts: [\"jquery.js\"] // uncomment to add jQuery if you need that.\n-  // TODO: if (config.debug) { add prop debug true }\n+  logLevel: config.debug ? \"debug\" : \"info\",\n+  verbose: config.debug\n });\n \n if (config.debug) {\n   console.log('Debug is enabled!');\n \n-  casper.on(\"page.error\", function(msg, trace) {\n-      this.echo(\"Remote Error >    \" + msg, \"error\");\n-      this.echo(\"file:     \" + trace[0].file, \"WARNING\");\n-      this.echo(\"line:     \" + trace[0].line, \"WARNING\");\n-      this.echo(\"function: \" + trace[0][\"function\"], \"WARNING\");\n+  casper.on(\"page.error\", function (msg, trace) {\n+    this.echo(\"Remote Error >    \" + msg, \"error\");\n+    this.echo(\"file:     \" + trace[0].file, \"WARNING\");\n+    this.echo(\"line:     \" + trace[0].line, \"WARNING\");\n+    this.echo(\"function: \" + trace[0][\"function\"], \"WARNING\");\n   });\n }\n \n-casper.on('remote.message', function(message) {\n+casper.on('remote.message', function (message) {\n   this.echo('remote console > ' + message);\n });\n \n-casper.on('resource.received', function(resource) {\n+casper.on('resource.received', function (resource) {\n   var status = resource.status;\n-  if(status >= 400) {\n+  if (status >= 400) {\n     casper.log('remote error > ' + resource.url + ' failed to load (' + status + ')', 'error');\n   }\n });\n \n-\n-\n-function capturePageSelectors(url,scenarios,viewports,bitmaps_reference,bitmaps_test,isReference){\n+function capturePageSelectors(scenarios, viewports, bitmaps_reference, bitmaps_test, isReference) {\n \n   var\n     screenshotNow = new Date(),\n     screenshotDateTime = screenshotNow.getFullYear() + pad(screenshotNow.getMonth() + 1) + pad(screenshotNow.getDate()) + '-' + pad(screenshotNow.getHours()) + pad(screenshotNow.getMinutes()) + pad(screenshotNow.getSeconds());\n \n \n   var consoleBuffer = '';\n-  var scriptTimeout = 20000;\n-\n \n-  casper.on('remote.message', function(message) {\n-      this.echo(message);\n-      consoleBuffer = consoleBuffer + '\\n' + message;\n+  casper.on('remote.message', function (message) {\n+    this.echo(message);\n+    consoleBuffer = consoleBuffer + '\\n' + message;\n   });\n \n   casper.start();\n \n-  casper.each(scenarios,function(casper, scenario, scenario_index){\n+  casper.each(scenarios, function (casper, scenario) {\n+    var referenceId = scenario.label.replace(/\\//g, '_');\n \n-    casper.each(viewports, function(casper, vp, viewport_index) {\n-      this.then(function() {\n-        this.viewport(vp.width||vp.viewport.width, vp.height||vp.viewport.height);\n-      });\n+    processScenario(casper, scenario, referenceId, referenceId, viewports, bitmaps_reference, bitmaps_test, screenshotDateTime, consoleBuffer);","path":"capture/genBitmaps.js","position":113,"original_position":113,"commit_id":"1f2076f174e6a2957ecfa079bfd5bd79dd1e73f9","original_commit_id":"1f2076f174e6a2957ecfa079bfd5bd79dd1e73f9","user":{"login":"garris","id":447033,"avatar_url":"https://avatars.githubusercontent.com/u/447033?v=3","gravatar_id":"","url":"https://api.github.com/users/garris","html_url":"https://github.com/garris","followers_url":"https://api.github.com/users/garris/followers","following_url":"https://api.github.com/users/garris/following{/other_user}","gists_url":"https://api.github.com/users/garris/gists{/gist_id}","starred_url":"https://api.github.com/users/garris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garris/subscriptions","organizations_url":"https://api.github.com/users/garris/orgs","repos_url":"https://api.github.com/users/garris/repos","events_url":"https://api.github.com/users/garris/events{/privacy}","received_events_url":"https://api.github.com/users/garris/received_events","type":"User","site_admin":false},"body":"`referenceId` is the 3rd and 4th arg?","created_at":"2016-08-19T20:38:31Z","updated_at":"2016-08-19T20:38:31Z","html_url":"https://github.com/garris/BackstopJS/pull/259#discussion_r75547945","pull_request_url":"https://api.github.com/repos/garris/BackstopJS/pulls/259","_links":{"self":{"href":"https://api.github.com/repos/garris/BackstopJS/pulls/comments/75547945"},"html":{"href":"https://github.com/garris/BackstopJS/pull/259#discussion_r75547945"},"pull_request":{"href":"https://api.github.com/repos/garris/BackstopJS/pulls/259"}}},"pull_request":{"url":"https://api.github.com/repos/garris/BackstopJS/pulls/259","id":81848164,"html_url":"https://github.com/garris/BackstopJS/pull/259","diff_url":"https://github.com/garris/BackstopJS/pull/259.diff","patch_url":"https://github.com/garris/BackstopJS/pull/259.patch","issue_url":"https://api.github.com/repos/garris/BackstopJS/issues/259","number":259,"state":"open","locked":false,"title":"[WIP] Rework of many parts for speed and CI reporting","user":{"login":"onigoetz","id":309594,"avatar_url":"https://avatars.githubusercontent.com/u/309594?v=3","gravatar_id":"","url":"https://api.github.com/users/onigoetz","html_url":"https://github.com/onigoetz","followers_url":"https://api.github.com/users/onigoetz/followers","following_url":"https://api.github.com/users/onigoetz/following{/other_user}","gists_url":"https://api.github.com/users/onigoetz/gists{/gist_id}","starred_url":"https://api.github.com/users/onigoetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onigoetz/subscriptions","organizations_url":"https://api.github.com/users/onigoetz/orgs","repos_url":"https://api.github.com/users/onigoetz/repos","events_url":"https://api.github.com/users/onigoetz/events{/privacy}","received_events_url":"https://api.github.com/users/onigoetz/received_events","type":"User","site_admin":false},"body":"Hello,\r\n\r\nfirst, I'm really sorry for the size of this pull request I know it will be difficult to code review it. We made this changes in a single sprint at our company and couldn't afford to keep everything to separate branches because we needed to push it to our central Jenkins.\r\n\r\nI will update this description as we add new changes.\r\n\r\n## Highlights\r\n- Completely removed gulp, rely only on `fs` to move files around\r\n- The report doesn't need a server to be seen\r\n- To see the report, the files are copied in the project (previously the images were copied into Backstop)\r\n- Backstop relies on `process.cwd()` to generate its path, not `./node_modules/backstopjs`\r\n- Add a `--filter` option to filter scenarii by `label` in test and reference\r\n\r\n## Variants\r\n- You can add \"variants\" to a scenario, they have the same options as a scenario, but are checked against the main scenario\r\n- no reference is created\r\n\r\n## Browser reporting\r\n- Removed resemblejs, use images generated by the CLI reporter. (we have more than 500 tests, running them in the browser just breaks the browser)\r\n- Copy the reporter files to the project.\r\n- The reporter required to disable the CSP rules of our Jenkins server, not longer the case\r\n- Add a way to toggle the summary of scenarii\r\n- Tweaked the styles a bit\r\n  - Removed custom \"circles\" to show the number of passed and failed tests : replaced with Bootstrap's \"label\" because with more than 100 tests, the circle is broken\r\n  - Made a more compact \"Report\" section : removed `analysisTime` and `dimensionDifference` (if `isSameDimensions` is true)\r\n  - Changed the font stack (there was a typo)\r\n\r\n## CLI Reporting\r\n- Reporting is always run in the CLI and results added to an object\r\n- You can easily add multiple new report types with this new object\r\n- junit report was moved to a separate code block to not clutter the main one\r\n\r\n## Internal changes\r\n- paths are made from the current working directory, not backstopjs.\r\n- removed the need for an internal hash of the configuration.\r\n- the list of comparisons to create is stored in a special temp file.\r\n- commands no longer have a `before` and `after` this makes the code very complicated to understand and can be replaced by promises inside the main execute\r\n- removed \"start\" and \"stop\" commands as the server is not needed anymore.\r\n\r\n## Bugfixes / Regressions\r\n- If the tests failed, the return code was still 0\r\n- You could not use a JavaScript configuration\r\n- Errors in Promises were swallowed\r\n\r\n## Code Style\r\n- Replaced jshint/jscs with eslint\r\n\r\n## Tests\r\n- Run tests on travis on more node versions (0.12, 4, 5, 6)\r\n\r\n## Still to do\r\n- Add a modal to see the differences between reference and test in big.\r\n- Update npm dependencies (Almost done)\r\n- Lint the code one final time","created_at":"2016-08-18T16:36:58Z","updated_at":"2016-08-19T20:38:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee0f6ec477e5e458ae7ceb3b2d459a7fa99c1ceb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/garris/BackstopJS/pulls/259/commits","review_comments_url":"https://api.github.com/repos/garris/BackstopJS/pulls/259/comments","review_comment_url":"https://api.github.com/repos/garris/BackstopJS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/garris/BackstopJS/issues/259/comments","statuses_url":"https://api.github.com/repos/garris/BackstopJS/statuses/1f2076f174e6a2957ecfa079bfd5bd79dd1e73f9","head":{"label":"onigoetz:version_2_0","ref":"version_2_0","sha":"1f2076f174e6a2957ecfa079bfd5bd79dd1e73f9","user":{"login":"onigoetz","id":309594,"avatar_url":"https://avatars.githubusercontent.com/u/309594?v=3","gravatar_id":"","url":"https://api.github.com/users/onigoetz","html_url":"https://github.com/onigoetz","followers_url":"https://api.github.com/users/onigoetz/followers","following_url":"https://api.github.com/users/onigoetz/following{/other_user}","gists_url":"https://api.github.com/users/onigoetz/gists{/gist_id}","starred_url":"https://api.github.com/users/onigoetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onigoetz/subscriptions","organizations_url":"https://api.github.com/users/onigoetz/orgs","repos_url":"https://api.github.com/users/onigoetz/repos","events_url":"https://api.github.com/users/onigoetz/events{/privacy}","received_events_url":"https://api.github.com/users/onigoetz/received_events","type":"User","site_admin":false},"repo":{"id":65578346,"name":"BackstopJS","full_name":"onigoetz/BackstopJS","owner":{"login":"onigoetz","id":309594,"avatar_url":"https://avatars.githubusercontent.com/u/309594?v=3","gravatar_id":"","url":"https://api.github.com/users/onigoetz","html_url":"https://github.com/onigoetz","followers_url":"https://api.github.com/users/onigoetz/followers","following_url":"https://api.github.com/users/onigoetz/following{/other_user}","gists_url":"https://api.github.com/users/onigoetz/gists{/gist_id}","starred_url":"https://api.github.com/users/onigoetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onigoetz/subscriptions","organizations_url":"https://api.github.com/users/onigoetz/orgs","repos_url":"https://api.github.com/users/onigoetz/repos","events_url":"https://api.github.com/users/onigoetz/events{/privacy}","received_events_url":"https://api.github.com/users/onigoetz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/onigoetz/BackstopJS","description":"Catch CSS curve balls.","fork":true,"url":"https://api.github.com/repos/onigoetz/BackstopJS","forks_url":"https://api.github.com/repos/onigoetz/BackstopJS/forks","keys_url":"https://api.github.com/repos/onigoetz/BackstopJS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onigoetz/BackstopJS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onigoetz/BackstopJS/teams","hooks_url":"https://api.github.com/repos/onigoetz/BackstopJS/hooks","issue_events_url":"https://api.github.com/repos/onigoetz/BackstopJS/issues/events{/number}","events_url":"https://api.github.com/repos/onigoetz/BackstopJS/events","assignees_url":"https://api.github.com/repos/onigoetz/BackstopJS/assignees{/user}","branches_url":"https://api.github.com/repos/onigoetz/BackstopJS/branches{/branch}","tags_url":"https://api.github.com/repos/onigoetz/BackstopJS/tags","blobs_url":"https://api.github.com/repos/onigoetz/BackstopJS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onigoetz/BackstopJS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onigoetz/BackstopJS/git/refs{/sha}","trees_url":"https://api.github.com/repos/onigoetz/BackstopJS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onigoetz/BackstopJS/statuses/{sha}","languages_url":"https://api.github.com/repos/onigoetz/BackstopJS/languages","stargazers_url":"https://api.github.com/repos/onigoetz/BackstopJS/stargazers","contributors_url":"https://api.github.com/repos/onigoetz/BackstopJS/contributors","subscribers_url":"https://api.github.com/repos/onigoetz/BackstopJS/subscribers","subscription_url":"https://api.github.com/repos/onigoetz/BackstopJS/subscription","commits_url":"https://api.github.com/repos/onigoetz/BackstopJS/commits{/sha}","git_commits_url":"https://api.github.com/repos/onigoetz/BackstopJS/git/commits{/sha}","comments_url":"https://api.github.com/repos/onigoetz/BackstopJS/comments{/number}","issue_comment_url":"https://api.github.com/repos/onigoetz/BackstopJS/issues/comments{/number}","contents_url":"https://api.github.com/repos/onigoetz/BackstopJS/contents/{+path}","compare_url":"https://api.github.com/repos/onigoetz/BackstopJS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onigoetz/BackstopJS/merges","archive_url":"https://api.github.com/repos/onigoetz/BackstopJS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onigoetz/BackstopJS/downloads","issues_url":"https://api.github.com/repos/onigoetz/BackstopJS/issues{/number}","pulls_url":"https://api.github.com/repos/onigoetz/BackstopJS/pulls{/number}","milestones_url":"https://api.github.com/repos/onigoetz/BackstopJS/milestones{/number}","notifications_url":"https://api.github.com/repos/onigoetz/BackstopJS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onigoetz/BackstopJS/labels{/name}","releases_url":"https://api.github.com/repos/onigoetz/BackstopJS/releases{/id}","deployments_url":"https://api.github.com/repos/onigoetz/BackstopJS/deployments","created_at":"2016-08-12T19:25:49Z","updated_at":"2016-08-12T19:25:50Z","pushed_at":"2016-08-19T19:11:46Z","git_url":"git://github.com/onigoetz/BackstopJS.git","ssh_url":"git@github.com:onigoetz/BackstopJS.git","clone_url":"https://github.com/onigoetz/BackstopJS.git","svn_url":"https://github.com/onigoetz/BackstopJS","homepage":"","size":4014,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"garris:version_2_0","ref":"version_2_0","sha":"b8453493e1692102894ecc529c3a4aeedc318629","user":{"login":"garris","id":447033,"avatar_url":"https://avatars.githubusercontent.com/u/447033?v=3","gravatar_id":"","url":"https://api.github.com/users/garris","html_url":"https://github.com/garris","followers_url":"https://api.github.com/users/garris/followers","following_url":"https://api.github.com/users/garris/following{/other_user}","gists_url":"https://api.github.com/users/garris/gists{/gist_id}","starred_url":"https://api.github.com/users/garris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garris/subscriptions","organizations_url":"https://api.github.com/users/garris/orgs","repos_url":"https://api.github.com/users/garris/repos","events_url":"https://api.github.com/users/garris/events{/privacy}","received_events_url":"https://api.github.com/users/garris/received_events","type":"User","site_admin":false},"repo":{"id":25268795,"name":"BackstopJS","full_name":"garris/BackstopJS","owner":{"login":"garris","id":447033,"avatar_url":"https://avatars.githubusercontent.com/u/447033?v=3","gravatar_id":"","url":"https://api.github.com/users/garris","html_url":"https://github.com/garris","followers_url":"https://api.github.com/users/garris/followers","following_url":"https://api.github.com/users/garris/following{/other_user}","gists_url":"https://api.github.com/users/garris/gists{/gist_id}","starred_url":"https://api.github.com/users/garris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garris/subscriptions","organizations_url":"https://api.github.com/users/garris/orgs","repos_url":"https://api.github.com/users/garris/repos","events_url":"https://api.github.com/users/garris/events{/privacy}","received_events_url":"https://api.github.com/users/garris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/garris/BackstopJS","description":"Catch CSS curve balls.","fork":false,"url":"https://api.github.com/repos/garris/BackstopJS","forks_url":"https://api.github.com/repos/garris/BackstopJS/forks","keys_url":"https://api.github.com/repos/garris/BackstopJS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garris/BackstopJS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garris/BackstopJS/teams","hooks_url":"https://api.github.com/repos/garris/BackstopJS/hooks","issue_events_url":"https://api.github.com/repos/garris/BackstopJS/issues/events{/number}","events_url":"https://api.github.com/repos/garris/BackstopJS/events","assignees_url":"https://api.github.com/repos/garris/BackstopJS/assignees{/user}","branches_url":"https://api.github.com/repos/garris/BackstopJS/branches{/branch}","tags_url":"https://api.github.com/repos/garris/BackstopJS/tags","blobs_url":"https://api.github.com/repos/garris/BackstopJS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garris/BackstopJS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garris/BackstopJS/git/refs{/sha}","trees_url":"https://api.github.com/repos/garris/BackstopJS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garris/BackstopJS/statuses/{sha}","languages_url":"https://api.github.com/repos/garris/BackstopJS/languages","stargazers_url":"https://api.github.com/repos/garris/BackstopJS/stargazers","contributors_url":"https://api.github.com/repos/garris/BackstopJS/contributors","subscribers_url":"https://api.github.com/repos/garris/BackstopJS/subscribers","subscription_url":"https://api.github.com/repos/garris/BackstopJS/subscription","commits_url":"https://api.github.com/repos/garris/BackstopJS/commits{/sha}","git_commits_url":"https://api.github.com/repos/garris/BackstopJS/git/commits{/sha}","comments_url":"https://api.github.com/repos/garris/BackstopJS/comments{/number}","issue_comment_url":"https://api.github.com/repos/garris/BackstopJS/issues/comments{/number}","contents_url":"https://api.github.com/repos/garris/BackstopJS/contents/{+path}","compare_url":"https://api.github.com/repos/garris/BackstopJS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garris/BackstopJS/merges","archive_url":"https://api.github.com/repos/garris/BackstopJS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garris/BackstopJS/downloads","issues_url":"https://api.github.com/repos/garris/BackstopJS/issues{/number}","pulls_url":"https://api.github.com/repos/garris/BackstopJS/pulls{/number}","milestones_url":"https://api.github.com/repos/garris/BackstopJS/milestones{/number}","notifications_url":"https://api.github.com/repos/garris/BackstopJS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garris/BackstopJS/labels{/name}","releases_url":"https://api.github.com/repos/garris/BackstopJS/releases{/id}","deployments_url":"https://api.github.com/repos/garris/BackstopJS/deployments","created_at":"2014-10-15T18:56:07Z","updated_at":"2016-08-19T11:09:58Z","pushed_at":"2016-08-19T19:11:47Z","git_url":"git://github.com/garris/BackstopJS.git","ssh_url":"git@github.com:garris/BackstopJS.git","clone_url":"https://github.com/garris/BackstopJS.git","svn_url":"https://github.com/garris/BackstopJS","homepage":"","size":4421,"stargazers_count":1526,"watchers_count":1526,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":132,"mirror_url":null,"open_issues_count":58,"forks":132,"open_issues":58,"watchers":1526,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/garris/BackstopJS/pulls/259"},"html":{"href":"https://github.com/garris/BackstopJS/pull/259"},"issue":{"href":"https://api.github.com/repos/garris/BackstopJS/issues/259"},"comments":{"href":"https://api.github.com/repos/garris/BackstopJS/issues/259/comments"},"review_comments":{"href":"https://api.github.com/repos/garris/BackstopJS/pulls/259/comments"},"review_comment":{"href":"https://api.github.com/repos/garris/BackstopJS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/garris/BackstopJS/pulls/259/commits"},"statuses":{"href":"https://api.github.com/repos/garris/BackstopJS/statuses/1f2076f174e6a2957ecfa079bfd5bd79dd1e73f9"}}}}
{"actor":{"display_login":"garris"}}