summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/support/headless.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/acceptance/features/support/headless.rb')
-rw-r--r--tests/acceptance/features/support/headless.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/acceptance/features/support/headless.rb b/tests/acceptance/features/support/headless.rb
new file mode 100644
index 000000000..a2095205f
--- /dev/null
+++ b/tests/acceptance/features/support/headless.rb
@@ -0,0 +1,34 @@
+# only run when export HEADLESS=true
+if ENV['HEADLESS'] == 'true'
+
+ require 'headless'
+
+ headless = Headless.new
+ headless.start
+
+ at_exit do
+ headless.destroy
+ end
+
+ Before do
+ #headless.video.start_capture
+ end
+
+ After do |scenario|
+ # for demo purpose: always record ;-)
+ #video= video_path(scenario)
+ #puts "Writing video to #{File.expand_path(video)}"
+ #headless.video.stop_and_save(video)
+
+ # if scenario.failed?
+ # headless.video.stop_and_save(video_path(scenario))
+ # else
+ # headless.video.stop_and_discard
+ # end
+ end
+
+ def video_path(scenario)
+ "#{scenario.name.split.join("_")}.mov"
+ end
+
+end \ No newline at end of file