Commit 91674552 authored by anonym's avatar anonym

Test suite: replace Sikuli with mix of xdotool and OpenCV.

Sikuli is broken with Java >= 9 and its Debian maintainer has given
up. So we need something else.

Here we implement something that is almost a drop-in-replacement for
the Sikuli features we use (although the interface for keyboard
interaction has changed, resulting in tons of small changes under
features/step_definitions in this commit). It uses OpenCV for (fuzzy)
image matching, and xdotool for keyboard/mouse interaction. We didn't
bother with most of the Sikuli class hierarchy, settling with just
equivalents of Screen and Match -- we drop Pattern since we don't do
OCR but just image matching; we drop Region because so far we have
always operated on the whole screen (if we care about a subsection we
can just use findAll() and check which matches fulfills the
constraints).

This commit removes some functionality: both --retry-find and
--fuzzy-image-matching are gone. These were mainly used for "image
bumping", and I do have plans for in improved feature replacing these.

Refs: #15460
parent 75bab5db
......@@ -2,8 +2,6 @@ CAPTURE: false
CAPTURE_ALL: false
INTERACTIVE_DEBUGGING: false
MAX_NEW_TOR_CIRCUIT_RETRIES: 10
SIKULI_RETRY_FINDFAILED: false
SIKULI_FUZZY_IMAGE_MATCHING: false
TMPDIR: "/tmp/TailsToaster"
Unsafe_SSH_private_key: |
......
......@@ -14,7 +14,7 @@ end
# otherwise, browser.tabs.warnOnClose will block this with a
# "Quit and close tabs?" dialog.
When /^I close the (?:Tor|Unsafe) Browser$/ do
@screen.type("q", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "q")
end
def xul_application_info(application)
......@@ -92,11 +92,11 @@ When /^I open the address "([^"]*)" in the (.*)$/ do |address, browser|
# shown, which we work around by pasting the address from the
# clipboard, in one go.
$vm.set_clipboard(address)
@screen.type('v', Sikuli::KeyModifier.CTRL)
@screen.type(Sikuli::Key.ENTER)
@screen.press("ctrl", 'v')
@screen.press("Return")
end
recovery_on_failure = Proc.new do
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
@screen.waitVanish(info[:browser_stop_button_image], 3)
open_address.call
end
......@@ -217,7 +217,7 @@ end
When /^I save the file to the default Tor Browser download directory$/ do
@screen.click('BrowserDownloadDialogSaveAsButton.png')
@screen.wait('Gtk3SaveFileDialog.png', 10)
@screen.type(Sikuli::Key.ENTER)
@screen.press("Return")
end
Then /^the file is saved to the default Tor Browser download directory$/ do
......@@ -248,7 +248,7 @@ Then /^I can listen to an Ogg audio track in Tor Browser$/ do
step "I open the address \"#{test_url}\" in the Tor Browser"
end
recovery_on_failure = Proc.new do
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
@screen.waitVanish(info[:browser_stop_button_image], 3)
open_test_url.call
end
......@@ -266,7 +266,7 @@ Then /^I can watch a WebM video in Tor Browser$/ do
step "I open the address \"#{test_url}\" in the Tor Browser"
end
recovery_on_failure = Proc.new do
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
@screen.waitVanish(info[:browser_stop_button_image], 3)
open_test_url.call
end
......
......@@ -16,7 +16,7 @@ def post_vm_start_hook
# opened). We sleep here, instead of in "I start […] via GNOME
# Activities Overview", because it's our responsibility to return to
# a normal desktop state that any following step can rely upon.
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
sleep 1
end
......@@ -239,8 +239,8 @@ end
Given /^the computer (re)?boots Tails( with genuine APT sources)?$/ do |reboot, keep_apt_sources|
step "Tails is at the boot menu's cmdline" + (reboot ? ' after rebooting' : '')
@screen.type(" autotest_never_use_this_option blacklist=psmouse #{@boot_options}" +
Sikuli::Key.ENTER)
@screen.type(" autotest_never_use_this_option blacklist=psmouse #{@boot_options}",
["Return"])
@screen.wait('TailsGreeter.png', 5*60)
$vm.wait_until_remote_shell_is_up
step 'I configure Tails to use a simulated Tor network'
......@@ -257,7 +257,7 @@ Given /^I log in to a new session(?: in )?(|German)$/ do |lang|
@screen.wait('TailsGreeterLanguagePopover.png', 10)
@screen.type(@language)
sleep(2) # Gtk needs some time to filter the results
@screen.type(Sikuli::Key.ENTER)
@screen.press("Return")
@screen.wait_and_click("TailsGreeterLoginButton#{@language}.png", 10)
when ''
@screen.wait_and_click('TailsGreeterLoginButton.png', 10)
......@@ -268,7 +268,7 @@ Given /^I log in to a new session(?: in )?(|German)$/ do |lang|
end
def open_greeter_additional_settings
@screen.click('TailsGreeterAddMoreOptions.png')
@screen.wait_and_click('TailsGreeterAddMoreOptions.png', 10)
@screen.wait('TailsGreeterAdditionalSettingsDialog.png', 10)
end
......@@ -288,9 +288,9 @@ Given /^I set an administration password$/ do
@screen.wait_and_click("TailsGreeterAdminPassword.png", 20)
@screen.wait("TailsGreeterAdminPasswordDialog.png", 10)
@screen.type(@sudo_password)
@screen.type(Sikuli::Key.TAB)
@screen.press("Tab")
@screen.type(@sudo_password)
@screen.type(Sikuli::Key.ENTER)
@screen.press("Return")
end
Given /^the Tails desktop is ready$/ do
......@@ -416,7 +416,7 @@ Given /^I add a bookmark to eff.org in the Tor Browser$/ do
url = "https://www.eff.org"
step "I open the address \"#{url}\" in the Tor Browser"
step 'the Tor Browser shows the "The proxy server is refusing connections" error'
@screen.type("d", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "d")
@screen.wait("TorBrowserBookmarkPrompt.png", 10)
@screen.type(url)
# The new default location for bookmarks is "Other Bookmarks", but our test
......@@ -427,11 +427,11 @@ Given /^I add a bookmark to eff.org in the Tor Browser$/ do
# Need to sleep here, otherwise the changed Bookmark location is not taken
# into account and we end up creating a bookmark in "Other Bookmark" location.
sleep 1
@screen.type(Sikuli::Key.ENTER)
@screen.press("Return")
end
Given /^the Tor Browser has a bookmark to eff.org$/ do
@screen.type("b", Sikuli::KeyModifier.ALT)
@screen.press("alt", "b")
@screen.wait("TorBrowserEFFBookmark.png", 10)
end
......@@ -440,7 +440,7 @@ Given /^all notifications have disappeared$/ do
# bar, which when clicked opens the calendar.
x, y = 512, 10
gnome_shell = Dogtail::Application.new('gnome-shell')
retry_action(10, recovery_proc: Proc.new { @screen.type(Sikuli::Key.ESC) }) do
retry_action(10, recovery_proc: Proc.new { @screen.press("Escape") }) do
@screen.click_point(x, y)
begin
gnome_shell.child('Clear All', roleName: 'push button', showingOnly: true).click
......@@ -451,7 +451,7 @@ Given /^all notifications have disappeared$/ do
end
gnome_shell.child?('No Notifications', roleName: 'label', showingOnly: true)
end
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
# Increase the chances that by the time we leave this step, the
# notifications menu was closed and the desktop is back to its
# normal state. Otherwise, all kinds of trouble may arise: for
......@@ -486,8 +486,7 @@ def deal_with_polkit_prompt(password, opts = {})
opts[:expect_success] ||= true
image = 'PolicyKitAuthPrompt.png'
@screen.wait(image, 60)
@screen.type(password)
@screen.type(Sikuli::Key.ENTER)
@screen.type(password, ["Return"])
if opts[:expect_success]
@screen.waitVanish(image, 20)
else
......@@ -612,7 +611,7 @@ When /^I run "([^"]+)" in GNOME Terminal$/ do |command|
else
@screen.wait_and_click('GnomeTerminalWindow.png', 20)
end
@screen.type(command + Sikuli::Key.ENTER)
@screen.type(command, ["Return"])
end
When /^the file "([^"]+)" exists(?:| after at most (\d+) seconds)$/ do |file, timeout|
......@@ -681,7 +680,7 @@ Given /^I start "([^"]+)" via GNOME Activities Overview$/ do |app_name|
# Type the rest of the search query
@screen.type(app_name[1..-1])
sleep 2
@screen.type(Sikuli::Key.ENTER, Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "Return")
end
When /^I type "([^"]+)"$/ do |string|
......@@ -690,7 +689,7 @@ end
When /^I press the "([^"]+)" key$/ do |key|
begin
@screen.type(eval("Sikuli::Key.#{key}"))
@screen.press(key)
rescue RuntimeError
raise "unsupported key #{key}"
end
......@@ -715,14 +714,15 @@ Then /^there is a GNOME bookmark for the (amnesiac|persistent) Tor Browser direc
end
@screen.wait_and_click('GnomePlaces.png', 10)
@screen.wait(bookmark_image, 40)
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
end
Then /^there is no GNOME bookmark for the persistent Tor Browser directory$/ do
try_for(65) do
@screen.wait_and_click('GnomePlaces.png', 10)
@screen.wait("GnomePlacesWithoutTorBrowserPersistent.png", 10)
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
true
end
end
......@@ -750,7 +750,7 @@ end
When /^I (can|cannot) save the current page as "([^"]+[.]html)" to the (.*) directory$/ do |should_work, output_file, output_dir|
should_work = should_work == 'can' ? true : false
@screen.type("s", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "s")
@screen.wait("Gtk3SaveFileDialog.png", 10)
if output_dir == "persistent Tor Browser"
output_dir = "/home/#{LIVE_USER}/Persistent/Tor Browser"
......@@ -758,7 +758,7 @@ When /^I (can|cannot) save the current page as "([^"]+[.]html)" to the (.*) dire
@screen.wait("GtkTorBrowserPersistentBookmarkSelected.png", 10)
# The output filename (without its extension) is already selected,
# let's use the keyboard shortcut to focus its field
@screen.type("n", Sikuli::KeyModifier.ALT)
@screen.press("alt", "n")
@screen.wait("TorBrowserSaveOutputFileSelected.png", 10)
elsif output_dir == "default downloads"
output_dir = "/home/#{LIVE_USER}/Tor Browser"
......@@ -767,8 +767,7 @@ When /^I (can|cannot) save the current page as "([^"]+[.]html)" to the (.*) dire
end
# Only the part of the filename before the .html extension can be easily replaced
# so we have to remove it before typing it into the arget filename entry widget.
@screen.type(output_file.sub(/[.]html$/, ''))
@screen.type(Sikuli::Key.ENTER)
@screen.type(output_file.sub(/[.]html$/, ''), ["Return"])
if should_work
try_for(20, :msg => "The page was not saved to #{output_dir}/#{output_file}") {
$vm.file_exist?("#{output_dir}/#{output_file}")
......@@ -784,7 +783,7 @@ When /^I can print the current page as "([^"]+[.]pdf)" to the (default downloads
else
output_dir = "/home/#{LIVE_USER}/Tor Browser"
end
@screen.type("p", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "p")
print_dialog = @torbrowser.child('Print', roleName: 'dialog')
print_dialog.child('Print to File', 'table cell').click
print_dialog.child('~/Tor Browser/output.pdf', roleName: 'push button').click()
......@@ -795,8 +794,8 @@ When /^I can print the current page as "([^"]+[.]pdf)" to the (default downloads
# Only the file's basename is selected when the file selector dialog opens,
# so we type only the desired file's basename to replace it
$vm.set_clipboard(output_dir + '/' + output_file.sub(/[.]pdf$/, ''))
@screen.type('v', Sikuli::KeyModifier.CTRL)
@screen.type(Sikuli::Key.ENTER)
@screen.press("ctrl", 'v')
@screen.press("Return")
# Yes, TorBrowserPrintButton.png != Gtk3PrintButton.png.
# If you try to unite them, make sure this does not break the tests
# that use either.
......
......@@ -56,7 +56,8 @@ def maybe_deal_with_pinentry
# miss keystrokes by typing too soon. This sleep prevents this problem from
# coming up.
sleep 5
@screen.type(@passphrase + Sikuli::Key.ENTER)
@screen.type(@passphrase)
@screen.press("Return")
rescue FindFailed
# The passphrase was cached or we wasn't prompted at all (e.g. when
# only encrypting to a public key)
......@@ -98,7 +99,9 @@ end
When /^I encrypt the message using my OpenPGP key$/ do
encrypt_sign_helper do
@screen.type(@key_name + Sikuli::Key.ENTER + Sikuli::Key.ENTER)
@screen.type(@key_name)
@screen.press("Return")
@screen.press("Return")
end
end
......@@ -109,7 +112,9 @@ end
When /^I sign the message using my OpenPGP key$/ do
encrypt_sign_helper do
@screen.type(Sikuli::Key.TAB + Sikuli::Key.DOWN + Sikuli::Key.ENTER)
@screen.press("Tab")
@screen.press("Down")
@screen.press("Return")
end
end
......@@ -121,10 +126,12 @@ end
When /^I both encrypt and sign the message using my OpenPGP key$/ do
encrypt_sign_helper do
@screen.wait_and_click('GpgAppletEncryptionKey.png', 20)
@screen.type(Sikuli::Key.SPACE)
@screen.press("space")
@screen.wait('GpgAppletKeySelected.png', 10)
@screen.type(Sikuli::Key.TAB + Sikuli::Key.DOWN + Sikuli::Key.ENTER)
@screen.type(Sikuli::Key.ENTER)
@screen.press("Tab")
@screen.press("Down")
@screen.press("Return")
@screen.press("Return")
end
end
......
......@@ -3,7 +3,7 @@ When /^I(?:| try to) open "([^"]+)" with Evince$/ do |filename|
end
Then /^I can print the current document to "([^"]+)"$/ do |output_file|
@screen.type("p", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "p")
@screen.wait("EvincePrintDialog.png", 10)
@screen.wait_and_click("EvincePrintToFile.png", 10)
@screen.wait_and_click("EvincePrintOutputFileButton.png", 10)
......@@ -11,8 +11,8 @@ Then /^I can print the current document to "([^"]+)"$/ do |output_file|
# Only the file's basename is selected by double-clicking,
# so we type only the desired file's basename to replace it
$vm.set_clipboard(output_file.sub(/[.]pdf$/, ''))
@screen.type('v', Sikuli::KeyModifier.CTRL)
@screen.type(Sikuli::Key.ENTER)
@screen.press("ctrl", 'v')
@screen.press("Return")
@screen.wait_and_click("Gtk3PrintButton.png", 10)
try_for(10, :msg => "The document was not printed to #{output_file}") {
$vm.file_exist?(output_file)
......@@ -20,6 +20,6 @@ Then /^I can print the current document to "([^"]+)"$/ do |output_file|
end
When /^I close Evince$/ do
@screen.type("w", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "w")
step 'process "evince" has stopped running after at most 20 seconds'
end
......@@ -6,7 +6,8 @@ When /^I clone the Git repository "([\S]+)" in GNOME Terminal$/ do |repo|
$vm.execute("rm -rf /home/#{LIVE_USER}/#{repo_directory}",
:user => LIVE_USER)
step 'I kill the process "git"'
@screen.type('clear' + Sikuli::Key.ENTER)
@screen.type('clear')
@screen.press("Return")
end
retry_tor(recovery_proc) do
......
......@@ -122,9 +122,8 @@ When /^I start a conversation with my friend$/ do
# friend, given it's the only subscribed user that's online, which
# we assume.
r = @screen.find("PidginFriendOnline.png")
bottom_left = r.getBottomLeft()
x = bottom_left.getX + r.getW/2
y = bottom_left.getY
x = r.x + r.w/2
y = r.y + r.h
@screen.doubleClick_point(x, y)
# Since Pidgin sets the window name to the contact, we have no good
# way to identify the conversation window. Let's just look for the
......@@ -134,14 +133,13 @@ end
And /^I say (.*) to my friend( in the multi-user chat)?$/ do |msg, multi_chat|
msg = "ping" if msg == "something"
msg = msg + Sikuli::Key.ENTER
if multi_chat
$vm.focus_window(@chat_room_jid.split("@").first)
msg = @friend_name + ": " + msg
else
$vm.focus_window(@friend_name)
end
@screen.type(msg)
@screen.type(msg, ["Return"])
end
Then /^I receive a response from my friend( in the multi-user chat)?$/ do |multi_chat|
......@@ -196,8 +194,8 @@ When /^I join some empty multi-user chat$/ do
# We will need the conference server later, when starting the bot.
@screen.click_mid_right_edge("PidginJoinChatServerLabel.png")
@screen.type("a", Sikuli::KeyModifier.CTRL)
@screen.type("c", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "a")
@screen.press("ctrl", "c")
conference_server =
$vm.execute_successfully("xclip -o", :user => LIVE_USER).stdout.chomp
@chat_room_jid = chat_room + "@" + conference_server
......@@ -304,13 +302,13 @@ end
When /^I close Pidgin$/ do
$vm.focus_window('Buddy List')
@screen.type("q", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "q")
@screen.waitVanish('PidginAvailableStatus.png', 10)
end
When /^I (de)?activate the "([^"]+)" Pidgin account$/ do |deactivate, account|
@screen.click("PidginAccount_#{account}.png")
@screen.type(Sikuli::Key.LEFT + Sikuli::Key.SPACE)
@screen.type(["Left"], ["space"])
if deactivate
@screen.waitVanish('PidginAccountEnabledCheckbox.png', 5)
else
......@@ -377,7 +375,7 @@ Then /^I can join the "([^"]+)" channel on "([^"]+)"$/ do |channel, account|
# If the channel tab can't be found it could be because there were
# multiple connection attempts and the channel tab we want is off the
# screen. We'll try closing tabs until the one we want can be found.
@screen.type("w", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "w")
raise e
end
end
......@@ -425,14 +423,14 @@ def pidgin_add_certificate_from (cert_file)
# do anything. Hence, this noop exception handler.
end
@screen.wait_and_click('GtkFileTypeFileNameButton.png', 10)
@screen.type("l", Sikuli::KeyModifier.ALT) # "Location" field
@screen.type(cert_file + Sikuli::Key.ENTER)
@screen.press("alt", "l") # "Location" field
@screen.type(cert_file, ["Return"])
end
Then /^I can add a certificate from the "([^"]+)" directory to Pidgin$/ do |cert_dir|
pidgin_add_certificate_from("#{cert_dir}/test.crt")
wait_and_focus('PidginCertificateAddHostnameDialog.png', 10, 'Certificate Import')
@screen.type("XXX test XXX" + Sikuli::Key.ENTER)
@screen.type("XXX test XXX", ["Return"])
wait_and_focus('PidginCertificateTestItem.png', 10, 'Certificate Manager')
end
......@@ -443,13 +441,13 @@ end
When /^I close Pidgin's certificate manager$/ do
wait_and_focus('PidginCertificateManagerDialog.png', 10, 'Certificate Manager')
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
# @screen.wait_and_click('PidginCertificateManagerClose.png', 10)
@screen.waitVanish('PidginCertificateManagerDialog.png', 10)
end
When /^I close Pidgin's certificate import failure dialog$/ do
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
# @screen.wait_and_click('PidginCertificateManagerClose.png', 10)
@screen.waitVanish('PidginCertificateImportFailed.png', 10)
end
......@@ -462,7 +460,7 @@ When /^I see the Tails roadmap URL$/ do
begin
@screen.find('PidginTailsRoadmapUrl.png')
rescue FindFailed => e
@screen.type(Sikuli::Key.PAGE_UP)
@screen.press("Page_Up")
raise e
end
end
......
......@@ -36,6 +36,6 @@ Then /^I should not be able to run a command as root with pkexec and the standar
['', 'live', 'amnesia'].each do |password|
deal_with_polkit_prompt(password, expect_success: false)
end
@screen.type(Sikuli::Key.ESC)
@screen.press("Escape")
@screen.wait('PolicyKitAuthCompleteFailure.png', 20)
end
......@@ -61,7 +61,7 @@ end
Given /^I (?:am prompted to )?verify the SSH fingerprint for the (?:Git|SSH) (?:repository|server)$/ do
@screen.wait("SSHFingerprint.png", 60)
sleep 1 # brief pause to ensure that the following keystrokes do not get lost
@screen.type('yes' + Sikuli::Key.ENTER)
@screen.type('yes', ["Return"])
end
def get_free_tcp_port
......@@ -145,8 +145,7 @@ Then /^I verify the SSH fingerprint for the SFTP server$/ do
end
# Here we'd like to click on the button using Dogtail, but something
# is buggy so let's just use the keyboard.
@screen.type(Sikuli::Key.TAB)
@screen.type(Sikuli::Key.ENTER)
@screen.type(["Tab"], ["Return"])
end
Then /^I successfully connect to the SFTP server$/ do
......
......@@ -54,7 +54,7 @@ Then /^I open Thunderbird's Add-ons Manager$/ do
thunderbird_main.button('AppMenu')
# ... then use keyboard shortcuts, with a little delay between both
# so that the menu has a chance to pop up:
@screen.type('t', Sikuli::KeyModifier.ALT)
@screen.press("alt", 't')
sleep(1)
@screen.type('a')
@thunderbird_addons = thunderbird_app.child(
......
......@@ -364,7 +364,7 @@ When /^I configure some (\w+) pluggable transports in Tor Launcher$/ do |bridge_
@bridge_hosts << { address: address, port: port.to_i }
bridge_line = bridge_type + " " + address + ":" + port
[fingerprint, extra].each { |e| bridge_line += " " + e.to_s if e }
@screen.type(bridge_line + Sikuli::Key.ENTER)
@screen.type(bridge_line, ["Return"])
end
@screen.hide_cursor
@screen.wait_and_click('TorLauncherFinishButton.png', 10)
......
......@@ -127,9 +127,9 @@ Then /^I enable key synchronization in Seahorse$/ do
@screen.wait_and_click("SeahorseWindow.png", 10)
seahorse_menu_click_helper('GnomeEditMenu.png', 'SeahorseEditPreferences.png', 'seahorse')
@screen.wait('SeahorsePreferences.png', 20)
@screen.type("p", Sikuli::KeyModifier.ALT) # Option: "Publish keys to...".
@screen.type(Sikuli::Key.DOWN) # select HKP server
@screen.type(Sikuli::Key.ESC) # no "Close" button
@screen.press("alt", "p") # Option: "Publish keys to...".
@screen.press("Down") # select HKP server
@screen.press("Escape") # no "Close" button
end
Then /^I synchronize keys in Seahorse$/ do
......@@ -159,7 +159,7 @@ Then /^I synchronize keys in Seahorse$/ do
'SeahorseRemoteMenuSync.png',
'seahorse')
@screen.wait('SeahorseSyncKeys.png', 20)
@screen.type("s", Sikuli::KeyModifier.ALT) # Button: Sync
@screen.press("alt", "s") # Button: Sync
# There's no visual feedback of Seahorse in Tails/Jessie, except on error.
try_for(120) {
change_of_status?
......@@ -187,7 +187,7 @@ When /^I fetch the "([^"]+)" OpenPGP key using Seahorse( via the OpenPGP Applet)
recovery_proc = Proc.new do
setup_onion_keyserver
@screen.click('GnomeCloseButton.png') if @screen.exists('GnomeCloseButton.png')
@screen.type("w", Sikuli::KeyModifier.CTRL)
@screen.press("ctrl", "w")
end
retry_tor(recovery_proc) do
@screen.wait_and_click("SeahorseWindow.png", 10)
......@@ -197,11 +197,11 @@ When /^I fetch the "([^"]+)" OpenPGP key using Seahorse( via the OpenPGP Applet)
@screen.wait('SeahorseFindKeysWindow.png', 10)
# Seahorse doesn't seem to support searching for fingerprints
# (https://gitlab.gnome.org/GNOME/seahorse/issues/177)
@screen.type(keyid + Sikuli::Key.ENTER)
@screen.type(keyid, ["Return"])
begin
@screen.waitAny(['SeahorseFoundKeyResult.png',
'GnomeCloseButton.png'], 120)
rescue FindAnyFailed
rescue FindFailed
# We may end up here if Seahorse appears to be "frozen".
# Sometimes--but not always--if we click another window
# the main Seahorse window will unfreeze, allowing us
......
# coding: utf-8
When /^I see and accept the Unsafe Browser start verification(?:| in the "([^"]+)" locale)$/ do |locale|
@screen.wait('GnomeQuestionDialogIcon.png', 30)
@screen.type(Sikuli::Key.TAB + Sikuli::Key.ENTER)
@screen.type(["Tab"], ["Return"])
end
def supported_torbrowser_languages
......@@ -48,12 +48,12 @@ end
Then /^the Unsafe Browser has only Firefox's default bookmarks configured$/ do
info = xul_application_info("Unsafe Browser")
# "Show all bookmarks"
@screen.type("o", Sikuli::KeyModifier.SHIFT + Sikuli::KeyModifier.CTRL)
@screen.press("shift", "ctrl", "o")
@screen.wait_and_click("UnsafeBrowserExportBookmarksButton.png", 20)
@screen.wait_and_click("UnsafeBrowserExportBookmarksMenuEntry.png", 20)
@screen.wait("UnsafeBrowserExportBookmarksSavePrompt.png", 20)
path = "/home/#{info[:user]}/bookmarks"
@screen.type(path + Sikuli::Key.ENTER)
@screen.type(path, ["Return"])
chroot_path = "#{info[:chroot]}/#{path}.json"
try_for(10) { $vm.file_exist?(chroot_path) }
dump = JSON.load($vm.file_content(chroot_path))
......@@ -81,7 +81,7 @@ Then /^the Unsafe Browser has only Firefox's default bookmarks configured$/ do
assert_equal(5, mozilla_uris_counter,
"Unexpected number (#{mozilla_uris_counter}) of mozilla " \
"bookmarks")
@screen.type(Sikuli::Key.F4, Sikuli::KeyModifier.ALT)
@screen.press("alt", "F4")
end
Then /^the Unsafe Browser has a red theme$/ do
......@@ -93,7 +93,7 @@ Then /^the Unsafe Browser shows a warning as its start page(?: in the "([^"]+)"
# Use localized image for languages that have a translated version
# of the Unsafe Browser homepage.
when /\A([a-z]+)/
if File.exists?("#{SIKULI_IMAGE_PATH}/UnsafeBrowserStartPage.#{$1}.png")
if File.exists?("#{OPENCV_IMAGE_PATH}/UnsafeBrowserStartPage.#{$1}.png")
start_page_image = "UnsafeBrowserStartPage.#{$1}.png"
else
start_page_image = "UnsafeBrowserStartPage.png"
......
......@@ -221,12 +221,12 @@ Given /^I enable all persistence presets$/ do
debug_log("typing TAB #{tabs_to_select_switch} times to select the switch")
tabs_to_select_switch.times do
debug_log("typing TAB")
@screen.type(Sikuli::Key.TAB)
@screen.press("Tab")
end
# Activate the switch
if ! setting['enabled']
debug_log("pressing space")
@screen.type(Sikuli::Key.SPACE)
@screen.press("space")
else
debug_log("setting already enabled, skipping")
end
......@@ -235,19 +235,17 @@ Given /^I enable all persistence presets$/ do
end
def save_and_exit_the_persistence_wizard
@screen.type(Sikuli::Key.ENTER) # Press the Save button
@screen.press("Return") # Press the Save button
@screen.wait('PersistenceWizardDone.png', 60)