catchpoint/WebPageTest.api-nodejs

Getting test status instead of test result responses in runTest callback

NickTulett opened this issue · 4 comments

xubuntu 14.04
node 0.10.35
npm 2.2.0
webpagetest-api 0.3.1
webpagetest 2.1.6
private instance

When I use runTest(script, options, callback) then the callback just gets a test status json response and never waits for the actual test result.

I haven't used this set up since Oct 14 (when it was last working) and upgraded everything this morning.

poll is still using the old results API:

(in webpagetest.js)

should be

 function poll(err, data) {
    // poll again when test started but not complete
    // and not when specs are done testing
    if (!err && (!data || data && data.data &&
        data.statusCode !== 200) &&
        !(typeof err === 'number' && data === undefined)) {
      polling = setTimeout(getTestResults.bind(this, testId,
        resultsOptions, poll.bind(this)), options.pollResults);
    } else {
      resultsCallback(err, data);
    }
  }

Same issue for me ("webpagetest": "^0.3.1", Windows 7, npm v.1.4.28, node v.0.10.33).
Fixed by rolling back to previous version of webpagetest ("webpagetest": "~0.2.4" in my package.json), which was taken from this https://github.com/tkadlec/grunt-perfbudget

In mentioned version of webpagetest pollResults works as expected and I receive data
Also, I shall note, that proposed by NickTulett fix works in latest version

Just noticed, that there was pull request from NickTulett merged, so, modifying my package.json to retrieve latest version ("webpagetest": "https://github.com/marcelduran/webpagetest-api/tarball/e447798e7ad85f15086eac579ad7e23649b1e337") fixed issue for me

tested against 0.3.2