0
我試圖與量角器例子很簡單的黃瓜,但得到的特徵文件中的錯誤,這是我的代碼黃瓜量角器
protractor.conf.js文件
var prefix = 'src/test/javascript/'.replace(/[^/]+/g,'..');
exports.config = {
seleniumServerJar: prefix + 'node_modules/protractor/selenium/selenium-server-standalone-2.52.0.jar',
chromeDriver: prefix + 'node_modules/protractor/selenium/chromedriver',
allScriptsTimeout: 20000,
frameworkPath: require.resolve('protractor-cucumber-framework'),
directConnect: true,
baseUrl: 'http://localhost:8099/',
cucumberOpts: {
require: 'step_definitions/stepDefinitions.js',
format: 'summary'
},
specs: [
'features/*.feature'
]
};
特徵文件
Feature: Running Protractor and Cucumber
Scenario: Protractor and Cucumber Test
Given I go to home page
stepDefinition js文件
module.exports = function() {
this.Given(/^I go to home page$/, function(site, callback) {
browser.get(site)
.then(callback);
});
}
,但是當我去了$一飲而盡量角器來運行,我得到以下錯誤
[16:01:21] Using gulpfile ~/git/adap_gateway/gulpfile.js
[16:01:21] Starting 'protractor'...
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
[launcher] Error: /home/ali/git/adap_gateway/src/test/javascript/features
/attack.feature:1
(function (exports, require, module, __filename, __dirname) { Feature:
Running Protractor and Cucumber
^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at /home/ali/git/adap_gateway/node_modules/jasmine/lib/jasmine.js:71:5
[launcher] Process exited with error code 100
[16:01:21] gulp-notify: [JHipster Gulp Build] Error: protractor exited
with code 100
[16:01:22] Finished 'protractor' after 936 ms
[16:01:22] E2E Tests failed
任何人都可以請幫我解決這個錯誤?
此錯誤是可能的。如果使用的是最新的量角器5.1版本,您的節點版本應該是ATLEAST v 6.9.x –
節點版本是v6.10.2 和量角器版本是5.1.1版本 –
你已經解決這個問題,因爲你也有一個關於[發生問題報告](http://stackoverflow.com/questions/43697992/serentiy-report-with-protracor-and-cucumber),它假設你得到它的工作,或者是那些沒有關係? – wswebcreation