I'm using a mock module for some testing.
When a page gets loaded e.g.
browser.get('http://localhost:5643/#/balance/import');
this api url below gets called and we get the below response which works just fine.
$httpBackend.whenGET('https://localhost:44329/api/daystatus').respond(
{
'DayID': 249,
'weekend': false,
'dayStatusTypeID': 5,
'balance': null
}
);
But when another page gets loaded e.g.
browser.get('http://localhost:5643/#/dashboard');
and also calls the api url in the mock module
but this time I want it to return different response. (Because the previous page was loaded and some UI test actions took place.)
$httpBackend.whenGET('https://localhost:44329/api/daystatus').respond(
{
'DayID': 249,
'weekend': false,
'dayStatusTypeID': 7,
'balance': null
}
);
How can I say in my mock module to use the second call to the API url this time not the first? At the moment whatever page I load it uses:
$httpBackend.whenGET('https://localhost:44329/api/daystatus').respond(
{
'DayID': 249,
'weekend': false,
'dayStatusTypeID': 5,
'balance': null
}
);
Can I detect which page the request came from..or can I pass in querystring variables? Not sure how to go about this.
Aucun commentaire:
Enregistrer un commentaire