我正在尝试通过 grunt 运行 cucumberjs 测试以获取浏览器堆栈功能矩阵。
矩阵通常配置为“grunt”(qcuberbatch 是本地 grunt 任务定义):
grunt.initConfig
qcumberbatch:
options:
steps: 'src/features/integration/steps'
tags: '~@ShouldFail'
browserstack:
'browserstack.user' : process.env.BS_USER
'browserstack.key' : process.env.BS_ACCESS_KEY
'browserstack.tunnel' : 'true' # This was the secret!
matrix: [
browser: 'firefox'
browser_version: '26.0'
os: 'Windows'
os_version : '7',
,
browser : 'IE',
browser_version : '9.0',
os : 'Windows',
os_version : '7',
resolution : '1024x768'
]
hub: "http://hub.browserstack.com/wd/hub"
local:
files:
src: ['src/features/integration/*']
options:
hub: 'http://localhost:4444/wd/hub'
matrix: ['firefox']
browserstack:
files:
src: ['src/features/integration/*']
failing:
files:
src: ['src/features/integration/*']
options:
tags: '@ShouldFail'
默认选项是在 Windows 7 上使用 firefox 和 IE 对 browserstack 运行,本地测试覆盖 browserstack 以使用本地 selenium webdriver hub。
黄瓜世界由一个构造函数设置,该构造函数采用功能对象:
module.exports = class World
###
Create a new world, assuming firefox capabilities.
@param {string} browser property name from the `webdriver.Capabilities`
list.
###
constructor: (capabilities = {browserName: "firefox"})->
@driver = new webdriver.Builder().
usingServer(process.env.SELENIUM_HUB).
withCapabilities(capabilities).build()
@driver.manage().timeouts().setScriptTimeout(10000)
当从 grunt 运行它时,问题是 cucumberjs 没有编程接口(我看到了)。如果无法配置在运行时加载几个功能块中的哪一个,我应该怎么做才能在 cucumberjs 运行和 grunt 之间传达功能?