summaryrefslogtreecommitdiffstats
path: root/features/step_definitions/totem.rb
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2014-10-03 16:45:40 +0000
committerTails developers <amnesia@boum.org>2014-10-03 16:47:26 +0000
commit9039294b5b5bf93c69ee88793476fb0c04926202 (patch)
tree80e479fda31b65f0abd6ff821bb049f9225f3ef9 /features/step_definitions/totem.rb
parente6c0064c71c3f7432ea63a91208b7a65dbef3fc0 (diff)
Add initial tests for Totem, and its AppArmor profile.
We now need to encode video when running the test suite, so promoted the corresponding (existing and new) needed packages to hard dependencies. Also, have Git ignore the file generated at this stage.
Diffstat (limited to 'features/step_definitions/totem.rb')
-rw-r--r--features/step_definitions/totem.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/features/step_definitions/totem.rb b/features/step_definitions/totem.rb
new file mode 100644
index 0000000..c89e1b4
--- /dev/null
+++ b/features/step_definitions/totem.rb
@@ -0,0 +1,31 @@
+def shared_video_dir_on_guest
+ "/tmp/shared_video_dir"
+end
+
+Given /^I create a sample MP4 video$/ do
+ next if @skip_steps_while_restoring_background
+ fatal_system("ffmpeg -loop 1 -t 30 -f image2 " +
+ "-i 'features/images/TailsBootSplash.png' " +
+ "-an -vcodec libx264 -y " +
+ "'#{$misc_files_dir}/video.mp4' >/dev/null 2>&1")
+end
+
+Given /^I setup a filesystem share containing sample videos$/ do
+ next if @skip_steps_while_restoring_background
+ @vm.add_share($misc_files_dir, shared_video_dir_on_guest)
+end
+
+Given /^I copy the sample videos to "([^"]+)" as user "([^"]+)"$/ do |destination, user|
+ next if @skip_steps_while_restoring_background
+ for video_on_host in Dir.glob("#{$misc_files_dir}/*.mp4") do
+ video_name = File.basename(video_on_host)
+ video_on_guest = "/home/#{$live_user}/#{video_name}"
+ step "I copy \"#{shared_video_dir_on_guest}/#{video_name}\" to \"#{video_on_guest}\" as user \"amnesia\""
+ end
+end
+
+When /^I(?:| try to) open "([^"]+)" with Totem$/ do |filename|
+ next if @skip_steps_while_restoring_background
+ puts @vm.execute("ls -l /home/amnesia").stdout
+ step "I run \"totem #{filename}\" in GNOME Terminal"
+end