i need a test to certify the http request results(only json) is right,How do I get it,or use other ways
describe('test', function() {
it('get a json', function() {
browser.get('http://.../consumer/2/indexinfo');
});
});
i don't get it because of the result a json not use element
You can use request to get a json response:
require("request")({
url: 'http://.../consumer/2/indexinfo',
json: true
}, function (error, response, body) {
if (!error && response.statusCode === 200) {
console.log(body);
}
})
Protractor is used for end to end (e2e) testing, with one end being user interaction (like a click), and the other end being DOM changes (like text updating). You should be asserting for DOM changes like text updating, not testing the JSON object used to update the DOM.
If you must test the response though, it is possible via the NPM module request .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.