Merge lp:~dpniel/ubuntu-autopilot-tests/autopilot_1.3_totem into lp:ubuntu-autopilot-tests

Proposed by Dan Chapman 
Status: Merged
Merged at revision: 47
Proposed branch: lp:~dpniel/ubuntu-autopilot-tests/autopilot_1.3_totem
Merge into: lp:ubuntu-autopilot-tests
Diff against target: 213 lines (+67/-124)
1 file modified
ubuntu_autopilot_tests/totem/test_totem.py (+67/-124)
To merge this branch: bzr merge lp:~dpniel/ubuntu-autopilot-tests/autopilot_1.3_totem
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) Approve
Review via email: mp+167367@code.launchpad.net

Description of the change

Tests playing/pausing content.

woohoo no sleeps on this one :D

To post a comment you must log in.
48. By DanChapman <email address hidden>

Added view>playlist to ensure playlist is in sidebar

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

Thanks for making the change for the playlist.. it muddies the test and man is it annoying.. but it ensures it works :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_autopilot_tests/totem/test_totem.py'
2--- ubuntu_autopilot_tests/totem/test_totem.py 2013-04-09 20:15:16 +0000
3+++ ubuntu_autopilot_tests/totem/test_totem.py 2013-06-04 20:19:23 +0000
4@@ -1,141 +1,84 @@
5 from autopilot.testcase import AutopilotTestCase
6-from autopilot.introspection.gtk import GtkIntrospectionTestMixin
7 from autopilot.matchers import Eventually
8 from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan, Contains
9+from autopilot.input import Mouse, Touch, Pointer
10
11 from time import sleep
12 import tempfile
13 import os
14
15
16-#Register Totem as an application so we can call it
17-AutopilotTestCase.register_known_application("Videos", "totem.desktop", "totem")
18+
19 #http://packages.qa.ubuntu.com/qatracker/testcases/1429/info
20-class GtkToolbarTests(AutopilotTestCase, GtkIntrospectionTestMixin):
21+class TotemTests(AutopilotTestCase):
22
23 def setUp(self):
24 #Open Totem
25- super(GtkToolbarTests, self).setUp()
26+ super(TotemTests, self).setUp()
27 self.app = self.launch_test_application('totem')
28
29- #Verify that File-roller is open
30- #GtkApplicationWindow
31- windowTitle = self.app.select_single('GtkApplicationWindow', title='Videos')
32- self.assertThat(windowTitle.title, Eventually(Equals('Videos')))
33-
34- def test_play_video(self):
35- #Test-case name: totem/tot-001
36- # This test will check that Totem can playback a video
37-
38- #Press the F9 button
39- #GtkApplicationWindow, GtkVbox, GtkHPaned, GtkVBox, GtkVBox, GtkHBox, GtkHBox, GtkToggleButton
40- #label: S_idebar active = 1
41- self.assertThat(lambda: self.app.select_single('GtkToggleButton', label='S_idebar'), Eventually(NotEquals(None)))
42- togglePlaylistBtn = self.app.select_single('GtkToggleButton', label='S_idebar')
43- #TODO
44- #verify that playlist is not visible, if so press F9 otherwise not
45- #if self.assertProperty(togglePlaylistBtn, active = False):
46- self.keyboard.press_and_release("F9")
47-
48- #Select the add icon (+) from the dropdown list
49- #GtkApplicationWindow, GtkVbox, GtkHPaned, GtkNotebook, TotemPlaylist, GtkVBox,GtkToolBar, GtkToolButton
50- #icon_name: list-add-symbolic
51- self.assertThat(lambda: self.app.select_single('GtkToolButton', icon_name='list-add-symbolic'), Eventually(NotEquals(None)))
52- addBtn = self.app.select_single('GtkToolButton', icon_name='list-add-symbolic')
53- #let's click it
54- self.mouse.move_to_object(addBtn)
55- self.mouse.click()
56- #go to(/usr/share/example-contect/Ubuntu_Free_Culture_Showcase)
57- self.keyboard.press_and_release("Alt+d")
58- self.keyboard.type("/usr/share/example-content/Ubuntu_Free_Culture_Showcase")
59- #GtkFileChooseDialog, GtkBox, GtkButtonBox, GtkButton, GtkLabel
60- #label: Add Directory
61- #self.assertThat(lambda: self.app.select_single('GtkLabel', label='Add Directory'), Eventually(NotEquals(None)))
62- addDirectoryBtn = self.app.select_single('GtkLabel', label='Add Directory')
63- #let's click it
64- self.mouse.move_to_object(addDirectoryBtn)
65- self.mouse.click()
66- #need to pause here
67- sleep(2)
68-
69- #once there select the video (how fast.ogg)
70- #self.assertThat(lambda: self.app.select_single('GtkImageMenuItem', name='_1. How fast.ogg'), Eventually(NotEquals(None)))
71- #videoSelection = self.app.select_single('GtkImageMenuItem', name='_1. How fast.ogg')
72- #let's click it
73- #self.mouse.move_to_object(videoSelection)
74- #self.mouse.click()
75-
76- #Veriry "How fast.ogg" is playing
77- #GtkApplicationWindow
78- #title: How fast.ogg
79- self.assertThat(lambda: self.app.select_single('GtkApplicationWindow').title, Eventually(Contains('How fast.ogg')))
80- #GtkApplicationWindow, GtkVBox, TotemStatusBar, GtkFrame,GtkBox, GtkLabel
81- #label: Playing
82- self.assertThat(lambda: self.app.select_single('GtkLabel', label='Playing').label, Eventually(Contains('Playing')))
83-
84- #press the pause button
85- #Video should pause and the button becomes a play button
86- #GtkButton tooltip_markup = Play
87- #self.assertThat(lambda: self.app.select_single('GtkToolButton', label='Play/P_ause'), Eventually(NotEquals(None)))
88- #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_text='Pause'), Eventually(NotEquals(None)))
89- #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Pause'), Eventually(NotEquals(None)))
90- #pauseBtn = self.app.select_single('GtkToolButton', tooltip_markup='Pause')
91- #let's click it
92- #self.mouse.move_to_object(pauseBtn)
93- #self.mouse.click()
94- #***** returns " More than one item was returned for query" error ************
95- self.keyboard.press_and_release("Ctrl+space")
96- self.assertThat(lambda: self.app.select_single('GtkLabel', label='Paused').label, Eventually(Contains('Paused')))
97- #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Play'), Eventually(NotEquals(None)))
98-
99-
100- # Press the play button
101- #Video should begin playing
102- #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Play'), Eventually(NotEquals(None)))
103- #playBtn = self.app.select_single('GtkButton', tooltip_markup='Play')
104- #let's click it
105- #self.mouse.move_to_object(pauseBtn)
106- #self.mouse.click()
107- #***** returns " More than one item was returned for query" error ************
108- self.keyboard.press_and_release("Ctrl+space")
109- self.assertThat(lambda: self.app.select_single('GtkLabel', label='Playing').label, Eventually(Contains('Playing')))
110- #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Pause'), Eventually(NotEquals(None)))
111-
112- #Press the full screen button
113- #GtkToggleButton tooltip_markup = Fullscreen
114- self.assertThat(lambda: self.app.select_single('GtkToggleButton', tooltip_markup='Fullscreen'), Eventually(NotEquals(None)))
115- fullscreenBtn = self.app.select_single('GtkToggleButton', tooltip_markup='Fullscreen')
116- #let's click it
117- self.mouse.move_to_object(fullscreenBtn)
118- self.mouse.click()
119- #Video should go to fullscreen and continue playing
120- #TODO
121- #verify we are in fullscreen
122- self.assertThat(lambda: self.app.select_single('GtkLabel', label='Playing').label, Eventually(Contains('Playing')))
123-
124- #Move the Volume control (up/down)
125- #Did you feel the change of volume?
126-
127-
128-
129-
130- #Hover your mouse along the button of the screen
131- #The controls menu should display
132-
133- # Move your mouse to the middle of the screen
134- #The controls menu should disappear
135-
136- #Press the full screen button
137- #Video should exit from fullscreen and continue playing
138- #self.assertThat(lambda: self.app.select_single('GtkLabel', label='Leave Fullscreen'), Eventually(NotEquals(None)))
139- #exitFullscreenBtn = self.app.select_single('GtkLabel', label='Leave Fullscreen')
140- #let's click it
141- #self.mouse.move_to_object(exitFullscreenBtn)
142- #self.mouse.click()
143-
144-
145- #Press Escape
146- #The video should return to normal size
147- self.keyboard.press_and_release("Escape")
148+
149+ self.windowTitle = self.app.select_single('GtkWindow', title='Videos')
150+ self.pointing_device = Pointer(Mouse.create())
151+
152+
153+ def test_play_and_pause_video(self):
154+ # check the window loaded
155+ self.assertThat(self.windowTitle.title, Eventually(Contains('Videos')))
156+ self.status_label = self.app.select_single('GtkLabel', label='Stopped')
157+
158+ # add content to playlist and auto starts
159+ self.setup_video()
160+ ## TODO assert playing label
161+
162+ self.assertThat(self.status_label.label, Eventually(Contains('Playing')))
163+ # press pause button
164+ ## currently not working
165+ #self.pause_button = self.app.select_single('GtkButton', tooltip_text='Pause')
166+ #self.pointing_device.move_to_object(self.pause_button)
167+ #self.pointing_device.click()
168+ self.keyboard.press_and_release('Ctrl+Space')
169+
170+ self.assertThat(self.status_label.label, Eventually(Contains('Paused')))
171+ # check we can start it playing again
172+ self.keyboard.press_and_release('Ctrl+Space')
173+ self.assertThat(self.status_label.label, Eventually(Contains('Playing')))
174+
175+ def setup_video(self, ):
176+ ''' select and add content to the playlist '''
177+ #get the sidebar button
178+ self.sidebar_button = self.app.select_single('GtkToggleButton', label='S_idebar')
179+ #make sure playlist window is displayed
180+ self.keyboard.press_and_release('Alt+v')
181+ self.keyboard.press_and_release('Up')
182+ self.keyboard.press_and_release('Up')
183+ self.keyboard.press_and_release('Enter')
184+ #check if sidebar is already open, if not then open it
185+ sideIsActive = self.sidebar_button.active
186+ if sideIsActive == 0:
187+ self.pointing_device.move_to_object(self.sidebar_button)
188+ self.pointing_device.click()
189+ sideIsActive = self.sidebar_button.active
190+ # check it is open
191+ self.assertThat(sideIsActive, Equals(1))
192+
193+ #select the + button
194+ self.add_button = self.app.select_single('GtkToolButton', tooltip_text='Add...')
195+ #click on + button
196+ self.pointing_device.move_to_object(self.add_button)
197+ self.pointing_device.click()
198+ # check the file chooser dialog loaded
199+ self.file_chooser_dialog = self.app.select_single('GtkFileChooserDialog')
200+ self.assertThat(self.file_chooser_dialog.title, Eventually(Contains('Select Movies or Playlists')))
201+ # enter content path
202+ self.keyboard.press_and_release('Alt+d')
203+ self.keyboard.type('/usr/share/example-content/Ubuntu_Free_Culture_Showcase')
204+ # add the directory to the playlist
205+ self.add_dir_button = self.app.select_single('GtkLabel', label='Add Directory')
206+ self.pointing_device.move_to_object(self.add_dir_button)
207+ self.pointing_device.click()
208+
209+
210+
211
212
213\ No newline at end of file

Subscribers

People subscribed via source and target branches