Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phantomjs and run-jasmine.js timeouts

So I've got an odd issue.

I've got a Jasmine test runner running locally on my machine available at localhost:8080/test/runner.html

When I open it in a web browser it works perfectly.

I wanted to automate this so I'm using phantomjs (installed from brew -- I'm on a mac) and I'm using the example run-jasmine.js file from the code.

But, whenever I run it against the URL, I get this:

phantomjs war/test/spec/run_jasmine.js http://localhost:8080/test/runner.html
'waitFor()' timeout

So I wrote a really simple script to see if there is something I'm missing:

var page = require('webpage').create();

page.open(phantom.args[0],
function(status) {
    if (status !== "success") {
        console.log("Unable to access network");
        phantom.exit();
    } else {
        if (document.body.querySelector('#hello')) {
            console.log('hi');
        }
    }
});

And created a new HTML file:

<!DOCTYPE html>
<html>
<head>
    <title>hi</title>
</head>
<body>
    <div id="hi"></div>
</body>
</html>

And the thing still just hangs forever.

Am I missing something here? I know the page is being loaded, but it doesn't look like phantomjs is ever parsing it.

like image 440
tkone Avatar asked Feb 21 '12 14:02

tkone


1 Answers

Well I feel dumb.

The /test/ requires authentication.

like image 157
tkone Avatar answered Nov 13 '22 09:11

tkone