我的查询是当我们说例如config.js时如何调用。“ npm run test”这将按照config.js中定义的配置运行测试
示例我的package.json包含
"scripts" : {
"test" : "Env=ST CukeTags=regression testrunner -s functional"
}
我遇到的另一个查询是,在哪里可以找到有关这些配置文件,钩子文件如何相互关联的详细信息?在量角器测试运行期间如何调用它们?
答案 0 :(得分:0)
您应该在package.json中设置测试脚本
该测试脚本将告诉命令运行量角器并给出配置文件的路径。
"scripts":{"test": "protractor typeScript/config/config.js"}
在这里,test命令将使用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();
},
};