Class: Geordi::Cucumber
- Inherits:
-
Object
- Object
- Geordi::Cucumber
- Defined in:
- lib/geordi/cucumber.rb
Constant Summary collapse
- VNC_DISPLAY =
':17'.freeze
- VNC_SERVER_COMMAND =
"vncserver #{VNC_DISPLAY} -localhost -nolisten tcp -SecurityTypes None -geometry 1280x1024".freeze
- VNC_VIEWER_COMMAND =
"vncviewer #{VNC_DISPLAY}".freeze
- VNC_ENV_VARIABLES =
%w[DISPLAY BROWSER LAUNCHY_BROWSER].freeze
Instance Method Summary collapse
- #launch_vnc_viewer ⇒ Object
- #restore_env ⇒ Object
- #run(files, cucumber_options, options = {}) ⇒ Object
- #setup_vnc ⇒ Object
Instance Method Details
#launch_vnc_viewer ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/geordi/cucumber.rb', line 31 def launch_vnc_viewer fork do error = capture_stderr do system(VNC_VIEWER_COMMAND) end unless $?.success? if $?.exitstatus == 127 Interaction.fail 'VNC viewer not found. Install it with `geordi vnc --setup`.' else Interaction.note 'VNC viewer could not be opened:' puts error puts end end end end |
#restore_env ⇒ Object
48 49 50 51 52 |
# File 'lib/geordi/cucumber.rb', line 48 def restore_env VNC_ENV_VARIABLES.each do |variable| ENV[variable] = ENV["OUTER_#{variable}"] end end |
#run(files, cucumber_options, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/geordi/cucumber.rb', line 17 def run(files, , = {}) self.argv = files + .map { |option| option.split('=') }.flatten consolidate_rerun_txt_files show_features_to_run setup_vnc command = use_parallel_tests?() ? parallel_execution_command : serial_execution_command Interaction.note_cmd(command) if [:verbose] puts # Make newline system command # Util.system! would reset the Firefox PATH end |
#setup_vnc ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/geordi/cucumber.rb', line 54 def setup_vnc if try_and_start_vnc VNC_ENV_VARIABLES.each do |variable| ENV["OUTER_#{variable}"] = ENV[variable] if ENV[variable] end ENV['BROWSER'] = ENV['LAUNCHY_BROWSER'] = File.('../../bin/launchy_browser', __dir__) ENV['DISPLAY'] = VNC_DISPLAY Interaction.note 'Run `geordi vnc` to view the Selenium test browsers' end end |