protractor - 量角器 - Cucumber 配置查询
问题描述
我的查询是当我们说例如 config.js 时将如何调用..“npm run test”这将根据 config.js 中定义的配置运行测试
例如我的 package.json 包含
"scripts" : {
"test" : "Env=ST CukeTags=regression testrunner -s functional"
}
我遇到的另一个问题是,我在哪里可以找到有关这些配置文件、挂钩文件如何相互关联的详细信息?在量角器测试运行期间如何调用这些?
解决方案
您应该在 package.json 中设置测试脚本
该测试脚本将告诉命令运行量角器并给出配置文件的路径。
"scripts":{"test": "protractor typeScript/config/config.js"}
在这里,测试命令将使用 typescript/config 文件夹中的配置文件运行量角器。
量角器和黄瓜的示例配置文件
import * as path from "path";
import { browser, Config } from "protractor";
import { Reporter } from "../support/reporter";
const jsonReports = process.cwd() + "/reports/json";
export const config: Config = {
seleniumAddress: "http://127.0.0.1:4444/wd/hub",
SELENIUM_PROMISE_MANAGER: false,
baseUrl: "https://www.google.com",
capabilities: {
browserName: "chrome",
},
framework: "custom",
frameworkPath: require.resolve("protractor-cucumber-framework"),
specs: [
"../../features/*.feature",
],
onPrepare: () => {
browser.ignoreSynchronization = true;
browser.manage().window().maximize();
Reporter.createDirectory(jsonReports);
},
cucumberOpts: {
compiler: "ts:ts-node/register",
format: "json:./reports/json/cucumber_report.json",
require: ["../../typeScript/stepdefinitions/*.js", "../../typeScript/support/*.js"],
strict: true,
tags: "@CucumberScenario or @ProtractorScenario or @TypeScriptScenario or @OutlineScenario",
},
onComplete: () => {
Reporter.createHTMLReport();
},
};
推荐阅读
- reactjs - npm install 库的路径略有不同是什么意思?
- python - send_Keys 因 Chromedriver 无头而失败
- lua - 如何处理多个块的冲突,就好像它们是一个实体一样?
- json - 用 react native 解析 JSON,循环遍历
- c++ - 删除以前打印的字符
- php - 如何使用 array_search 在对象数组中搜索对象?
- jquery - 如何使用锚标记进行所需的字段文件上传验证?
- html - 在 HTML 和 CSS 中,图像左侧、文本和标题向右对齐顶部
- node.js - 尝试在 Graphql-Yoga 服务器中使用 Google Oauth2 和 Passportjs
- android - 重复类 android.support.v4。在模块 classes.jar (com.android.support:support-compat:28.0.0) 中找到