Skip to content

E2E Tests fail on CI build after ejecting #10534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zebslc opened this issue Apr 30, 2018 · 2 comments
Closed

E2E Tests fail on CI build after ejecting #10534

zebslc opened this issue Apr 30, 2018 · 2 comments

Comments

@zebslc
Copy link

zebslc commented Apr 30, 2018

Versions

Angular CLI: 1.7.3 Node: 9.11.1 OS: win32 x64 Angular: 5.2.8 @angular/cli: 1.7.3 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.5.3 webpack: 3.11.0

Repro steps

I have a problem with ejecting from the Angular CLI and running E2E on my build server. It works on my dev machine (and the build server prior to ejecting) but when I run it in Visual Studio online's automated build process it fails because it can't find localhost:4200 server.

Failed: Angular could not be found on the page http://localhost:4200/.If this is not an Angular application, you may need to turn off waiting for Angular.

My build step within visual studio online is npm with custom as the Command Type and: run-script e2e which worked previously and generated artifacts from the test results which it then published ( Screenshot of my build steps showing the e2e call)

The full code is a variation on the ng seed project and is on GitHub complete with a number of pre-configured test settings and headless chrome support https://github.com/zebslc/angular5mat to make it work in a CI/CT using visual studio online/Azure environment. I have had to temporarily revert my ejected cli branch because of this change.

"scripts": {
"ng": "ng",
"start": "webpack-dev-server --port=4200 --config webpack.dev.config",
"watch": "webpack --watch --config webpack.dev.config",
"build": "webpack --config webpack.dev.config",
"build:prod": "webpack --config webpack.prod.config",
"test": "karma start ./karma.conf.js",
"ct": "karma start ./karma.conf.js --single-run --browsers ChromeHeadless --sourcemaps=false",
"lint": "ng lint",
"e2e": "protractor ./protractor.conf.js",
"cover": "karma start ./karma.conf.js --code-coverage",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet"
},
My protractor config has the following default setting but it also contains puppeteer/headless chrome.

baseUrl: "http://localhost:4200/",

Observed behavior

As mentioned this was working perfectly prior to ejecting but I need to add more advanced features such as progressive web app/css profiling so it needs to be ejected. Am I now missing something obvious with my e2e script call and if so what?

The problem seems to be that the CLI creates an instance and runs the tests in the same thread whereas when it is ejected the web service tested against is creating a separate web service.

Discussions in a closed answer suggest you should be able to script it to work the same but then don't give any examples - it also shows the issue has been around a while looking at the comments. They also suggest it is just inconvenient but it is actually a breaking change for me not to be able to do CI E2E tests

Desired behavior

Ejecting should continue with all the same features as currently setup by the cli - i.e. the marshalling scripts for tests exactly all run as before so that it can be run in a CI environment.

If I have to mess around setting up scripts to try and make the process run in the same thread on a server I don't control then that's broken IMHO.

I would also appreciate a workaround if anyone has one till this is fixed or the webpack part can be hooked into without ejecting.

Other Info

I did submit this to stack overflow first in the hope of getting an answer/workaround but since that hasn't happened I am now submitting it as a bug as this completely breaks my build
My stack overflow question

@clydin
Copy link
Member

clydin commented Sep 28, 2018

eject functionality is no longer available in the latest version (6.x+). For custom webpack configurations the following unofficial add-on is a suggested solution: https://github.com/manfredsteyer/ngx-build-plus

@clydin clydin closed this as completed Sep 28, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants