Open DebashishSamanta opened 5 years ago
I am using Request-promise for my Protractor-TypeScript API Testing. But after repeated trials also I am unable to get response from API.
Class File: To execute the API
var rp = require('request-promise');
export class Apitesting {
public APIRequest; constructor(){ this.APIRequest = function() { console.log("Starting....."); var options = { method: 'GET', url: 'http://www.vanguard.com.au/', headers: { 'Postman-Token': '3e7eeab8-aff5-4d86-ba36-e52ada393846', 'cache-control': 'no-cache' }, json: true }; rp(options).then(function (repos) { console.log('User has %d repos', repos.length); }).catch(function (err) { // API call failed... }); } }
}
Calling this Function from Spec file Prints the console console.log("Starting.....");
But does not call rp(options).
Spec File:
import {Apitesting} from "../utils/api";
describe("Validate the Broken Links",()=> { const api:Apitesting = new Apitesting();
it("Validate the List of Links and and if they are broken",(done)=> {
try { api.APIRequest(); done(); }catch(e) { console.log(e); }
});
Response:
I am using Request-promise for my Protractor-TypeScript API Testing. But after repeated trials also I am unable to get response from API.
Class File: To execute the API
var rp = require('request-promise');
export class Apitesting {
}
Calling this Function from Spec file Prints the console console.log("Starting.....");
But does not call rp(options).
Spec File:
import {Apitesting} from "../utils/api";
describe("Validate the Broken Links",()=> { const api:Apitesting = new Apitesting();
it("Validate the List of Links and and if they are broken",(done)=> {
});
});
Response: