waitAny is failing to find images that are on the screen
_Originally created by @kytv on [#9633 (Redmine)](https://public-redmine-archive.tails.boum.org/code/issues/9633)_
The functionality of `waitAny` would be incredibly useful for tails/tails#9517.
While retrying the connection to OFTC, I want to look for one of two
images
- `PidginTailsChannelEntry.png`
- `PidginReconnect.png`
Even though one of the images is on the screen, I
see
```
Then Pidgin successfully connects to the "irc.oftc.net" account # features/step_definitions/pidgin.rb:283
FindFailed: can not find any of the images ["PidginTailsChannelEntry.png", "PidginReconnect.png"] on the screen
Line ?, in File ? (RuntimeError)
```
However, if I use `--retry-find` the images **will** be found without my
having to do anything more than pressing
enter.
```
When I activate the "irc.oftc.net" Pidgin account # features/step_definitions/pidgin.rb:273
[log] CLICK on (711,509)
And I close Pidgin's account manager window # features/step_definitions/pidgin.rb:268
calling as amnesia: xdotool search --name 'Buddy List' windowactivate --sync
call returned: [0, "", ""]
FindFailed for: PidginTailsChannelEntry.png
Update the image and press RETURN to retry
FindFailed for: PidginReconnect.png
Update the image and press RETURN to retry
Forcing new Tor circuit... (attempt #1)
calling as root: pidof -x -o '%PPID' vidalia
call returned: [0, "6216\n", ""]
[log] TYPE "
[log] RIGHT CLICK on (728,11)
[log] CLICK on (782,105)
[log] CLICK on (363,509)
calling as amnesia: xdotool search --name 'Buddy List' windowactivate --sync
call returned: [0, "", ""]
FindFailed for: PidginTailsChannelEntry.png
Update the image and press RETURN to retry
Forcing new Tor circuit... (attempt #2)
calling as root: pidof -x -o '%PPID' vidalia
call returned: [0, "6216\n", ""]
[log] TYPE "
[log] RIGHT CLICK on (728,11)
[log] CLICK on (782,105)
[log] CLICK on (363,509)
calling as amnesia: xdotool search --name 'Buddy List' windowactivate --sync
call returned: [0, "", ""]
FindFailed for: PidginTailsChannelEntry.png
Update the image and press RETURN to retry
Forcing new Tor circuit... (attempt #3)
calling as root: pidof -x -o '%PPID' vidalia
call returned: [0, "6216\n", ""]
[log] TYPE "
[log] RIGHT CLICK on (728,11)
[log] CLICK on (782,105)
[log] CLICK on (363,509)
calling as amnesia: xdotool search --name 'Buddy List' windowactivate --sync
call returned: [0, "", ""]
FindFailed for: PidginTailsChannelEntry.png
Update the image and press RETURN to retry
Forcing new Tor circuit... (attempt #4)
calling as root: pidof -x -o '%PPID' vidalia
call returned: [0, "6216\n", ""]
[log] TYPE "
[log] RIGHT CLICK on (728,11)
[log] CLICK on (782,105)
[log] CLICK on (363,509)
calling as amnesia: xdotool search --name 'Buddy List' windowactivate --sync
call returned: [0, "", ""]
FindFailed for: PidginTailsChannelEntry.png
Update the image and press RETURN to retry
Forcing new Tor circuit... (attempt #5)
calling as root: pidof -x -o '%PPID' vidalia
call returned: [0, "6216\n", ""]
[log] TYPE "
[log] RIGHT CLICK on (728,11)
[log] CLICK on (782,105)
[log] CLICK on (363,509)
```
It’s entirely possible that my expectations for `waitAny` are incorrect.
The code I’m using at the moment is the
following:
Then /^Pidgin successfully connects to the "([^"]+)" account$/ do |account|
next if @skip_steps_while_restoring_background
expected_channel_entry = chan_image(account, default_chan(account), 'roaster')
reconnect_button = 'PidginReconnect.png'
tries = 0
until tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
# Sometimes the OFTC welcome notice window pops up over the buddy list one...
@vm.focus_window('Buddy List')
what_we_see, region =
@screen.waitAny([expected_channel_entry, reconnect_button], 60)
if what_we_see == expected_channel_entry
break
else
tries += 1
@screen.wait(reconnect_button, 30)
STDERR.puts "Forcing new Tor circuit... (attempt ##{tries})" if $config["DEBUG"]
step "in Vidalia I force Tor to use a new circuit"
@screen.wait_and_click(reconnect_button, 20)
end
end
@screen.wait(expected_channel_entry)
end
Feature Branch: test/9633-fix-waitAny
Parent Task: tails/tails#8539
### Related issues
- **Blocks** tails/tails#6306
issue