Sha256: 944fcdc59102a0b91976f7c29705c78817d8749f42c255d747cfeccdb297ed51

Contents?: true

Size: 1.89 KB

Versions: 43

Compression:

Stored size: 1.89 KB

Contents

desc '-setup-vnc', 'Setup VNC for running Selenium tests there', :hide => true
def _setup_vnc
  `clear`

  note 'This script will help you install a VNC server and a VNC viewer.'
  puts
  puts strip_heredoc <<-TEXT
    With those you will be able to use our cucumber script without being
    disturbed by focus-stealing Selenium windows. Instead, they will open
    inside a VNC session.

    You can still inspect everything with:
  TEXT
  note_cmd 'geordi vnc'
  puts
  note 'Please open a second shell to execute instructions.'
  prompt 'Continue ...'

  announce 'Setup VNC server'

  vnc_server_installed = system('which vncserver > /dev/null 2>&1')
  if vnc_server_installed
    success 'It appears you already have a VNC server installed. Good job!'
  else
    puts 'Please run:'
    note_cmd 'sudo apt-get install vnc4server'
    prompt 'Continue ...'

    puts
    note 'We will now set a password for your VNC server.'
    puts strip_heredoc <<-TEXT
      When running our cucumber script, you will not actually need this
      password, and there is no security risk. However, if you start a vncserver
      without our cucumber script, a user with your password can connect to
      your machine.

    TEXT
    puts 'Please run:'
    note_cmd 'vncserver :20'
    warn 'Enter a secure password!'
    prompt 'Continue ...'

    puts 'Now stop the server again. Please run:'
    note_cmd 'vncserver -kill :20'
    prompt 'Continue ...'
  end

  announce 'Setup VNC viewer'

  vnc_viewer_installed = system('which vncviewer > /dev/null 2>&1')
  if vnc_viewer_installed
    success 'It appears you already have a VNC viewer installed. Good job!'
  else
    puts 'Please run:'
    note_cmd 'sudo apt-get install xtightvncviewer'
    prompt 'Continue ...'
  end

  puts
  puts strip_heredoc <<-TEXT
    All done. Our cucumber script will now automatically run Selenium features
    in VNC.
  TEXT

  success 'Happy cuking!'
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
geordi-1.2.2 lib/geordi/commands/_setup_vnc.rb
geordi-1.2.1 lib/geordi/commands/_setup_vnc.rb
geordi-1.2.0 lib/geordi/commands/_setup_vnc.rb