我正在使用量角器 - 黄瓜框架,无法运行我的测试。浏览器启动,但不会浏览到我的网址,然后我收到以下错误:量角器黄瓜测试不运行
$ protractor conf.js
(node:10648) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[11:25:05] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[11:25:05] I/launcher - Running 1 instances of WebDriver
[11:25:09] E/launcher - Error: TypeError: Cannot call a class as a function
at exports.default (C:\Source\test\node_modules\babel-runtime\helpers\classCallCheck.js:7:11)
at Object.Cli (C:\Source\test\node_modules\cucumber\lib\cli\index.js:64:34)
at C:\Source\test\node_modules\protractor-cucumber-framework\index.js:31:16
at Function.promise (C:\Source\test\node_modules\q\q.js:682:9)
at C:\Source\test\node_modules\protractor-cucumber-framework\index.js:24:14
at _fulfilled (\\hermes\vhd_profiles\VDI_Home_VHD1\modisej\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (\\hermes\vhd_profiles\VDI_Home_VHD1\modisej\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (\\hermes\vhd_profiles\VDI_Home_VHD1\modisej\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
at \\hermes\vhd_profiles\VDI_Home_VHD1\modisej\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49
at runSingle (\\hermes\vhd_profiles\VDI_Home_VHD1\modisej\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:137:13)
at flush (\\hermes\vhd_profiles\VDI_Home_VHD1\modisej\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
[11:25:09] E/launcher - Process exited with error code 100
Conf.js
exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
//// getPageTimeout: 60000,
////allScriptsTimeout: 500000,
framework: 'custom',
// path relative to the current config file
frameworkPath: require.resolve('protractor-cucumber-framework'),
capabilities: {
'browserName': 'chrome'
},
// Spec patterns are relative to this directory.
specs: ['Features/*.feature'],
baseURL: 'http://localhost:/8080',
cucumberOpts: {
require: 'Features/step_definitions/homePage.js',
tags: false,
format: undefined,
profile: false,
'no-source': true
}
};
特性文件:
#features/test.feature
Feature: App hub home page
Scenario: First sample
Given I go to the app hub site
When the homepage has loaded
Then I expect to see title app hub
步骤定义:
目前,我只把步骤定义为声明“鉴于我去应用中心站点”
的step_definitions是在“功能”文件夹中保存在一个名为“step_definitions”文件夹中,我在我的conf.js文件中提到过。
module.exports = function() {
this.Given('I go to the app hub site', function (callback) {
browser.get('http://localhost:8080')
.then (callback);
});
};
任何帮助将不胜感激。
下面是Protractor Cookbook示例的'package.json'链接,其中包含typescript和cucumber:https://github.com/angular/protractor-cookbook/blob/master/protractor-typescript-cucumber/package以.json。 – cnishina
上述错误是由于量角器黄瓜框架还不支持的黄瓜2.0! –