jberger / Mojo-Phantom

PhantomJS client-side testing for Mojolicious apps
Other
13 stars 6 forks source link

Disable IOLoop timeout #14

Open ksmadsen opened 7 years ago

ksmadsen commented 7 years ago

If the phantomjs process is slow to respond (for whatever reason), the IOLoop's timeout will close the connection. So any later test-result from phantomjs will be ignored by the parent process.

This is especially a problem if no plan has been specified when calling phantom_ok, as a single ok before the timeout will make the subtest pass.

Note that the included test is quite slow, as it needs to run for more than 15 seconds to illustrate the problem on a non-modified Mojo:Phantom::Process.

ksmadsen commented 7 years ago

Btw. it might make sense to have a timeout that will kill the phantomjs process after a while, to prevent it from hanging indefinitely.

As far as I can tell nothing actually kills the phantomjs process if the IOLoop timeout triggers?

ksmadsen commented 7 years ago

I've taken a stab at implementing a timeout option to phantom_ok, and added it to this pull request. It doesn't really depend on the previous patch, except when the timeout is longer than 15 seconds.