Skip to content
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

Grunt test fail when OAuth2 and spring-websocket are selected #1991

Closed
fontanellif opened this issue Sep 9, 2015 · 5 comments
Closed

Grunt test fail when OAuth2 and spring-websocket are selected #1991

fontanellif opened this issue Sep 9, 2015 · 5 comments
Milestone

Comments

@fontanellif
Copy link

Hi, after update my project i catch this error:

mvn clean package -Pprod

INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket dF3nQKHV1-n5Y2-ZRu40 with id 31045219
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 0 of 21 SUCCESS (0 secs / 0 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 1 of 21 SUCCESS (0 secs / 0.231 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 2 of 21 SUCCESS (0 secs / 0.317 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 3 of 21 SUCCESS (0 secs / 0.4 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 4 of 21 SUCCESS (0 secs / 0.482 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 5 of 21 SUCCESS (0 secs / 0.604 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 6 of 21 SUCCESS (0 secs / 0.685 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 7 of 21 SUCCESS (0 secs / 0.766 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 8 of 21 SUCCESS (0 secs / 0.84 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 9 of 21 SUCCESS (0 secs / 0.93 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 10 of 21 SUCCESS (0 secs / 1.024 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 11 of 21 SUCCESS (0 secs / 1.151 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 12 of 21 SUCCESS (0 secs / 1.223 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 13 of 21 SUCCESS (0 secs / 1.297 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 14 of 21 SUCCESS (0 secs / 1.372 secs)
WARN [web-server]: 404: /bower_components/angular-i18n/angular-locale_en.js
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 15 of 21 SUCCESS (0 secs / 1.508 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 16 of 21 SUCCESS (0 secs / 1.585 secs)

PhantomJS 1.9.8 (Mac OS X 0.0.0) Directive Tests  Password strength Should display the password strength bar FAILED
    TypeError: 'null' is not an object (evaluating 'JSON.parse(localStorage.getItem('ls.token')).access_token')
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/tracker/tracker.service.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/auth/principal.service.js:9
        at processQueue (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at done (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at handleResponse (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9
        at /Users/fontanellif/jhipster/app/src/test/javascript/spec/app/account/password/password.directive.spec.js:9
�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0) Directive Tests  Password strength Should display the password strength bar FAILED
    TypeError: 'null' is not an object (evaluating 'JSON.parse(localStorage.getItem('ls.token')).access_token')
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/tracker/tracker.service.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/auth/principal.service.js:9
        at processQueue (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at done (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at handleResponse (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9
        at /Users/fontanellif/jhipster/app/src/test/javascript/spec/app/account/password/password.directive.spec.js:9
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 17 of 21 (1 FAILED) (0 secs / 1.805 secs)
PhantomJS 1.9.8 (Mac OS X 0.0.0) Directive Tests  Password strength Should change the first 2 points of the strength bar FAILED
    TypeError: 'null' is not an object (evaluating 'JSON.parse(localStorage.getItem('ls.token')).access_token')
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/tracker/tracker.service.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/auth/principal.service.js:9
        at processQueue (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at done (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at handleResponse (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9
        at /Users/fontanellif/jhipster/app/src/test/javascript/spec/app/account/password/password.directive.spec.js:9
�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0) Directive Tests  Password strength Should change the first 2 points of the strength bar FAILED
    TypeError: 'null' is not an object (evaluating 'JSON.parse(localStorage.getItem('ls.token')).access_token')
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/tracker/tracker.service.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/auth/principal.service.js:9
        at processQueue (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at done (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at handleResponse (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9
        at /Users/fontanellif/jhipster/app/src/test/javascript/spec/app/account/password/password.directive.spec.js:9
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 18 of 21 (2 FAILED) (0 secs / 1.912 secs)
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 18 of 21 (2 FAILED) (0 secs / 1.912 secs)
PhantomJS 1.9.8 (Mac OS X 0.0.0) Directive Tests  Password strength Should change the first 4 points of the strength bar FAILED
    TypeError: 'null' is not an object (evaluating 'JSON.parse(localStorage.getItem('ls.token')).access_token')
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/tracker/tracker.service.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/auth/principal.service.js:9
        at processQueue (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at done (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at handleResponse (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9
        at /Users/fontanellif/jhipster/app/src/test/javascript/spec/app/account/password/password.directive.spec.js:9
�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0) Directive Tests  Password strength Should change the first 4 points of the strength bar FAILED
    TypeError: 'null' is not an object (evaluating 'JSON.parse(localStorage.getItem('ls.token')).access_token')
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/tracker/tracker.service.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/scripts/components/auth/principal.service.js:9
        at processQueue (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9
        at done (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular/angular.js:9)
        at handleResponse (/Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9)
        at /Users/fontanellif/jhipster/app/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:9
        at /Users/fontanellif/jhipster/app/src/test/javascript/spec/app/account/password/password.directive.spec.js:9
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 19 of 21 (3 FAILED) (0 secs / 2.191 secs)
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 19 of 21 (3 FAILED) (0 secs / 2.191 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 20 of 21 (3 FAILED) (0 secs / 2.476 secs)
.�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 21 of 21 (3 FAILED) (0 secs / 2.636 secs)

PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 21 of 21 (3 FAILED) (10.167 secs / 2.636 secs)
�[1A�[2KPhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 21 of 21 (3 FAILED) (10.167 secs / 2.636 secs)
Warning: Task "karma:unit" failed. Use --force to continue.

This is my .yo-rc.json

{
  "generator-jhipster": {
    "baseName": "app",
    "packageName": "it.app.app",
    "packageFolder": "it.app.app",
    "authenticationType": "oauth2",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "prodDatabaseType": "mysql",
    "searchEngine": "elasticsearch",
    "buildTool": "maven",
    "frontendBuilder": "grunt",
    "javaVersion": "8",
    "rememberMeKey": "5bd325c59a71ed99f3b295382e71f2f43477d9dc",
    "enableTranslation": true,
    "useSass": true
  }
}

Thank you for your help.

@andreybleme
Copy link

Have you already tried to run karma: unit --force ?

@jdubois
Copy link
Member

jdubois commented Sep 10, 2015

Yes I confirm the issue! I guess it's because of some combinaison of options, at least the OAuth2 option is for sure one of the cause of the issue.

@marcelinobadin
Copy link
Contributor

I had the same issue. To solve, I just added to password.directive.js in the beginning of beforeEach section:

Object.defineProperty(localStorage, 'getItem', { value: function(key) { return '{ "var": "abcdef" }'; }, writable: true});

@jdubois jdubois changed the title karma:unit task error after update Grunt test fail when OAuth2 and spring-websocket are selected Sep 20, 2015
@jdubois
Copy link
Member

jdubois commented Sep 20, 2015

The issue is when you have both selected OAuth2 and spring-websocket, which isn't a common use-case! I have modified the title accordingly

@marcelinobadin
Copy link
Contributor

That's my case. I have both features in my project. And with the proposed solution the tests are ok.

@jdubois jdubois modified the milestone: 2.21.1 Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants