Bug #9317

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

Added by intrigeri 2015-05-01 08:52:08 . Updated 2015-07-03 03:41:08 .

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

100%

Feature Branch:
kytv:test/9317-pidgin-focus-conversation
Type of work:
Code
Blueprint:

Starter:
Affected tool:
Instant Messaging
Deliverable for:

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.


Files


Subtasks


History

#1 Updated by intrigeri 2015-05-01 08:52:32

  • blocks #8538 added

#2 Updated by intrigeri 2015-05-03 08:49:16

  • Affected tool set to Instant Messaging

#3 Updated by kytv 2015-05-08 19:13:10

  • Status changed from Confirmed to In Progress

#4 Updated by kytv 2015-05-09 01:11:33

  • 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 2015-05-11 05:20:02

  • 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 2015-05-11 16:16:05

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

#7 Updated by kytv 2015-05-11 19:52:56

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 2015-05-12 05:33:20

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 2015-05-12 22:49:31

  • 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 2015-05-12 23:18:14

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

#11 Updated by kytv 2015-05-14 12:50:38

  • 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 2015-05-14 13:43:27

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

#13 Updated by kytv 2015-05-14 13:50:40

  • 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 2015-05-26 15:35:19

  • 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 Bug #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 2015-05-26 19:03:30

  • 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 Bug #9317#note-14 may be moot, but from the look of it, they shouldn’t be.

#16 Updated by anonym 2015-05-27 06:44:46

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

> My comments in Bug #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 2015-05-28 19:10:04

anonym wrote:
> > My comments in Bug #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 2015-05-28 19:41:18

anonym wrote:
>
> IMHO, it may still be worth investigating my suggestion in Bug #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 2015-06-21 11:34:05

  • 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 Bug #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 2015-06-22 00:51:14

  • Assignee changed from anonym to intrigeri

#21 Updated by kytv 2015-06-22 03:15:29

Feature #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 Feature #9517. If this gets merged I’ll take care of the hardcoding in the other branch.

#22 Updated by intrigeri 2015-06-22 04:46:33

  • 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 2015-06-28 07:54:10

  • Status changed from Fix committed to In Progress

Applied in changeset commit:5d0fb3acfa06f2f97fa42ba10085d0250530189f.

#24 Updated by kytv 2015-06-28 07:54:10

Applied in changeset commit:43b04ff0f4e798e63c59e717429b03a7db7b8a50.

#25 Updated by intrigeri 2015-06-28 07:54:12

  • Status changed from In Progress to Fix committed

Applied in changeset commit:5f6065d9d831743b566cb5150c6c6fc3a744418e.

#26 Updated by intrigeri 2015-07-03 03:41:08

  • Status changed from Fix committed to Resolved