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
=== modified file 'ubuntu_autopilot_tests/totem/test_totem.py'
--- ubuntu_autopilot_tests/totem/test_totem.py 2013-04-09 20:15:16 +0000
+++ ubuntu_autopilot_tests/totem/test_totem.py 2013-06-04 20:19:23 +0000
@@ -1,141 +1,84 @@
1from autopilot.testcase import AutopilotTestCase1from autopilot.testcase import AutopilotTestCase
2from autopilot.introspection.gtk import GtkIntrospectionTestMixin
3from autopilot.matchers import Eventually2from autopilot.matchers import Eventually
4from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan, Contains3from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan, Contains
4from autopilot.input import Mouse, Touch, Pointer
55
6from time import sleep6from time import sleep
7import tempfile7import tempfile
8import os8import os
99
1010
11#Register Totem as an application so we can call it11
12AutopilotTestCase.register_known_application("Videos", "totem.desktop", "totem")
13#http://packages.qa.ubuntu.com/qatracker/testcases/1429/info12#http://packages.qa.ubuntu.com/qatracker/testcases/1429/info
14class GtkToolbarTests(AutopilotTestCase, GtkIntrospectionTestMixin):13class TotemTests(AutopilotTestCase):
1514
16 def setUp(self):15 def setUp(self):
17 #Open Totem16 #Open Totem
18 super(GtkToolbarTests, self).setUp()17 super(TotemTests, self).setUp()
19 self.app = self.launch_test_application('totem')18 self.app = self.launch_test_application('totem')
20 19
21 #Verify that File-roller is open 20
22 #GtkApplicationWindow21 self.windowTitle = self.app.select_single('GtkWindow', title='Videos')
23 windowTitle = self.app.select_single('GtkApplicationWindow', title='Videos')22 self.pointing_device = Pointer(Mouse.create())
24 self.assertThat(windowTitle.title, Eventually(Equals('Videos')))23
25 24
26 def test_play_video(self):25 def test_play_and_pause_video(self):
27 #Test-case name: totem/tot-00126 # check the window loaded
28 # This test will check that Totem can playback a video 27 self.assertThat(self.windowTitle.title, Eventually(Contains('Videos')))
29 28 self.status_label = self.app.select_single('GtkLabel', label='Stopped')
30 #Press the F9 button 29
31 #GtkApplicationWindow, GtkVbox, GtkHPaned, GtkVBox, GtkVBox, GtkHBox, GtkHBox, GtkToggleButton30 # add content to playlist and auto starts
32 #label: S_idebar active = 131 self.setup_video()
33 self.assertThat(lambda: self.app.select_single('GtkToggleButton', label='S_idebar'), Eventually(NotEquals(None)))32 ## TODO assert playing label
34 togglePlaylistBtn = self.app.select_single('GtkToggleButton', label='S_idebar')33
35 #TODO 34 self.assertThat(self.status_label.label, Eventually(Contains('Playing')))
36 #verify that playlist is not visible, if so press F9 otherwise not35 # press pause button
37 #if self.assertProperty(togglePlaylistBtn, active = False):36 ## currently not working
38 self.keyboard.press_and_release("F9")37 #self.pause_button = self.app.select_single('GtkButton', tooltip_text='Pause')
39 38 #self.pointing_device.move_to_object(self.pause_button)
40 #Select the add icon (+) from the dropdown list 39 #self.pointing_device.click()
41 #GtkApplicationWindow, GtkVbox, GtkHPaned, GtkNotebook, TotemPlaylist, GtkVBox,GtkToolBar, GtkToolButton40 self.keyboard.press_and_release('Ctrl+Space')
42 #icon_name: list-add-symbolic41
43 self.assertThat(lambda: self.app.select_single('GtkToolButton', icon_name='list-add-symbolic'), Eventually(NotEquals(None)))42 self.assertThat(self.status_label.label, Eventually(Contains('Paused')))
44 addBtn = self.app.select_single('GtkToolButton', icon_name='list-add-symbolic')43 # check we can start it playing again
45 #let's click it44 self.keyboard.press_and_release('Ctrl+Space')
46 self.mouse.move_to_object(addBtn)45 self.assertThat(self.status_label.label, Eventually(Contains('Playing')))
47 self.mouse.click()46
48 #go to(/usr/share/example-contect/Ubuntu_Free_Culture_Showcase) 47 def setup_video(self, ):
49 self.keyboard.press_and_release("Alt+d")48 ''' select and add content to the playlist '''
50 self.keyboard.type("/usr/share/example-content/Ubuntu_Free_Culture_Showcase")49 #get the sidebar button
51 #GtkFileChooseDialog, GtkBox, GtkButtonBox, GtkButton, GtkLabel50 self.sidebar_button = self.app.select_single('GtkToggleButton', label='S_idebar')
52 #label: Add Directory51 #make sure playlist window is displayed
53 #self.assertThat(lambda: self.app.select_single('GtkLabel', label='Add Directory'), Eventually(NotEquals(None)))52 self.keyboard.press_and_release('Alt+v')
54 addDirectoryBtn = self.app.select_single('GtkLabel', label='Add Directory')53 self.keyboard.press_and_release('Up')
55 #let's click it54 self.keyboard.press_and_release('Up')
56 self.mouse.move_to_object(addDirectoryBtn)55 self.keyboard.press_and_release('Enter')
57 self.mouse.click()56 #check if sidebar is already open, if not then open it
58 #need to pause here57 sideIsActive = self.sidebar_button.active
59 sleep(2)58 if sideIsActive == 0:
60 59 self.pointing_device.move_to_object(self.sidebar_button)
61 #once there select the video (how fast.ogg)60 self.pointing_device.click()
62 #self.assertThat(lambda: self.app.select_single('GtkImageMenuItem', name='_1. How fast.ogg'), Eventually(NotEquals(None)))61 sideIsActive = self.sidebar_button.active
63 #videoSelection = self.app.select_single('GtkImageMenuItem', name='_1. How fast.ogg')62 # check it is open
64 #let's click it63 self.assertThat(sideIsActive, Equals(1))
65 #self.mouse.move_to_object(videoSelection)64
66 #self.mouse.click() 65 #select the + button
67 66 self.add_button = self.app.select_single('GtkToolButton', tooltip_text='Add...')
68 #Veriry "How fast.ogg" is playing67 #click on + button
69 #GtkApplicationWindow68 self.pointing_device.move_to_object(self.add_button)
70 #title: How fast.ogg69 self.pointing_device.click()
71 self.assertThat(lambda: self.app.select_single('GtkApplicationWindow').title, Eventually(Contains('How fast.ogg')))70 # check the file chooser dialog loaded
72 #GtkApplicationWindow, GtkVBox, TotemStatusBar, GtkFrame,GtkBox, GtkLabel71 self.file_chooser_dialog = self.app.select_single('GtkFileChooserDialog')
73 #label: Playing72 self.assertThat(self.file_chooser_dialog.title, Eventually(Contains('Select Movies or Playlists')))
74 self.assertThat(lambda: self.app.select_single('GtkLabel', label='Playing').label, Eventually(Contains('Playing')))73 # enter content path
75 74 self.keyboard.press_and_release('Alt+d')
76 #press the pause button75 self.keyboard.type('/usr/share/example-content/Ubuntu_Free_Culture_Showcase')
77 #Video should pause and the button becomes a play button76 # add the directory to the playlist
78 #GtkButton tooltip_markup = Play77 self.add_dir_button = self.app.select_single('GtkLabel', label='Add Directory')
79 #self.assertThat(lambda: self.app.select_single('GtkToolButton', label='Play/P_ause'), Eventually(NotEquals(None)))78 self.pointing_device.move_to_object(self.add_dir_button)
80 #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_text='Pause'), Eventually(NotEquals(None)))79 self.pointing_device.click()
81 #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Pause'), Eventually(NotEquals(None))) 80
82 #pauseBtn = self.app.select_single('GtkToolButton', tooltip_markup='Pause')81
83 #let's click it82
84 #self.mouse.move_to_object(pauseBtn)
85 #self.mouse.click()
86 #***** returns " More than one item was returned for query" error ************
87 self.keyboard.press_and_release("Ctrl+space")
88 self.assertThat(lambda: self.app.select_single('GtkLabel', label='Paused').label, Eventually(Contains('Paused')))
89 #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Play'), Eventually(NotEquals(None)))
90
91
92 # Press the play button
93 #Video should begin playing
94 #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Play'), Eventually(NotEquals(None)))
95 #playBtn = self.app.select_single('GtkButton', tooltip_markup='Play')
96 #let's click it
97 #self.mouse.move_to_object(pauseBtn)
98 #self.mouse.click()
99 #***** returns " More than one item was returned for query" error ************
100 self.keyboard.press_and_release("Ctrl+space")
101 self.assertThat(lambda: self.app.select_single('GtkLabel', label='Playing').label, Eventually(Contains('Playing')))
102 #self.assertThat(lambda: self.app.select_single('GtkButton', tooltip_markup='Pause'), Eventually(NotEquals(None)))
103
104 #Press the full screen button
105 #GtkToggleButton tooltip_markup = Fullscreen
106 self.assertThat(lambda: self.app.select_single('GtkToggleButton', tooltip_markup='Fullscreen'), Eventually(NotEquals(None)))
107 fullscreenBtn = self.app.select_single('GtkToggleButton', tooltip_markup='Fullscreen')
108 #let's click it
109 self.mouse.move_to_object(fullscreenBtn)
110 self.mouse.click()
111 #Video should go to fullscreen and continue playing
112 #TODO
113 #verify we are in fullscreen
114 self.assertThat(lambda: self.app.select_single('GtkLabel', label='Playing').label, Eventually(Contains('Playing')))
115
116 #Move the Volume control (up/down)
117 #Did you feel the change of volume?
118
119
120
121
122 #Hover your mouse along the button of the screen
123 #The controls menu should display
124
125 # Move your mouse to the middle of the screen
126 #The controls menu should disappear
127
128 #Press the full screen button
129 #Video should exit from fullscreen and continue playing
130 #self.assertThat(lambda: self.app.select_single('GtkLabel', label='Leave Fullscreen'), Eventually(NotEquals(None)))
131 #exitFullscreenBtn = self.app.select_single('GtkLabel', label='Leave Fullscreen')
132 #let's click it
133 #self.mouse.move_to_object(exitFullscreenBtn)
134 #self.mouse.click()
135
136
137 #Press Escape
138 #The video should return to normal size
139 self.keyboard.press_and_release("Escape")
140 83
141 84
142\ No newline at end of file85\ No newline at end of file

Subscribers

People subscribed via source and target branches