Merge lp:~om26er/mediaplayer-app/imrove_autopilot_tests into lp:mediaplayer-app

Proposed by Omer Akram
Status: Merged
Merged at revision: 173
Proposed branch: lp:~om26er/mediaplayer-app/imrove_autopilot_tests
Merge into: lp:mediaplayer-app
Diff against target: 290 lines (+76/-67)
5 files modified
src/qml/player.qml (+1/-0)
tests/autopilot/mediaplayer_app/emulators/main_window.py (+35/-2)
tests/autopilot/mediaplayer_app/tests/__init__.py (+2/-5)
tests/autopilot/mediaplayer_app/tests/test_player.py (+9/-21)
tests/autopilot/mediaplayer_app/tests/test_player_with_video.py (+29/-39)
To merge this branch: bzr merge lp:~om26er/mediaplayer-app/imrove_autopilot_tests
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Renato Araujo Oliveira Filho (community) Approve
Review via email: mp+184584@code.launchpad.net

Commit message

Make autopilot test code clean

Description of the change

this branch improves the autopilot tests for the mediaplayer app. I have now created reusable emulators to select objects

=========================================================================================

As discussed on IRC I have created 2 new MR based on this one:

ADD the necessary dep to play the test video on desktop:
  *https://code.launchpad.net/~renatofilho/mediaplayer-app/add-gst-libav/+merge/193604

Replaced mp4 video to ogg video:
  *https://code.launchpad.net/~renatofilho/mediaplayer-app/use-ogg/+merge/193600

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: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Branch is now ready for review.

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: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/mediaplayer-app-autolanding/71/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/177
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/171/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-amd64-autolanding/1
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-armhf-autolanding/1
        deb: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-armhf-autolanding/1/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-i386-autolanding/1
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/166
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/177
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/177/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/171
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/171/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2794/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2845
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/628
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/627

review: Needs Fixing (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

kick a new build.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

try again

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

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/mediaplayer-app-autolanding/74/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/269
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/261/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-amd64-autolanding/4
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-armhf-autolanding/4
        deb: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-armhf-autolanding/4/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediaplayer-app-trusty-i386-autolanding/4
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/256
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/269
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/269/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/261
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/261/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2877/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2929
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/801
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/802

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/player.qml'
2--- src/qml/player.qml 2013-10-15 22:50:12 +0000
3+++ src/qml/player.qml 2013-10-21 14:31:38 +0000
4@@ -60,6 +60,7 @@
5
6 Popups.Dialog {
7 id: dialogue
8+ objectName: "noMediaDialog"
9
10 title: i18n.tr("Error")
11 text: i18n.tr("No video selected to play. Connect your phone to your computer to transfer videos to the phone. Then select video from Videos lens.")
12
13=== modified file 'tests/autopilot/mediaplayer_app/emulators/main_window.py'
14--- tests/autopilot/mediaplayer_app/emulators/main_window.py 2013-05-27 11:23:52 +0000
15+++ tests/autopilot/mediaplayer_app/emulators/main_window.py 2013-10-21 14:31:38 +0000
16@@ -16,5 +16,38 @@
17 """Get the main QML view"""
18 return self.app.select_single("QQuickView")
19
20- def get_object(self, typeName, name):
21- return self.app.select_single(typeName, objectName=name)
22+ def get_controls(self):
23+ return self.app.select_single("Controls", objectName="controls")
24+
25+ def get_video_area(self):
26+ return self.app.select_single("VideoPlayer", objectName="player")
27+
28+ def get_toolbar(self):
29+ return self.app.select_single("GenericToolbar", objectName="toolbar")
30+
31+ def get_playback_button(self):
32+ return self.app.select_single("IconButton", objectName="Controls.PlayBackButton")
33+
34+ def get_player(self):
35+ return self.app.select_single("VideoPlayer", objectName="player")
36+
37+ def get_scene_selector(self):
38+ return self.app.select_single("SceneSelector", objectName="Controls.SceneSelector")
39+
40+ def get_slider(self):
41+ return self.app.select_single("Slider", objectName="TimeLine.Slider")
42+
43+ def get_timeline(self):
44+ return self.app.select_single("TimeLine", objectName="TimeLine")
45+
46+ def get_scene_0(self):
47+ return self.app.select_single("SceneFrame", objectName="SceneSelector.Scene0")
48+
49+ def get_scene_2(self):
50+ return self.app.select_single("SceneFrame", objectName="SceneSelector.Scene2")
51+
52+ def get_time_label(self):
53+ return self.app.select_single("Label", objectName="TimeLine.TimeLabel")
54+
55+ def get_no_video_dialog(self):
56+ return self.app.select_single("Dialog", objectName="noMediaDialog")
57
58=== modified file 'tests/autopilot/mediaplayer_app/tests/__init__.py'
59--- tests/autopilot/mediaplayer_app/tests/__init__.py 2013-05-27 11:23:52 +0000
60+++ tests/autopilot/mediaplayer_app/tests/__init__.py 2013-10-21 14:31:38 +0000
61@@ -7,7 +7,6 @@
62
63 """mediaplayer-app autopilot tests."""
64
65-from os import remove
66 import os.path
67 import os
68
69@@ -26,11 +25,9 @@
70 """
71
72 if model() == 'Desktop':
73- scenarios = [
74- ('with mouse', dict(input_device_class=Mouse))]
75+ scenarios = [('with mouse', dict(input_device_class=Mouse))]
76 else:
77- scenarios = [
78- ('with touch', dict(input_device_class=Touch))]
79+ scenarios = [('with touch', dict(input_device_class=Touch))]
80
81 def setUp(self):
82 self.pointing_device = Pointer(self.input_device_class.create())
83
84=== modified file 'tests/autopilot/mediaplayer_app/tests/test_player.py'
85--- tests/autopilot/mediaplayer_app/tests/test_player.py 2013-05-27 11:23:52 +0000
86+++ tests/autopilot/mediaplayer_app/tests/test_player.py 2013-10-21 14:31:38 +0000
87@@ -14,11 +14,6 @@
88
89 from mediaplayer_app.tests import MediaplayerAppTestCase
90
91-import unittest
92-import time
93-import os
94-from os import path
95-
96
97 class TestPlayer(MediaplayerAppTestCase):
98 """Tests the main media player features"""
99@@ -34,19 +29,12 @@
100 def tearDown(self):
101 super(TestPlayer, self).tearDown()
102
103- """ Test if the toolbar appears with mouse click over the video area """
104- def test_controls_visibility(self):
105- controls = self.main_window.get_object("Controls", "controls")
106-
107- """ The toolbar is invisible by default """
108- self.assertProperty(controls, visible=False)
109-
110- """ Toolbar must apper when clicked in the video area """
111- video_area = self.main_window.get_object("VideoPlayer", "player")
112- self.pointing_device.move_to_object(video_area)
113- self.pointing_device.click()
114- self.assertProperty(controls, visible=True)
115-
116- """ Toolbar must disappear when clicked in the video area again """
117- self.pointing_device.click()
118- self.assertProperty(controls, visible=True)
119+ def test_no_video_dialog_visible(self):
120+ """ Makes sure 'No Video' dialog appears if the meidaplayer is opened
121+ without a video file argument.
122+
123+ """
124+
125+ dialog = self.main_window.get_no_video_dialog()
126+ self.assertThat(dialog.visible, Eventually(Equals(True)))
127+
128
129=== modified file 'tests/autopilot/mediaplayer_app/tests/test_player_with_video.py'
130--- tests/autopilot/mediaplayer_app/tests/test_player_with_video.py 2013-09-25 21:19:34 +0000
131+++ tests/autopilot/mediaplayer_app/tests/test_player_with_video.py 2013-10-21 14:31:38 +0000
132@@ -30,64 +30,60 @@
133 self.assertThat(
134 self.main_window.get_qml_view().visible, Eventually(Equals(True)))
135 # wait video player start
136- player = self.main_window.get_object("VideoPlayer", "player")
137+ player = self.main_window.get_player()
138 self.assertThat(player.playing, Eventually(Equals(True)))
139
140 def tearDown(self):
141 super(TestPlayerWithVideo, self).tearDown()
142
143 def show_controls(self):
144- video_area = self.main_window.get_object("VideoPlayer", "player")
145- self.pointing_device.move_to_object(video_area)
146- self.pointing_device.click()
147- toolbar = self.main_window.get_object("GenericToolbar", "toolbar")
148+ video_area = self.main_window.get_video_area()
149+ self.pointing_device.click_object(video_area)
150+ toolbar = self.main_window.get_toolbar()
151 self.assertThat(toolbar.ready, Eventually(Equals(True)))
152
153 def pause_video(self):
154- playback_buttom = self.main_window.get_object("IconButton", "Controls.PlayBackButton")
155- self.pointing_device.move_to_object(playback_buttom)
156- self.pointing_device.click()
157+ playback_button = self.main_window.get_playback_button()
158+ self.pointing_device.click_object(playback_button)
159
160- def test_playback_buttom_states(self):
161+ def test_playback_button_states(self):
162 self.show_controls()
163
164- playback_buttom = self.main_window.get_object("IconButton", "Controls.PlayBackButton")
165- player = self.main_window.get_object("VideoPlayer", "player")
166+ playback_button = self.main_window.get_playback_button()
167+ player = self.main_window.get_player()
168
169 """ Default state after load the video is playing and with pause
170 icon.
171 """
172 self.assertProperty(player, playing=True, paused=False)
173- self.assertProperty(playback_buttom, icon="pause")
174+ self.assertProperty(playback_button, icon="pause")
175
176- self.pointing_device.move_to_object(playback_buttom)
177- self.pointing_device.click()
178+ self.pointing_device.click_object(playback_button)
179
180 """ First click must pause the video, change playing state and show
181 play icon. """
182 self.assertProperty(player, playing=False, paused=True)
183- self.assertProperty(playback_buttom, icon="play")
184+ self.assertProperty(playback_button, icon="play")
185
186 self.pointing_device.click()
187
188 """ Second click should change the state to playing again """
189 self.assertProperty(player, playing=True, paused=False)
190- self.assertProperty(playback_buttom, icon="pause")
191+ self.assertProperty(playback_button, icon="pause")
192
193 @skip("New backend work needed. bug 1231147")
194 def test_scene_selector_visibility(self):
195 self.show_controls()
196 self.pause_video()
197
198- scene_selector = self.main_window.get_object("SceneSelector", "Controls.SceneSelector")
199- slider = self.main_window.get_object("Slider", "TimeLine.Slider")
200+ scene_selector = self.main_window.get_scene_selector()
201+ slider = self.main_window.get_slider()
202
203 """ Default state is hide """
204 self.assertProperty(scene_selector, visible=False)
205
206 """ Scene selector must apper when clicking int the slider handler """
207- self.pointing_device.move_to_object(slider)
208- self.pointing_device.click()
209+ self.pointing_device.click_object(slider)
210 self.assertProperty(scene_selector, visible=True)
211
212 """ click again must dismiss the scene selector """
213@@ -99,17 +95,16 @@
214 self.show_controls()
215 self.pause_video()
216
217- slider = self.main_window.get_object("Slider", "TimeLine.Slider")
218- time_line = self.main_window.get_object("TimeLine", "TimeLine")
219- selector = self.main_window.get_object("SceneSelector", "Controls.SceneSelector")
220+ slider = self.main_window.get_slider()
221+ time_line = self.main_window.get_timeline()
222+ selector = self.main_window.get_scene_selector()
223 self.assertThat(selector.count, Eventually(GreaterThan(3)))
224
225 """ Show scene selector """
226- self.pointing_device.move_to_object(slider)
227- self.pointing_device.click()
228+ self.pointing_device.click_object(slider)
229
230 """ Make sure that the scenes are in correct place """
231- scene_0 = self.main_window.get_object("SceneFrame", "SceneSelector.Scene0")
232+ scene_0 = self.main_window.get_scene_0()
233 selectorRect = selector.globalRect
234 self.pointing_device.drag(
235 selectorRect[0], selectorRect[1] + selectorRect[3] / 2,
236@@ -118,10 +113,9 @@
237 self.assertThat(scene_0.x, Eventually(Equals(0)))
238
239 """ Click in the second scene """
240- scene_2 = self.main_window.get_object("SceneFrame", "SceneSelector.Scene2")
241+ scene_2 = self.main_window.get_scene_2()
242 self.assertThat(scene_2.ready, Eventually(Equals(True)))
243- self.pointing_device.move_to_object(scene_2)
244- self.pointing_device.click()
245+ self.pointing_device.click_object(scene_2)
246 self.assertThat(selector.currentIndex, Eventually(Equals(2)))
247 self.assertProperty(time_line, value=1.107)
248
249@@ -130,35 +124,31 @@
250 self.show_controls()
251 self.pause_video()
252
253- time_line = self.main_window.get_object("Slider", "TimeLine.Slider")
254- time_label = self.main_window.get_object("Label", "TimeLine.TimeLabel")
255- scene_selector = self.main_window.get_object("SceneSelector", "Controls.SceneSelector")
256+ time_line = self.main_window.get_slider()
257+ time_label = self.main_window.get_time_label()
258
259 """ Seek to the midle of the movie """
260 self.pointing_device.click_object(time_line)
261- self.assertThat(scene_selector.opacity, Eventually(Equals(1)))
262
263 """ Time label must show the current video time (diff from zero or empty) """
264 self.assertNotEqual(time_label.text, "00:00:00")
265 self.assertNotEqual(time_label.text, "")
266
267 """ Click in the label to change the state """
268- self.pointing_device.move_to_object(time_label)
269- self.pointing_device.click()
270+ self.pointing_device.click_object(time_label)
271
272 """ After the click the label must show the remaning time (with '-' signal) """
273 self.assertEqual(time_label.text[0:1], "-")
274
275 @skipIf(model() == 'Nexus 4' or model() == 'Galaxy Nexus', 'Screen width not enough for seekbar')
276 def test_show_controls_at_end(self):
277- time_line = self.main_window.get_object("Slider", "TimeLine.Slider")
278
279 """ wait for video ends and control appears"""
280- time_label = self.main_window.get_object("Label", "TimeLine.TimeLabel")
281+ time_label = self.main_window.get_time_label()
282
283 """ avoid the test fails due the timeout """
284 self.assertThat(time_label.text, Eventually(Equals("00:00:25"), timeout=35))
285-
286- controls = self.main_window.get_object("Controls", "controls")
287+
288+ controls = self.main_window.get_controls()
289 self.assertProperty(controls, visible=False)
290 self.assertThat(controls.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches