1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| client.addCommand("getUrlAndTitle", function(customVar) { return this.url().then(function(urlResult) { return this.getTitle().then(function(titleResult) { console.log(customVar); return { url: urlResult.value, title: titleResult }; }); }); }); client .init() .url('http://www.github.com') .getUrlAndTitle('a custom variable',function(err,result){ assert.equal(null, err) assert.strictEqual(result.url,'https://github.com/'); assert.strictEqual(result.title,'GitHub · Build software better, together.'); }) .end();
|