summaryrefslogtreecommitdiffstats
path: root/features/step_definitions/evince.rb
blob: d9bb42c1051dc3bcb2248ec396f04e02b14991fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
When /^I(?:| try to) open "([^"]+)" with Evince$/ do |filename|
  next if @skip_steps_while_restoring_background
  step "I run \"evince #{filename}\" in GNOME Terminal"
end

Then /^I can print the current document to "([^"]+)"$/ do |output_file|
  next if @skip_steps_while_restoring_background
  @screen.type("p", Sikuli::KeyModifier.CTRL)
  @screen.wait("EvincePrintDialog.png", 10)
  @screen.wait_and_click("EvincePrintToFile.png", 10)
  @screen.wait_and_double_click("EvincePrintOutputFile.png", 10)
  @screen.hide_cursor
  @screen.wait("EvincePrintOutputFileSelected.png", 10)
  # Only the file's basename is selected by double-clicking,
  # so we type only the desired file's basename to replace it
  @screen.type(output_file.sub(/[.]pdf$/, '') + Sikuli::Key.ENTER)
  try_for(10, :msg => "The document was not printed to #{output_file}") {
    @vm.file_exist?(output_file)
  }
end