Mock services using server.js and proxy.config.json using Protractor

后端 未结 1 757
日久生厌
日久生厌 2021-01-26 17:57

I am trying to mock service using server.js and the proxy.config.json file so I can use that mocked service in a Protractor test. The way I\'m going about it is having the test

相关标签:
1条回答
  • 2021-01-26 18:23

    I was finally able to solve my initial issue by creating an environmentE2E.ts file as such:

    export const environment = {
      production: false,
      baseURL: 'http://localhost:49156'
    };
    

    adding the following in angular-cli.json file:

          "environments": {
            "dev": "environments/environment.ts",
            "prod": "environments/environment.prod.ts",
            "e2e": "environments/environmentE2E.ts"  // Added only this line, the others were already there
          }
    

    and called the tests with the following command:

    ng e2e --proxy-config proxy.config.json --environment e2e
    

    Hope it helps others. Thank you.

    0 讨论(0)
提交回复
热议问题