Bonjour les amis je teste mon application angulaire 2 en utilisant protractor et concombre js mais il me donne cette erreur j'essaie plusieurs solution pour ce problème, mais personne ne peut résoudre mon problème.if vous connaissez un sol, il serait grand merci u ..en utilisant protractor-concombre-cadre pour le tester donne cette erreur
[1] rejet Unhandled TypeError: this.registerHandler est pas une fonction [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] à l'objet. (/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] at Array.forEach (natif) [1] à Cli.getSupportCodeLibrary (/home/ca1/WebstormProjects/DME/node_modules/cucumber/src/cli/index.js:61:22) [1] chez Cli. (/home/ca1/WebstormProjects/DME/node_modules/cucumber/src/cli/index.js:76:37) [1] at next (natif) [1] [17:30:50] E/lanceur - BOGUE: lanceur 1 terminé avec les tâches restant
voici mon 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": {}
}
et mon 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() {}
}*/
}