Many autopilot tests will fail if the orientation of the app is landscape on startup

Bug #1337284 reported by Brendan Donegan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qtubuntu-sensors
Fix Released
Undecided
Brendan Donegan
webbrowser-app
Invalid
Undecided
Unassigned
qtubuntu-sensors (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

There are a lot of failures in webbrowser-app recently that have this common cause:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/webbrowser_app/tests/test_tabs.py", line 160, in test_error_only_for_current_tab
    self.ensure_activity_view_visible()
  File "/usr/lib/python3/dist-packages/webbrowser_app/tests/__init__.py", line 164, in ensure_activity_view_visible
    self.main_window.open_toolbar().click_button("activityButton")
  File "/usr/lib/python3/dist-packages/autopilot/logging.py", line 46, in inner
    return f(instance, *args, **kwargs)
  File "/home/phablet/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py", line 59, in open_toolbar
    return self.get_toolbar().open()
  File "/usr/lib/python3/dist-packages/autopilot/logging.py", line 46, in inner
    return f(instance, *args, **kwargs)
  File "/home/phablet/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py", line 41, in open
    self.opened.wait_for(True)
  File "/usr/lib/python3/dist-packages/autopilot/introspection/types.py", line 181, in wait_for
    failure_msg))
AssertionError: After 10.0 seconds test on Panel.opened failed: True != dbus.Boolean(False, variant_level=1)

After a bit of a stroke of luck, we finally realised this happens because when the app starts, even though the phone is lying flat, the app orients itself in landscape mode. This is an issue because currently the toolbar cannot be revealed when the web browser is in landscape mode. We could fix these failures in a number of ways, either by fixing unity so that the toolbar can be revealed, or by ensuring somehow that the app starts in portrait mode.

Related branches

tags: added: qa-broken-test qa-daily-testing qa-landing-email
Revision history for this message
Olivier Tilloy (osomon) wrote :

I don’t think this issue should be worked around in the browser app. It’s an issue in the shell, and it should be fixed there. It has existed since the very beginning, and it affects all applications that react to orientation changes and expose some sort of functionality through the bottom edge.

Note that webbrowser-app uses the standard MainView component from the UITK, which handles orientation changes under the hood, so I don’t think we can hack it to force portrait mode. Besides, even if we could, it wouldn’t make sense to break the UX (starting in portrait mode while in landscape orientation is unexpected) to make the tests more reliable.

What about the orientation sensor’s sensitivity? It looks like this is a relatively recent regression, couldn’t it be fixed/improved there?

Finally, have we considered a setup where test devices are standing upright, to prevent this from happening at all?

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

The short term workaround would definitely be to elevate the devices during testing. Note that even a small gradient (like resting an object underneath the top of the device) prevents it launching in landscape mode, so the devices do not need to be fully standing. In the long term, probably there is a bug to fix somewhere in the shell/sensors, but it's worth noting that when I launch the web browser from the shell it never launches in landscape mode, even when lying flat - so the test is doing something a bit different (not sure what)

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Note that this bug is mainly for tracking the issue and not an indictment on webbrowser-app as being at fault. It will hopefully be moved to a more appropriate place in due course.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

I can reproduce this like this:

/usr/bin/webbrowser-app -testability --desktop_file_hint=/usr/share/applications/webbrowser-app.desktop http://people.canonical.com/~brendan-donegan/browse.html

This is how autopilot launches the web browser from the test.

If I remove -testability:

/usr/bin/webbrowser-app --desktop_file_hint=/usr/share/applications/webbrowser-app.desktop http://people.canonical.com/~brendan-donegan/browse.html

Then it stays in portrait mode.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I can’t reproduce this here on N7. My device is lying on a (mostly) flat surface, and the -testability switch doesn’t seem to make any difference (I’m having a hard time imagining how it possibly could).

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

I haven't tried on flo yet - I'm currently focused on mako as I don't have time to try things on both. Even on mako this doesn't happen every time, with the -testability switch. I know it's hard to imagine - it's baffling me as well, but this does seem to be the case.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

A couple of findings on this over the weekend while debugging in the qtubuntu-sensors code.

1.) Adding to many qDebug statements in the code causes the unit tests to fail. This suggests the code is timing sensitive.
2.) Maybe related - this section of code is found in the core_orientation_sensor.cpp code:

int nearestRotation = 0;

void core::OrientationSensor::onAccelerometerReadingChanged(QSharedPointer<QAccelerometerReading> reading)
{

i.e. nearestRotation is defined outside any function. I'm not sure if this is intended/necessary, but it certainly looks wrong.

Changed in webbrowser-app:
status: New → Invalid
Changed in qtubuntu-sensors:
status: New → In Progress
assignee: nobody → Brendan Donegan (brendan-donegan)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtubuntu-sensors - 0.6+14.10.20140707-0ubuntu1

---------------
qtubuntu-sensors (0.6+14.10.20140707-0ubuntu1) utopic; urgency=low

  [ Brendan Donegan ]
  * Initialize m_last{X,Y,Z} to avoid faulty values (LP: #1337284)
 -- Ubuntu daily release <email address hidden> Mon, 07 Jul 2014 21:49:14 +0000

Changed in qtubuntu-sensors (Ubuntu):
status: New → Fix Released
Changed in qtubuntu-sensors:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.