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