Test hangs indefinitely on opener.location.reload

38 views
Skip to first unread message

Tom Tindall

unread,
May 29, 2015, 11:03:35 AM5/29/15
to casp...@googlegroups.com
Feel free to scold me if there's already an answer for this, but I've been googling for a few hours and don't know where else to turn.

Anyway, I have a test suite that uses a popup. This popup calls:
opener.location.reload(true);
when you click a button. For some reason, I think refreshing the 'opener' window is causing casper to hang indefinitely.

Attached are two minimal HTML files and a casper test file that recreates the issue. I've used a fresh nginx installation for this and configured it to port 1234. Stick the HTML files in nginx/html and run "casperjs test test.js".

I'm new to casper & phantomjs, so I'm probably doing something wrong. If it helps, I'm on Windows 7, using casperjs 1.1.0-beta3 (cloned from github) and phantomjs 2.0.0.

You may need to run the test a several times to get it to hang with this example. In my actual tests (which are much larger) it hangs every single time, so I can't progress.

Any help/advice would be greatly appreciated!
index.html
popuppage.html
test.js

Tom Tindall

unread,
Jun 10, 2015, 7:58:36 AM6/10/15
to casp...@googlegroups.com
Still unsure why the attached example hangs sometimes, but I found the problem with my other tests.

It was my own stupid fault, as I didn't read the documentation properly. The culprit was this:
casper.withPopup(/someurlhere/, function() {
    this.viewport(1024, 768); // <-- incorrect usage
    // do stuff...
});

See this for correct usage (and make sure to read more than just the first line!): http://docs.casperjs.org/en/latest/modules/casper.html#viewport 

Reply all
Reply to author
Forward
0 new messages