From da080c472fc415b0ce918f4dd4a1ab143bb1bca4 Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Mon, 14 Mar 2016 15:36:16 +0100 Subject: rough attempt to grab the good cucumber bits from recent tails --- features/step_definitions/totem.rb | 49 ++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 28 deletions(-) (limited to 'features/step_definitions/totem.rb') diff --git a/features/step_definitions/totem.rb b/features/step_definitions/totem.rb index d125f4ec..72698dde 100644 --- a/features/step_definitions/totem.rb +++ b/features/step_definitions/totem.rb @@ -1,50 +1,43 @@ -def shared_video_dir_on_guest - "/tmp/shared_video_dir" -end - Given /^I create sample videos$/ do - next if @skip_steps_while_restoring_background - fatal_system("ffmpeg -loop 1 -t 30 -f image2 " + + @shared_video_dir_on_host = "#{$config["TMPDIR"]}/shared_video_dir" + @shared_video_dir_on_guest = "/tmp/shared_video_dir" + FileUtils.mkdir_p(@shared_video_dir_on_host) + add_after_scenario_hook { FileUtils.rm_r(@shared_video_dir_on_host) } + fatal_system("avconv -loop 1 -t 30 -f image2 " + "-i 'features/images/TailsBootSplash.png' " + "-an -vcodec libx264 -y " + - "'#{$misc_files_dir}/video.mp4' >/dev/null 2>&1") + '-filter:v "crop=in_w-mod(in_w\,2):in_h-mod(in_h\,2)" ' + + "'#{@shared_video_dir_on_host}/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) + $vm.add_share(@shared_video_dir_on_host, @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 + for video_on_host in Dir.glob("#{@shared_video_dir_on_host}/*.mp4") do video_name = File.basename(video_on_host) - src_on_guest = "#{shared_video_dir_on_guest}/#{video_name}" + src_on_guest = "#{@shared_video_dir_on_guest}/#{video_name}" dst_on_guest = "#{destination}/#{video_name}" step "I copy \"#{src_on_guest}\" to \"#{dst_on_guest}\" as user \"amnesia\"" end end -When /^I start Totem through the GNOME menu$/ do - next if @skip_steps_while_restoring_background - @screen.wait_and_click("GnomeApplicationsMenu.png", 10) - @screen.wait_and_click("GnomeApplicationsSoundVideo.png", 10) - @screen.wait_and_click("GnomeApplicationsTotem.png", 20) - @screen.wait_and_click("TotemMainWindow.png", 20) -end - -When /^I load the "([^"]+)" URL in Totem$/ do |url| - next if @skip_steps_while_restoring_background - @screen.type("l", Sikuli::KeyModifier.CTRL) - @screen.wait("TotemOpenUrlDialog.png", 10) - @screen.type(url + Sikuli::Key.ENTER) -end - When /^I(?:| try to) open "([^"]+)" with Totem$/ do |filename| - next if @skip_steps_while_restoring_background step "I run \"totem #{filename}\" in GNOME Terminal" end When /^I close Totem$/ do step 'I kill the process "totem"' end + +Then /^I can watch a WebM video over HTTPs$/ do + test_url = 'https://webm.html5.org/test.webm' + recovery_on_failure = Proc.new do + step 'I close Totem' + end + retry_tor(recovery_on_failure) do + step "I open \"#{test_url}\" with Totem" + @screen.wait("SampleRemoteWebMVideoFrame.png", 120) + end +end -- cgit v1.2.3-70-g09d2