View Full Version : Automated ExtJS testing using Jasmine and PhantomJS

5 Nov 2012, 12:09 AM
Hi All,

I'm trying to use Jasmine + PhantomJS to automate ExtJS testing on my CI server. I've looked through Authur's post (http://www.sencha.com/blog/automating-unit-tests/) and his examples work fine. However, when I followed the ExtJS Doc here http://docs.sencha.com/ext-js/4-1/#!/guide/testing I have problems:

When I open the Jasmine tests in a browser, it works fine. However, when I run it in PhantomJS, I get the following errors.


I compared the difference between the two projects and I suspect the error was thrown because of the run-test.html file in ExtJS Doc example. It directly calls "app-test.js" without including the following code in the <body> (which is present in the run-spec.html in Arthur's example)

<script type="text/javascript"> (function() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;

var htmlReporter = new jasmine.HtmlReporter();


jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);

var currentWindowOnload = window.onload;

window.onload = function() {
if (currentWindowOnload) {

function execJasmine() {


I tried to add these code in my html but it failed to load the ExtJS project. Can any one show me how to do it and run via PhantomJS properly?

Thanks a lot!

5 Nov 2012, 1:51 AM
Hi guys,

I think I have found the problem.

<script type="text/javascript" src="/ext-4/ext-all.js"></script>

In the HTML file, when adding the ExtJS library, initially I added ext-debug.js and PhantomJS was throwing errors. When I changedto ext-all.js, it was fine...

I'm a bit confused. Currently in Ext 4.1 there are the following files:

What are the differences?