используя protractor-cucumber-framework для тестирования, он дает эту ошибку

Привет, друзья, я тестирую свое приложение angular 2 с помощью транспортира и огурца js, но это дает мне эту ошибку, я пробую несколько решений для этой проблемы, но никто не может решить мою проблему. Если вы знаете какие-либо решения, было бы здорово, спасибо.

[1] Необработанное отклонение TypeError: this.registerHandler не является функцией [1] в Object.registerHandlers (/home/ca1/WebstormProjects/DME/node_modules/protractor-cucumber-framework/lib/resultsCapturer.js:16:8) [ 1] в /home/ca1/WebstormProjects/DME/node_modules/protractor-cucumber-framework/lib/resultsCapturer.js:6:22 [1] в Object.defineSupportCode (/ home / ca1 / WebstormProjects / DME / node_modules / cucumber / src / support_code_library_builder / index.js: 20: 9) [1] в объекте. (/home/ca1/WebstormProjects/DME/node_modules/protractor-cucumber-framework/lib/resultsCapturer.js:5:12) [1] в Module._compile (module.js: 570: 32) [1] в Object. Module._extensions..js (module.js: 579: 10) [1] в Module.load (module.js: 487: 32) [1] в tryModuleLoad (module.js: 446: 12) [1] в Function .Module._load (module.js: 438: 3) [1] в Module.require (module.js: 497: 17) [1] в require (internal / module.js: 20: 19) [1] в / home / ca1 / WebstormProjects / DME / node_modules / cucumber / src / cli / index.js: 61: 42 [1] в Array.forEach (собственный) [1] в Cli.getSupportCodeLibrary (/ home / ca1 / WebstormProjects / DME / node_modules / cucumber / src / cli / index.js: 61: 22) [1] в Cli. (/home/ca1/WebstormProjects/DME/node_modules/cucumber/src/cli/index.js:76:37) [1] в следующем (родном) [1] [17:30:50] E / launcher - ОШИБКА: Программа запуска завершена, осталось 1 задача

вот мой package.json

{
  "name": "dpt-angular",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "e2e": "concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
    "lint": "tslint ./app/**/*.ts -t verbose",
    "lite": "lite-server",
    "pree2e": "webdriver-manager update",
    "test": "concurrently \"tsc -w\" \"karma start karma.conf.js\"",
    "test-once": "karma start karma.conf.js --single-run",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/common": "~2.4.0",
    "@angular/compiler": "~2.4.0",
    "@angular/core": "~2.4.0",
    "@angular/forms": "~2.4.0",
    "@angular/http": "~2.4.0",
    "@angular/platform-browser": "~2.4.0",
    "@angular/platform-browser-dynamic": "~2.4.0",
    "@angular/router": "~3.4.0",
    "@types/file-saver": "0.0.1",
    "angular-in-memory-web-api": "~0.2.4",
    "angular2-moment": "^1.1.0",
    "core-js": "^2.4.1",
    "mydatepicker": "^2.0.25",
    "ng2-completer": "^1.5.2",
    "ng2-file-upload": "^1.2.1",
    "ng2-pdf-viewer": "^1.1.0",
    "rxjs": "5.0.1",
    "systemjs": "0.19.40",
    "zone.js": "^0.7.4"
  },
  "devDependencies": {
    "@types/jasmine": "^2.5.36",
    "@types/node": "^6.0.46",
    "canonical-path": "0.0.2",
    "concurrently": "^3.1.0",
    "cucumber": "^3.0.0",
    "cucumber-tsflow": "^2.2.0",
    "http-server": "^0.9.0",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lite-server": "^2.2.2",
    "lodash": "^4.16.4",
    "protractor": "^4.0.14",
    "protractor-cucumber-framework": "^3.0.0",
    "rimraf": "^2.5.4",
    "ts-node": "^3.3.0",
    "tslint": "^3.15.1",
    "typescript": "~2.3.4",
    "webdriver-manager": "^12.0.6"
  },
  "repository": {}
}

и мой protractor.conf.json

var fs = require('fs');
var path = require('canonical-path');
var _ = require('lodash');


exports.config = {
  directConnect: true,

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'chrome'
  },

    allScriptsTimeout:90000,
    getPageTimeout:400000,
    ignoreUncaughtExceptions: true,
    framework: 'custom',

    frameworkPath: require.resolve('protractor-cucumber-framework'),

    // Spec patterns are relative to this config file
  specs: ['**/cucumber_test/*.feature' ],

    cucumberOpts: {
        compiler: "ts:ts-node/register",
        require: ['**/*e2e-spec.js'],  // require step definition files before executing features
        tags: '@TypeScriptScenario,@dev,@AddScenario,@SubtractScenario,@MultiplyScenario,@DivideScenario,@ModulusScenario',                      // <string[]> (expression) only execute the features or scenarios with tags matching the expression
        strict: true,                  // <boolean> fail if there are any undefined or pending steps
        format: ["pretty"],            // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
        dryRun: false,                 // <boolean> invoke formatters without executing steps
        'fail-fast': true
    },


  // For angular tests
  useAllAngular2AppRoots: true,

  // Base URL for application server
  baseUrl: 'http://localhost:3000',

  // doesn't seem to work.
  // resultJsonOutputFile: "foo.json",

  onPrepare: function() {
    //// SpecReporter
    //var SpecReporter = require('jasmine-spec-reporter');
    //jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'none'}));
    //// jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));

    // debugging
    // console.log('browser.params:' + JSON.stringify(browser.params));
    /*jasmine.getEnv().addReporter(new Reporter( browser.params )) ;*/

    // Allow changing bootstrap mode to NG1 for upgrade tests
    global.setProtractorToNg1Mode = function() {
      browser.useAllAngular2AppRoots = false;
      browser.rootEl = 'body';
    };
    //  browser.manage().window().maximize();
  },

  /*jasmineNodeOpts: {
    // defaultTimeoutInterval: 60000,
    defaultTimeoutInterval: 10000,
    showTiming: true,
    print: function() {}
  }*/
}

person Vikram Pawar    schedule 16.08.2017    source источник


Ответы (1)


Эта проблема будет решена просто понижением версии огурца 3 до 2.

person Vikram Pawar    schedule 23.08.2017