我正在学习使用serenity js库的Cucumber BDD,以便在Angular网站上进行报告。我使用Type脚本作为编程语言。
我能够为不同的功能文件场景生成黄瓜报告。但是当我试图将宁静库包含在报告增强中时,我面临着以下问题。 -
问题是:
PS R:\protractor\protractor-cucumber-typescript> tsc
PS R:\protractor\protractor-cucumber-typescript> npm test
> protractor-typescript-cucumber@3.0.0 pretest R:\protractor\protractor-cucumber-typescript
> serenity update
info: Serenity BDD CLI jar file is up to date :-)
> protractor-typescript-cucumber@3.0.0 test R:\protractor\protractor-cucumber-typescript
> protractor typeScript/config/config.js
[15:29:46] I/launcher - Running 1 instances of WebDriver
[15:29:46] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[15:29:54] E/launcher - Error: TypeError: Path must be a string. Received true
at assertPath (path.js:7:11)
at Object.basename (path.js:801:5)
at R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli\configuration.js:11:27
at Array.forEach (native)
at Function.Configuration (R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli\configuration.js:10:10)
at getConfiguration (R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli.js:63:38)
at Object.run (R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli.js:69:27)
at R:\protractor\protractor-cucumber-typescript\node_modules\serenity-js\src\serenity-cucumber\cucumber_test_framework.ts:24:51
at CucumberTestFramework.run (R:\protractor\protractor-cucumber-typescript\node_modules\serenity-js\src\serenity-cucumber\cucumber_test_framework.ts
:21:16)
at R:\protractor\protractor-cucumber-typescript\node_modules\serenity-js\src\serenity-protractor\framework\serenity_protractor_framework.ts:52:35
[15:29:54] E/launcher - Process exited with error code 100
npm ERR! Test failed. See above for more details.
它没有给出任何文件的痕迹。它向我展示了一个不同的文件。
文件如下所示 -
Conf.ts文件如下所示:
import * as path from "path";
import { browser, Config } from "protractor";
const crew = require('serenity-js/lib/stage_crew');
export const config: Config = {
seleniumAddress: "http://127.0.0.1:4444/wd/hub",
SELENIUM_PROMISE_MANAGER: false,
// baseUrl: "http://www.google.com",
baseUrl2: "https://angularjs.org/",
framework: "custom",
frameworkPath: require.resolve('serenity-js'),
specs: [
"../../features/*Home.feature",
],
cucumberOpts: {
// require: ["../../stepdefinitions/*.ts","../../support/stepdefinitions/*.js"],
require: ["stepdefinitions/*/**.ts","support/stepdefinitions/*/**.js"],
// strict: true,
format: "pretty",
compiler: "ts:ts-node/register",
},
serenity: {
dialect: 'cucumber',
crew: [
crew.serenityBDDReporter(),
crew.photographer(),
crew.consoleReporter()
]
},
capabilities: {
browserName: "chrome",
},
onPrepare: () => {
browser.ignoreSynchronization = true;
browser.manage().window().maximize();
browser.get("https://angularjs.org/");
},
};
我的package.json文件如下所示:
{
"name": "protractor-typescript-cucumber",
"keywords": [
"protractor",
"cucumber",
"typescript",
"angular",
"angularjs",
"testing",
"behaviour driven development",
"bdd",
"selenium",
"webdriverJS",
"gherkin",
"automation testing"
],
"main": "index.js",
"scripts": {
"build": "tsc",
"clean": "rimraf typeScript/",
"clean-build": "npm run clean && npm run build",
"test": "protractor typeScript/config/config.js",
"webdriver-update": "webdriver-manager update",
"webdriver-start": "webdriver-manager start",
"pretest": "serenity update",
"report": "serenity run"
},
"devDependencies": {
"@types/cucumber": "^2.0.4",
"@types/node": "^8.0.3",
"@types/selenium-webdriver": "^3.0.7",
"chai": "^4.0.2",
"chai-as-promised": "^7.0.0",
"chai-smoothie": "^0.3.2",
"cucumber": "1.3.2",
"cucumber-html-reporter": "^3.0.4",
"mkdirp": "^0.5.1",
"protractor": "^5.1.2",
"protractor-cucumber": "^0.1.8",
"protractor-cucumber-framework": "^4.0.8",
"rimraf": "^2.6.2",
"serenity-cli": "^0.2.4",
"serenity-js": "^1.4.1",
"standard-loader": "^6.0.1",
"ts-node": "^3.3.0",
"typescript": "^2.5.3"
},
"dependencies": {
"@types/chai": "^4.0.4"
}
}
请更新我,我出错的地方