【发布时间】:2018-07-18 08:33:11
【问题描述】:
所以我有以下场景。
我们有一个基于this 框架的Protractor-Cucumber 框架。
该框架已被修改为配置文件是用 TS 编写的。这是一个示例配置:
import { browser, Config } from 'protractor';
import { Reporter } from '../support/reporter';
const jsonReports = process.cwd() + '/reports/json';
export const config: Config = {
directConnect: true,
SELENIUM_PROMISE_MANAGER: false,
stackTrace: true,
capabilities: {
browserName: 'chrome'
},
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs: [
'../../features/*.feature',
'../../features/**/*.feature',
],
onPrepare: () => {
browser.manage().window().maximize();
Reporter.createDirectory(jsonReports);
},
cucumberOpts: {
compiler: 'ts:ts-node/register',
format: 'json:./reports/json/cucumber_report.json',
require: [
'../../stepdefinitions/*.ts',
'../../stepdefinitions/**/*.ts',
'../../support/*.ts'
],
strict: true,
tags: '(@e2e) and (not @ignore) and (not @notImplemented)',
keepAlive: false,
},
allScriptsTimeout: 10000,
getPageTimeout: 5000,
onComplete: () => {
return Reporter.generateReports();
},
afterLaunch: exitCode => {
if (exitCode === 1) {
console.log('Actual Exit code: ' + exitCode);
process.exit(0);
}
}
};
回顾一下这个实现的框架,现在他们已经实现了 protractor-flake,这是我需要包含的东西。
我已经尝试使用正在使用的实际配置,并且可以看到 here 但是当我尝试运行它时,我收到以下错误:
E/configParser - Error code: 105
[09:14:04] E/configParser - Error message: failed loading configuration file ./build/config/conf.debug.js
[09:14:04] E/configParser - Error: Cannot find module 'C:\Users\Protractor\build\config\conf.debug.js'
请注意,我已更改量角器参数以加载上面显示的配置,因此显示无法加载 config.debug.js。
我还浏览了 Nick Tomlin 的 protractor flake 和 cucumber 特定文档的存储库,并在 After support 代码中添加了必要的 console.log 并测试了从 cli 运行的 protractor flake,但似乎没有任何效果。我收到上面的错误,然后是:
使用黄瓜解析输出 测试失败,但未找到规范。
将再次运行所有规范。重新运行测试:测试尝试 2
但是没有运行测试。即根本不跑。
当我使用 npm 运行常规配置时,一切运行良好,无需重新运行量角器薄片。
谁能在这个问题上提供他们的 2 美分,我错过了什么?
我已经搜索了相当多的内容以找到一个打字稿示例,但目前还没有,除非我错过了。
对不起,我知道它很长,但想尝试涵盖我尝试过的所有内容。
提前致谢。
【问题讨论】:
-
能否提供测试启动命令及其参数?
-
当然。 npm run build && protractor-flake --parser cucumber --max-attempts=3 ./build/config/config.debug.js
标签: typescript protractor cucumberjs