angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.13k stars 1.24k forks source link

test:e2e ERROR: invalid argument: missing 'name' #2714

Open kathy-ems opened 6 years ago

kathy-ems commented 6 years ago
Item Version
generator-angular-fullstack 4.1.2
Node 6.9.5
npm 3.10.10
Operating System OS X 10.12
gulp-protractor ^4.0.0
chrome 66.0.3359.117
chromedriver 2.38.552518
webdriver-manager global installed version 12.0.6
Item Answer
Transpiler Babel
Markup HTML
CSS SCSS
Router ui-router
Client Tests Jasmine
DB MongoDB
Auth N

Error that is displayed in the console when running gulp test:e2e

[10:39:39] E/launcher - invalid argument: missing 'name'
  (Session info: chrome=66.0.3359.117)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)
[10:39:39] E/launcher - WebDriverError: invalid argument: missing 'name'
  (Session info: chrome=66.0.3359.117)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)
    at WebDriverError (/Users/username/Dropbox/git/DataTools/ssfdata/node_modules/selenium-webdriver/lib/error.js:27:5)
    at Object.checkLegacyResponse (/Users/username/Dropbox/git/DataTools/ssfdata/node_modules/selenium-webdriver/lib/error.js:546:15)

Received an error running gulp test:e2e today. Which led me to digging through the selenium-webdriver module, and found that line 95 & 97 of protractor.conf was causing this error. Commenting out these two lines allows gulp test:e2e to run.

line 93                browser.get('http://localhost:9000/');
line 94                browser.manage().addCookie('token', token);
line 95                // browser.manage().getCookie('token').then(function(cookie) {
line 96                  defer.fulfill();
line 97                // });

Any idea why? Is this line necessary? I am concerned I will run into problems when testing the browser back button functionality and this cookie/token is missing.

The problem is that getCookie produces an http response LEGACY status code of 14, which is then thrown by the selenium-webdriver.

node_modules/selenium-webdriver/lib/http.js The invalid arguments (command and http response) that is parsed by the function parseHttpResponse in node_modules/selenium-webdriver/lib/http.js (line 441) produces the legacy status code of 14.

Command {
  name_: 'addCookie',
  parameters_: 
   { cookie: 
      { name: undefined,
        value: undefined,
        path: undefined,
        domain: undefined,
        secure: false,
        httpOnly: false,
        expiry: undefined } } } 
Response {
  status: 200,
  body: '{"sessionId":"305923af833e29d89805f2addfe271e3","status":14,"value":{"message":"invalid argument: missing \'name\'\\n  (Session info: chrome=66.0.3359.117)\\n  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)"}}',
  headers: 
   Map {
     'connection' => 'close',
     'expires' => 'Thu, 01 Jan 1970 00:00:00 GMT',
     'cache-control' => 'no-cache',
     'content-type' => 'application/json;charset=utf-8',
     'content-length' => '274',
     'server' => 'Jetty(9.4.7.v20170914)' } }

Package.json

{
  "name": "ssfdata",
  "version": "1.0.0",
  "main": "server/index.js",
  "dependencies": {
    "angular": "~1.6.0",
    "angular-animate": "~1.6.0",
    "angular-aria": "~1.6.0",
    "angular-cookies": "~1.6.0",
    "angular-resource": "~1.6.0",
    "angular-sanitize": "~1.6.0",
    "angular-socket-io": "~0.7.0",
    "angular-ui-bootstrap": "^2.0.1",
    "angular-ui-router": "1.0.0-rc.1",
    "angular-validation-match": "^1.9.0",
    "babel-polyfill": "^6.7.2",
    "babel-runtime": "^6.6.1",
    "bluebird": "^3.3.3",
    "body-parser": "^1.13.3",
    "bootstrap": "~3.3.7",
    "bootstrap-sass": "~3.3.7",
    "bootstrap-social": "^5.0.0",
    "composable-middleware": "^0.3.0",
    "compression": "^1.6.2",
    "connect-mongo": "^1.2.1",
    "cookie-parser": "^1.3.5",
    "core-js": "^2.2.1",
    "datatables.net": "^1.10.13",
    "datatables.net-bs": "^1.10.13",
    "datatables.net-responsive": "^2.1.1",
    "datatables.net-responsive-bs": "^2.1.1",
    "ejs": "^2.5.3",
    "errorhandler": "^1.4.2",
    "express": "^4.13.3",
    "express-jwt": "^5.0.0",
    "express-session": "^1.11.3",
    "fast-json-patch": "^1.0.0",
    "file-saver": "^1.3.3",
    "font-awesome": ">=4.1.0",
    "jquery": "^3.1.1",
    "jquery-datatables-checkboxes": "^1.2.9",
    "jsonwebtoken": "^7.0.0",
    "lodash": "^4.6.1",
    "lusca": "^1.3.0",
    "method-override": "^2.3.5",
    "moment": "^2.18.1",
    "moment-duration-format": "^1.3.0",
    "mongoose": "^4.1.2",
    "morgan": "~1.7.0",
    "passport": "~0.3.0",
    "passport-google-oauth20": "^1.0.0",
    "passport-local": "^1.0.0",
    "serve-favicon": "^2.3.0",
    "socket.io": "^1.3.5",
    "socket.io-client": "^1.3.5",
    "socketio-jwt": "^4.2.0",
    "sprint-js": "~0.1.0"
  },
  "devDependencies": {
    "angular-mocks": "~1.6.0",
    "autoprefixer": "^6.0.0",
    "awesome-typescript-loader": "0.17.0",
    "babel-core": "^6.6.5",
    "babel-eslint": "^6.1.2",
    "babel-loader": "^6.2.4",
    "babel-plugin-syntax-flow": "^6.8.0",
    "babel-plugin-transform-class-properties": "^6.6.0",
    "babel-plugin-transform-flow-comments": "^6.8.0",
    "babel-plugin-transform-runtime": "^6.6.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-es2015": "^6.6.0",
    "babel-register": "^6.6.5",
    "browser-sync": "^2.8.0",
    "bs-fullscreen-message": "^1.0.0",
    "chai": "^3.2.0",
    "chai-as-promised": "^5.1.0",
    "chai-things": "^0.2.0",
    "css-loader": "^0.24.0",
    "del": "^2.0.2",
    "eslint": "^3.17.1",
    "extend": "^3.0.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.9.0",
    "flow-bin": "^0.31.0",
    "fs": "0.0.1-security",
    "grunt": "^1.0.1",
    "grunt-build-control": "^0.7.0",
    "gulp": "^3.9.1",
    "gulp-babel": "^6.1.2",
    "gulp-env": "^0.4.0",
    "gulp-eslint": "^2.0.0",
    "gulp-imagemin": "^3.0.1",
    "gulp-inject": "^4.0.0",
    "gulp-istanbul": "^1.1.1",
    "gulp-istanbul-enforcer": "^1.0.3",
    "gulp-load-plugins": "^1.0.0-rc.1",
    "gulp-mocha": "^4.3.1",
    "gulp-node-inspector": "^0.1.0",
    "gulp-plumber": "^1.0.1",
    "gulp-protractor": "^4.0.0",
    "gulp-rev": "^7.0.0",
    "gulp-rev-replace": "^0.4.2",
    "gulp-sort": "^2.0.0",
    "gulp-sourcemaps": "^1.5.2",
    "gulp-stylint": "^3.0.0",
    "gulp-util": "^3.0.5",
    "gulp-watch": "^4.3.5",
    "html-webpack-harddisk-plugin": "~0.0.2",
    "html-webpack-plugin": "^2.16.0",
    "imports-loader": "^0.6.5",
    "isparta": "^4.0.0",
    "isparta-instrumenter-loader": "^1.0.0",
    "isparta-loader": "^2.0.0",
    "istanbul": "1.1.0-alpha.1",
    "istanbul-instrumenter-loader": "^0.2.0",
    "jasmine-core": "^2.4.1",
    "jasmine-spec-reporter": "^2.4.0",
    "karma": "~0.13.3",
    "karma-chrome-launcher": "^2.0.0",
    "karma-coverage": "^1.0.0",
    "karma-firefox-launcher": "^1.0.0",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-matchers": "^3.6.0",
    "karma-phantomjs-launcher": "~1.0.0",
    "karma-script-launcher": "^1.0.0",
    "karma-sourcemap-loader": "~0.3.7",
    "karma-spec-reporter": "~0.0.20",
    "karma-webpack": "^1.7.0",
    "lazypipe": "^1.0.1",
    "mocha": "^3.0.2",
    "ng-annotate-loader": "~0.1.0",
    "node-sass": "^3.8.0",
    "nodemon": "^1.3.7",
    "null-loader": "^0.1.1",
    "open": "~0.0.4",
    "phantomjs-prebuilt": "^2.1.4",
    "postcss-loader": "^0.11.1",
    "proxyquire": "^1.0.1",
    "raw-loader": "^0.5.1",
    "request": "^2.81.0",
    "run-sequence": "^2.2.1",
    "sass-loader": "^4.0.1",
    "sinon": "^1.16.1",
    "sinon-chai": "^2.8.0",
    "strip-ansi": "^3.0.1",
    "style-loader": "^0.13.0",
    "supertest": "^1.1.0",
    "through2": "^2.0.1",
    "webpack": "^1.12.14",
    "webpack-dev-middleware": "^1.5.1",
    "webpack-stream": "^3.2.0",
    "xml2js": "^0.4.17",
    "xslt": "^0.7.0"
  },
  "engines": {
    "node": "^6.2.2",
    "npm": "^3.9.5"
  },
  "scripts": {
    "test": "gulp test",
    "flow": "flow",
    "update-webdriver": "node node_modules/protractor/bin/webdriver-manager update",
    "start": "NODE_ENV=production node dist/server"
  },
  "private": true
}
Awk34 commented 6 years ago

Looking at the protractor.conf.js for the generator version you listed (4.1.2), I don't see the lines you said you had to comment out: https://github.com/angular-fullstack/generator-angular-fullstack/blob/fdbb222717cade93a43f403dcb5f5abcb1e32c59/templates/app/protractor.conf.js