Giter Club home page Giter Club logo

Comments (2)

leonid-shevtsov avatar leonid-shevtsov commented on May 24, 2024

So you're saying that it's not necessary to check if the PID file is accessible, we only need the X11 socket? But then you only need to set ENV['DISPLAY'] for X apps to work, possibly even outside of the Ruby code. Why use headless?

from headless.

p0deje avatar p0deje commented on May 24, 2024

The way that we use headless is pretty interesting. We have set it up for Cucumber + WebDriver and its logic is the following:

  1. On Mac, ignore Xvfb and start up browser normally.
  2. On Linux desktops, start browser in Xvfb so its window doesn't bother during development.
  3. On Linux without X11 (Vagrant), start browser using /etc/init.d/xvfb running service rather than "headless" gem and allow to view the tests via x11vnc (which requires Xvfb to be running before itself). This applies to tests running in 1 process.
  4. On Linux without X11, when tests are being run in parallel processes, start new Xvfb instance for each process using "headless" gem.

Point 3 doesn't work for us, since headless cannot connect to run by root Xvfb instance.

The code we use to achieve this:

require 'headless'
displays = ENV['TEST_ENV_NUMBER'].to_i..ENV['TEST_ENV_NUMBER'].to_i + 100
def displays.to_i
  self
end

begin
  Headless.new(
    display: displays,
    reuse: true,
    destroy_at_exit: false
  ).start
rescue Headless::Exception
  puts 'Xvfb not found on your system, keeping calm'
end

from headless.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.