Get help with testing, discuss unit testing strategies etc.


Post by fredric berling »

When i run the phantmjs <urltomytesthtml> i sometimes get that Ext is not defined. Sometimes i get it to work but all tests fail.

Is there a good way of finding out what is happening. Debugging?

The tests works fine running them in browser on autolaunch. The tests differ in complexity but in command mode they all fail.

Post by nickolay »

Well, the only way of debugging in phantomjs is using "t.diag(message)". Tests may fail because of different rendering engine - phantomjs is using Webkit (not the latest version). In general, running tests in phantom should be equal to running them in Safari. Do you see the same failures in Safari?

Post by nickolay »

Might be also a fixed bug - we'll update the beta package tomorrow (it will also have the Selenium integration capabilities ;))

Post by nickolay »

fredric berling wrote:When i run the phantmjs <urltomytesthtml> i sometimes get that Ext is not defined. Sometimes i get it to work but all tests fail.

Is there a good way of finding out what is happening. Debugging?

The tests works fine running them in browser on autolaunch. The tests differ in complexity but in command mode they all fail.
Are you loading ExtJS from their CDN? If so can you try to switch to localized version and check this issue?

Post by nmorado »

I tried running phantomJS 1.3.0 on windows XP: phantonjs.exe <https://myserver:port/app/index.html> but always gives me 'Cant open' URL error.

Does anyone encounter this issue before?

Post by nickolay »

Do you use "https" perhaps? I saw somewhere in phantoms wiki that some builds of phantom does not support https.

Post by nickolay »

Also - where does your preload reside? Can you open the preload url using some of the phantomjs examples?

Post by nmorado »

I am using http.

The preload resides in the index.js (i assume you are referring to the preload directive?)

The preload are all relative URLs (relative to index). Does it have to be absolute?

What phantomJS version did you use in your documentation? 1.3.0?

Thank you.

Post by nmorado »

BTW i tried running it programmatically using WebPage object:


var page = new WebPage();

page.viewportSize = { width: 1024, height: 768};

page.open('https://localhost:8080/myserver:port/app/index.html', function (status) {
if (status !== 'success') {
console.log('Unable to access the network!');
} else {
// what to do here
console.log('Successfully run the tests');

page.render('quickallote.png');
}
phantom.exit();
});


It seems to print fine, although the tests are not triggered automatically.
Attachments
render capture from test
render capture from test
quickallote.png (48.48 KiB) Viewed 8190 times

Post by mats »

Were you able to find Nickolay on Ym?

Post Reply