Commit 403eb3fc authored by anonym's avatar anonym
Browse files

Test suite: adapt tests after change of semantics for Dogtail.

This is vs #12059, which changes the semantics of Dogtail so that
nodes are searched for on Dogtail::* object creation.

Refs: #12059
parent f4fa0c45
......@@ -86,8 +86,9 @@ When /^I update APT using Synaptic$/ do
try_for(15*60, :msg => "Took too much time to download the APT data") {
!$vm.has_process?("/usr/lib/apt/methods/tor+http")
}
if @synaptic.child(roleName: 'dialog', recursive: false).child('Error', roleName: 'icon', retry: false).exist?
raise "Updating APT with Synaptic failed."
assert_raise(RuntimeError) do
@synaptic.child(roleName: 'dialog', recursive: false)
.child('Error', roleName: 'icon', retry: false)
end
if !$vm.has_process?("synaptic")
raise "Synaptic process vanished, did it segfault again?"
......
......@@ -347,8 +347,9 @@ When /^I see the "(.+)" notification(?: after at most (\d+) seconds)?$/ do |titl
notification_list = gnome_shell.child(
'No Notifications', roleName: 'label', showingOnly: false
).parent.parent
notification_list.child(title, roleName: 'label', showingOnly: false)
.wait(timeout)
try_for(timeout) do
notification_list.child?(title, roleName: 'label', showingOnly: false)
end
end
Given /^Tor is ready$/ do
......@@ -392,7 +393,7 @@ end
Given /^the Tor Browser has started( in offline mode)?$/ do |offline|
try_for(60) do
@torbrowser.child(roleName: 'frame', recursive: false).exist?
@torbrowser.child?(roleName: 'frame', recursive: false)
end
end
......@@ -439,10 +440,10 @@ Given /^all notifications have disappeared$/ do
gnome_shell = Dogtail::Application.new('gnome-shell')
retry_action(10, recovery_proc: Proc.new { @screen.type(Sikuli::Key.ESC) }) do
@screen.click_point(x, y)
unless gnome_shell.child('No Notifications', roleName: 'label').exist?
unless gnome_shell.child?('No Notifications', roleName: 'label')
@screen.click('GnomeCloseAllNotificationsButton.png')
end
gnome_shell.child('No Notifications', roleName: 'label').exist?
gnome_shell.child?('No Notifications', roleName: 'label')
end
@screen.type(Sikuli::Key.ESC)
end
......
......@@ -141,7 +141,7 @@ end
Then /^I verify the SSH fingerprint for the SFTP server$/ do
try_for(30) do
Dogtail::Application.new('gnome-shell').child('Log In Anyway').exist?
Dogtail::Application.new('gnome-shell').child?('Log In Anyway')
end
# Here we'd like to click on the button using Dogtail, but something
# is buggy so let's just use the keyboard.
......@@ -151,6 +151,6 @@ end
Then /^I successfully connect to the SFTP server$/ do
try_for(60) do
Dogtail::Application.new('nautilus')
.child("#{@sftp_username} on #{@sftp_host}").exist?
.child?("#{@sftp_username} on #{@sftp_host}")
end
end
......@@ -83,6 +83,12 @@ module Dogtail
return c
end
def child?(*args)
!!child(*args)
rescue
false
end
def exist?
run("dogtail.config.searchCutoffCount = 0")
run(@find_code)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment