Commit 438f5f01 authored by anonym's avatar anonym
Browse files

Merge remote-tracking branch 'kytv/test/9330-focus' into stable

Fix-committed: #9330
parents bb560d66 b1705ccf
......@@ -23,14 +23,6 @@ def focus_pidgin_irc_conversation_window(account)
@vm.focus_window(".*#{Regexp.escape(account)}$")
end
def close_pidgin_conversation_window(account)
focus_pidgin_irc_conversation_window(account)
@screen.type(Sikuli::Key.F4, Sikuli::KeyModifier.ALT)
if @screen.exists('PidginConfirmationIcon.png')
@screen.click('GnomeCloseButton.png')
end
end
When /^I create my XMPP account$/ do
next if @skip_steps_while_restoring_background
account = xmpp_account("Tails_account")
......@@ -299,14 +291,7 @@ Then /^Pidgin successfully connects to the "([^"]+)" account$/ do |account|
@new_circuit_tries = 0
until @new_circuit_tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
# Sometimes the OFTC welcome notice window pops up over the buddy list one...
begin
@vm.focus_window('Buddy List')
rescue ExecutionFailedInVM
# Sometimes focusing the window with xdotool will fail with the
# conversation window right on top of it. We'll try to close the
# conversation window. At worst, the test will still fail...
close_pidgin_conversation_window(account)
end
@vm.focus_window('Buddy List')
# FIXME This should be modified to use waitAny once #9633 is addressed
begin
......
......@@ -408,12 +408,34 @@ EOF
return execute("pidof -x -o '%PPID' " + process).stdout.chomp.split
end
def focus_window(window_title, user = LIVE_USER)
def select_virtual_desktop(desktop_number, user = LIVE_USER)
assert(desktop_number >= 0 && desktop_number <=3,
"Only values between 0 and 3 are valid virtual desktop numbers")
execute_successfully(
"xdotool search --name '#{window_title}' windowactivate --sync", user
"xdotool set_desktop '#{desktop_number}'", user
)
end
def focus_window(window_title, user = LIVE_USER)
def do_focus(window_title, user)
execute_successfully(
"xdotool search --name '#{window_title}' windowactivate --sync", user
)
end
begin
do_focus(window_title, user)
rescue ExecutionFailedInVM
# Often when vdotool fails to focus a window it'll work when retried
# after redrawing the screen. Switching to a new virtual desktop then
# back seems to be a reliable way to handle this.
select_virtual_desktop(3)
select_virtual_desktop(0)
sleep 1
do_focus(window_title, user)
end
end
def file_exist?(file)
execute("test -e '#{file}'").success?
end
......
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