Behat tests in PhantomJS slower

Behat tests in PhantomJS slower

by Urs Hunkler -
Number of replies: 2
Picture of Core developers

I am astonished when I see that the Behat test I am working on runs slower in PhantomJS than in Selenium/Chrome on an iMac with Mavericks. I expected the test to execute faster with PhantomJS (v 1.9.7)

Is this the normal behavior with Moodle Behat tests? Or are there issues with my test?

Or may there be an issue with the PhantomJS installation? I get an PhantomJS error but the Behat test completes without errors.

The PhantomJS error message is:

[ERROR - 2014-03-23T11:42:47.896Z] RouterReqHand - _handle.error - {"message":"{\"headers\":{\"Accept\":\"application/json;charset=UTF-8\",\"Content-Length\":\"0\",\"Content-Type\":\"application/json;charset=UTF-8\",\"Expect\":\"100-continue\",\"Host\":\"localhost:4444\"},\"httpVersion\":\"1.1\",\"method\":\"POST\",\"post\":\"\",\"url\":\"/accept_alert\",\"urlParsed\":{\"anchor\":\"\",\"query\":\"\",\"file\":\"accept_alert\",\"directory\":\"/\",\"path\":\"/accept_alert\",\"relative\":\"/accept_alert\",\"port\":\"\",\"host\":\"\",\"password\":\"\",\"user\":\"\",\"userInfo\":\"\",\"authority\":\"\",\"protocol\":\"\",\"source\":\"/accept_alert\",\"queryKey\":{},\"chunks\":[\"accept_alert\"]},\"urlOriginal\":\"/session/3d9c7a70-b280-11e3-9542-67c64752bf31/accept_alert\"}","name":"Invalid Command Method","line":199,"sourceId":136951480,"sourceURL":":/ghostdriver/request_handlers/session_request_handler.js","stack":"Invalid Command Method: {\"headers\":{\"Accept\":\"application/json;charset=UTF-8\",\"Content-Length\":\"0\",\"Content-Type\":\"application/json;charset=UTF-8\",\"Expect\":\"100-continue\",\"Host\":\"localhost:4444\"},\"httpVersion\":\"1.1\",\"method\":\"POST\",\"post\":\"\",\"url\":\"/accept_alert\",\"urlParsed\":{\"anchor\":\"\",\"query\":\"\",\"file\":\"accept_alert\",\"directory\":\"/\",\"path\":\"/accept_alert\",\"relative\":\"/accept_alert\",\"port\":\"\",\"host\":\"\",\"password\":\"\",\"user\":\"\",\"userInfo\":\"\",\"authority\":\"\",\"protocol\":\"\",\"source\":\"/accept_alert\",\"queryKey\":{},\"chunks\":[\"accept_alert\"]},\"urlOriginal\":\"/session/3d9c7a70-b280-11e3-9542-67c64752bf31/accept_alert\"}\n at :/ghostdriver/request_handlers/session_request_handler.js:199\n at :/ghostdriver/request_handlers/request_handler.js:61\n at :/ghostdriver/request_handlers/router_request_handler.js:78","stackArray":[{"sourceURL":":/ghostdriver/request_handlers/session_request_handler.js","line":199},{"sourceURL":":/ghostdriver/request_handlers/request_handler.js","line":61},{"sourceURL":":/ghostdriver/request_handlers/router_request_handler.js","line":78}]}
Average of ratings: -
In reply to Urs Hunkler

Re: Behat tests in PhantomJS slower

by David Monllaó -

Hi Urs,

PhantomJS should not be slower that Selenium using the default Firefox driver, the error you see in PhantomJS log is because some scenarios can fail leaving an opened Javascript modal window and we try to autoaccept them so there is nothing blocking the executing of the following scenario, the error states that we are sending the accept_alert command, but it does not produce any significant performance difference, in fact selenium runs the same query.