Merge lp:~aacid/ubuntu-performance-tests/scroll_scopes_up_down_left_right into lp:ubuntu-performance-tests

Proposed by Albert Astals Cid
Status: Merged
Merged at revision: 41
Proposed branch: lp:~aacid/ubuntu-performance-tests/scroll_scopes_up_down_left_right
Merge into: lp:ubuntu-performance-tests
Diff against target: 90 lines (+53/-5)
2 files modified
kpi/dashqmlmetrics/runner.py (+7/-1)
utils/scripts/dash.py (+46/-4)
To merge this branch: bzr merge lp:~aacid/ubuntu-performance-tests/scroll_scopes_up_down_left_right
Reviewer Review Type Date Requested Status
Sergio Cazzolato Pending
Review via email: mp+295605@code.launchpad.net

Commit message

Scroll the fake scopes left/right and up/down

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'kpi/dashqmlmetrics/runner.py'
2--- kpi/dashqmlmetrics/runner.py 2016-05-19 13:54:43 +0000
3+++ kpi/dashqmlmetrics/runner.py 2016-05-24 16:15:11 +0000
4@@ -35,6 +35,9 @@
5 PACKAGES = ['unity8-common.deb', 'unity8-private.deb', 'unity8-fake-env.deb',
6 'unity8.deb', 'unity8-autopilot.deb']
7
8+# TODO How do we do ?
9+# ppa:unity-team/scopes-dev
10+# sudo apt-get install unity-scope-fake
11
12 def setup(args, install_deps):
13 if args.serial:
14@@ -49,6 +52,9 @@
15 if install_deps:
16 install_packages()
17
18+ # Set the scopes we want to test
19+ executor.execute_remote_command("gsettings set com.canonical.Unity.Dash favorite-scopes \\\"['scope://fake_films_scope', 'scope://fake_music_scope', 'scope://fake_nearby_scope', 'scope://fake_news_scope', 'scope://fake_photos_scope', 'scope://fake_today_scope', 'scope://fake_ubrick_scope', 'scope://fake_videos_scope']\\\"");
20+
21 # Copy the autopilot tests
22 executor.push_to_device(
23 executor.get_script_path_to_copy("__init__.py"),
24@@ -111,7 +117,7 @@
25
26 # Start autopilot
27 autopilot = executor.execute_remote_command_async(
28- "autopilot3 run metrics-qml.dash.PerformanceScenarios.test_search")
29+ "autopilot3 run metrics-qml.dash.PerformanceScenarios.test_metrics")
30
31 # Wait for autopilot to finish
32 logger.info("Waiting for autopilot test to finish")
33
34=== modified file 'utils/scripts/dash.py'
35--- utils/scripts/dash.py 2016-05-18 22:08:00 +0000
36+++ utils/scripts/dash.py 2016-05-24 16:15:11 +0000
37@@ -52,7 +52,49 @@
38 self.qmlprofiler.communicate("r\nq\n")
39 print("QML profiler stopped")
40
41- def test_search(self):
42- self.dash.enter_search_query('Test', self.keyboard)
43- text_field = self.dash.get_search_text_field()
44- self.assertEqual(text_field.text, 'Test')
45+ def _scroll_down(self):
46+ currentScopeLVWPH = self.dash.get_scope_by_index(self.dash.dash_content_list.currentIndex).wait_select_single('ListViewWithPageHeader')
47+
48+ while not currentScopeLVWPH.atYEnd:
49+ dash_content = self.dash.select_single(objectName="dashContent")
50+ x, y, width, height = dash_content.globalRect
51+ # Make the drag range be a multiple of the drag "rate" value.
52+ # Workarounds https://bugs.launchpad.net/mir/+bug/1399690
53+ rate = 25
54+ divisions = 5
55+ jump = (height / divisions) // rate * rate
56+ start_x = stop_x = x + 1
57+ start_y = y + jump * (divisions - 1)
58+ stop_y = y + jump * (divisions - 2)
59+ self.dash.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate)
60+ currentScopeLVWPH.moving.wait_for(False)
61+
62+ def _scroll_up(self):
63+ currentScopeLVWPH = self.dash.get_scope_by_index(self.dash.dash_content_list.currentIndex).wait_select_single('ListViewWithPageHeader')
64+
65+ while not currentScopeLVWPH.atYBeginning:
66+ dash_content = self.dash.select_single(objectName="dashContent")
67+ x, y, width, height = dash_content.globalRect
68+ # Make the drag range be a multiple of the drag "rate" value.
69+ # Workarounds https://bugs.launchpad.net/mir/+bug/1399690
70+ rate = 25
71+ divisions = 5
72+ jump = (height / divisions) // rate * rate
73+ start_x = stop_x = x + 1
74+ stop_y = y + jump * (divisions - 1)
75+ start_y = y + jump * (divisions - 2)
76+ self.dash.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate)
77+ currentScopeLVWPH.moving.wait_for(False)
78+
79+ def test_metrics(self):
80+ for i in range(7):
81+ self._scroll_down()
82+ self._scroll_up()
83+ self.dash._scroll_to_right_scope()
84+
85+ self._scroll_down()
86+ self._scroll_up()
87+
88+ for i in range(7):
89+ self.dash._scroll_to_left_scope()
90+

Subscribers

People subscribed via source and target branches