Class: Geordi::Cucumber
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
#announce, #fail, #note, #note_cmd, #prompt, #strip_heredoc, #success, #warn
Instance Method Details
#launch_vnc_viewer ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/geordi/cucumber.rb', line 32
def launch_vnc_viewer
fork do
error = capture_stderr do
system(VNC_VIEWER_COMMAND)
end
unless $CHILD_STATUS.success?
if $CHILD_STATUS.exitstatus == 127
raise 'VNC viewer not found. Install it with `geordi vnc --setup`.'
else
note 'VNC viewer could not be opened:'
puts error
puts
end
end
end
end
|
#restore_env ⇒ Object
49
50
51
52
53
|
# File 'lib/geordi/cucumber.rb', line 49
def restore_env
VNC_ENV_VARIABLES.each do |variable|
ENV[variable] = ENV["OUTER_#{variable}"]
end
end
|
#run(files, cucumber_options, options = {}) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/geordi/cucumber.rb', line 18
def run(files, cucumber_options, options = {})
self.argv = files + cucumber_options.map { |option| option.split('=') }.flatten
consolidate_rerun_txt_files
show_features_to_run
setup_vnc
command = use_parallel_tests?(options) ? parallel_execution_command : serial_execution_command
note_cmd(command) if options[:verbose]
puts system command end
|
#setup_vnc ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/geordi/cucumber.rb', line 55
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.expand_path('../../bin/launchy_browser', __dir__)
ENV['DISPLAY'] = VNC_DISPLAY
note 'Run `geordi vnc` to view the Selenium test browsers'
end
end
|