I'm trying to run Protractor tests both in command line and with Jenkins. Both fail with the same error.
Command line
- 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
Jenkins
- 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 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
Why won't my tests plug on the Xvfb I started for them so zealously? Thanks for your help.