Asked By: Anonymous
Context: I have an acceptance test for my ember-cli application, and the test passes just fine in Chrome. However, in phantomjs, my test fails — the UI doesn’t get created the same way, and I’m trying to work out why. (I think the test is broken because of https://github.com/ember-cli/ember-cli/issues/1763, but the general question of how to debug remains)
In Chrome, I can use the standard debugging tools on my tests and all is well — but in phantomjs, I can’t get at it with a debugger. I also don’t see console.log() messages show up in the output — all I get is a list of test results in my terminal window.
I can sort-of get diagnostic info by writing things like
equal(true, false, "This is a log message");
and then I get the message as details for the assertion that failed, or I can try and work out what’s in the DOM with
equal(true, false, document.getElementsByClassName("my-class".innerHTML);
but both of those a:stop the test going any further, and b:only let me log information from the test itself, not my application.
Is there a way to run my tests outside of “ember test”, or some way to attach to the running test processes? Alternatively, is there a way to get console.log() messages to show up in the output?
Answered By: Anonymous
You can expose PhantomJS debug port and open it in browser then you can interact with context at your debugger breakpoints.