Merge lp:~nskaggs/ubuntu-terminal-app/fix-circle-test into lp:ubuntu-terminal-app

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 41
Merged at revision: 40
Proposed branch: lp:~nskaggs/ubuntu-terminal-app/fix-circle-test
Merge into: lp:ubuntu-terminal-app
Diff against target: 100 lines (+22/-34)
2 files modified
tests/autopilot/ubuntu_terminal_app/emulators.py (+10/-27)
tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py (+12/-7)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-terminal-app/fix-circle-test
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Łukasz Zemczak Approve
Ubuntu Terminal Developers Pending
Review via email: mp+208635@code.launchpad.net

Commit message

Fix check for circle menu test
Remove polling test emulator function

Description of the change

Fix check for circle menu test
Remove polling test emulator function

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

hm, ok wait_select_single() changes are ok, so +1 on those. Not sure about line 77.
This will fix the test but it *might* theoretically make this test broken in certain cases, like when the phone is in landscape orientation. Then the first press is done in the middle of the screen, the OSK pops up, takes up half of the screen and the longpress is not registered (because the press happens on the OSK).

review: Needs Fixing
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I wanted to see how jenkins responded as well to the changes. We can disable the OSK for the run, or select someplace outside the middle of the screen to ensure we don't run into the OSK.

41. By Nicholas Skaggs

tweak circle menu to top in top third of screen

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I did the tap on the top of the screen with the following code:

        x, y = get_center_point(kterm)
        y = kterm.y + ((y - kterm.y) / 3)
        self.pointing_device.move(x, y)
        self.pointing_device.press()

But this was using autopilot.input._common's get_center_point, which seems to be a private function. Maybe we could use center_x or center_y instead?

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

It's coooool! +1

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/ubuntu_terminal_app/emulators.py'
--- tests/autopilot/ubuntu_terminal_app/emulators.py 2013-08-14 22:40:48 +0000
+++ tests/autopilot/ubuntu_terminal_app/emulators.py 2014-02-27 17:17:43 +0000
@@ -23,54 +23,37 @@
23class MainView(toolkit_emulators.MainView):23class MainView(toolkit_emulators.MainView):
24 """Terminal MainView Autopilot emulator."""24 """Terminal MainView Autopilot emulator."""
2525
26 def _poll_for_object(self, function, timeout = 10):
27 """Wait until the function returns an object, or timesout"""
28 poll = 0
29 while function == None and poll < timeout:
30 poll += 1
31 sleep(1)
32
33 def get_main_view(self):26 def get_main_view(self):
34 self._poll_for_object(lambda: self.select_single("QQuickView"))27 return self.wait_select_single("QQuickView")
35 return self.select_single("QQuickView")
3628
37 def get_header_item(self):29 def get_header_item(self):
38 """Get the header"""30 """Get the header"""
39 self._poll_for_object(lambda: self.select_single("Header"))31 return self.wait_select_single("Header")
40 return self.select_single("Header")
4132
42 def get_slider_item(self, slider):33 def get_slider_item(self, slider):
43 self._poll_for_object(lambda: self.select_single("Slider", objectName=slider))34 return self.wait_select_single("Slider", objectName=slider)
44 return self.select_single("Slider", objectName=slider)
4535
46 def get_kterm(self):36 def get_kterm(self):
47 self._poll_for_object(lambda: self.select_single("KTerminalDisplay", objectName="kterm"))37 return self.wait_select_single("KTerminalDisplay", objectName="kterm")
48 return self.select_single("KTerminalDisplay", objectName="kterm")
4938
50 def get_control_panel(self):39 def get_control_panel(self):
51 self._poll_for_object(lambda: self.select_single("CtrlKeys", objectName="kbCtrl"))40 return self.wait_select_single("CtrlKeys", objectName="kbCtrl")
52 return self.select_single("CtrlKeys", objectName="kbCtrl")
5341
54 def get_function_panel(self):42 def get_function_panel(self):
55 self._poll_for_object(lambda: self.select_single("FnKeys", objectName="kbFn"))43 return self.wait_select_single("FnKeys", objectName="kbFn")
56 return self.select_single("FnKeys", objectName="kbFn")
5744
58 def get_scroll_panel(self):45 def get_scroll_panel(self):
59 self._poll_for_object(lambda: self.select_single("ScrlKeys", objectName="kbScrl"))46 return self.wait_select_single("ScrlKeys", objectName="kbScrl")
60 return self.select_single("ScrlKeys", objectName="kbScrl")
6147
62 def get_terminal_page(self):48 def get_terminal_page(self):
63 self._poll_for_object(lambda: self.select_single("Terminal", objectName="pgTerm"))49 return self.wait_select_single("Terminal", objectName="pgTerm")
64 return self.select_single("Terminal", objectName="pgTerm")
6550
66 def get_circle_menu(self):51 def get_circle_menu(self):
67 self._poll_for_object(lambda: self.select_single("CircleMenu", objectName="cmenu"))52 return self.wait_select_single("CircleMenu", objectName="cmenu")
68 return self.select_single("CircleMenu", objectName="cmenu")
6953
70 def get_panel_actions_popover(self):54 def get_panel_actions_popover(self):
71 """Return the ActionSelectionPopover emulator of the popup action."""55 """Return the ActionSelectionPopover emulator of the popup action."""
72 self._poll_for_object(lambda: self.select_single(ActionSelectionPopover, objectName='panelpopover'))56 return self.wait_select_single(ActionSelectionPopover, objectName='panelpopover')
73 return self.select_single(ActionSelectionPopover, objectName='panelpopover')
7457
75 def drag_horizontal_slider(self, slider, pos):58 def drag_horizontal_slider(self, slider, pos):
76 """Drag slider until value is set"""59 """Drag slider until value is set"""
7760
=== modified file 'tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py'
--- tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-01-07 16:35:37 +0000
+++ tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-02-27 17:17:43 +0000
@@ -113,15 +113,20 @@
113 """Make sure that Circle Menu is visible113 """Make sure that Circle Menu is visible
114 on long tap"""114 on long tap"""
115 kterm = self.main_view.get_terminal_page()115 kterm = self.main_view.get_terminal_page()
116 #in order to ensure the longtap is pressed, we click and wait for OSK to appear116 x, y, w, h = kterm.globalRect
117 self.pointing_device.click_object(kterm)117 tap_x = (x + w ) / 2
118 sleep(2)118 tap_y = (y + h ) / 3
119 self.pointing_device.move_to_object(kterm)119
120 #tap in the top third of the screen, to avoid OSK
121 self.pointing_device.move(tap_x, tap_y)
120 self.pointing_device.press()122 self.pointing_device.press()
121 sleep(2)123 #we can hold the press for a long time without issue
124 #so we'll ensure the app recieves our signal when under load
125 sleep(4)
122 self.pointing_device.release()126 self.pointing_device.release()
123 menu = lambda: self.main_view.get_circle_menu().visible127
124 self.assertThat(menu, Eventually(Equals(True)))128 menu = self.main_view.get_circle_menu()
129 self.assertThat(menu.visible, Eventually(Equals(True)))
125130
126 def test_header(self):131 def test_header(self):
127 """Make sure that Header is visible132 """Make sure that Header is visible

Subscribers

People subscribed via source and target branches