Start Seahorse via the Applications menu.
[tails-test.git] / features / step_definitions / torified_gnupg.rb
blob5a1462ce71ec73e00eed10555ca3a1e8e4eea2f4
1 When /^the "([^"]*)" OpenPGP key is not in the live user's public keyring$/ do |keyid|
2   next if @skip_steps_while_restoring_background
3   assert(!@vm.execute("gpg --batch --list-keys '#{keyid}'", $live_user).success?,
4          "The '#{keyid}' key is in the live user's public keyring.")
5 end
7 When /^I fetch the "([^"]*)" OpenPGP key using the GnuPG CLI$/ do |keyid|
8   next if @skip_steps_while_restoring_background
9   @gnupg_recv_key_res = @vm.execute(
10     "gpg --batch --recv-key '#{keyid}'",
11     $live_user)
12 end
14 When /^the GnuPG fetch is successful$/ do
15   next if @skip_steps_while_restoring_background
16   assert(@gnupg_recv_key_res.success?,
17          "gpg keyserver fetch failed:\n#{@gnupg_recv_key_res.stderr}")
18 end
20 When /^GnuPG uses the configured keyserver$/ do
21   next if @skip_steps_while_restoring_background
22   assert(@gnupg_recv_key_res.stderr[$configured_keyserver_hostname],
23          "GnuPG's stderr did not mention keyserver #{$configured_keyserver_hostname}")
24 end
26 When /^the "([^"]*)" key is in the live user's public keyring after at most (\d+) seconds$/ do |keyid, delay|
27   next if @skip_steps_while_restoring_background
28   try_for(delay.to_f, :msg => "The '#{keyid}' key is not in the live user's public keyring") {
29     @vm.execute("gpg --batch --list-keys '#{keyid}'", $live_user).success?
30   }
31 end
33 When /^I start Seahorse$/ do
34   next if @skip_steps_while_restoring_background
35   @screen.wait_and_click("GnomeApplicationsMenu.png", 10)
36   @screen.wait_and_click("GnomeApplicationsSystem.png", 10)
37   @screen.wait_and_click("GnomeApplicationsPreferences.png", 10)
38   @screen.wait_and_click("GnomeApplicationsSeahorse.png", 10)
39 end
41 When /^I fetch the "([^"]*)" OpenPGP key using Seahorse$/ do |keyid|
42   next if @skip_steps_while_restoring_background
43   step "I start Seahorse"
44   @screen.wait("SeahorseWindow.png", 10)
45   @screen.type("r", Sikuli::KeyModifier.ALT) # Menu: "Remote" ->
46   @screen.type("f")                  # "Find Remote Keys...".
47   @screen.wait("SeahorseFindKeysWindow.png", 10)
48   # Seahorse doesn't seem to support searching for fingerprints
49   @screen.type(keyid + Sikuli::Key.ENTER)
50   @screen.wait("SeahorseFoundKeyResult.png", 5*60)
51   @screen.type(Sikuli::Key.DOWN)   # Select first item in result menu
52   @screen.type("f", Sikuli::KeyModifier.ALT) # Menu: "File" ->
53   @screen.type("i")                  # "Import"
54 end