Generator-jhipster: Protractor: e2e tests with Angular are broken

Created on 9 Sep 2019  路  20Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

Our current e2e tests with Angular are broken
The tests failed during create/save entities

See https://dev.azure.com/hipster-labs/jhipster-daily-builds/_build

cc @vishal423

Motivation for or Use Case

All new PRs will fail, so it needed to be fixed as soon as possible
That's why I'm putting a bounty on this

Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)
JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

  • [ ] Checking this box is mandatory (this is just to show you read everything)
$$ bug-bounty $$ $100 area angular

Most helpful comment

Made PR #10375 for fix

All 20 comments

I changed test-integration scripts in jhipster/generator-jhipster, the same change is needed to be done also in hipster-labs/jhipster-daily-builds project, I wasn't aware of that, change app.module.ts --> core/core.module.ts:

https://github.com/hipster-labs/jhipster-daily-builds/blob/master/test-integration/jdl-scripts/23-package.sh#L26-L29

I can do PR if needed.

Yes, it would be an improvement but I don't think it's related to this issue.

The daily builds have 2 big parts

  • 1st part with a lot of configs, using the same scripts than the generator-jhipster : this part have e2e tests broken with Angular
  • 2nd part with JDL generation, with dedicated shell scripts in the daily build repo, done by @Hawkurane : it is still WIP as it doesn't work well today
  • 1st part with a lot of configs, using the same scripts than the generator-jhipster : this part have e2e tests broken with Angular

@pascalgrimaud you are correct, https://dev.azure.com/hipster-labs/jhipster-daily-builds/_build/results?buildId=5371&view=logs&jobId=156bdf7b-70dc-51a2-f964-752e46e62347&taskId=b435151a-1623-59a8-950d-4475fc04637b&lineStart=14&lineEnd=15&colStart=1&colEnd=1 shows that changing alertTimeout successful.

I tried to reproduce on my computer. It seems that when you click on save when you create an entity, the user is not redirected to the entity list page, which causes the test to fail (the entity is still created). I'll try to investigate further

And it seems to only appear when running with prod profile...

It seems to come from the webpack config. I managed to fix the bug locally by adding devtool: 'eval-source-map' in the webpack prod profile (note that devtool: 'source-map' does not fix it). As I don't know how works webpack, I'm not sure what should be done to fix that

CI is passing here on my own Azure pipeline: https://dev.azure.com/clementdessoude/Test/_build/results?buildId=342&view=results

I'd like to understand what happened here ?
I don't see any commits related to that, the last 2 days, so it's probably related to one of our dependency ?

I guess so

I was able to reproduce in prod profile as @clement26695 described. When generating output to error chain from https://github.com/jhipster/generator-jhipster/blob/master/generators/entity-client/templates/angular/src/main/webapp/app/entities/entity-management-update.component.ts.ejs#L317 then in my computer in Chrome error message is: ReferenceError: mXSSAttempts is not defined

If I searched from my node_modules folder then mXSSAttempts was found in @angular\core and in terser-webpack-plugin (under node_modules/.cache).
The terser-webpack-plugin misses mXSSAttempts definition, only 2 occurrences in the form:

..... do{if(0===mXSSAttempts)throw new Error(\"Failed to sanitize html because the input is unstable\");mXSSAttempts-- .....

Seems that problem comes from https://github.com/terser/terser version 4.3.0
There is already more than 1 opened issue about that, for example https://github.com/terser/terser/issues/452
If I fixed terser in devDependencies to version 4.2.1:

    "terser": "4.2.1",

then Angular is working in prod profile.

I guess so. Would you be able to make a PR @kaidohallik ?

Seems that React tests passed, so this time is needed to fix version only in Angular part. Doing PR for Angular.

Made PR #10375 for fix

@kaidohallik : so do you think this issue can be closed ?

Just tested with deleting my node_modules and the package-lock, and it seems ok

@pascalgrimaud, yes, I think this issue can be closed as the latest Terser version 4.3.1 solved this issue.

thanks a lot @kaidohallik ! as you spend a lot of time yesterday on this, I propose you to claim the bounty. Don't hesitate

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pascalgrimaud picture pascalgrimaud  路  4Comments

SudharakaP picture SudharakaP  路  3Comments

frantzynicolas picture frantzynicolas  路  3Comments

SudharakaP picture SudharakaP  路  3Comments

ahmedeldeeb25 picture ahmedeldeeb25  路  3Comments