无头量角器测试未插入Xvfb [英] Headless protractor tests don't plug on Xvfb

查看:164
本文介绍了无头量角器测试未插入Xvfb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试在命令行和Jenkins中运行量角器测试.两者均因相同的错误而失败.



I'm trying to run Protractor tests both in command line and with Jenkins. Both fail with the same error.

  • 我打开了一个提示并启动了webdriver-manager start
  • 在另一个提示中,我启动了Xvfb :42 -ac -screen 0 1024x768x24 &
  • 在第三个中,我最终启动了protractor myconf.js
  • I opened a prompt and launched webdriver-manager start
  • In another prompt, I launched Xvfb :42 -ac -screen 0 1024x768x24 &
  • In a third one, I eventually launched protractor myconf.js
  • 在我的构建中,我选中了在构建之前启动Xvfb,然后在构建之后将其关闭".
  • 我在shell脚本中运行测试.

  • In my build, I checked "Start Xvfb before the build, and shut it down after.".
  • I run the tests in a shell script.

sh'sudo webdriver-manager clean'
sh'sudo webdriver-manager更新'
sh'xvfb-run webdriver-manager start --seleniumPort 9094&'
checkout([$ class:'GitSCM',分支:[[name:'*/master']],doGenerateSubmoduleConfigurations:false,扩展名:[[$ class:'RelativeTargetDirectory',relativeTargetDir:'tests']],submoduleCfg:[ ],userRemoteConfigs:[[credentialsId:'myprettycredentials',URL:'myprettyproject.git']]])
sh'sudo sudo chudo -R a + rwx测试'
sh'sudo killall Xvfb'
sh'export DISPLAY =:43'
sh'sudo Xvfb:43 -ac -screen 0 1024x768x24&'
wrap([$ class:'Xvfb']){
sh'sudo量角器测试/src/conf-demo.js-故障排除'
}

sh 'sudo webdriver-manager clean'
sh 'sudo webdriver-manager update'
sh 'xvfb-run webdriver-manager start --seleniumPort 9094 &'
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'tests']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'myprettycredentials', url: 'myprettyproject.git']]])
sh 'sudo sudo chmod -R a+rwx tests'
sh 'sudo killall Xvfb'
sh 'export DISPLAY=:43'
sh 'sudo Xvfb :43 -ac -screen 0 1024x768x24 &'
wrap([$class: 'Xvfb']) {
sh 'sudo protractor tests/src/conf-demo.js --troubleshoot'
}

在两种情况下,我都会收到此错误.

In both cases, I get this error.

Failed: unknown error: an X display is required for keycode conversions,
consider using Xvfb

为什么我的测试不能如此热心地插入我为它们而启动的Xvfb?感谢您的帮助.

Why won't my tests plug on the Xvfb I started for them so zealously? Thanks for your help.

推荐答案

好吧,我终于设法使用

xvfb-run -a webdriver-manager start --seleniumPort 9094 &
protractor myconf.js

-a选择任何自由显示的位置,而&使任务在后台运行.

Where -a chooses any free display, and & makes the task run in background.

这篇关于无头量角器测试未插入Xvfb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆