【发布时间】:2021-01-27 03:09:59
【问题描述】:
我正在使用这个框架https://github.com/labs42io/web-automation,我想在本地运行我的测试。为此,我在 config 文件夹下创建了一个 wdio.local.conf.js 并将以下值分配给 test:local 到 package json。 "test:local": "node ./node_modules/@wdio/cli/bin/wdio.js ./config/wdio.local.conf.js --spec"。
下面是我的 JSON 包
下面是我的 wdio.local.conf.js
//import { ENGINE_METHOD_DIGESTS } from "constants";
//const { TimelineService } = require('wdio-timeline-reporter/timeline-service');
exports.config = {
runner: 'local',
hostname: 'localhost',
port: 4444,
path: '/wd/hub',
specs: ['./src/UI/features/*.feature'],
maxInstances: 1,
capabilities: [
{
maxInstances: 1,
browserName: 'chrome',
},
// {
// maxInstances: 1,
// browserName: 'firefox',
// }
//{
//maxInstances: 1,
//browserName: 'MicrosoftEdge',
// },//
//{
//maxInstances: 1,
//browserName: 'safari',
//},//
],
logLevel: 'trace',
outputDir: './test-report/output',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'cucumber',
reporters: ['spec', [
'cucumberjs-json', {
jsonFolder: './report/cucumber/',
}],
],
cucumberOpts: {
requireModule: [
() => {
require('ts-node').register({ transpileOnly: true });
},
],
require: ['./src/UI/steps/*.ts'],
backtrace: false,
compiler: [],
dryRun: false,
failFast: true,
format: ['pretty'],
colors: true,
snippets: true,
source: true,
profile: [],
strict: false,
tags: [],
timeout: 300000,
ignoreUndefinedDefinitions: false,
tagExpression: 'not @skip',
},
services: ['chromedriver'],
//services:['selenium-standalone'],
beforeSession() {
require('expect-webdriverio').setOptions({ wait: 5000 });
},
before() {
browser.maximizeWindow();
},
//afterStep(
//uri: undefined,
//feature: undefined,
// scenario: { error: boolean },
//) {
//if (scenario.error) {
// browser.takeScreenshot();
//}
//},//
};
但我无法运行如下所示的测试:
【问题讨论】:
-
如果你想使用
wdio-chromedriver-service,不需要安装selenium-standalone,你也可以删除wdio包,只要它不是WebdriverIO的一部分。如果您想使用 WebdriverIO v6,我建议您摆脱chai并使用内置的期望 webdriver.io/docs/api/expect-webdriverio.html 更好。另见gitlab.com/bar_foo/wdio-cucumber-typescript
标签: typescript docker testing selenium-chromedriver webdriver-io