Merge lp:~dandrader/unity/phablet_autopilotTouchOnly into lp:unity/phablet

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Michał Sawicz
Approved revision: no longer in the source branch.
Merged at revision: 708
Proposed branch: lp:~dandrader/unity/phablet_autopilotTouchOnly
Merge into: lp:unity/phablet
Diff against target: 245 lines (+44/-57)
4 files modified
debian/control (+1/-0)
tests/autopilot/qml_phone_shell/tests/__init__.py (+4/-4)
tests/autopilot/qml_phone_shell/tests/helpers.py (+19/-29)
tests/autopilot/qml_phone_shell/tests/testcases.py (+20/-24)
To merge this branch: bzr merge lp:~dandrader/unity/phablet_autopilotTouchOnly
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michał Sawicz Approve
Albert Astals Cid (community) Approve
Review via email: mp+165666@code.launchpad.net

Commit message

Make autopilot tests use only touch instead of mouse

To better emulate what happens on real usage, as phone and tablet UIs are
touch (not mouse) operated.

Includes some minor refactoring here and there as well.

Description of the change

Make autopilot tests use only touch instead of mouse

To better emulate what happens on real usage, as phone and tablet UIs are touch (not mouse) operated.

Includes some minor refactoring here and there as well.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

In
30 - self.pointing_device.move_to_object(password_field)
31 + self.touch.tap_object(password_field)
32 self.assertThat(password_field.opacity, Eventually(Equals(1)))
33 - self.pointing_device.click()

I remember we added the opacity assert because sometimes we had problems with the click not happening, i guess it'd make sense to do the same and put the tap after the opacity assert

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> In
> 30 - self.pointing_device.move_to_object(password_field)
> 31 + self.touch.tap_object(password_field)
> 32 self.assertThat(password_field.opacity, Eventually(Equals(1)))
> 33 - self.pointing_device.click()
>
> I remember we added the opacity assert because sometimes we had problems with
> the click not happening, i guess it'd make sense to do the same and put the
> tap after the opacity assert

Fixed.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me, let's wait for CI

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Jenkins failed because of merge conflicts.

Revision history for this message
Michał Sawicz (saviq) wrote :

Please go "wrap-and-sort" in the source tree while you're at it.

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

With that change, shouldn't we drop "-mousetouch" from the autopilot calls?

review: Needs Information
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> With that change, shouldn't we drop "-mousetouch" from the autopilot calls?

It's not needed but it does no harm either.

But ok, I've removed the "-mousetouch" arguments.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Jenkins failed because of merge conflicts.

Solved. Rebased on top of latest trunk.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Please go "wrap-and-sort" in the source tree while you're at it.

Done. Put python-evdev dependency in the correct, ordered, place.

Revision history for this message
Michał Sawicz (saviq) wrote :

Pending CI.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2013-05-27 07:00:02 +0000
+++ debian/control 2013-05-29 11:59:29 +0000
@@ -67,6 +67,7 @@
67Depends: libautopilot-qt,67Depends: libautopilot-qt,
68 libqt5test5,68 libqt5test5,
69 libqt5widgets5,69 libqt5widgets5,
70 python-evdev,
70 qml-phone-shell (= ${source:Version}),71 qml-phone-shell (= ${source:Version}),
71 qml-phone-shell-fake-env (= ${source:Version}),72 qml-phone-shell-fake-env (= ${source:Version}),
72 ${misc:Depends},73 ${misc:Depends},
7374
=== modified file 'tests/autopilot/qml_phone_shell/tests/__init__.py'
--- tests/autopilot/qml_phone_shell/tests/__init__.py 2013-05-24 09:36:28 +0000
+++ tests/autopilot/qml_phone_shell/tests/__init__.py 2013-05-29 11:59:29 +0000
@@ -41,20 +41,20 @@
41 os.environ['QML2_IMPORT_PATH'] = "../../builddir/tests/mocks:../../builddir/plugins"41 os.environ['QML2_IMPORT_PATH'] = "../../builddir/tests/mocks:../../builddir/plugins"
42 if geometry != "0x0":42 if geometry != "0x0":
43 self.app = self.launch_test_application(43 self.app = self.launch_test_application(
44 "../../builddir/qml-phone-shell", "-geometry", geometry, "-frameless", "-mousetouch")44 "../../builddir/qml-phone-shell", "-geometry", geometry, "-frameless")
45 else:45 else:
46 self.app = self.launch_test_application(46 self.app = self.launch_test_application(
47 "../../builddir/qml-phone-shell", "-fullscreen", "-mousetouch")47 "../../builddir/qml-phone-shell", "-fullscreen")
4848
49 def launch_test_installed(self, geometry):49 def launch_test_installed(self, geometry):
50 os.environ['LD_LIBRARY_PATH'] = "/usr/share/qml-phone-shell/plugins/mocks/LightDM/full"50 os.environ['LD_LIBRARY_PATH'] = "/usr/share/qml-phone-shell/plugins/mocks/LightDM/full"
51 os.environ['QML2_IMPORT_PATH'] = "/usr/share/qml-phone-shell/plugins/mocks:/usr/share/qml-phone-shell/plugins"51 os.environ['QML2_IMPORT_PATH'] = "/usr/share/qml-phone-shell/plugins/mocks:/usr/share/qml-phone-shell/plugins"
52 if model() == 'Desktop' and geometry != "0x0":52 if model() == 'Desktop' and geometry != "0x0":
53 self.app = self.launch_test_application(53 self.app = self.launch_test_application(
54 "qml-phone-shell", "-geometry", geometry, "-frameless", "-mousetouch")54 "qml-phone-shell", "-geometry", geometry, "-frameless")
55 else:55 else:
56 self.app = self.launch_test_application(56 self.app = self.launch_test_application(
57 "qml-phone-shell", "-fullscreen", "-mousetouch")57 "qml-phone-shell", "-fullscreen")
5858
59 def skipWrapper(*args, **kwargs):59 def skipWrapper(*args, **kwargs):
60 pass60 pass
6161
=== modified file 'tests/autopilot/qml_phone_shell/tests/helpers.py'
--- tests/autopilot/qml_phone_shell/tests/helpers.py 2013-05-23 18:07:17 +0000
+++ tests/autopilot/qml_phone_shell/tests/helpers.py 2013-05-29 11:59:29 +0000
@@ -44,8 +44,7 @@
44 if target_user is None:44 if target_user is None:
45 break45 break
46 user_label = target_user.get_children_by_type("Label")[0]46 user_label = target_user.get_children_by_type("Label")[0]
47 self.pointing_device.move_to_object(user_label)47 self.touch.tap_object(user_label)
48 self.pointing_device.click()
49 self.assertThat(path_view.movingInternally, Eventually(Equals(False)))48 self.assertThat(path_view.movingInternally, Eventually(Equals(False)))
50 if user_label.text == username:49 if user_label.text == username:
51 return login_list.get_children_by_type("TextField")[0]50 return login_list.get_children_by_type("TextField")[0]
@@ -58,9 +57,8 @@
5857
59 if greeter.multiUser:58 if greeter.multiUser:
60 password_field = self.select_greeter_user("No Password")59 password_field = self.select_greeter_user("No Password")
61 self.pointing_device.move_to_object(password_field)
62 self.assertThat(password_field.opacity, Eventually(Equals(1)))60 self.assertThat(password_field.opacity, Eventually(Equals(1)))
63 self.pointing_device.click()61 self.touch.tap_object(password_field)
6462
65 else:63 else:
66 rect = greeter.globalRect64 rect = greeter.globalRect
@@ -68,10 +66,7 @@
68 start_y = int(rect[1] + rect[3] / 2)66 start_y = int(rect[1] + rect[3] / 2)
69 stop_x = int(rect[0] + rect[2] * 0.2)67 stop_x = int(rect[0] + rect[2] * 0.2)
70 stop_y = start_y68 stop_y = start_y
71 self.pointing_device.move(start_x, start_y)69 self.touch.drag(start_x, start_y, stop_x, stop_y)
72 self.pointing_device.press()
73 self.pointing_device.move(stop_x, stop_y)
74 self.pointing_device.release()
7570
76 # Because the shell loads up lots of stuff, unlocking the greeter can71 # Because the shell loads up lots of stuff, unlocking the greeter can
77 # be a bit stuttery while lenses are still consuming all resources.72 # be a bit stuttery while lenses are still consuming all resources.
@@ -93,8 +88,7 @@
93 self.assertThat(app_grid.get_children()[0].totalContentHeight, Eventually(NotEquals(0)))88 self.assertThat(app_grid.get_children()[0].totalContentHeight, Eventually(NotEquals(0)))
94 self.assertThat(app_grid.get_children()[0].height, Eventually(Equals(app_grid.get_children()[0].totalContentHeight)))89 self.assertThat(app_grid.get_children()[0].height, Eventually(Equals(app_grid.get_children()[0].totalContentHeight)))
95 first_app = app_grid.get_children()[0].get_children()[0].get_children()[0].get_children()[0]90 first_app = app_grid.get_children()[0].get_children()[0].get_children()[0].get_children()[0]
96 self.pointing_device.move_to_object(first_app)91 self.touch.tap_object(first_app)
97 self.pointing_device.click()
98 bottombar = self.main_window.get_bottombar()92 bottombar = self.main_window.get_bottombar()
9993
100 # if we have huge amounts of pixels (e.g. Nexus10), but slow video (e.g. VM) it might take a little94 # if we have huge amounts of pixels (e.g. Nexus10), but slow video (e.g. VM) it might take a little
@@ -116,30 +110,31 @@
116110
117 hud_show_button = self.main_window.get_hud_show_button()111 hud_show_button = self.main_window.get_hud_show_button()
118 hud = self.main_window.get_hud()112 hud = self.main_window.get_hud()
119 rect = hud.globalRect113 window = self.main_window.get_qml_view()
120 start_x = int(rect[0] + rect[2] / 2)114 start_x = int(window.x + window.width / 2)
121 start_y = rect[1] + rect[3] - 1115 start_y = window.y + window.height - 3
122 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))116 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
123 self.pointing_device.move(start_x, start_y)117 self.touch.press(start_x, start_y)
124 self.pointing_device.press()118 self.touch._finger_move(start_x, start_y - self.grid_size)
125 self.pointing_device.move(start_x, start_y - self.grid_size)119 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
126 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))120 self.touch._finger_move(start_x, start_y - self.grid_size * 2)
127 self.pointing_device.move(start_x, start_y - self.grid_size * 2)121 self.touch._finger_move(start_x, start_y - self.grid_size * 3)
122 self.touch._finger_move(start_x, start_y - self.grid_size * 4)
128 try:123 try:
129 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))124 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
130 except:125 except:
131 if retries > 0:126 if retries > 0:
132 logger.warning("Failed to get hud button to show. Retrying...")127 logger.warning("Failed to get hud button to show. Retrying...")
133 self.pointing_device.release()128 self.touch.release()
134 self.show_hud(retries-1)129 self.show_hud(retries-1)
135 return130 return
136 else:131 else:
137 logger.warning("Failed to get hud button to show. Giving up. Tests may fail...")132 logger.warning("Failed to get hud button to show. Giving up. Tests may fail...")
138 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))133 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
139 self.pointing_device.move(start_x, start_y - self.grid_size * 34)134 self.touch._finger_move(start_x, start_y - self.grid_size * 34)
140 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))135 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
141 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(True)))136 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(True)))
142 self.pointing_device.release()137 self.touch.release()
143 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))138 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
144 self.assertThat(hud.shown, Eventually(Equals(True)))139 self.assertThat(hud.shown, Eventually(Equals(True)))
145140
@@ -149,8 +144,7 @@
149 rect = hud.globalRect144 rect = hud.globalRect
150 x = int(rect[0] + rect[2] / 2)145 x = int(rect[0] + rect[2] / 2)
151 y = rect[1] + self.grid_size146 y = rect[1] + self.grid_size
152 self.pointing_device.move(x, y)147 self.touch.tap(x, y)
153 self.pointing_device.click()
154 self.assertThat(hud.shown, Eventually(Equals(False)))148 self.assertThat(hud.shown, Eventually(Equals(False)))
155149
156 def show_launcher(self):150 def show_launcher(self):
@@ -160,9 +154,5 @@
160 start_y = view.y + view.height / 2154 start_y = view.y + view.height / 2
161 stop_x = start_x + launcher.shortcutsWidth + 1155 stop_x = start_x + launcher.shortcutsWidth + 1
162 stop_y = start_y156 stop_y = start_y
163 self.pointing_device.move(start_x, start_y)157 self.touch.drag(start_x, start_y, stop_x, stop_y)
164 self.pointing_device.press()
165 self.pointing_device.move(stop_x, stop_y)
166 self.assertThat(launcher.state, Eventually(Equals("spreadMoving")))
167 self.pointing_device.release()
168 self.assertThat(launcher.shown, Eventually(Equals(True)))158 self.assertThat(launcher.shown, Eventually(Equals(True)))
169159
=== modified file 'tests/autopilot/qml_phone_shell/tests/testcases.py'
--- tests/autopilot/qml_phone_shell/tests/testcases.py 2013-05-14 14:27:05 +0000
+++ tests/autopilot/qml_phone_shell/tests/testcases.py 2013-05-29 11:59:29 +0000
@@ -52,22 +52,19 @@
5252
53 if model() == 'Desktop':53 if model() == 'Desktop':
54 scenarios = [54 scenarios = [
55 # Nexus455 ('Nexus 4', dict(app_width=768, app_height=1280, grid_unit_px=18)),
56 ('with mouse', dict(input_device_class=Mouse, app_width=768, app_height=1280, grid_unit_px=18)),56 ('Nexus 10', dict(app_width=2560, app_height=1600, grid_unit_px=20)),
57 # Nexus10
58 ('with mouse', dict(input_device_class=Mouse, app_width=2560, app_height=1600, grid_unit_px=20)),
59# TODO: don't run fullscreen tests just yet as the VM is performing too badly for that. Enable this once57# TODO: don't run fullscreen tests just yet as the VM is performing too badly for that. Enable this once
60# Autopilot tests are running on bear metal.58# Autopilot tests are running on bear metal.
61# ('with mouse', dict(input_device_class=Mouse, app_width=0, app_height=0, grid_unit_px=10)),59# ('Fullscreen', dict(app_width=0, app_height=0, grid_unit_px=10)),
62 ]60 ]
63 else:61 else:
64 scenarios = [62 scenarios = [
65 # Fullscreen63 ('Fullscreen', dict(app_width=0, app_height=0, grid_unit_px=0)),
66 ('with touch', dict(input_device_class=Touch, app_width=0, app_height=0, grid_unit_px=0)),
67 ]64 ]
6865
69 def setUp(self):66 def setUp(self):
70 self.pointing_device = Pointer(self.input_device_class.create())67 self.touch = Touch.create()
7168
72 sg = Display().create()69 sg = Display().create()
73 divisor = 170 divisor = 1
@@ -89,24 +86,25 @@
89 self.open_first_dash_home_app()86 self.open_first_dash_home_app()
90 hud_show_button = self.main_window.get_hud_show_button()87 hud_show_button = self.main_window.get_hud_show_button()
91 hud = self.main_window.get_hud()88 hud = self.main_window.get_hud()
92 rect = hud.globalRect89 window = self.main_window.get_qml_view()
93 start_x = int(rect[0] + rect[2] / 2)90 start_x = int(window.x + window.width / 2)
94 start_y = rect[1] + rect[3] - 191 start_y = window.y + window.height - 2
95 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))92 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
96 self.pointing_device.move(start_x, start_y)93 self.touch.press(start_x, start_y)
97 self.pointing_device.press()94 self.touch._finger_move(start_x, start_y - self.grid_size)
98 self.pointing_device.move(start_x, start_y - self.grid_size)95 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
99 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))96 self.touch._finger_move(start_x, start_y - self.grid_size * 2)
100 self.pointing_device.move(start_x, start_y - self.grid_size * 2)97 self.touch._finger_move(start_x, start_y - self.grid_size * 3)
98 self.touch._finger_move(start_x, start_y - self.grid_size * 4)
101 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))99 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
102 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))100 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
103 self.pointing_device.move(start_x, start_y - self.grid_size * 34)101 self.touch._finger_move(start_x, start_y - self.grid_size * 34)
104 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))102 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
105 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(True)))103 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(True)))
106 self.pointing_device.move(start_x, start_y - self.grid_size)104 self.touch._finger_move(start_x, start_y - self.grid_size)
107 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))105 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
108 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))106 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
109 self.pointing_device.release()107 self.touch.release()
110 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))108 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
111 self.assertThat(hud.shown, Eventually(Equals(False)))109 self.assertThat(hud.shown, Eventually(Equals(False)))
112110
@@ -124,8 +122,7 @@
124 rect = hud.globalRect122 rect = hud.globalRect
125 x = int(rect[0] + rect[2] / 2)123 x = int(rect[0] + rect[2] / 2)
126 y = rect[1] + hud.handleHeight + 1124 y = rect[1] + hud.handleHeight + 1
127 self.pointing_device.move(x, y)125 self.touch.tap(x, y)
128 self.pointing_device.click()
129 self.assertRaises(MismatchError, lambda: self.assertThat(hud.shown, Eventually(Equals(False), timeout=3)))126 self.assertRaises(MismatchError, lambda: self.assertThat(hud.shown, Eventually(Equals(False), timeout=3)))
130127
131 def test_hide_hud_dragging(self):128 def test_hide_hud_dragging(self):
@@ -137,11 +134,10 @@
137 start_y = rect[1] + 1134 start_y = rect[1] + 1
138 stop_x = start_x135 stop_x = start_x
139 stop_y = start_y + (rect[3] - rect[1]) / 2136 stop_y = start_y + (rect[3] - rect[1]) / 2
140 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)137 self.touch.drag(start_x, start_y, stop_x, stop_y)
141 self.assertThat(hud.shown, Eventually(Equals(False)))138 self.assertThat(hud.shown, Eventually(Equals(False)))
142139
143 def test_hide_hud_launcher(self):140 def test_hide_hud_launcher(self):
144 launcher = self.main_window.get_hud()
145 hud = self.main_window.get_hud()141 hud = self.main_window.get_hud()
146 self.unlock_greeter()142 self.unlock_greeter()
147 self.show_hud()143 self.show_hud()

Subscribers

People subscribed via source and target branches