We are doing end to end UI testing using Protractor and using Jasmine as BDD framework. We need text of UI to be validated against the data from REST API, for which we are using Axios!! Is this the right approach? Sample code is mentioned below:
import axios from "axios";
describe("Some test for ", () => {
beforeEach(function(done) {
axios
.get(
"******************"
)
.then(response => {
data_file = response.data;
done();
});
});
it("some spec ", done => {
expect($('#someId').getText()).toBe(data_file.someData);
done();
});
});
Can we use Chakram instead of Axios inside Jasmine in Protractor for fetching data?
If the above approaches are wrong, then what is the correct way of testing UI against data from REST end points? (Chai + Mocha + Chakram + Protractor) or anything else?