Angular migration (from 4 to 6) e2e --proxy-config not working












10














Ive been currently migrating my app from 4 to 6 and I can not executing my proxy script for my e2e tests.
The script listing looks as follows:



"scripts": {
"ng": "ng",
"start": "ng serve",
"start:tst1": "ng serve --proxy-config config/proxy/proxy.tst1.json",
"start:tst5": "ng serve --proxy-config config/proxy/proxy.tst5.json",
...
"test:watch": "ng test",
"lint": "ng lint --type-check true",
"e2e": "ng e2e",
"e2e:tst1": "ng e2e --proxy-config config/proxy/proxy.tst1.json",
"e2e:tst5": "ng e2e --proxy-config config/proxy/proxy.tst5.json",
},


What I dont understand is, that the start commands (ng serve) work perfectly fine for instancenpm run start:tst5. But when I try to execute the e2e tests like npm run e2e:tst5 it throws me the error: Unknown option: '--proxyConfig'.



The config in my angular.json looks as follows:



angular.json



...
"lmsbo-bo-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "lmsbo-bo:serve"
},
"configurations": {
"production": {
"devServerTarget": "lmsbo-bo:serve:production"
}
}
},
...


EDIT



I got the e2e test working with following addition in the angular.cli:



        "serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "lmsbo-bo:build",
"proxyConfig": "config/proxy/proxy.tst5.json" <== **added this** line
},
"configurations": {
"production": {
"browserTarget": "lmsbo-bo:build:production"
}
}
},


But this solution approach is not satisfying by any means. I got to change this line of code everytime I want to execute against another environment. I would rather want to manage this via command line by writing something like: ng serve --proxy-config config/proxy/proxy.tst5.json.



Any suggestions would be appreciated! :)










share|improve this question
























  • Try see this: -stackoverflow.com/questions/51681813/… -stackoverflow.com/questions/50927406/… bye
    – RikG93
    Aug 20 '18 at 11:30










  • Not what I am looking for.
    – creep-story
    Aug 20 '18 at 13:55










  • You can run the following command in terminal before your test execution Set the proxy in terminal SET https_proxy=yourcompanydomain.com:portnumber SET http_proxy=yourcompanydomain.com:com:portnumber
    – Ragavan Rajan
    Aug 24 '18 at 1:23






  • 3




    From what I can see, it is not supported anymore github.com/angular/angular-cli/issues/11408 github.com/angular/angular-cli/issues/6358
    – Zysce
    Aug 24 '18 at 12:59








  • 1




    there is an open issue for this on GitHub see following github.com/angular/angular-cli/issues/6358
    – Crying Freeman
    Aug 24 '18 at 13:11


















10














Ive been currently migrating my app from 4 to 6 and I can not executing my proxy script for my e2e tests.
The script listing looks as follows:



"scripts": {
"ng": "ng",
"start": "ng serve",
"start:tst1": "ng serve --proxy-config config/proxy/proxy.tst1.json",
"start:tst5": "ng serve --proxy-config config/proxy/proxy.tst5.json",
...
"test:watch": "ng test",
"lint": "ng lint --type-check true",
"e2e": "ng e2e",
"e2e:tst1": "ng e2e --proxy-config config/proxy/proxy.tst1.json",
"e2e:tst5": "ng e2e --proxy-config config/proxy/proxy.tst5.json",
},


What I dont understand is, that the start commands (ng serve) work perfectly fine for instancenpm run start:tst5. But when I try to execute the e2e tests like npm run e2e:tst5 it throws me the error: Unknown option: '--proxyConfig'.



The config in my angular.json looks as follows:



angular.json



...
"lmsbo-bo-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "lmsbo-bo:serve"
},
"configurations": {
"production": {
"devServerTarget": "lmsbo-bo:serve:production"
}
}
},
...


EDIT



I got the e2e test working with following addition in the angular.cli:



        "serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "lmsbo-bo:build",
"proxyConfig": "config/proxy/proxy.tst5.json" <== **added this** line
},
"configurations": {
"production": {
"browserTarget": "lmsbo-bo:build:production"
}
}
},


But this solution approach is not satisfying by any means. I got to change this line of code everytime I want to execute against another environment. I would rather want to manage this via command line by writing something like: ng serve --proxy-config config/proxy/proxy.tst5.json.



Any suggestions would be appreciated! :)










share|improve this question
























  • Try see this: -stackoverflow.com/questions/51681813/… -stackoverflow.com/questions/50927406/… bye
    – RikG93
    Aug 20 '18 at 11:30










  • Not what I am looking for.
    – creep-story
    Aug 20 '18 at 13:55










  • You can run the following command in terminal before your test execution Set the proxy in terminal SET https_proxy=yourcompanydomain.com:portnumber SET http_proxy=yourcompanydomain.com:com:portnumber
    – Ragavan Rajan
    Aug 24 '18 at 1:23






  • 3




    From what I can see, it is not supported anymore github.com/angular/angular-cli/issues/11408 github.com/angular/angular-cli/issues/6358
    – Zysce
    Aug 24 '18 at 12:59








  • 1




    there is an open issue for this on GitHub see following github.com/angular/angular-cli/issues/6358
    – Crying Freeman
    Aug 24 '18 at 13:11
















10












10








10







Ive been currently migrating my app from 4 to 6 and I can not executing my proxy script for my e2e tests.
The script listing looks as follows:



"scripts": {
"ng": "ng",
"start": "ng serve",
"start:tst1": "ng serve --proxy-config config/proxy/proxy.tst1.json",
"start:tst5": "ng serve --proxy-config config/proxy/proxy.tst5.json",
...
"test:watch": "ng test",
"lint": "ng lint --type-check true",
"e2e": "ng e2e",
"e2e:tst1": "ng e2e --proxy-config config/proxy/proxy.tst1.json",
"e2e:tst5": "ng e2e --proxy-config config/proxy/proxy.tst5.json",
},


What I dont understand is, that the start commands (ng serve) work perfectly fine for instancenpm run start:tst5. But when I try to execute the e2e tests like npm run e2e:tst5 it throws me the error: Unknown option: '--proxyConfig'.



The config in my angular.json looks as follows:



angular.json



...
"lmsbo-bo-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "lmsbo-bo:serve"
},
"configurations": {
"production": {
"devServerTarget": "lmsbo-bo:serve:production"
}
}
},
...


EDIT



I got the e2e test working with following addition in the angular.cli:



        "serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "lmsbo-bo:build",
"proxyConfig": "config/proxy/proxy.tst5.json" <== **added this** line
},
"configurations": {
"production": {
"browserTarget": "lmsbo-bo:build:production"
}
}
},


But this solution approach is not satisfying by any means. I got to change this line of code everytime I want to execute against another environment. I would rather want to manage this via command line by writing something like: ng serve --proxy-config config/proxy/proxy.tst5.json.



Any suggestions would be appreciated! :)










share|improve this question















Ive been currently migrating my app from 4 to 6 and I can not executing my proxy script for my e2e tests.
The script listing looks as follows:



"scripts": {
"ng": "ng",
"start": "ng serve",
"start:tst1": "ng serve --proxy-config config/proxy/proxy.tst1.json",
"start:tst5": "ng serve --proxy-config config/proxy/proxy.tst5.json",
...
"test:watch": "ng test",
"lint": "ng lint --type-check true",
"e2e": "ng e2e",
"e2e:tst1": "ng e2e --proxy-config config/proxy/proxy.tst1.json",
"e2e:tst5": "ng e2e --proxy-config config/proxy/proxy.tst5.json",
},


What I dont understand is, that the start commands (ng serve) work perfectly fine for instancenpm run start:tst5. But when I try to execute the e2e tests like npm run e2e:tst5 it throws me the error: Unknown option: '--proxyConfig'.



The config in my angular.json looks as follows:



angular.json



...
"lmsbo-bo-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "lmsbo-bo:serve"
},
"configurations": {
"production": {
"devServerTarget": "lmsbo-bo:serve:production"
}
}
},
...


EDIT



I got the e2e test working with following addition in the angular.cli:



        "serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "lmsbo-bo:build",
"proxyConfig": "config/proxy/proxy.tst5.json" <== **added this** line
},
"configurations": {
"production": {
"browserTarget": "lmsbo-bo:build:production"
}
}
},


But this solution approach is not satisfying by any means. I got to change this line of code everytime I want to execute against another environment. I would rather want to manage this via command line by writing something like: ng serve --proxy-config config/proxy/proxy.tst5.json.



Any suggestions would be appreciated! :)







angular protractor angular6 e2e-testing angular-e2e






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 24 '18 at 12:51

























asked Aug 20 '18 at 10:34









creep-story

251321




251321












  • Try see this: -stackoverflow.com/questions/51681813/… -stackoverflow.com/questions/50927406/… bye
    – RikG93
    Aug 20 '18 at 11:30










  • Not what I am looking for.
    – creep-story
    Aug 20 '18 at 13:55










  • You can run the following command in terminal before your test execution Set the proxy in terminal SET https_proxy=yourcompanydomain.com:portnumber SET http_proxy=yourcompanydomain.com:com:portnumber
    – Ragavan Rajan
    Aug 24 '18 at 1:23






  • 3




    From what I can see, it is not supported anymore github.com/angular/angular-cli/issues/11408 github.com/angular/angular-cli/issues/6358
    – Zysce
    Aug 24 '18 at 12:59








  • 1




    there is an open issue for this on GitHub see following github.com/angular/angular-cli/issues/6358
    – Crying Freeman
    Aug 24 '18 at 13:11




















  • Try see this: -stackoverflow.com/questions/51681813/… -stackoverflow.com/questions/50927406/… bye
    – RikG93
    Aug 20 '18 at 11:30










  • Not what I am looking for.
    – creep-story
    Aug 20 '18 at 13:55










  • You can run the following command in terminal before your test execution Set the proxy in terminal SET https_proxy=yourcompanydomain.com:portnumber SET http_proxy=yourcompanydomain.com:com:portnumber
    – Ragavan Rajan
    Aug 24 '18 at 1:23






  • 3




    From what I can see, it is not supported anymore github.com/angular/angular-cli/issues/11408 github.com/angular/angular-cli/issues/6358
    – Zysce
    Aug 24 '18 at 12:59








  • 1




    there is an open issue for this on GitHub see following github.com/angular/angular-cli/issues/6358
    – Crying Freeman
    Aug 24 '18 at 13:11


















Try see this: -stackoverflow.com/questions/51681813/… -stackoverflow.com/questions/50927406/… bye
– RikG93
Aug 20 '18 at 11:30




Try see this: -stackoverflow.com/questions/51681813/… -stackoverflow.com/questions/50927406/… bye
– RikG93
Aug 20 '18 at 11:30












Not what I am looking for.
– creep-story
Aug 20 '18 at 13:55




Not what I am looking for.
– creep-story
Aug 20 '18 at 13:55












You can run the following command in terminal before your test execution Set the proxy in terminal SET https_proxy=yourcompanydomain.com:portnumber SET http_proxy=yourcompanydomain.com:com:portnumber
– Ragavan Rajan
Aug 24 '18 at 1:23




You can run the following command in terminal before your test execution Set the proxy in terminal SET https_proxy=yourcompanydomain.com:portnumber SET http_proxy=yourcompanydomain.com:com:portnumber
– Ragavan Rajan
Aug 24 '18 at 1:23




3




3




From what I can see, it is not supported anymore github.com/angular/angular-cli/issues/11408 github.com/angular/angular-cli/issues/6358
– Zysce
Aug 24 '18 at 12:59






From what I can see, it is not supported anymore github.com/angular/angular-cli/issues/11408 github.com/angular/angular-cli/issues/6358
– Zysce
Aug 24 '18 at 12:59






1




1




there is an open issue for this on GitHub see following github.com/angular/angular-cli/issues/6358
– Crying Freeman
Aug 24 '18 at 13:11






there is an open issue for this on GitHub see following github.com/angular/angular-cli/issues/6358
– Crying Freeman
Aug 24 '18 at 13:11














3 Answers
3






active

oldest

votes


















4














Even though this feature is not supported anymore and there is already an open issue on github, Ive found out a pretty convinient way to execute the proxy config via script:



add in your package.json following lines (example):



"e2e:local": "ng config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile1** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''",
"e2e:tst1": "ng config config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile2** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''"


All you do is to set the proxyConfig value in your angular.json via ng command and reset it after the e2e tests are finished. Make sure the ng command is working (if not add your angular/cli path into your environment properties of your operating System and restart your computer).






share|improve this answer























  • This will throw me Error: Unexpected end of file. when it tries to remove config.
    – Bojan Kogoj
    Oct 19 '18 at 13:10



















0














You can accomplish this by updating your angular.json as follows (substitute your project name for my-project):



1) In projects -> my-project-e2e, update devServerTarget from



"my-project:serve" 


to



"my-project:serve:e2e"


2) In projects -> my-project -> architect -> configurations, add



"e2e": {
"browserTarget": "cli-advisor-portal:build:e2e",
"proxyConfig": "proxy.local.config.json"
}





share|improve this answer





















  • Not sure why this was voted down. It worked very well for me - in my case I wanted to use two different proxy configs for two different environments (local and test).
    – Dawid Stróżak
    Nov 12 '18 at 23:24












  • Glad to hear it!
    – raymondboswel
    Dec 24 '18 at 7:52



















0














If I understand correctly - you want to avoid having to change the proxy config line every time you want to run e2e tests against different evironment:



Create separate proxy configs for your environments such as:




  • proxy.config.yourenv1.json

  • proxy.config.yourenv2.json


Add configurations for each environment under serve:




"serve": {
...
"configurations": {
"yourenv1-e2e": {
"browserTarget": "yourapp:build",
"proxyConfig": "proxy.config.yourenv1.json"
},
"yourenv2-e2e": {
"browserTarget": "yourapp:build",
"proxyConfig": "proxy.config.yourenv2.json"
}
}
},



Then under yourapp-e2e again add configurations for each environment:



"yourapp-e2e": {
...
"architect": {
"e2e": {
...
"configurations": {
"yourenv1-e2e": {
"devServerTarget": "yourapp:serve:yourenv1-e2e"
},
"yourenv2-e2e": {
"devServerTarget": "yourapp:serve:yourenv2-e2e"
},
}
},


Now you can simply run this:



ng e2e --configuration yourenv-e2e



The e2e tests will run using desired proxy config file.
Based on the @raymondboswel's answer.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51928880%2fangular-migration-from-4-to-6-e2e-proxy-config-not-working%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    Even though this feature is not supported anymore and there is already an open issue on github, Ive found out a pretty convinient way to execute the proxy config via script:



    add in your package.json following lines (example):



    "e2e:local": "ng config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile1** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''",
    "e2e:tst1": "ng config config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile2** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''"


    All you do is to set the proxyConfig value in your angular.json via ng command and reset it after the e2e tests are finished. Make sure the ng command is working (if not add your angular/cli path into your environment properties of your operating System and restart your computer).






    share|improve this answer























    • This will throw me Error: Unexpected end of file. when it tries to remove config.
      – Bojan Kogoj
      Oct 19 '18 at 13:10
















    4














    Even though this feature is not supported anymore and there is already an open issue on github, Ive found out a pretty convinient way to execute the proxy config via script:



    add in your package.json following lines (example):



    "e2e:local": "ng config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile1** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''",
    "e2e:tst1": "ng config config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile2** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''"


    All you do is to set the proxyConfig value in your angular.json via ng command and reset it after the e2e tests are finished. Make sure the ng command is working (if not add your angular/cli path into your environment properties of your operating System and restart your computer).






    share|improve this answer























    • This will throw me Error: Unexpected end of file. when it tries to remove config.
      – Bojan Kogoj
      Oct 19 '18 at 13:10














    4












    4








    4






    Even though this feature is not supported anymore and there is already an open issue on github, Ive found out a pretty convinient way to execute the proxy config via script:



    add in your package.json following lines (example):



    "e2e:local": "ng config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile1** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''",
    "e2e:tst1": "ng config config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile2** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''"


    All you do is to set the proxyConfig value in your angular.json via ng command and reset it after the e2e tests are finished. Make sure the ng command is working (if not add your angular/cli path into your environment properties of your operating System and restart your computer).






    share|improve this answer














    Even though this feature is not supported anymore and there is already an open issue on github, Ive found out a pretty convinient way to execute the proxy config via script:



    add in your package.json following lines (example):



    "e2e:local": "ng config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile1** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''",
    "e2e:tst1": "ng config config projects.**yourAppName**.architect.serve.options.proxyConfig **yourProxyFile2** && ng e2e && ng config projects.**yourAppName**.architect.serve.options.proxyConfig ''"


    All you do is to set the proxyConfig value in your angular.json via ng command and reset it after the e2e tests are finished. Make sure the ng command is working (if not add your angular/cli path into your environment properties of your operating System and restart your computer).







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Oct 28 '18 at 8:38

























    answered Aug 27 '18 at 11:23









    creep-story

    251321




    251321












    • This will throw me Error: Unexpected end of file. when it tries to remove config.
      – Bojan Kogoj
      Oct 19 '18 at 13:10


















    • This will throw me Error: Unexpected end of file. when it tries to remove config.
      – Bojan Kogoj
      Oct 19 '18 at 13:10
















    This will throw me Error: Unexpected end of file. when it tries to remove config.
    – Bojan Kogoj
    Oct 19 '18 at 13:10




    This will throw me Error: Unexpected end of file. when it tries to remove config.
    – Bojan Kogoj
    Oct 19 '18 at 13:10













    0














    You can accomplish this by updating your angular.json as follows (substitute your project name for my-project):



    1) In projects -> my-project-e2e, update devServerTarget from



    "my-project:serve" 


    to



    "my-project:serve:e2e"


    2) In projects -> my-project -> architect -> configurations, add



    "e2e": {
    "browserTarget": "cli-advisor-portal:build:e2e",
    "proxyConfig": "proxy.local.config.json"
    }





    share|improve this answer





















    • Not sure why this was voted down. It worked very well for me - in my case I wanted to use two different proxy configs for two different environments (local and test).
      – Dawid Stróżak
      Nov 12 '18 at 23:24












    • Glad to hear it!
      – raymondboswel
      Dec 24 '18 at 7:52
















    0














    You can accomplish this by updating your angular.json as follows (substitute your project name for my-project):



    1) In projects -> my-project-e2e, update devServerTarget from



    "my-project:serve" 


    to



    "my-project:serve:e2e"


    2) In projects -> my-project -> architect -> configurations, add



    "e2e": {
    "browserTarget": "cli-advisor-portal:build:e2e",
    "proxyConfig": "proxy.local.config.json"
    }





    share|improve this answer





















    • Not sure why this was voted down. It worked very well for me - in my case I wanted to use two different proxy configs for two different environments (local and test).
      – Dawid Stróżak
      Nov 12 '18 at 23:24












    • Glad to hear it!
      – raymondboswel
      Dec 24 '18 at 7:52














    0












    0








    0






    You can accomplish this by updating your angular.json as follows (substitute your project name for my-project):



    1) In projects -> my-project-e2e, update devServerTarget from



    "my-project:serve" 


    to



    "my-project:serve:e2e"


    2) In projects -> my-project -> architect -> configurations, add



    "e2e": {
    "browserTarget": "cli-advisor-portal:build:e2e",
    "proxyConfig": "proxy.local.config.json"
    }





    share|improve this answer












    You can accomplish this by updating your angular.json as follows (substitute your project name for my-project):



    1) In projects -> my-project-e2e, update devServerTarget from



    "my-project:serve" 


    to



    "my-project:serve:e2e"


    2) In projects -> my-project -> architect -> configurations, add



    "e2e": {
    "browserTarget": "cli-advisor-portal:build:e2e",
    "proxyConfig": "proxy.local.config.json"
    }






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 30 '18 at 11:44









    raymondboswel

    266210




    266210












    • Not sure why this was voted down. It worked very well for me - in my case I wanted to use two different proxy configs for two different environments (local and test).
      – Dawid Stróżak
      Nov 12 '18 at 23:24












    • Glad to hear it!
      – raymondboswel
      Dec 24 '18 at 7:52


















    • Not sure why this was voted down. It worked very well for me - in my case I wanted to use two different proxy configs for two different environments (local and test).
      – Dawid Stróżak
      Nov 12 '18 at 23:24












    • Glad to hear it!
      – raymondboswel
      Dec 24 '18 at 7:52
















    Not sure why this was voted down. It worked very well for me - in my case I wanted to use two different proxy configs for two different environments (local and test).
    – Dawid Stróżak
    Nov 12 '18 at 23:24






    Not sure why this was voted down. It worked very well for me - in my case I wanted to use two different proxy configs for two different environments (local and test).
    – Dawid Stróżak
    Nov 12 '18 at 23:24














    Glad to hear it!
    – raymondboswel
    Dec 24 '18 at 7:52




    Glad to hear it!
    – raymondboswel
    Dec 24 '18 at 7:52











    0














    If I understand correctly - you want to avoid having to change the proxy config line every time you want to run e2e tests against different evironment:



    Create separate proxy configs for your environments such as:




    • proxy.config.yourenv1.json

    • proxy.config.yourenv2.json


    Add configurations for each environment under serve:




    "serve": {
    ...
    "configurations": {
    "yourenv1-e2e": {
    "browserTarget": "yourapp:build",
    "proxyConfig": "proxy.config.yourenv1.json"
    },
    "yourenv2-e2e": {
    "browserTarget": "yourapp:build",
    "proxyConfig": "proxy.config.yourenv2.json"
    }
    }
    },



    Then under yourapp-e2e again add configurations for each environment:



    "yourapp-e2e": {
    ...
    "architect": {
    "e2e": {
    ...
    "configurations": {
    "yourenv1-e2e": {
    "devServerTarget": "yourapp:serve:yourenv1-e2e"
    },
    "yourenv2-e2e": {
    "devServerTarget": "yourapp:serve:yourenv2-e2e"
    },
    }
    },


    Now you can simply run this:



    ng e2e --configuration yourenv-e2e



    The e2e tests will run using desired proxy config file.
    Based on the @raymondboswel's answer.






    share|improve this answer


























      0














      If I understand correctly - you want to avoid having to change the proxy config line every time you want to run e2e tests against different evironment:



      Create separate proxy configs for your environments such as:




      • proxy.config.yourenv1.json

      • proxy.config.yourenv2.json


      Add configurations for each environment under serve:




      "serve": {
      ...
      "configurations": {
      "yourenv1-e2e": {
      "browserTarget": "yourapp:build",
      "proxyConfig": "proxy.config.yourenv1.json"
      },
      "yourenv2-e2e": {
      "browserTarget": "yourapp:build",
      "proxyConfig": "proxy.config.yourenv2.json"
      }
      }
      },



      Then under yourapp-e2e again add configurations for each environment:



      "yourapp-e2e": {
      ...
      "architect": {
      "e2e": {
      ...
      "configurations": {
      "yourenv1-e2e": {
      "devServerTarget": "yourapp:serve:yourenv1-e2e"
      },
      "yourenv2-e2e": {
      "devServerTarget": "yourapp:serve:yourenv2-e2e"
      },
      }
      },


      Now you can simply run this:



      ng e2e --configuration yourenv-e2e



      The e2e tests will run using desired proxy config file.
      Based on the @raymondboswel's answer.






      share|improve this answer
























        0












        0








        0






        If I understand correctly - you want to avoid having to change the proxy config line every time you want to run e2e tests against different evironment:



        Create separate proxy configs for your environments such as:




        • proxy.config.yourenv1.json

        • proxy.config.yourenv2.json


        Add configurations for each environment under serve:




        "serve": {
        ...
        "configurations": {
        "yourenv1-e2e": {
        "browserTarget": "yourapp:build",
        "proxyConfig": "proxy.config.yourenv1.json"
        },
        "yourenv2-e2e": {
        "browserTarget": "yourapp:build",
        "proxyConfig": "proxy.config.yourenv2.json"
        }
        }
        },



        Then under yourapp-e2e again add configurations for each environment:



        "yourapp-e2e": {
        ...
        "architect": {
        "e2e": {
        ...
        "configurations": {
        "yourenv1-e2e": {
        "devServerTarget": "yourapp:serve:yourenv1-e2e"
        },
        "yourenv2-e2e": {
        "devServerTarget": "yourapp:serve:yourenv2-e2e"
        },
        }
        },


        Now you can simply run this:



        ng e2e --configuration yourenv-e2e



        The e2e tests will run using desired proxy config file.
        Based on the @raymondboswel's answer.






        share|improve this answer












        If I understand correctly - you want to avoid having to change the proxy config line every time you want to run e2e tests against different evironment:



        Create separate proxy configs for your environments such as:




        • proxy.config.yourenv1.json

        • proxy.config.yourenv2.json


        Add configurations for each environment under serve:




        "serve": {
        ...
        "configurations": {
        "yourenv1-e2e": {
        "browserTarget": "yourapp:build",
        "proxyConfig": "proxy.config.yourenv1.json"
        },
        "yourenv2-e2e": {
        "browserTarget": "yourapp:build",
        "proxyConfig": "proxy.config.yourenv2.json"
        }
        }
        },



        Then under yourapp-e2e again add configurations for each environment:



        "yourapp-e2e": {
        ...
        "architect": {
        "e2e": {
        ...
        "configurations": {
        "yourenv1-e2e": {
        "devServerTarget": "yourapp:serve:yourenv1-e2e"
        },
        "yourenv2-e2e": {
        "devServerTarget": "yourapp:serve:yourenv2-e2e"
        },
        }
        },


        Now you can simply run this:



        ng e2e --configuration yourenv-e2e



        The e2e tests will run using desired proxy config file.
        Based on the @raymondboswel's answer.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 '18 at 23:50









        Dawid Stróżak

        10116




        10116






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51928880%2fangular-migration-from-4-to-6-e2e-proxy-config-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python