Merge lp:~veebers/unity8/adding-extra-helpers-from-sanity into lp:unity8

Proposed by Christopher Lee
Status: Work in progress
Proposed branch: lp:~veebers/unity8/adding-extra-helpers-from-sanity
Merge into: lp:unity8
Prerequisite: lp:~canonical-platform-qa/unity8/click_item_with_swipe
Diff against target: 110 lines (+35/-9)
3 files modified
tests/autopilot/unity8/shell/emulators/dash.py (+26/-7)
tests/autopilot/unity8/shell/tests/__init__.py (+3/-2)
tests/autopilot/unity8/shell/tests/test_emulators.py (+6/-0)
To merge this branch: bzr merge lp:~veebers/unity8/adding-extra-helpers-from-sanity
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Brendan Donegan (community) Needs Fixing
Review via email: mp+256419@code.launchpad.net

Commit message

Upstreaming required helpers that originate from the Ubuntu sanity test suite.

Description of the change

Upstreaming required helpers that originate from the Ubuntu sanity test suite.

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
Brendan Donegan (brendan-donegan) wrote :

I suppose we need to add some tests using these two helpers to unity8

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

Yes, using swipe to top in a test would be good.

In the case of wait_for_processing_to_complete, it should replace the other calls to the same statement in dash.py. Then it will be used in tests.

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

Text conflict in tests/autopilot/unity8/shell/emulators/dash.py
1 conflicts encountered.

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

Text conflict in tests/autopilot/unity8/shell/emulators/dash.py
1 conflicts encountered.

1525. By Christopher Lee

Merge trunk + resolve conflict

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

Please clean your tags as described in https://wiki.ubuntu.com/Process/Merges/Checklists/Unity8

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

Text conflict in tests/autopilot/unity8/shell/emulators/dash.py
1 conflicts encountered.

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

No work on it for over two months, i'll set it to Work In Progress to clear the dashboard a bit.

Unmerged revisions

1525. By Christopher Lee

Merge trunk + resolve conflict

1524. By Christopher Lee

Added wait_for_processing_to_complete to Dash CPO.

1523. By Christopher Lee

Add swipe_to_top method to GenericScopeView

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity8/shell/emulators/dash.py'
2--- tests/autopilot/unity8/shell/emulators/dash.py 2015-04-28 15:20:13 +0000
3+++ tests/autopilot/unity8/shell/emulators/dash.py 2015-05-22 15:41:49 +0000
4@@ -72,6 +72,10 @@
5 return self.dash_content_list.wait_select_single(
6 'QQuickLoader', objectName=("scopeLoader%i" % scope_index))
7
8+ def wait_for_processing_to_complete(self):
9+ self.select_single(
10+ objectName='processingIndicator').visible.wait_for(False)
11+
12 @autopilot_logging.log_action(logger.info)
13 def open_scope(self, scope_id):
14 """Open a dash scope.
15@@ -185,14 +189,17 @@
16
17
18 class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
19- pass
20+
21+ # Overriden because the margin to start the swipe is bigger than in the
22+ # other apps. --elopio - 2014-12-11
23+ margin_to_swipe_from_bottom = 50
24
25
26 class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
27 """Autopilot emulator for generic scopes."""
28
29 @autopilot_logging.log_action(logger.info)
30- def open_preview(self, category, app_name):
31+ def open_preview(self, category, app_name, press_duration=0.10):
32 """Open the preview of an application.
33
34 :parameter category: The name of the category where the application is.
35@@ -203,16 +210,25 @@
36 # FIXME some categories need a long press in order to see the preview.
37 # Some categories do not show previews, like recent apps.
38 # --elopio - 2014-1-14
39- self.click_scope_item(category, app_name)
40+ self.click_scope_item(category, app_name, press_duration)
41 preview_list = self.wait_select_single(
42 'QQuickLoader', objectName='subPageLoader')
43 preview_list.subPageShown.wait_for(True)
44 preview_list.x.wait_for(0)
45+ self.get_root_instance().select_single(
46+ objectName='processingIndicator').visible.wait_for(False)
47 return preview_list.select_single(
48 Preview, objectName='preview{}'.format(preview_list.currentIndex))
49
50 @autopilot_logging.log_action(logger.debug)
51- def click_scope_item(self, category, title):
52+ def swipe_to_top(self):
53+ """Swipe to the top of the scope."""
54+ list_view = self.select_single(
55+ ListViewWithPageHeader, objectName='categoryListView')
56+ list_view.swipe_to_top()
57+
58+ @autopilot_logging.log_action(logger.debug)
59+ def click_scope_item(self, category, title, press_duration=0.10):
60 """Click an item from the scope.
61
62 :parameter category: The name of the category where the item is.
63@@ -220,9 +236,12 @@
64
65 """
66 category_element = self._get_category_element(category)
67- icon = category_element.wait_select_single('AbstractButton',
68- title=title)
69- self.pointing_device.click_object(icon)
70+ icon = category_element.wait_select_single(
71+ 'AbstractButton', title=title)
72+ list_view = self.select_single(
73+ ListViewWithPageHeader, objectName='categoryListView')
74+ list_view.swipe_child_into_view(icon)
75+ self.pointing_device.click_object(icon, press_duration=press_duration)
76
77 def _get_category_element(self, category):
78 try:
79
80=== modified file 'tests/autopilot/unity8/shell/tests/__init__.py'
81--- tests/autopilot/unity8/shell/tests/__init__.py 2015-05-05 14:46:49 +0000
82+++ tests/autopilot/unity8/shell/tests/__init__.py 2015-05-22 15:41:49 +0000
83@@ -338,8 +338,9 @@
84 self.wait_for_dash()
85
86 def ensure_dash_not_running(self):
87- if process_helpers.is_job_running('unity8-dash'):
88- process_helpers.stop_job('unity8-dash')
89+ if model() != 'Desktop':
90+ if process_helpers.is_job_running('unity8-dash'):
91+ process_helpers.stop_job('unity8-dash')
92
93 def launch_dash(self, binary_path, variables):
94 launch_dash_app_fixture = fixture_setup.LaunchDashApp(
95
96=== modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py'
97--- tests/autopilot/unity8/shell/tests/test_emulators.py 2015-04-17 21:58:16 +0000
98+++ tests/autopilot/unity8/shell/tests/test_emulators.py 2015-05-22 15:41:49 +0000
99@@ -120,6 +120,12 @@
100 self.assertIsInstance(preview, dash_emulators.Preview)
101 self.assertTrue(preview.isCurrent)
102
103+ def test_open_preview_of_non_visible_item(self):
104+ """Open an item that requires swiping to make it visible."""
105+ preview = self.generic_scope.open_preview('2', 'Title.2.0')
106+ self.assertIsInstance(preview, dash_emulators.Preview)
107+ self.assertTrue(preview.isCurrent)
108+
109
110 class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
111

Subscribers

People subscribed via source and target branches