【发布时间】:2022-12-11 08:19:09
【问题描述】:
嗨:我想通过 npx 命令运行 Cucumber 功能,但我不能。
这是我使用的命令:npx playwright tests:chrome --grep @POC
这里的编剧配置文件:
const config = {
timeout: 3000,
actionTimeout: 1500,
//workers: 2, //for parallel testing
retries: 2,
testDir: 'features/**/*.feature',
use: {
headless: false, //true
viewport: { width: 1920, height: 1080 }, //1280x720
launchOptions: {
slowMo: 1000,
},
video:"off",
screenshot: 'only-on-failure',
},
projects: [
{
name: 'Chromium',
use: { browserName: 'chromium'},
},
{
name: 'Firefox',
use: { browserName: 'firefox'},
},
{
name: 'Webkit',
use: { browserName: 'webkit'},
},
],
};
module.exports = config;
这是我的包.json文件:
{
"name": "automation-testing",
"version": "1.0.0",
"description": "Testing Automation Framework with Playwright and CucumberJs.",
"main": "config.js",
"scripts": {
"tests:chrome": "playwright test --config=playwright.config.js --project=Chromium",
"tests:firefox": "playwright test --config=playwright.config.js --project=Firefox",
"tests:webkit": "playwright test --config=playwright.config.js --project=Webkit",
"tests:cucumber": "./node_modules/.bin/cucumber-js --require cucumber.js --require step-definitions/**/*.js --require features/**/*.js -f json:cucumber_report.json",
"report": "node reporter.js"
},
"author": "NN",
"license": "ISC",
"homepage": "https://bitbucket.org/maritzmotivation/rpp-automation-testing#readme",
"dependencies": {
"@cucumber/cucumber": "^8.8.0",
"@playwright/test": "^1.27.1",
"chai": "^4.3.7",
"cucumber-html-reporter": "^5.5.0",
"playwright": "^1.27.1",
"prettier": "^2.8.0"
},
"devDependencies": {
"playwright-expect": "^0.1.2"
}
}
当我彻底运行 Cucumber 时它可以工作 (npm run tests:cucumber -- --tags "@MyTag"),但是当我尝试使用 npx (npx playwright tests:chrome --grep @MyTag) 运行它时它显示错误:
error: unknown command 'tests:chrome'
有人可以帮我吗?
【问题讨论】:
标签: javascript playwright cucumberjs