WebPagetest Forums
Webpagetest returning value "undefined" in function callback - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Bugs/Issues (/forumdisplay.php?fid=10)
+--- Thread: Webpagetest returning value "undefined" in function callback (/showthread.php?tid=14351)



Webpagetest returning value "undefined" in function callback - anilpothala - 05-26-2016 08:15 AM

HI Guys,

Can some one help me on how to get test id in callback method.

Below is the script

it('WebpageTest Homepage', function(done) {

var script = wpt.scriptToString([
{navigate: config.homepage},
'waitForComplete'
]);
wpt.runTest(script, {
label: 'homepagetest',
runs: 1,
pollResults: 5,
firstViewOnly : true,
connectivity: "3GFast",
emulateMobile:true,
specs:path.join(__dirname, 'specs.json'),},

function(err, res) {
console.log("============"+res)

assert.equal(err, 0);
done();

});


in console log im getting value of "res" or "res.data" as undefined. can some one please suggest here if im doing anything wrong. Test was running fine with out any issues.
I wanted to capture testId from callback function(res.data.testId).