Project

General

Profile

Bug #9330

Focusing windows during the test suite is fragile

Added by intrigeri over 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Test suite
Target version:
Start date:
09/19/2015
Due date:
% Done:

100%

Feature Branch:
kytv:test/9330-focus
Type of work:
Code
Blueprint:
Starter:
Affected tool:
Instant Messaging

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

pidgin-2015-05-03T09_36_48-04_00.png View (36.5 KB) intrigeri, 05/03/2015 08:47 AM

certtest-2015-09-19T10_15_26-07_00.png View (61 KB) kytv, 09/19/2015 10:20 AM


Subtasks

Bug #10222: Pidgin tests with certificates are fragileResolved


Related issues

Related to Tails - Feature #5330: Test suite: identify and document race conditions Resolved 01/19/2015

Associated revisions

Revision 438f5f01
Added by anonym almost 4 years ago

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

Fix-committed: #9330

History

#2 Updated by kytv about 4 years ago

  • 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 about 4 years ago

  • 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 about 4 years ago

kytv: if you think this can be completed today, please do. Otherwise, please postpone to 1.5.

#5 Updated by kytv about 4 years ago

  • Target version changed from Tails_1.4.1 to Tails_1.5

#6 Updated by kytv about 4 years ago

  • Target version changed from Tails_1.5 to Tails_1.6

#7 Updated by kytv almost 4 years ago

  • 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 almost 4 years ago

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 almost 4 years ago

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 almost 4 years ago

  • 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 #10222)

#11 Updated by anonym almost 4 years ago

  • Status changed from In Progress to Fix committed
  • % Done changed from 40 to 100

#12 Updated by anonym almost 4 years ago

  • Assignee deleted (anonym)
  • QA Check changed from Ready for QA to Pass

#13 Updated by kytv almost 4 years ago

  • Related to Feature #5330: Test suite: identify and document race conditions added

#14 Updated by bertagaz almost 4 years ago

  • Status changed from Fix committed to Resolved
  • QA Check deleted (Pass)

Also available in: Atom PDF