{"action":"created","issue":{"url":"https://api.github.com/repos/segmentio/nightmare/issues/553","repository_url":"https://api.github.com/repos/segmentio/nightmare","labels_url":"https://api.github.com/repos/segmentio/nightmare/issues/553/labels{/name}","comments_url":"https://api.github.com/repos/segmentio/nightmare/issues/553/comments","events_url":"https://api.github.com/repos/segmentio/nightmare/issues/553/events","html_url":"https://github.com/segmentio/nightmare/pull/553","id":145609709,"number":553,"title":"Goto should fail if the page doesn’t load","user":{"login":"Mr0grog","id":74178,"avatar_url":"https://avatars.githubusercontent.com/u/74178?v=3","gravatar_id":"","url":"https://api.github.com/users/Mr0grog","html_url":"https://github.com/Mr0grog","followers_url":"https://api.github.com/users/Mr0grog/followers","following_url":"https://api.github.com/users/Mr0grog/following{/other_user}","gists_url":"https://api.github.com/users/Mr0grog/gists{/gist_id}","starred_url":"https://api.github.com/users/Mr0grog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mr0grog/subscriptions","organizations_url":"https://api.github.com/users/Mr0grog/orgs","repos_url":"https://api.github.com/users/Mr0grog/repos","events_url":"https://api.github.com/users/Mr0grog/events{/privacy}","received_events_url":"https://api.github.com/users/Mr0grog/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-04T07:43:32Z","updated_at":"2016-04-07T14:18:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/segmentio/nightmare/pulls/553","html_url":"https://github.com/segmentio/nightmare/pull/553","diff_url":"https://github.com/segmentio/nightmare/pull/553.diff","patch_url":"https://github.com/segmentio/nightmare/pull/553.patch"},"body":"~~**This is just a work-in-progress at the moment, but filing the PR as there are open questions…**~~\r\n\r\nThis adds tests (which fail), but no implementation—I need to work out the best solution for https://github.com/atom/electron/issues/5013 and https://github.com/atom/electron/issues/4396 (this second one I can’t actually reproduce, so it may have been fixed). For the former, the simplest solution is probably tracking the URL of the failed page and comparing it to the URL of the main frame. Need to make sure that works right for redirects, though. A more exacting solution might be to track resource requests on the `session` object, though doing so requires a bit more rigamarole.\r\n\r\nThere is also an open question of how this should behave w/r/t error responses (e.g. 404, 500, etc). For now, I’m planning to take the approach that any valid response (including things like 404s and 500s) are successes (after all, you might be trying to test a 404 page with Nightmare), but I can also imagine someone wanting the option to treat any non-2xx response as a failure. Maybe that’s something to wait for as a feature request, though? Curious what others think."},"comment":{"url":"https://api.github.com/repos/segmentio/nightmare/issues/comments/206927019","html_url":"https://github.com/segmentio/nightmare/pull/553#issuecomment-206927019","issue_url":"https://api.github.com/repos/segmentio/nightmare/issues/553","id":206927019,"user":{"login":"rosshinkley","id":1823131,"avatar_url":"https://avatars.githubusercontent.com/u/1823131?v=3","gravatar_id":"","url":"https://api.github.com/users/rosshinkley","html_url":"https://github.com/rosshinkley","followers_url":"https://api.github.com/users/rosshinkley/followers","following_url":"https://api.github.com/users/rosshinkley/following{/other_user}","gists_url":"https://api.github.com/users/rosshinkley/gists{/gist_id}","starred_url":"https://api.github.com/users/rosshinkley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosshinkley/subscriptions","organizations_url":"https://api.github.com/users/rosshinkley/orgs","repos_url":"https://api.github.com/users/rosshinkley/repos","events_url":"https://api.github.com/users/rosshinkley/events{/privacy}","received_events_url":"https://api.github.com/users/rosshinkley/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T14:18:07Z","updated_at":"2016-04-07T14:18:07Z","body":"@Mr0grog re your previous comment: like I said, my knowledge there was limited.  Thanks for setting me straight.  :)\r\n\r\nI _really_ like `.goto()` returning information about the request.  One question about that, and this may be silly: I see in your tests that [valid redirects are okay](https://github.com/segmentio/nightmare/pull/553/files#diff-910eb6f57886ca16c136101fb1699231R233), but it doesn't check the internal information bubbled up from `.goto()`.  Based on the changes you've put in, would that show the 3xx?  At first blush, I don't think it would - wouldn't it show the 2xx (assuming success) for the final destination (after `did-finish-load`)?\r\n\r\nTo be clear: I'm not sure `.goto()` should track all of the redirect information from a given request, but I do want to clarify what to expect.  Thoughts?\r\n\r\nIt looks like atom/electron#5029 has been accepted and as such atom/electron#5013 has been fixed.  I don't know what kind of release schedule Electron is on, but they cut releases often enough that I think I'm willing to wait as it reduces the complexity of your solution (seemingly by quite a bit).  What do you think?\r\n\r\nOnto the test issues: I can't get the test suite from your fork to run consistently.  The \"should fail properly if request handler is present\" test fails intermittently.  It looks like once in a while, `did-fail-load` gets emitted after `did-finish-load`.  (That's the difference in debug output anyway.  I'm not clear on the underlying cause yet.)  Coincidentally, that appears to be one of the problems in build 662.  I don't have time to dig into this right this moment, but as time permits today, I'm going to dig into this and the other CircleCI issues.\r\n\r\n"}}