Project

General

Profile

Bug #9317

Bug #8059: Windows Camouflage automated tests sometimes failed due to differently ordered icons in the notification area

Pidgin IRC test can fail with buddy list window over conversation one

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

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

100%

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

Description

I've seen this:

  Scenario: Connecting to the #tails IRC channel with the pre-configured account   # features/pidgin.feature:17
    When I start Pidgin through the GNOME menu                                     # features/step_definitions/pidgin.rb:252
    Then I see Pidgin's account manager window                                     # features/step_definitions/pidgin.rb:263
    When I activate the "irc.oftc.net" Pidgin account                              # features/step_definitions/pidgin.rb:273
    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
    And I can join the "#tails" channel on "irc.oftc.net"                          # features/step_definitions/pidgin.rb:307
      FindFailed: can not find PidginTailsConversationTab.png on the screen.
      Line ?, in File ? (RuntimeError)
      features/pidgin.feature:23:in `And I can join the "#tails" channel on "irc.oftc.net"'

... and the attached failure screenshot. I guess the "I can join [...]" step should focus the conversation window before waiting for the conversation tab.

pidgin-error.png View (39.1 KB) intrigeri, 05/01/2015 08:49 AM

Associated revisions

Revision 5d0fb3ac (diff)
Added by kytv over 4 years ago

Avoid showing Pidgin's tooltips during test, potentially "confusing" sikuli

Will-fix: #9317

Revision 43b04ff0 (diff)
Added by kytv over 4 years ago

Focus the conversation window

Failing to focus the window before trying to activate the channel tab
can result in the Buddy List/Roster window covering the window that we
need to interact with.

Will-fix: #9317

Revision 5f6065d9
Added by intrigeri about 4 years ago

Merge remote-tracking branch 'kytv/test/9317-pidgin-focus-conversation' into stable

Fix-committed: #9317

History

#2 Updated by intrigeri over 4 years ago

  • Affected tool set to Instant Messaging

#3 Updated by kytv over 4 years ago

  • Status changed from Confirmed to In Progress

#4 Updated by kytv over 4 years ago

  • Assignee changed from kytv to anonym
  • QA Check set to Ready for QA
  • Feature Branch set to kytv:test/9317-pidgin-focus-conversation

#5 Updated by anonym over 4 years ago

  • Assignee changed from anonym to kytv
  • % Done changed from 0 to 30
  • QA Check changed from Ready for QA to Dev Needed

Commits 23e6d18 and ad00a10 look good. However, I do not feel confident that commit:371c71c will fix the issue every time:

   @screen.doubleClick(   chan_image(account, channel, 'roaster'))
   @screen.hide_cursor
+  @screen.wait_and_click('PidginMessageTabIcon.png', 10)
   @screen.wait_and_click(chan_image(account, channel, 'conversation_tab'), 10)
   @screen.hide_cursor
   @screen.wait(          chan_image(account, channel, 'welcome'), 10)

Now, if Pidgin's buddy list window happens to cover the PidginMessageTabIcon.png-part of the chat window, we'll have a failure. @vm.focus_window(channel) should be the proper solution, but the problem is that the chat window will have the private "chat" with $SOME_SERVER.oftc.net selected, which will dictate the chat window's title name. This could be remedied by closing the $SOME_SERVER.oftc.net chat tab (which I believe at the time means closing the chat window itself) in between these steps:
    Then Pidgin successfully connects to the "irc.oftc.net" account
    And I can join the "#tails" channel on "irc.oftc.net" 

with a dedicated step, like I close the server greeting chat or whatever.

#6 Updated by kytv over 4 years ago

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

#7 Updated by kytv over 4 years ago

anonym wrote:

Commits 23e6d18 and ad00a10 look good. However, I do not feel confident that commit:371c71c will fix the issue every time:
[...]
Now, if Pidgin's buddy list window happens to cover the PidginMessageTabIcon.png-part of the chat window, we'll have a failure.

Good point.

How about just hiding the buddy list/roster window? This would be straightforward (and reliable) using the systray icon. After doing that the the window we want would be automatically focused and nothing should be able to cover it.

#8 Updated by anonym over 4 years ago

kytv wrote:

anonym wrote:

Commits 23e6d18 and ad00a10 look good. However, I do not feel confident that commit:371c71c will fix the issue every time:
[...]
Now, if Pidgin's buddy list window happens to cover the PidginMessageTabIcon.png-part of the chat window, we'll have a failure.

Good point.

How about just hiding the buddy list/roster window? This would be straightforward (and reliable) using the systray icon. After doing that the the window we want would be automatically focused and nothing should be able to cover it.

Sounds like an excellent idea! Go for it. An alternative would be to use @vm.focus_window(".*\.oftc\.net$), which uses xdotool search that supports regexes, but after actually trying it on my system it doesn't seem to work, which may be a bug in xdotool's regex engine, or similar.

#9 Updated by kytv over 4 years ago

  • Assignee changed from kytv to anonym
  • QA Check changed from Dev Needed to Ready for QA

I "went for it" and I'm quite pleased with the end result. :)

I force pushed a cleaned up version, stopping what are now unused images from going to the repo.

#10 Updated by kytv over 4 years ago

  • Blocks Bug #9046: Update the encryption test for Jessie added

#11 Updated by kytv over 4 years ago

  • Assignee changed from anonym to kytv
  • QA Check changed from Ready for QA to Dev Needed

I'll take this back to do more testing.

#12 Updated by kytv over 4 years ago

  • Blocks deleted (Bug #9046: Update the encryption test for Jessie)

#13 Updated by kytv over 4 years ago

  • Assignee changed from kytv to anonym
  • QA Check changed from Dev Needed to Ready for QA

Now I'm done with this branch (unless it fails review).

#14 Updated by anonym over 4 years ago

  • Assignee changed from anonym to kytv
  • QA Check changed from Ready for QA to Dev Needed

Now I get this:

  Scenario: Using a persistent Pidgin configuration
[...]
    And I can join the "#tails" channel on "irc.oftc.net" 
    And I cannot add a certificate from the "/home/amnesia/.gnupg" directory to Pidgin
      FindFailed: can not find PidginToolsMenu.png on the screen.
      Line ?, in File ? (RuntimeError)
      features/pidgin.feature:109:in `And I cannot add a certificate from the "/home/amnesia/.gnupg" directory to Pidgin'

In I join the ... step you introduced I hide the buddy list window so the "Tools" menu in the buddy list cannot be found in the I cannot add a certificate ... step. That's a problem, but I think it's a problem in itself that a step called I can join the "$CHANNEL" channel on "$ACCOUNT" also ends up hiding the buddy list. It's a quite unexpected side-effect, and indeed we already got hit by it. IMHO, when having to do weird workaround like this, try to restore the initial state, e.g. also run a I show the buddy list window step.

IMHO, it may still be worth investigating my suggestion in #9317#note-5, to play around with VM.focus_window() (hopefully I'm just wrong about muggy regex handling in xdotool).

#15 Updated by anonym over 4 years ago

  • Assignee changed from kytv to anonym
  • QA Check changed from Dev Needed to Ready for QA

Let me revisit this. Something went wrong when I fetched your remote, and I tested the old version. My comments in #9317#note-14 may be moot, but from the look of it, they shouldn't be.

#16 Updated by anonym over 4 years ago

  • Assignee changed from anonym to kytv
  • QA Check changed from Ready for QA to Dev Needed

My comments in #9317#note-14 may be moot, but from the look of it, they shouldn't be.

Indeed, that is still a problem.

Also, a performance issue:

+When /^I (un)?hide the buddy list window$/ do |unhide|
+  begin
+    @screen.wait_and_right_click('PidginSystrayIncomingMessage.png', 20)
+  rescue FindFailed
+    # The Pidgin systray icon is probably the standard, green 'connected' one.
+    @screen.wait_and_click('PidginSystrayConnected.png', 20)
+  end
[...]

This introduces an unnecessary wait for up to 20 seconds in one of the two cases. We can avoid it thanks to findAny()/waitAny() (see features/support/helpers/sikuli_helper.rb). I suggest something like this (untested):

--- a/features/step_definitions/pidgin.rb
+++ b/features/step_definitions/pidgin.rb
@@ -403,11 +403,14 @@ When /^I click on the Tails roadmap URL$/ do
 end

 When /^I (un)?hide the buddy list window$/ do |unhide|
-  begin
-    @screen.wait_and_right_click('PidginSystrayIncomingMessage.png', 20)
-  rescue FindFailed
-    # The Pidgin systray icon is probably the standard, green 'connected' one.
-    @screen.wait_and_click('PidginSystrayConnected.png', 20)
+  incoming_systray = 'PidginSystrayIncomingMessage.png'
+  connected_systray = 'PidginSystrayConnected.png'
+  actual_systray, region =
+     @screen.waitAny([incoming_systray, connected_systray], 20)
+  if actual_systray == incoming_systray
+    @screen.right_click(region)
+  elsif actual_systray == connected_systray
+    @screen.click(region)
   end

   if unhide

#17 Updated by kytv over 4 years ago

anonym wrote:

My comments in #9317#note-14 may be moot, but from the look of it, they shouldn't be.

Indeed, that is still a problem.

Also, a performance issue:

[...]

This introduces an unnecessary wait for up to 20 seconds in one of the two cases. We can avoid it thanks to findAny()/waitAny() (see features/support/helpers/sikuli_helper.rb). I suggest something like this (untested):

[...]

Tested here, seems to do the job. (Yay findAny/waitAny)

#18 Updated by kytv over 4 years ago

anonym wrote:

IMHO, it may still be worth investigating my suggestion in #9317#note-5, to play around with VM.focus_window() (hopefully I'm just wrong about muggy regex handling in xdotool).

Your suggestion seems to work fine. (I never used xdotool before). To test it I did the following:

-  step 'I hide the buddy list window'
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")
+  @vm.focus_window("Buddy List")
+  @vm.focus_window(".*\.oftc\.net$")

and it did exactly what it was supposed to.

anonym++

#19 Updated by kytv about 4 years ago

  • Assignee changed from kytv to anonym
  • QA Check changed from Dev Needed to Ready for QA

kytv wrote:

anonym wrote:

IMHO, it may still be worth investigating my suggestion in #9317#note-5, to play around with VM.focus_window() (hopefully I'm just wrong about muggy regex handling in xdotool).

This is what I went with and, indeed, it worked well.

As always, anonym++

#20 Updated by intrigeri about 4 years ago

  • Assignee changed from anonym to intrigeri

#21 Updated by kytv about 4 years ago

#9517 will need to do something similar, After letting it try to reconnect to OFTC, it finally succeeded on attempt number 309. It failed to join #tails because there were too many tabs in the conversation window which caused Sikuli to not find PidginTailsConversationTab.png; it was off of the screen.

Right now this branch has a hardcoded @vm.focus_window(".*\.oftc\.net$") which will work now but when/if I2P support is added, of course it'll fail.

I have an idea to solve it which I'm handing over at #9517. If this gets merged I'll take care of the hardcoding in the other branch.

#22 Updated by intrigeri about 4 years ago

  • Status changed from In Progress to Fix committed
  • Assignee deleted (intrigeri)
  • % Done changed from 30 to 100
  • QA Check changed from Ready for QA to Pass

Merged, thanks!

#23 Updated by kytv about 4 years ago

  • Status changed from Fix committed to In Progress

#24 Updated by kytv about 4 years ago

#25 Updated by intrigeri about 4 years ago

  • Status changed from In Progress to Fix committed

#26 Updated by intrigeri about 4 years ago

  • Status changed from Fix committed to Resolved

Also available in: Atom PDF