casperjs tests freezing causing jenkins build to time out

i run casperjs tests with jenkins in a staging environment. lately jenkins has been timing out (at 10 min) and it's almost always because of the casper tests. there are 4 tests in the suite and an average successful build takes about 1 min 30 sec.

i can sometimes reproduce this when i run an individual test locally -- casper seems to just get stuck. one notable thing is it seems to always be on an action that loads a new page (a url change).

here's a log on a pretty simple login test:

[info] [phantom] Starting...
[info] [phantom] Running suite: 12 steps
[debug] [phantom] opening url: http://mytestsite.dev/log_in, HTTP GET
[debug] [phantom] Navigation requested: url=http://mytestsite.dev/log_in, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "http://mytestsite.dev/log_in"
[debug] [phantom] Successfully injected Casper client-side utilities
[debug] [phantom] start page is loaded
[info] [phantom] Step anonymous 3/12 http://mytestsite.dev/log_in (HTTP 200)
logging in
[info] [remote] attempting to fetch form element from selector: '#login_form'
[debug] [remote] Set "email" field value to test.user@gmail.com
[debug] [remote] Set "password" field value to ***********
[info] [phantom] Step anonymous 3/12: done in 445ms.
[info] [phantom] Step anonymous 4/12 http://mytestsite.dev/log_in (HTTP 200)
[debug] [phantom] Mouse event 'mousedown' on selector: xpath selector: //*[@id="login_form"]/span[3]/input
[debug] [phantom] Mouse event 'mouseup' on selector: xpath selector: //*[@id="login_form"]/span[3]/input
[debug] [phantom] Mouse event 'click' on selector: xpath selector: //*[@id="login_form"]/span[3]/input
[info] [phantom] Step anonymous 4/12: done in 466ms.
[debug] [phantom] Navigation requested: url=http://mytestsite.dev/log_in, type=FormSubmitted, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=http://mytestsite.dev/home, type=FormSubmitted, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "http://mytestsite.dev/home"

it freezes, and then the build times out. this has started happening more over the last few weeks.

[edit] can also get this to happen intermittently when i try to run this test - https://gist.github.com/n1k0/4509789

any ideas on how to debug?

链接地址: http://www.djcxy.com/p/73480.html

上一篇: CasperJS,测试页面无法完全加载

下一篇: casperjs测试冷冻导致jenkins生成超时