webdriver-io - 有没有办法只运行标签而不打开和关闭浏览器?
问题描述
我正在尝试使用 tagExpression 从各种不同的功能文件运行特定场景,但 webdriver 会为每个场景打开和关闭浏览器,直到找到我提供的标签。有没有办法在找到标签之前不打开浏览器?
// <string[]> (file/dir) require files before executing features
require: ['./features/step_definitions/*.js'],
// <boolean> show full backtrace for errors
backtrace: true,
// <string[]> ("extension:module")
// require files with the given EXTENSION after requiring MODULE (repeatable)
compiler: [],
dryRun: false, // <boolean> invoke formatters without executing steps
failFast: true, // <boolean> abort the run on first failure
// <string[]> (type[:path]) specify the output format,
// optionally supply PATH to redirect formatter output (repeatable)
format: ['pretty'],
colors: true,
snippets: true,
source: true,
profile: [],
strict: true,
tagExpression: '@testone',
timeout: 300000, ble this config to treat undefined definitions as warnings.
ignoreUndefinedDefinitions: false,
},```
解决方案
为每个功能文件(不适用于场景)创建 Selenium 会话(此时打开和关闭浏览器)。如果您有一些功能文件没有任何与您的标签匹配的场景,那么您可以避免使用以下两个选项之一打开它们:exclude
或suites
方法。
请遵循他们的文档。
例子:
//Not required features can be added here such that wdio ignores them
exclude: [
'./features/**/test.feature'
]
或者
//Define suites and pass as part of params
suites:{
bvt: [
'./features/BVT_Desktop.feature',
'./features/BVT_Mobile.feature',
]
}
推荐阅读
- java - 如何在没有persistence.xml文件的情况下禁用Wildfly 10 Hibernate Search模块是自动配置的Spring Boot应用程序?
- git - 使用 Lerna 通过 CI 自动发布 npm 包
- java - Spring Boot 安全性中的多种身份验证策略
- node.js - 发送后无法设置标头nodejs
- android - 使用最新的 React Native (AdMob) 构建失败
- django - 将数据库用于表单 django
- python - plotly,半极坐标图,将角轴设置为 -90° 到 90°
- php - Symfony 3 视图重载控制器继承
- plsql - 对变量 c sys refcursor 的无效引用
- php - 无法让当前语言出现在小部件中