在Jenkins管道中的xfvb包装内设置屏幕分辨率

时间:2017-04-18 20:00:29

标签: jenkins groovy jenkins-plugins xvfb jenkins-2

在Jenkins 2.0管道中,我使用的代码类似于

wrap([$class: 'Xvfb']) {
  // execute selenium tests
}

正如所料,此xvfb会话使用默认屏幕分辨率(1024x768x8?)。我想覆盖它。

根据https://github.com/jenkinsci/xvfb-plugin的文档,Xvfb插件有一个控制分辨率的Screen成员。这样做的语法是什么?我试过了

wrap([$class: 'Xvfb'](Screen:'1440x900x24')) {
  // execute selenium tests
}

wrap([$class: 'Xvfb'][Screen:'1440x900x24']) {
  // execute selenium tests
}

wrap([$class: 'Xvfb']) {
  Screen = '1440x900x24'
  // execute selenium tests
}

1 个答案:

答案 0 :(得分:3)

我相信配置会进入相同的地图,所以

wrap([$class: 'Xvfb', screen: '1440x900x24']) {
  // execute selenium tests
}

应该有效。你不应该使用方括号