{"action":"created","issue":{"url":"https://api.github.com/repos/nightwatchjs/nightwatch/issues/1166","repository_url":"https://api.github.com/repos/nightwatchjs/nightwatch","labels_url":"https://api.github.com/repos/nightwatchjs/nightwatch/issues/1166/labels{/name}","comments_url":"https://api.github.com/repos/nightwatchjs/nightwatch/issues/1166/comments","events_url":"https://api.github.com/repos/nightwatchjs/nightwatch/issues/1166/events","html_url":"https://github.com/nightwatchjs/nightwatch/issues/1166","id":174258532,"number":1166,"title":"Can not `resizeWindow` and run tests","user":{"login":"xcambar","id":657654,"avatar_url":"https://avatars.githubusercontent.com/u/657654?v=3","gravatar_id":"","url":"https://api.github.com/users/xcambar","html_url":"https://github.com/xcambar","followers_url":"https://api.github.com/users/xcambar/followers","following_url":"https://api.github.com/users/xcambar/following{/other_user}","gists_url":"https://api.github.com/users/xcambar/gists{/gist_id}","starred_url":"https://api.github.com/users/xcambar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcambar/subscriptions","organizations_url":"https://api.github.com/users/xcambar/orgs","repos_url":"https://api.github.com/users/xcambar/repos","events_url":"https://api.github.com/users/xcambar/events{/privacy}","received_events_url":"https://api.github.com/users/xcambar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-31T12:19:35Z","updated_at":"2016-09-02T07:55:31Z","closed_at":null,"body":"Full disclosure: I don't know where this bug actually lies (nightwatch/selenium/webdriver/...)\r\n\r\nHere's a test that leverages `Promise`s that work perfectly (simplified for the sake of the issue):\r\n\r\n```js\r\nmodule.exports = {\r\n  beforeEach(browser, done) {\r\n    setTimeout(()=> done(), 100);\r\n  },\r\n  doMyTests(browser) {\r\n    let browserPromise = Promise.resolve(browser);\r\n\r\n    \r\n    blocks.forEach((block)=> {\r\n      browserPromise = browserPromise.then(function(browser) {\r\n        return browser\r\n        .url(getBlockPageUrl(block))\r\n        .timeouts('script', 3000)\r\n        .executeAsync(function(data, done) {\r\n          setTimeout(function() {\r\n            done();\r\n          }, 100);\r\n        }, ['fake arg'], function() {\r\n          browser\r\n            .perform((api, done)=> {\r\n              api.verify.ok(true);\r\n              setTimeout(function() {\r\n                done();\r\n              }, 100);\r\n            });\r\n        });\r\n      });\r\n    });\r\n    browserPromise.then((browser)=> browser.end(), (error)=> console.error(error));\r\n  }\r\n};\r\n```\r\n\r\nI've added a number of setTimeout to replace what would be in real life some `Promise`s.\r\n\r\nNow, the following code (the difference is highlighted) runs no tests at all:\r\n\r\n```js\r\nmodule.exports = {\r\n  beforeEach(browser, done) {\r\n    //\r\n    // This syntax breaks the tests\r\n    // though it seems to trigger the callback correctly\r\n    //\r\n    browser.resizeWindow(800,800, function () {\r\n      console.log('1. This log IS correctly output');\r\n      done();\r\n    });\r\n  },\r\n  doMyTests(browser) {\r\n    console.log('2. This log comes after 1.');\r\n    let browserPromise = Promise.resolve(browser);\r\n\r\n    \r\n    blocks.forEach((block)=> {\r\n      browserPromise = browserPromise.then(function(browser) {\r\n        return browser\r\n        .url(getBlockPageUrl(block))\r\n        .timeouts('script', 3000)\r\n        .executeAsync(function(data, done) {\r\n          setTimeout(function() {\r\n            done();\r\n          }, 100);\r\n        }, ['fake arg'], function() {\r\n          browser\r\n            .perform((api, done)=> {\r\n              api.verify.ok(true);\r\n              setTimeout(function() {\r\n                done();\r\n              }, 100);\r\n            });\r\n        });\r\n      });\r\n    });\r\n    browserPromise.then((browser)=> browser.end(), (error)=> console.error(error));\r\n  }\r\n};\r\n```\r\n\r\nI wish you will help me find a way to understand (and hopefully fix) this issue, I've been struggling with this for way too long 😆 .\r\n\r\nBest,"},"comment":{"url":"https://api.github.com/repos/nightwatchjs/nightwatch/issues/comments/244308221","html_url":"https://github.com/nightwatchjs/nightwatch/issues/1166#issuecomment-244308221","issue_url":"https://api.github.com/repos/nightwatchjs/nightwatch/issues/1166","id":244308221,"user":{"login":"beatfactor","id":419506,"avatar_url":"https://avatars.githubusercontent.com/u/419506?v=3","gravatar_id":"","url":"https://api.github.com/users/beatfactor","html_url":"https://github.com/beatfactor","followers_url":"https://api.github.com/users/beatfactor/followers","following_url":"https://api.github.com/users/beatfactor/following{/other_user}","gists_url":"https://api.github.com/users/beatfactor/gists{/gist_id}","starred_url":"https://api.github.com/users/beatfactor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beatfactor/subscriptions","organizations_url":"https://api.github.com/users/beatfactor/orgs","repos_url":"https://api.github.com/users/beatfactor/repos","events_url":"https://api.github.com/users/beatfactor/events{/privacy}","received_events_url":"https://api.github.com/users/beatfactor/received_events","type":"User","site_admin":false},"created_at":"2016-09-02T07:55:31Z","updated_at":"2016-09-02T07:55:31Z","body":"I need an example which uses a public url to run the test, to be able to reproduce the problem. "}}
{"actor":{"display_login":"beatfactor"}}