I am trying to mock the api requests to auth0 using ng-apimock while running the e2e tests using protractor in an angular project. While running the e2e tests using protractor the request to browser.get('/')
redirects to localhost:4200/ngApimock/init
before the request which I intend to mock (i.e. /authorize
). This results in the tests to fail before the mocked response is received. I suspect that the mock setup itself results in such an error. Below is the current config that I am using
poxy.config:
"domain-url-to-target": {
"target": "http://localhost:3000/authorize",
"secure": false,
"logLevel": "debug"
},
"/ngapimock/*": {
"target": "http://localhost:3000",
"secure": false,
"logLevel": "debug"
}
mock:
{
"expression": "/authorize",
"method": "POST",
"name": "postLoginForm",
"responses": {
"authSucess":{
"status": "302",
"location": "http://localhost:4200/callback/....",
"access_token": "Mock_Access_Token",
"expires_in": 8600,
"id_token": "Some_id_Token",
"scope": "openid profile email",
"token_type:": "Bearer"
}
}
}
step definition:
Given('statement', async functions (<params>){
await browser.get('/');
await ngApimock.selectScenario('postLoginForm','authSucess');
});