test_looses_focus_when_reloading fails when run on desktop

Bug #1417118 reported by Olivier Tilloy on 2015-02-02
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Olivier Tilloy
ubuntu-ui-toolkit (Ubuntu)
webbrowser-app (Ubuntu)
Olivier Tilloy

Bug Description

Recently, the otto tests started runnning successfully again for the webbrowser-app CI job (they had been broken for a long time).

Now they all pass but one:


I’m attaching the test result output as well as a video capture of what happens when the test is run.

It appears that clicking the reload button in the address bar doesn’t activate the reload action, but instead shows the contextual menu as if the click had gone through to the TextField below.

Related branches

Olivier Tilloy (osomon) wrote :
Olivier Tilloy (osomon) wrote :

I am able to reproduce the issue in an up-to-date vivid VM.

Changed in webbrowser-app:
status: New → Confirmed
Olivier Tilloy (osomon) wrote :

Added an ubuntu-ui-toolkit task as I suspect it could be a UITK regression.

Olivier Tilloy (osomon) wrote :

I cannot reproduce the issue by manually executing the test case in the same vivid VM that reproduces it when running the autopilot test. There is no apparent difference in the automated test and the steps I’m taking to reproduce:

 - launch webbrowser-app, wait for page to be loaded
 - click in the address bar to focus it, the entire address is selected (no context menu shown)
 - move the cursor to the center of the reload icon, click

(see http://bazaar.launchpad.net/~phablet-team/webbrowser-app/trunk/view/head:/tests/autopilot/webbrowser_app/tests/test_addressbar_states.py#L46 for the automated test code)

Zsombor Egri (zsombi) wrote :

The text selection is made programatically by the WebBrowser, and the context menu appears right after the click happens over the refresh button.

The failure happens only on AP tests, we could not reproduce it manually.

Changed in ubuntu-ui-toolkit (Ubuntu):
importance: Undecided → High
status: New → Confirmed
assignee: nobody → Christian Dywan (kalikiana)
Olivier Tilloy (osomon) wrote :

I’m observing something interesting (and really puzzling). If in the autopilot test I replace this code:



        action_button.globalRect.x + action_button.width * 0.5,
        action_button.globalRect.y + action_button.height * 0.5)

The bug still happens.
But if I now replace 0.5 in the calculations above by 0.49999, the test passes.

There is something fishy going on with mouse coordinates.

Olivier Tilloy (osomon) wrote :

It seems making the test click anywhere in the rightmost half of the reload button (x >= 0.5 × width) makes it fail, whereas clicking anywhere in the leftmost half (x < 0.5 × width) makes it pass.

This doesn’t happen when interacting with the app manually.

Leo Arias (elopio) wrote :

After some digging, it seems that creating the Touch device is causing the weird behaviour.

To reproduce, do this in a terminal:

$ python3
Python 3.4.2 (default, Dec 27 2014, 23:37:21)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from autopilot.input._uinput import Touch
>>> Touch.create()
<autopilot.input._uinput.Touch object at 0x7f3571933e80>

In a different terminal, do:

elopio@tangamandapio76-desktop:~/workspace/canonical/webbrowser-app/trunk$ ./src/app/webbrowser/webbrowser-app --new-session http://www.ubuntu.com/download

Wait for the page to load. Click the url bar so the refresh button appears. Now click the refresh button a little to the right from the center, and you will see what osomon attached in his video.

Olivier Tilloy (osomon) on 2015-02-04
Changed in webbrowser-app:
assignee: nobody → Olivier Tilloy (osomon)
Olivier Tilloy (osomon) wrote :

Unfortunately removing autopilot-touch from the runtime deps doesn’t fix the issue, as python3-evdev is still pulled in as a recommends of python3-autopilot (it seems that apt-get installs the recommends by default).

I wonder if python3-evdev should be removed from the list of recommends of python3-autopilot?

Olivier Tilloy (osomon) wrote :

It seems the issue stems from the workaround for bug #1297592 in autopilot, rather than from the actual presence of python3-evdev.
That workaround always tries to create a touch device unconditionally, which seems wrong (see http://bazaar.launchpad.net/~autopilot/autopilot/trunk/view/head:/autopilot/testcase.py#L168).
If python3-evdev is not present on the system, I assume the touch device creation fails, and thus the tests pass.

Olivier Tilloy (osomon) wrote :

I think I (finally) found the culprit. When the entire text in the address bar is selected (which happens programatically when giving focus to the address bar), the TextField widget displays selection handles to allow the user to resize the selection. The mouse areas to interact with them are wider than the actual handles, and the left one overlaps with the action button. I’m attaching a screenshot that demonstrates this visually (I added a semi-transparent green rectangle that outlines the mouse areas for the handles).

Changed in ubuntu-ui-toolkit (Ubuntu):
status: Confirmed → Invalid
assignee: Christian Dywan (kalikiana) → nobody
Olivier Tilloy (osomon) on 2015-02-17
Changed in webbrowser-app:
importance: Undecided → High
status: Confirmed → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package webbrowser-app - 0.23+15.04.20150217.1-0ubuntu1

webbrowser-app (0.23+15.04.20150217.1-0ubuntu1) vivid; urgency=medium

  [ CI Train Bot ]
  * New rebuild forced.

  [ Olivier Tilloy ]
  * Honour Window.close() requests.
  * Work around autopilot test failure by ensuring that the selection is
    cleared before clicking on the action button. (LP: #1417118)
  * Add a config option to allow users to turn off automatic session
 -- CI Train Bot <email address hidden> Tue, 17 Feb 2015 20:54:17 +0000

Changed in webbrowser-app (Ubuntu):
status: New → Fix Released
Olivier Tilloy (osomon) on 2015-02-18
Changed in webbrowser-app:
status: In Progress → Fix Released
Changed in webbrowser-app (Ubuntu):
assignee: nobody → Olivier Tilloy (osomon)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers