I am trying to modify a URL within a javascript file in my automation tests. This is so I can point off to a stubbed version of a service. The framework i am using for testing is Serenity-js (Using protractor)
In my HTML DOM I have:
<script type="text/javascript" src="main.js"></script>
main.js
var DataService = (function () {
function DataService(http) {
this.http = http;
}
DataService.prototype.getStudentDetails = function (id) {
var parcel = this.http
.get('http://127.0.0.1/endpoint/' + id)
.map(function (res) {
return __WEBPACK_IMPORTED_MODULE_2__student_model__["a"].createStudent(res.json());
});
return student;
};
return DataService;
}());
The part i need to change is 127.0.0.1/endpoint
I know I cold change the HTML DOM using $.document.write
or $().append
but don't know how to change/overwirte a DOM element.