我正在使用量角器黃瓜, 首先,沒有黃瓜我成功地運行測試,但我很快通過NPM添加黃瓜支持,我得到的結果與未定義的測試,見下文:沒有結果從黃瓜量角器運行
1 scenario (1 undefined)
3 steps (3 undefined)
0m00.000s
[15:04:58] I/launcher - 0 instance(s) of WebDriver still running
[15:04:58] I/launcher - chrome #01 passed
Process finished with exit code 0
這意味着chromeDriver開始後幾秒鐘關閉, 我已經嘗試過了兩個項目,一個是混帳: https://github.com/eis95/CucumberProtractorExample
所以你可以看到我是如何定義的配置,也是packages.js文件, 包文件:
{
"name": "uiautomation-v2.0",
"version": "0.0.0",
"description": "UIAutomationV2.0",
"main": "app.js",
"author": {
"name": "Eyal.Cohen"
},
"devDependencies": {
"cucumber": "^2.3.1",
"protractor-cucumber-framework": "^3.1.2"
},
"dependencies": {
"@types/jasmine": "^2.5.53",
"protractor": "latest"
}
}
And the conf.js file:
exports.config = {
specs: ['features/**/*.feature'],
//seleniumServerJar:'./node_modules/protractor/selenium/selenium-server-standalone-2.52.0.jar',
//chromeDriver: './node_modules/protractor/selenium/chromedriver_2.21',
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
tags: [],
require: ['features/step_definitions/newGameSteps.js'], //'features/specSetup.js','features/**/step_definitions/**/*Steps.js'
format: 'pretty'
}
};
規格:
defineSupportCode(function({Given, When, Then}) {
Given(/^Navigate to studio url$/, function(callback) {
//callback(null, 'pending');
navigationSteps.navigateToStudio(data.server).then(function() {
loginPage.userName.isDisplyed();
})
callback();
});
When(/^Login with username and pass$/, function(callback) {
navigationSteps.loginToStudio(data.username, data.password).then(function() {
navigationSteps.navigateUrl(data.server + '/studio/#/sxp?isautomation=true').then(function() {
})
callback();
});
});
Then(/^Welcome page is displayed$/, function(callback) {
sxpSteps.sendSxp(testData.requestNewTaskSxp).then(function() {
navigationSteps.navigateToUrl(data.server + '/studio/#/schedule').then(callback)
});
callback();
});
});
根據您提供的信息的東西感謝您的幫助 感謝
你能提供完整的記錄和你的步實施?現在看起來它會在控制檯中輸出一個缺失的場景。如果你有一個步驟文件,這應該表示它找不到它/代碼不正確。最後一個問題,你爲什麼用量角器和CucumberJS這樣的舊版本?這可能會給瀏覽器和支持帶來問題。量角器已經在5.1.2和CucumberJS已經在1.3.3/2.3.1 – wswebcreation
我已經更新量角器和黃瓜,但package.js沒有更新它是正確的?我想念什麼? ,只需卸載使用NPM和安裝量角器:NPM安裝量角器....對不對? – user1937902
我加入了SEPC代碼 - 看到後 – user1937902