angularjs - protractor different mock httpbackend responses -
i'm using mock module testing.
when page gets loaded e.g.
browser.get('http://localhost:5643/#/balance/import');
this api url below gets called , below response works fine.
$httpbackend.whenget('https://localhost:44329/api/daystatus').respond( { 'dayid': 249, 'weekend': false, 'daystatustypeid': 5, 'balance': null } );
but when page gets loaded e.g.
browser.get('http://localhost:5643/#/dashboard');
and calls api url in mock module
but time want return different response. (because previous page loaded , ui test actions took place.)
$httpbackend.whenget('https://localhost:44329/api/daystatus').respond( { 'dayid': 249, 'weekend': false, 'daystatustypeid': 7, 'balance': null } );
how can in mock module use second call api url time not first? @ moment whatever page load uses:
$httpbackend.whenget('https://localhost:44329/api/daystatus').respond( { 'dayid': 249, 'weekend': false, 'daystatustypeid': 5, 'balance': null } );
can detect page request came from..or can pass in querystring variables? not sure how go this.
you can distinguish api calls referer
header:
$httpbackend.whenget('https://localhost:44329/api/daystatus', {'referer': 'http://localhost:5643/#/balance/import'})
and:
$httpbackend.whenget('https://localhost:44329/api/daystatus', {'referer': 'http://localhost:5643/#/dashboard'})
Comments
Post a Comment