When wkhtmltopdf is using Headless, and cucumber is invoking a block of code which uses a headless session, make sure to override the default display of cucumber to retain browser focus. Note: this is true for other programs which may use headless at the same time as cucumber is running There's also a different approach that creates a new virtual display for every parallel test process - see this implementation by Cucumber with wkhtmltopdf destroy # kill_headless_without_waiting.rb new ( display: 100, reuse: true ) headless. new ( display: 100, reuse: true, destroy_at_exit: false ). start # test_suite_that_could_be_ran_multiple_times.rb new ( display: 100, destroy_at_exit: false ). You can even spawn a Headless instance in one ruby script, and then reuse the same instance in other scripts by specifying the same display number and reuse: true. If you have multiple threads running acceptance tests in parallel, you want to spawn Headless before forking, and then reuse that instance with destroy_at_exit: false. current_driver = :selenium require ' headless ' headless = Headless. Running cucumber headless is now as simple as adding a before and after hook in features/support/env.rb: # change the condition to fit your setup Object mode: require ' rubygems ' require ' headless ' require ' selenium-webdriver ' headless = Headless. On Debian/Ubuntu: sudo apt-get install xvfbīlock mode: require ' rubygems ' require ' headless ' require ' selenium-webdriver ' Headless. Here is a detailed explanation Installation Note: Headless will NOT hide most applications on OS X. Other possible uses include pdf generation with wkhtmltopdf, or screenshotting.ĭocumentation is available at Even more, you can go headless only when you run tests against Selenium. I created it so I can run Selenium tests in Cucumber without any shell scripting. For example, you can record screenshots and screencasts of your failing integration specs. It can also capture images and video from the virtual framebuffer. It allows you to create a headless display straight from Ruby code, hiding the low-level action.
0 Comments
Leave a Reply. |