Bug #9330
Focusing windows during the test suite is fragile
100%
Description
While testing 1.4~rc1:
And I close Pidgin's account manager window # features/step_definitions/pidgin.rb:268
Then Pidgin successfully connects to the "irc.oftc.net" account # features/step_definitions/pidgin.rb:283
Command failed: xdotool search --name 'Buddy List' windowactivate --sync
error code: 1
Files
Related issues
Related to Tails - |
Resolved | 2015-01-19 |
History
#1 Updated by intrigeri 2015-05-03 08:49:03
- blocks #8538 added
#2 Updated by kytv 2015-05-29 12:30:27
- Assignee changed from kytv to anonym
- QA Check set to Info Needed
It looks to me that according to the screenshot, Pidgin (or X) was in a weird state which may explain why xdotool
couldn’t to its thing.
Unfortunately I’ve never seen this sort of failure; it would be nice to attach to the VM to experiment/“poke around” when it’s at a state like this.
Would it make sense to have focus_window
retry? Do you perhaps have any other ideas to handle this?
#3 Updated by anonym 2015-05-29 14:35:02
- Assignee changed from anonym to kytv
- QA Check changed from Info Needed to Dev Needed
kytv wrote:
> It looks to me that according to the screenshot, Pidgin (or X) was in a weird state which may explain why xdotool couldn’t to its thing.
> Unfortunately I’ve never seen this sort of failure; it would be nice to attach to the VM to experiment/“poke around” when it’s at a state like this.
Chances are that the “real” interaction (as opposed to xdotool
interaction) you’d do wouldn’t cause the same issue and make everything look normal. Perhaps you can just play around with xdotool
via vm-execute
(running with --pause-on-fail
) and look in the --view
window what happens.
> Would it make sense to have focus_window
retry?
It could be worth investigating if retrying works.
> Do you perhaps have any other ideas to handle this?
An other idea would be to first focus something else (the desktop?) and then focus the real target window.
#4 Updated by intrigeri 2015-06-28 02:16:11
kytv: if you think this can be completed today, please do. Otherwise, please postpone to 1.5.
#5 Updated by kytv 2015-06-28 13:04:36
- Target version changed from Tails_1.4.1 to Tails_1.5
#6 Updated by kytv 2015-08-11 10:35:35
- Target version changed from Tails_1.5 to Tails_1.6
#7 Updated by kytv 2015-09-19 09:02:05
- Subject changed from Pidgin test sometimes doesn't manage to focus the buddy list window to Focusing windows during the test suite is fragile
- Status changed from Confirmed to In Progress
- % Done changed from 0 to 20
#8 Updated by kytv 2015-09-19 09:32:01
I was able to reproduce cases in which vm.focus_window
didn’t work 100% reliably to focus the window. In my workspace I have code to make vm.focus_window
retry on failure. When it fails it’ll temporarily switch to another virtual desktop, switch back to the original virtual desktop, then retry the focusing operation. Doing this, the focusing has been 100% successful.
I’m still testing (and testing that I didn’t break anything else by “fixing” this). Whether it’ll be “good enough” to merge remains to be seen but I’m quite happy with the results I’m seeing.
#9 Updated by kytv 2015-09-19 10:21:48
- File certtest-2015-09-19T10_15_26-07_00.png added
In the stable branch without my fixes I just saw
Scenario: Failing to add a certificate to Pidgin # features/certtest.feature:274
Then I cannot add a certificate from the "/home/amnesia/.gnupg" directory to Pidgin # features/step_definitions/pidgin.rb:415
Command failed: xdotool search --name 'Buddy List' windowactivate --sync
error code: 1
stderr: X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 20 (X_GetProperty)
Resource id in failed request: 0xa00006
Serial number of failed request: 211
Current serial number in output stream: 211
.
<false> is not true. (ExecutionFailedInVM)
./features/support/helpers/vm_helper.rb:381:in `rescue in execute_successfully'
./features/support/helpers/vm_helper.rb:378:in `execute_successfully'
./features/support/helpers/vm_helper.rb:412:in `focus_window'
./features/step_definitions/pidgin.rb:388:in `pidgin_add_certificate_from'
./features/step_definitions/pidgin.rb:417:in `/^I cannot add a certificate from the "([^"]+)" directory to Pidgin$/'
features/certtest.feature:275:in `Then I cannot add a certificate from the "/home/amnesia/.gnupg" directory to Pidgin'
When I close Pidgin's certificate import failure dialog # features/step_definitions/pidgin.rb:427
And I close Pidgin's certificate manager # features/step_definitions/pidgin.rb:421
Scenario failed at time 00:16:50
…but the buddy list is clearly on the screen. My changes should prevent this from happening.
#10 Updated by kytv 2015-09-19 17:41:11
- Assignee changed from kytv to anonym
- QA Check changed from Dev Needed to Ready for QA
- Feature Branch set to kytv:test/9330-focus
I’m not sure that this is a good way to handle this but it has worked reliably for me (such as in Bug #10222)
#11 Updated by anonym 2015-09-20 07:59:41
- Status changed from In Progress to Fix committed
- % Done changed from 40 to 100
Applied in changeset commit:438f5f01fc3237262e1deeee7152867d121fdb8c.
#12 Updated by anonym 2015-09-20 08:00:03
- Assignee deleted (
anonym) - QA Check changed from Ready for QA to Pass
#13 Updated by kytv 2015-09-20 15:36:57
- related to
Feature #5330: Test suite: identify and document race conditions added
#14 Updated by bertagaz 2015-09-22 15:09:24
- Status changed from Fix committed to Resolved
- QA Check deleted (
Pass)