我正在尝试使用带有量角器-黄瓜框架的grunt-protractor-runner创建grunt任务。下面是Gruntfile.js的样子:
grunt.initConfig({
protractor: {
options: {
configFile: "./config/config.js",
keepAlive: true,
noColor: false,
},
chrome: {
options: {
configFile: "./config/config.js",
args: {
// autoConnect: false,
// seleniumServerJar: './node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar',
// chromeDriver: './node_modules/webdriver-manager/selenium/chromedriver.exe',
specs: [
'../features/calendar.feature',
'../features/deal.feature',
'../features/entitlement.feature',
'../features/filter.feature',
'../features/product.feature'
],
capabilities: {
browserName: 'chrome',
chromeOptions: {
useAutomationExtension: false,
args: ['–disable-gpu'],
}
}
}
}
}
},
});
grunt.registerTask('test', ['protractor:chrome']);
如果我运行命令grunt test,它将打开chrome浏览器并关闭以下日志:
看起来像这样:正在运行“量角器:铬”(量角器)任务[17:22:57] I /启动器-运行1个WebDriver实例[17:22:57]我/托管-在http://localhost:4444/wd/hub使用硒服务器
0种情况0步0m00.000s
这不会选择要运行的任何方案。您能帮我了解这里的问题吗?我的config.conf
const Reporter = require('../support/Reporter.js');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
autoConnect: false,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
restartBrowserBetweenTests: false,
SELENIUM_PROMISE_MANAGER: true,
ignoreUncaughtExceptions: true,
onPrepare: function () {
browser.ignoreSynchronization = false;
browser.manage().timeouts().setScriptTimeout(40 * 1000);
browser.manage().timeouts().implicitlyWait(4 * 1000);
browser.manage().window().maximize();
require('babel-register');
},
cucumberOpts: {
strict: true,
format: ['json:./reports/json/cucumber_report.json'],
require: ['../support/*.js', '../stepDefinitions/*.js', '../stepDefinitions/*.ts'],
tags: 'not @Ignore', //(@CucumberScenario or @ProtractorScenario) and (not @Ignore)
retry: 3
},
params: {
env: 'test',
test: {
url: '',
users: {
BankerRO: '',
BankerRW: '',
BusinessRiskRW: '',
RiskRW: '',
RO: '',
},
db: {
server: '',
port: '',
name: '',
userId: '',
password: '',
}
}
},
onComplete: function () {
Reporter.moveReportToArchive();
Reporter.createHTMLReport();
}
};
我正在尝试通过我的量角器-黄瓜框架使用grunt-protractor-runner创建grunt任务。下面是Gruntfile.js的外观:grunt.initConfig({量角器:{...
我终于找到了根本原因,如果我将spec []保留在Gruntfile中,则grunt无法选择方案。当我从Gruntfile中删除规范并将其保留在配置中时,它开始正常工作。我不确定这是如何工作的,或者不确定grunt-protractor-runner