Merge lp:~dpniel/ubiquity/autopilot into lp:ubiquity
- autopilot
- Merge into trunk
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 6072 | ||||||||||||
Proposed branch: | lp:~dpniel/ubiquity/autopilot | ||||||||||||
Merge into: | lp:ubiquity | ||||||||||||
Diff against target: |
1158 lines (+410/-417) 15 files modified
autopilot/launch_vis (+9/-0) autopilot/ubiquity-autopilot-runner/custom-installation/iso-override/usr/local/bin/run-autopilot.sh (+2/-0) autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py (+0/-102) autopilot/ubiquity_autopilot_tests/configs/english_label_conf.py (+170/-0) autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py (+0/-74) autopilot/ubiquity_autopilot_tests/tests/__init__.py (+220/-206) autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py (+1/-1) autopilot/ubiquity_autopilot_tests/tests/test_english_default.py (+2/-2) autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py (+1/-1) autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py (+1/-1) autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py (+2/-2) autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py (+1/-1) autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py (+1/-1) autopilot/ubiquity_autopilot_tests/unittests/test_expects.py (+0/-12) autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py (+0/-14) |
||||||||||||
To merge this branch: | bzr merge lp:~dpniel/ubiquity/autopilot | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jean-Baptiste Lallement | Approve | ||
Review via email: mp+196945@code.launchpad.net |
Commit message
Description of the change
This fixes the bug 1255589, but also further improving the way the test checks the english values.
AT the start of the test we generate a config file in /tmp/english_
I removed alot of repetitive code checking visible, string, unicode properties of objects. SO now all objects are passed to either check_visible or check_hidden functions which accepts either a object name or a list of names, and its during this stage that the english values will get tested if they are present in the config file
This fix changes nothing for Ubuntu but causes all the other flavors to fail due to 'Ubuntu' being present in some object labels instead of the actual flavors name. But at least its picking up a legitimate bug.
Also added checks for U1 labels and improved the handling of waiting on the progress bar to complete and check no error dialogs appear while waiting and also on page change.
- 6073. By Dan Chapman
-
disabled xterm from launching in run-autopilot.sh
- 6074. By Dan Chapman
-
Merged progress page and Ubuntu one improvments into this MP
- 6075. By Dan Chapman
-
fix pyflakes
- 6076. By Dan Chapman
-
disable xterm
- 6077. By Dan Chapman
-
fixed conflict
- 6078. By Dan Chapman
-
Added options for selecting edubuntu desktop env
Preview Diff
1 | === added file 'autopilot/launch_vis' |
2 | --- autopilot/launch_vis 1970-01-01 00:00:00 +0000 |
3 | +++ autopilot/launch_vis 2013-11-29 17:06:55 +0000 |
4 | @@ -0,0 +1,9 @@ |
5 | +#!/bin/sh |
6 | +. /var/log/installer/autopilot |
7 | +export DBUS_SESSION_BUS_ADDRESS |
8 | +export UBIQUITY_PID |
9 | + |
10 | +# Disable X access control to let root access :0 |
11 | +xhost + |
12 | +#launch vis using autopilot py2 |
13 | +sudo -E autopilot vis |
14 | |
15 | === modified file 'autopilot/ubiquity-autopilot-runner/custom-installation/iso-override/usr/local/bin/run-autopilot.sh' |
16 | --- autopilot/ubiquity-autopilot-runner/custom-installation/iso-override/usr/local/bin/run-autopilot.sh 2013-11-28 06:21:02 +0000 |
17 | +++ autopilot/ubiquity-autopilot-runner/custom-installation/iso-override/usr/local/bin/run-autopilot.sh 2013-11-29 17:06:55 +0000 |
18 | @@ -150,10 +150,12 @@ |
19 | |
20 | [ -e "$flag" ] && return 0 |
21 | |
22 | + |
23 | if [ $DEBUG -ne 0 ]; then |
24 | # Put here everything you want to run in debug mode |
25 | xterm & # Easier to debug from a live session, and rarely broken |
26 | fi |
27 | + |
28 | sudo stty -F /dev/ttyS0 raw speed 115200 |
29 | |
30 | tail_logs $SESSION_LOG /var/log/syslog |
31 | |
32 | === removed file 'autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py' |
33 | --- autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py 2013-11-19 09:07:08 +0000 |
34 | +++ autopilot/ubiquity_autopilot_tests/configs/eng_label_values.py 1970-01-01 00:00:00 +0000 |
35 | @@ -1,102 +0,0 @@ |
36 | -# Config file for english label values |
37 | -# Author: Dan Chapman <daniel@chapman-mail.com> |
38 | -# Copyright (C) 2013 |
39 | -# |
40 | -# This program is free software: you can redistribute it and/or modify |
41 | -# it under the terms of the GNU General Public License version 3 as |
42 | -# published by the Free Software Foundation. |
43 | -# |
44 | -# This program is distributed in the hope that it will be useful, |
45 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
46 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
47 | -# GNU General Public License for more details. |
48 | -# |
49 | -# You should have received a copy of the GNU General Public License |
50 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
51 | - |
52 | - |
53 | -def get_distribution(): |
54 | - """Returns the name of the running distribution.""" |
55 | - with open('/cdrom/.disk/info') as f: |
56 | - for line in f: |
57 | - distro = line[:max(line.find(' '), 0) or None] |
58 | - if distro: |
59 | - return str(distro) |
60 | - raise SystemError("Could not get distro name") |
61 | - |
62 | -distro_flavor = get_distribution() |
63 | - |
64 | -stepLanguage = { |
65 | - "release_notes_label": 'You may wish to read the <a href="release-notes">' |
66 | - 'release notes</a>.', |
67 | - "page_title": 'page_title= <span size="xx-large">Welcome</span>' |
68 | -} |
69 | - |
70 | -stepPrepare = { |
71 | - "page_title": '<span size="xx-large">Preparing to install {0}</span>' |
72 | - .format(distro_flavor), |
73 | - "prepare_best_results": 'For best results, please ensure that this ' |
74 | - 'computer:', |
75 | - "prepare_foss_disclaimer": 'Ubuntu uses third-party software to play ' |
76 | - 'Flash, MP3 and other media, and to work with some graphics and wi-fi ' |
77 | - 'hardware. Some of this software is proprietary. The software is subject ' |
78 | - 'to license terms included with its documentation.', |
79 | - "prepare_download_updates": 'Download updates while installing', |
80 | - "prepare_nonfree_software": 'Install this third-party software', |
81 | - "prepare_network_connection": 'is connected to the Internet', |
82 | - "prepare_sufficient_space": 'has at least 6.0 GB available drive space' |
83 | -} |
84 | - |
85 | - |
86 | -stepPartAsk = { |
87 | - "page_title": '<span size="xx-large">Installation type</span>', |
88 | - "use_device": 'Erase disk and install {0}'.format(distro_flavor), |
89 | - "use_device_desc": '<span size="small"><span foreground="darkred">' |
90 | - 'Warning:</span> This will delete any files on the disk.</span>', |
91 | - "use_crypto": 'Encrypt the new Ubuntu installation for security', |
92 | - "use_crypto_desc": '<span size="small">You will choose a security key in ' |
93 | - 'the next step.</span>', |
94 | - "use_lvm": 'Use LVM with the new Ubuntu installation', |
95 | - "use_lvm_desc": '<span size="small">This will set up Logical Volume ' |
96 | - 'Management. It allows taking snapshots and easier partition ' |
97 | - 'resizing.</span>', |
98 | - "custom_partitioning": 'Something else', |
99 | - "custom_partitioning_desc": '<span size="small">You can create or resize ' |
100 | - 'partitions yourself, or choose multiple partitions for Ubuntu.</span>' |
101 | -} |
102 | - |
103 | - |
104 | -stepPartCrypto = { |
105 | - "page_title": '<span size="xx-large">Choose a security key:</span>', |
106 | - "verified_crypto_label": 'Confirm the security key:', |
107 | - "crypto_label": 'Choose a security key:', |
108 | - "crypto_description": 'Disk encryption protects your files in case you ' |
109 | - 'lose your computer. It requires you to enter a security key each time ' |
110 | - 'the computer starts up.', |
111 | - "crypto_warning": '<span foreground="darkred">Warning:</span> If you lose ' |
112 | - 'this security key, all data will be lost. If you need to, write down ' |
113 | - 'your key and keep it in a safe place elsewhere.', |
114 | - "crypto_extra_label": 'For more security:', |
115 | - "crypto_extra_time": 'The installation may take much longer.', |
116 | - "crypto_description_2": 'Any files outside of Ubuntu will not be ' |
117 | - 'encrypted.', |
118 | - "crypto_overwrite_space": 'Overwrite empty disk space' |
119 | -} |
120 | - |
121 | -stepLocation = { |
122 | - "page_title": '<span size="xx-large">Where are you?</span>' |
123 | -} |
124 | - |
125 | -stepKeyboardConf = { |
126 | - "page_title": '<span size="xx-large">Keyboard layout</span>' |
127 | -} |
128 | - |
129 | -stepUserInfo = { |
130 | - "page_title": '<span size="xx-large">Who are you?</span>', |
131 | - "hostname_label": "Your computer's name:", |
132 | - "username_label": 'Pick a username:', |
133 | - "password_label": 'Choose a password:', |
134 | - "verified_password_label": 'Confirm your password:', |
135 | - "hostname_extra_label": 'The name it uses when it talks to other ' |
136 | - 'computers.' |
137 | -} |
138 | |
139 | === added file 'autopilot/ubiquity_autopilot_tests/configs/english_label_conf.py' |
140 | --- autopilot/ubiquity_autopilot_tests/configs/english_label_conf.py 1970-01-01 00:00:00 +0000 |
141 | +++ autopilot/ubiquity_autopilot_tests/configs/english_label_conf.py 2013-11-29 17:06:55 +0000 |
142 | @@ -0,0 +1,170 @@ |
143 | +# Config file for english label values |
144 | +# Author: Dan Chapman <daniel@chapman-mail.com> |
145 | +# Copyright (C) 2013 |
146 | +# |
147 | +# This program is free software: you can redistribute it and/or modify |
148 | +# it under the terms of the GNU General Public License version 3 as |
149 | +# published by the Free Software Foundation. |
150 | +# |
151 | +# This program is distributed in the hope that it will be useful, |
152 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
153 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
154 | +# GNU General Public License for more details. |
155 | +# |
156 | +# You should have received a copy of the GNU General Public License |
157 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
158 | +import configparser |
159 | + |
160 | + |
161 | +def get_distribution(): |
162 | + """Returns the name of the running distribution.""" |
163 | + with open('/cdrom/.disk/info') as f: |
164 | + for line in f: |
165 | + distro = line[:max(line.find(' '), 0) or None] |
166 | + if distro: |
167 | + return str(distro) |
168 | + raise SystemError("Could not get distro name") |
169 | + |
170 | + |
171 | +def generate_config(): |
172 | + distro_flavor = get_distribution() |
173 | + config = configparser.ConfigParser() |
174 | + |
175 | + #CREATE STEP LANGUAGE CONFIG |
176 | + config['stepLanguage'] = {} |
177 | + stepLanguage = config['stepLanguage'] |
178 | + stepLanguage['release_notes_label'] = \ |
179 | + 'You may wish to read the <a href="release-notes">release notes</a>.' |
180 | + stepLanguage["page_title"] = \ |
181 | + '<span size="xx-large">Welcome</span>' |
182 | + |
183 | + # CREATE STEP PREPARE CONFIG |
184 | + config['stepPrepare'] = {} |
185 | + stepPrepare = config['stepPrepare'] |
186 | + stepPrepare['page_title'] = \ |
187 | + '<span size="xx-large">Preparing to install {0}</span>'\ |
188 | + .format(distro_flavor) |
189 | + stepPrepare['prepare_best_results'] = \ |
190 | + 'For best results, please ensure that this computer:' |
191 | + stepPrepare['prepare_foss_disclaimer'] = \ |
192 | + '{0} uses third-party software to play ' \ |
193 | + 'Flash, MP3 and other media, and to work with some graphics ' \ |
194 | + 'and wi-fi hardware. Some of this software is proprietary. ' \ |
195 | + 'The software is subject to license terms included with its ' \ |
196 | + 'documentation.'.format(distro_flavor) |
197 | + stepPrepare['prepare_download_updates'] = \ |
198 | + 'Download updates while installing' |
199 | + stepPrepare['prepare_nonfree_software'] = \ |
200 | + 'Install this third-party software' |
201 | + stepPrepare['prepare_network_connection'] = \ |
202 | + 'is connected to the Internet' |
203 | + stepPrepare['prepare_sufficient_space'] = \ |
204 | + 'has at least 6.0 GB available drive space' |
205 | + |
206 | + #CREATE STEP PART ASK CONFIG |
207 | + config['stepPartAsk'] = {} |
208 | + stepPartAsk = config['stepPartAsk'] |
209 | + stepPartAsk['page_title'] = \ |
210 | + '<span size="xx-large">Installation type</span>' |
211 | + stepPartAsk['use_device'] = \ |
212 | + 'Erase disk and install {0}'.format(distro_flavor) |
213 | + stepPartAsk['use_device_desc'] = \ |
214 | + '<span size="small"><span foreground="darkred">Warning:</span> ' \ |
215 | + 'This will delete any files on the disk.</span>' |
216 | + stepPartAsk['use_crypto'] = \ |
217 | + 'Encrypt the new Ubuntu installation for security' |
218 | + stepPartAsk['use_crypto_desc'] = \ |
219 | + '<span size="small">You will choose a security key in the ' \ |
220 | + 'next step.</span>' |
221 | + stepPartAsk['use_lvm'] = 'Use LVM with the new {0} installation'.format( |
222 | + distro_flavor |
223 | + ) |
224 | + stepPartAsk['use_lvm_desc'] = \ |
225 | + '<span size="small">This will set up Logical Volume ' \ |
226 | + 'Management. It allows taking snapshots and easier partition ' \ |
227 | + 'resizing.</span>' |
228 | + stepPartAsk['custom_partitioning'] = 'Something else' |
229 | + stepPartAsk['custom_partitioning_desc'] = \ |
230 | + '<span size="small">You can create or resize partitions yourself, ' \ |
231 | + 'or choose multiple partitions for {0}.</span>'.format(distro_flavor) |
232 | + |
233 | + #CREATE STEP PART CRYPTO CONFIG |
234 | + config['stepPartCrypto'] = {} |
235 | + stepPartCrypto = config['stepPartCrypto'] |
236 | + stepPartCrypto["page_title"] = \ |
237 | + '<span size="xx-large">Choose a security key:</span>' |
238 | + stepPartCrypto["verified_crypto_label"] = 'Confirm the security key:' |
239 | + stepPartCrypto["crypto_label"] = 'Choose a security key:' |
240 | + stepPartCrypto["crypto_description"] = \ |
241 | + 'Disk encryption protects your files in case you lose your computer.' \ |
242 | + ' It requires you to enter a security key each time the computer ' \ |
243 | + 'starts up.' |
244 | + stepPartCrypto["crypto_warning"] = \ |
245 | + '<span foreground="darkred">Warning:</span> If you lose ' \ |
246 | + 'this security key, all data will be lost. If you need to, ' \ |
247 | + 'write down your key and keep it in a safe place elsewhere.' |
248 | + stepPartCrypto["crypto_extra_label"] = 'For more security:' |
249 | + stepPartCrypto["crypto_extra_time"] = \ |
250 | + 'The installation may take much longer.' |
251 | + stepPartCrypto["crypto_description_2"] = \ |
252 | + 'Any files outside of Ubuntu will not be encrypted.' |
253 | + stepPartCrypto["crypto_overwrite_space"] = 'Overwrite empty disk space' |
254 | + |
255 | + #CREATE STEP LOCATION CONFIG |
256 | + config['stepLocation'] = {} |
257 | + stepLocation = config['stepLocation'] |
258 | + stepLocation["page_title"] = '<span size="xx-large">Where are you?</span>' |
259 | + |
260 | + #CREATE STEP KEYBOARD CONFIG |
261 | + config['stepKeyboardConf'] = {} |
262 | + stepKeyboardConf = config['stepKeyboardConf'] |
263 | + stepKeyboardConf["page_title"] = \ |
264 | + '<span size="xx-large">Keyboard layout</span>' |
265 | + |
266 | + #CREATE STEP USER INFO CONFIG |
267 | + config['stepUserInfo'] = {} |
268 | + stepUserInfo = config['stepUserInfo'] |
269 | + stepUserInfo["page_title"] = '<span size="xx-large">Who are you?</span>' |
270 | + stepUserInfo["hostname_label"] = "Your computer's name:" |
271 | + stepUserInfo["username_label"] = 'Pick a username:' |
272 | + stepUserInfo["password_label"] = 'Choose a password:' |
273 | + stepUserInfo["verified_password_label"] = 'Confirm your password:' |
274 | + stepUserInfo["hostname_extra_label"] = \ |
275 | + 'The name it uses when it talks to other computers.' |
276 | + |
277 | + #CREATE STEP UBUNTU 1 CONFIG |
278 | + config['stepUbuntuOne'] = {} |
279 | + stepUbuntuOne = config['stepUbuntuOne'] |
280 | + stepUbuntuOne['u1_about_label'] = 'Ubuntu One is the single account you ' \ |
281 | + 'use to log in to all services and sites related to Ubuntu.\n\nGet ' \ |
282 | + 'new apps from the Software Center, store files in your personal ' \ |
283 | + 'cloud, buy tracks from the Music Store, manage your payments and ' \ |
284 | + 'subscriptions - you decide which services you need.\n\nIf you have ' \ |
285 | + 'an existing Ubuntu single sign on account, that is now called your ' \ |
286 | + 'Ubuntu One account.' |
287 | + stepUbuntuOne['cloud_label'] = 'Cloud' |
288 | + stepUbuntuOne['music_label'] = 'Music' |
289 | + stepUbuntuOne['photos_label'] = 'Photos' |
290 | + stepUbuntuOne['apps_label'] = 'Apps' |
291 | + stepUbuntuOne['u1_existing_account'] = \ |
292 | + 'I am a returning Ubuntu One user and my password is:' |
293 | + stepUbuntuOne['u1_new_account'] = 'I am a new Ubuntu One user.' |
294 | + stepUbuntuOne['u1_explain_email_2'] = '<span size="small">If you ' \ |
295 | + 'don\'t have an account yet, don\'t worry we\'ll create one for ' \ |
296 | + 'you.</span>' |
297 | + stepUbuntuOne['u1_explain_email'] = '<span size="small">Enter the email ' \ |
298 | + 'address you use to log into your Ubuntu One account.</span>' |
299 | + stepUbuntuOne['u1_terms'] = \ |
300 | + 'I have read and accept the <a href="">Ubuntu One terms of use</a>' |
301 | + stepUbuntuOne['u1_tc_check'] = '' |
302 | + stepUbuntuOne['password_mismatch'] = 'Passwords do not match' |
303 | + stepUbuntuOne['u1_ask_name_pass'] = \ |
304 | + 'Please tell us your name and choose a password:' |
305 | + stepUbuntuOne['u1_ask_email1'] = 'Please type your email:' |
306 | + stepUbuntuOne['u1_no_internet'] = 'There is no internet connection. ' \ |
307 | + 'To be able to create an account or to log in to Ubuntu One, you ' \ |
308 | + 'need to be connected to the internet.' |
309 | + |
310 | + #write config to tmp file |
311 | + with open('/tmp/english_config.ini', 'w') as configfile: |
312 | + config.write(configfile) |
313 | |
314 | === modified file 'autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py' |
315 | --- autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py 2013-11-19 09:07:08 +0000 |
316 | +++ autopilot/ubiquity_autopilot_tests/emulators/gtktoplevel.py 2013-11-29 17:06:55 +0000 |
317 | @@ -25,7 +25,6 @@ |
318 | import Config4, Config5, Config6 |
319 | from ubiquity_autopilot_tests.emulators\ |
320 | import gtkcontrols, gtkaccessible, gtkcontainers |
321 | -import time |
322 | import logging |
323 | logger = logging.getLogger(__name__) |
324 | |
325 | @@ -96,79 +95,6 @@ |
326 | logger.debug('Returning {0} object'.format(dialogType)) |
327 | return dialog |
328 | |
329 | - def run_install_progress_page_tests(self, ): |
330 | - ''' Runs the test for the installation progress page |
331 | - |
332 | - This method tracks the current progress of the install |
333 | - by using the fraction property of the progress bar |
334 | - to assertain the percentage complete. |
335 | - |
336 | - ''' |
337 | - logger.debug("run_install_progress_page_tests()") |
338 | - #We cant assert page title here as its an external html page |
339 | - #Maybe try assert WebKitWebView is visible |
340 | - webkitwindow = self.select_single('GtkScrolledWindow', |
341 | - name='webkit_scrolled_window') |
342 | - expectThat(webkitwindow.visible).equals( |
343 | - True, msg="Expected the slideshow to be visible, but it wasn't") |
344 | - |
345 | - #Can we track the progress percentage? |
346 | - self.install_progress = self.select_single('GtkProgressBar', |
347 | - name='install_progress') |
348 | - |
349 | - #Copying files progress bar |
350 | - self._track_install_progress_bar() |
351 | - |
352 | - self.install_progress.fraction.wait_for(0.0, timeout=120) |
353 | - #And now the install progress bar |
354 | - self._track_install_progress_bar() |
355 | - |
356 | - def _track_install_progress_bar(self): |
357 | - '''Gets the value of the fraction property of the progress bar |
358 | - |
359 | - so we can see when the progress bar is complete |
360 | - |
361 | - ''' |
362 | - logger.debug("_track_install_progress_bar()") |
363 | - progress = 0.0 |
364 | - complete = 1.0 |
365 | - logger.debug('Percentage complete "{0:.0f}%"'.format(progress * 100)) |
366 | - while progress < complete: |
367 | - #keep updating fraction value |
368 | - progress = self.install_progress.fraction |
369 | - # lets sleep for a second on each loop until we get near the end of |
370 | - # the progress bar |
371 | - if progress < 0.7: |
372 | - time.sleep(1) |
373 | - |
374 | - logger.debug('Percentage complete "{0:.0f}%"' |
375 | - .format(progress * 100)) |
376 | - #check for install errors while waiting |
377 | - try: |
378 | - crash_dialog = self.get_dialog('GtkDialog', |
379 | - BuilderName='crash_dialog') |
380 | - logger.debug("Checking crash dialog hasn't appeared....") |
381 | - if crash_dialog.visibe: |
382 | - logger.error("Crash Dialog appeared") |
383 | - assert not crash_dialog.visible,\ |
384 | - "Crash Dialog appeared! Something went wrong!!!" |
385 | - progress = 1.0 |
386 | - except Exception: |
387 | - pass |
388 | - # Lets try and grab the grub failed message box on the fly |
389 | - try: |
390 | - logger.debug("Checking failed grub install dialog hasn't " |
391 | - "appeared.......") |
392 | - grub_dialog = self.get_dialog('GtkMessageDialog') |
393 | - if grub_dialog.visible: |
394 | - logger.error("The Grub installation failed dialog " |
395 | - "appeared :-(") |
396 | - assert grub_dialog.visible != 1,\ |
397 | - "The Grub installation failed" |
398 | - progress = 1.0 |
399 | - except Exception: |
400 | - pass |
401 | - |
402 | |
403 | class GtkDialog(GtkWindow): |
404 | """ Emulator class for a GtkDialog, """ |
405 | |
406 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/__init__.py' |
407 | --- autopilot/ubiquity_autopilot_tests/tests/__init__.py 2013-11-22 12:29:14 +0000 |
408 | +++ autopilot/ubiquity_autopilot_tests/tests/__init__.py 2013-11-29 17:06:55 +0000 |
409 | @@ -20,6 +20,7 @@ |
410 | import logging |
411 | import random |
412 | import time |
413 | +import configparser |
414 | |
415 | from testtools.matchers import Equals, NotEquals |
416 | |
417 | @@ -34,7 +35,7 @@ |
418 | from ubiquity_autopilot_tests.emulators.gtktoplevel import GtkWindow |
419 | from ubiquity_autopilot_tests.emulators import AutopilotGtkEmulatorBase |
420 | from ubiquity_autopilot_tests.testcase import UbiquityTestCase |
421 | -from ubiquity_autopilot_tests.configs import eng_label_values |
422 | +from ubiquity_autopilot_tests.configs import english_label_conf |
423 | from ubiquity_autopilot_tests.configs.partconfig import ( |
424 | Config1, |
425 | Config2, |
426 | @@ -49,6 +50,7 @@ |
427 | |
428 | |
429 | class UbiquityAutopilotTestCase(UbiquityTestCase): |
430 | + |
431 | def setUp(self): |
432 | super(UbiquityAutopilotTestCase, self).setUp() |
433 | self.app = self.launch_application() |
434 | @@ -60,7 +62,11 @@ |
435 | self.current_step = '' |
436 | self.step_before = '' |
437 | self.english_install = False |
438 | - self.eng_config = {} |
439 | + english_label_conf.generate_config() |
440 | + self.english_config = configparser.ConfigParser() |
441 | + self.english_config.read('/tmp/english_config.ini') |
442 | + #delete config at end of test |
443 | + self.addCleanup(os.remove, '/tmp/english_config.ini') |
444 | |
445 | def launch_application(self): |
446 | ''' |
447 | @@ -92,6 +98,8 @@ |
448 | |
449 | """ |
450 | logger.debug('go_to_next_page(wait={0})'.format(wait)) |
451 | + # check no error dialogs before moving on |
452 | + self._check_no_visible_dialogs() |
453 | nxt_button = self.main_window.select_single('GtkButton', name='next') |
454 | nxt_button.click() |
455 | |
456 | @@ -134,6 +142,7 @@ |
457 | the tests to work for any language. |
458 | |
459 | """ |
460 | + |
461 | self._update_current_step('stepLanguage') |
462 | self._check_navigation_buttons() |
463 | #first check pageTitle visible and correct if label given |
464 | @@ -159,37 +168,24 @@ |
465 | "doesn't contain any text") |
466 | |
467 | if lang: |
468 | + if lang == 'English': |
469 | + self.english_install = True |
470 | item = treeview.select_item(lang) |
471 | language = item |
472 | else: |
473 | language = welcome_page.get_random_language() |
474 | - if language == 'English': |
475 | - self.english_install = True |
476 | + if language == 'English': |
477 | + self.english_install = True |
478 | welcome_page.select_language(language) |
479 | |
480 | self.assertThat(language.selected, Equals(True)) |
481 | ##Test release notes label is visible |
482 | logger.debug("Checking the release_notes_label") |
483 | + self.check_visible_object_with_label('release_notes_label') |
484 | release_notes_label = welcome_page.select_single( |
485 | - 'GtkLabel', BuilderName='release_notes_label') |
486 | - self.expectThat(release_notes_label.visible, Equals(True), |
487 | - "[Page:'{0}'] Release notes label was not visible" |
488 | - .format(self.current_step)) |
489 | - self.expectThat(release_notes_label.label, NotEquals(u''), |
490 | - "[Page:'{0}'] Release notes label did not contain " |
491 | - "any text".format(self.current_step)) |
492 | - self.expectIsInstance(release_notes_label.label, str, |
493 | - "[Page:'{0}'] Expected release notes label to " |
494 | - "be unicode but it wasn't") |
495 | + BuilderName='release_notes_label') |
496 | self.pointing_device.move_to_object(release_notes_label) |
497 | self._update_page_titles() |
498 | - if self.english_install: |
499 | - #if english install check english values |
500 | - self.eng_config = eng_label_values.stepLanguage |
501 | - self.expectThat(release_notes_label.label, |
502 | - Equals(self.eng_config['release_notes_label'])) |
503 | - self.expectThat(self.current_page_title, |
504 | - Equals(self.eng_config['page_title'])) |
505 | self._check_page_titles() |
506 | self._check_navigation_buttons() |
507 | |
508 | @@ -230,25 +226,7 @@ |
509 | |
510 | objList = ['prepare_best_results', 'prepare_foss_disclaimer', |
511 | 'prepare_download_updates', 'prepare_nonfree_software'] |
512 | - for i in objList: |
513 | - logging.debug("Running checks on {0} object".format(i)) |
514 | - obj = preparing_page.select_single(BuilderName=i) |
515 | - self.expectThat(obj.visible, Equals(True), |
516 | - "[Page:'{0}'] Expected {1} object to be " |
517 | - "visible but it wasn't" |
518 | - .format(self.current_step, obj.name)) |
519 | - self.expectThat(obj.label, NotEquals(u''), |
520 | - "[Page:'{0}'] Expected {1} objects label value " |
521 | - "to contain text but it didn't" |
522 | - .format(self.current_step, obj.name)) |
523 | - self.expectIsInstance(obj.label, str, |
524 | - "[Page:'{0}'] Expected {1} objects label " |
525 | - "value to be unicode but it wasn't" |
526 | - .format(self.current_step, obj.name)) |
527 | - if self.english_install: |
528 | - #if english install check english values |
529 | - self.eng_config = eng_label_values.stepPrepare |
530 | - self.expectThat(obj.label, Equals(self.eng_config[i])) |
531 | + self.check_visible_object_with_label(objList) |
532 | |
533 | if updates: |
534 | logger.debug("Selecting install updates") |
535 | @@ -272,12 +250,10 @@ |
536 | visible=powerSource) |
537 | |
538 | self._check_page_titles() |
539 | - if self.english_install: |
540 | - self.expectThat(self.current_page_title, |
541 | - Equals(self.eng_config['page_title'])) |
542 | self._check_navigation_buttons() |
543 | |
544 | - def edubuntu_addon_window_tests(self, ): |
545 | + def edubuntu_addon_window_tests(self, unity=False, |
546 | + gnome=False, ltsp=False): |
547 | """ |
548 | Run Page tests for edubuntu addon page |
549 | """ |
550 | @@ -289,30 +265,27 @@ |
551 | page_objects = ['fallback_install', 'description', 'fallback_title', |
552 | 'fallback_description', 'ltsp_install', 'ltsp_title', |
553 | 'ltsp_description', 'ltsp_interface_label'] |
554 | - |
555 | - for i in page_objects: |
556 | - obj = add_on_page.select_single(BuilderName=i) |
557 | - self.expectThat(obj.visible, Equals(True), |
558 | - "[Page:'{0}'] Expected {1} object to be visible " |
559 | - "but it wasn't" |
560 | - .format(self.current_step, obj.name)) |
561 | - self.expectThat(obj.label, NotEquals(u''), |
562 | - "[Page:'{0}'] Expected {1} objects label value " |
563 | - "to contain text but it didn't" |
564 | - .format(self.current_step, obj.name)) |
565 | - self.expectIsInstance(obj.label, str, |
566 | - "[Page:'{0}'] Expected {1} objects label " |
567 | - "value to be unicode but it wasn't" |
568 | - .format(self.current_step, obj.name)) |
569 | - #if self.english_install: |
570 | - # #if english install check english values |
571 | - # self.eng_config = eng_label_values.stepPrepare |
572 | - # self.expectThat(obj.label, Equals(self.eng_config[i])) |
573 | - #TODO: provide option to select different desktop |
574 | + self.check_visible_object_with_label(page_objects) |
575 | + |
576 | + env = None |
577 | + if unity: |
578 | + logger.debug('Using default Unity env...') |
579 | + pass |
580 | + elif gnome: |
581 | + logger.debug("Using gnome fallback env") |
582 | + env = 'fallback_install' |
583 | + elif ltsp: |
584 | + logger.debug('Using LTSP env') |
585 | + env = 'ltsp_install' |
586 | + else: |
587 | + items = [None, 'fallback_install', 'ltsp_install'] |
588 | + env = random.choice(items) |
589 | + |
590 | + if env: |
591 | + choice = add_on_page.select_single(BuilderName=env) |
592 | + self.pointing_device.click_object(choice) |
593 | + |
594 | self._check_page_titles() |
595 | - #if self.english_install: |
596 | - # self.expectThat(self.current_page_title, |
597 | - # Equals(self.eng_config['page_title'])) |
598 | self._check_navigation_buttons() |
599 | |
600 | def edubuntu_packages_window_tests(self, ): |
601 | @@ -322,32 +295,8 @@ |
602 | self._update_current_step('edubuntu-packages_window') |
603 | self._check_navigation_buttons() |
604 | self._update_page_titles() |
605 | - packages_page = self.main_window.select_single( |
606 | - 'GtkVBox', BuilderName='edubuntu-packages_window') |
607 | - description = packages_page.select_single( |
608 | - 'GtkLabel', BuilderName='description') |
609 | - self.expectThat(description.visible, Equals(True), |
610 | - "[Page:'{0}'] Expected {1} object to be visible but " |
611 | - "it wasn't" |
612 | - .format(self.current_step, description.name)) |
613 | - self.expectThat(description.label, NotEquals(u''), |
614 | - "[Page:'{0}'] Expected {1} objects label value to " |
615 | - "contain text but it didn't" |
616 | - .format(self.current_step, description.name)) |
617 | - self.expectIsInstance(description.label, str, |
618 | - "[Page:'{0}'] Expected {1} objects label " |
619 | - "value to be unicode but it wasn't" |
620 | - .format(self.current_step, description.name)) |
621 | - #if self.english_install: |
622 | - # #if english install check english values |
623 | - # self.eng_config = eng_label_values.stepPrepare |
624 | - # self.expectThat(obj.label, Equals(self.eng_config[i])) |
625 | - #TODO: provide option to select different packages from tree view |
626 | - |
627 | + self.check_visible_object_with_label('description') |
628 | self._check_page_titles() |
629 | - #if self.english_install: |
630 | - # self.expectThat(self.current_page_title, |
631 | - # Equals(self.eng_config['page_title'])) |
632 | self._check_navigation_buttons() |
633 | |
634 | def installation_type_page_tests(self, default=False, lvm=False, |
635 | @@ -392,7 +341,9 @@ |
636 | |
637 | config = custom_install |
638 | option_name = 'custom_partitioning' |
639 | - self._options_tests(config.visible_options, config.hidden_options) |
640 | + |
641 | + self.check_visible_object_with_label(config.visible_options) |
642 | + self.check_hidden_object_with_label(config.hidden_options) |
643 | install_type_page = self.main_window.select_single( |
644 | 'GtkAlignment', BuilderName='stepPartAsk') |
645 | if option_name: |
646 | @@ -400,10 +351,6 @@ |
647 | self.pointing_device.click_object(obj) |
648 | |
649 | self._check_page_titles() |
650 | - if self.english_install: |
651 | - self.expectThat(self.current_page_title, |
652 | - Equals(self.eng_config['page_title'])) |
653 | - |
654 | self._check_navigation_buttons() |
655 | |
656 | def lvm_crypto_page_tests(self, crypto_password): |
657 | @@ -426,31 +373,10 @@ |
658 | items = ['verified_crypto_label', 'crypto_label', 'crypto_description', |
659 | 'crypto_warning', 'crypto_extra_label', 'crypto_extra_time', |
660 | 'crypto_description_2', 'crypto_overwrite_space'] |
661 | - for i in items: |
662 | - item = crypto_page.select_single(BuilderName=i) |
663 | - self.expectThat(item.visible, Equals(True), |
664 | - "[Page:'{0}'] Expected {1} object to be visible " |
665 | - "but it wasn't" |
666 | - .format(self.current_step, item.name)) |
667 | - self.expectThat(item.label, NotEquals(u''), |
668 | - "[Page:'{0}'] Expected {1} objects label value " |
669 | - "to contain text but it didn't" |
670 | - .format(self.current_step, item.name)) |
671 | - self.expectIsInstance(item.label, str, |
672 | - "[Page:'{0}'] Expected {1} objects label " |
673 | - "value to be unicode but it wasn't" |
674 | - .format(self.current_step, item.name)) |
675 | - if self.english_install: |
676 | - #if english install check english values |
677 | - self.eng_config = eng_label_values.stepPartCrypto |
678 | - self.expectThat(item.label, Equals(self.eng_config[i])) |
679 | + self.check_visible_object_with_label(items) |
680 | |
681 | crypto_page.enter_crypto_phrase(crypto_password) |
682 | self._check_page_titles() |
683 | - if self.english_install: |
684 | - self.expectThat(self.current_page_title, |
685 | - Equals(self.eng_config['page_title'])) |
686 | - |
687 | self._check_navigation_buttons() |
688 | |
689 | def custom_partition_page_tests(self, part_config=None): |
690 | @@ -542,9 +468,6 @@ |
691 | location = ['London', 'Paris', 'Madrid', 'Algiers'] |
692 | if self.english_install: |
693 | location_page.select_location('London') |
694 | - self.eng_config = eng_label_values.stepLocation |
695 | - self.expectThat(self.current_page_title, |
696 | - Equals(self.eng_config['page_title'])) |
697 | else: |
698 | location_page.select_location(random.choice(location)) |
699 | self._check_page_titles() |
700 | @@ -583,12 +506,9 @@ |
701 | entry = keyboard_page.select_single('GtkEntry') |
702 | with self.keyboard.focused_type(entry) as kb: |
703 | kb.type(u'Testing keyboard layout') |
704 | - # TODO: only test the entry value if we are using english install |
705 | - #message = "Expected {0} (the length of the keyboard entry text) " |
706 | - # " to be {1}" |
707 | - # .format(len(entry.text), len(u'Testing keyboard layout')) |
708 | - #self.expectThat(len(entry.text), Equals( |
709 | - # len(u'Testing keyboard layout'))) |
710 | + # only test the entry value if we are using english install |
711 | + if self.english_install: |
712 | + self.expectThat(entry.text, Equals(u'Testing keyboard layout')) |
713 | self.expectThat(entry.text, NotEquals(u''), |
714 | "[Page:'{0}'] Expected Entry to contain text " |
715 | "after typing but it didn't" |
716 | @@ -599,11 +519,6 @@ |
717 | .format(self.current_step)) |
718 | # TODO: Test detecting keyboard layout |
719 | self._check_page_titles() |
720 | - if self.english_install: |
721 | - self.eng_config = eng_label_values.stepKeyboardConf |
722 | - self.expectThat(self.current_page_title, Equals( |
723 | - self.eng_config['page_title'])) |
724 | - |
725 | self._check_navigation_buttons(continue_button=True, back_button=True, |
726 | quit_button=False, skip_button=False) |
727 | |
728 | @@ -634,24 +549,7 @@ |
729 | 'verified_password_label', 'hostname_extra_label' |
730 | ] |
731 | logger.debug("checking user info page objects ......") |
732 | - for i in objects: |
733 | - obj = user_info_page.select_single('GtkLabel', name=i) |
734 | - self.expectThat(obj.visible, Equals(True), |
735 | - "[Page:'{0}'] Expected {1} object to be visible " |
736 | - "but it wasn't" |
737 | - .format(self.current_step, obj.name)) |
738 | - self.expectThat(obj.label, NotEquals(u''), |
739 | - "[Page:'{0}'] Expected {1} objects label value to " |
740 | - "contain text but it didn't" |
741 | - .format(self.current_step, obj.name)) |
742 | - self.expectIsInstance(obj.label, str, |
743 | - "[Page:'{0}'] Expected {1} objects label " |
744 | - "value to be unicode but it wasn't" |
745 | - .format(self.current_step, obj.name)) |
746 | - if self.english_install: |
747 | - #if english install check english values |
748 | - self.eng_config = eng_label_values.stepUserInfo |
749 | - self.expectThat(obj.label, Equals(self.eng_config[i])) |
750 | + self.check_visible_object_with_label(objects) |
751 | |
752 | user_info_page.create_user(username, pwd) |
753 | #TODO: get these working |
754 | @@ -661,29 +559,180 @@ |
755 | user_info_page.set_auto_login() |
756 | |
757 | self._check_page_titles() |
758 | - if self.english_install: |
759 | - self.expectThat(self.current_page_title, |
760 | - Equals(self.eng_config['page_title'])) |
761 | - |
762 | self._check_navigation_buttons(continue_button=True, back_button=True, |
763 | quit_button=False, skip_button=False) |
764 | |
765 | def ubuntu_one_page_tests(self, ): |
766 | - #self._update_current_step('stepUserInfo') |
767 | + self._update_current_step('stepUbuntuOne') |
768 | self._check_navigation_buttons(continue_button=True, back_button=True, |
769 | quit_button=False, skip_button=True) |
770 | logger.debug("run_ubuntu_one_page_tests()") |
771 | + #uOnePage = self.main_window.select_single(BuilderName='stepUbuntuOne') |
772 | + page_objects = ['u1_about_label', 'cloud_label', 'music_label', |
773 | + 'photos_label', 'apps_label', 'u1_existing_account', |
774 | + 'u1_new_account', 'u1_explain_email_2', |
775 | + 'u1_explain_email', 'u1_terms', |
776 | + 'password_mismatch', 'u1_ask_name_pass', |
777 | + 'u1_ask_email', 'u1_no_internet'] |
778 | + self.check_visible_object_with_label(page_objects) |
779 | + # XXX: we currently can't test signing in as it is yet to possible |
780 | + # to set ubiquity to use a staging server for testing. |
781 | skip_button = self.main_window.select_single('GtkButton', name='skip') |
782 | self.pointing_device.click_object(skip_button) |
783 | - #TODO: add checks to the U1 page |
784 | + #lets just sleep a little to wait for progress page as we |
785 | + # can't wait on the page_title |
786 | + time.sleep(5) |
787 | |
788 | def progress_page_tests(self, ): |
789 | - # TODO: move here from emulator and use process manager to check window |
790 | - # stack doesn't change during the progress stage and if a dialog |
791 | - # becomes top of stack we get window title to work outwhich one. |
792 | - # Currently polling on dbus for two specific dialogs is really horrible |
793 | - # for the logs and test design so need to find a cleaner way. |
794 | - pass |
795 | + ''' Runs the test for the installation progress page |
796 | + |
797 | + This method tracks the current progress of the install |
798 | + by using the fraction property of the progress bar |
799 | + to assertain the percentage complete. |
800 | + |
801 | + ''' |
802 | + logger.debug("run_install_progress_page_tests()") |
803 | + #We cant assert page title here as its an external html page |
804 | + #Maybe try assert WebKitWebView is visible |
805 | + webkitwindow = self.main_window.select_single( |
806 | + 'GtkScrolledWindow', name='webkit_scrolled_window' |
807 | + ) |
808 | + self.expectThat(webkitwindow.visible, Equals(True)) |
809 | + |
810 | + progress_bar = self.main_window.select_single( |
811 | + 'GtkProgressBar', name='install_progress') |
812 | + |
813 | + #Copying files progress bar |
814 | + self._track_install_progress() |
815 | + |
816 | + self.assertThat(progress_bar.fraction, Eventually( |
817 | + Equals(0.0), timeout=120)) |
818 | + #And now the install progress bar |
819 | + self._track_install_progress() |
820 | + |
821 | + def check_visible_object_with_label(self, visible_obj): |
822 | + """Check an visible objects label and visible properties, |
823 | + |
824 | + :param visible_obj: Accepts either a objects name property or |
825 | + a list of names |
826 | + ..note:: If english installation this function will also test the |
827 | + english label value which is retrieved from the |
828 | + generated english_config.ini file |
829 | + """ |
830 | + if isinstance(visible_obj, list): |
831 | + for item in visible_obj: |
832 | + self._check_object(item) |
833 | + return |
834 | + if isinstance(visible_obj, str): |
835 | + self._check_object(visible_obj) |
836 | + return |
837 | + raise ValueError( |
838 | + "Object name must either be a string or list of strings") |
839 | + |
840 | + def check_hidden_object_with_label(self, hidden_obj): |
841 | + """Check an hidden objects label and visible properties, |
842 | + |
843 | + :param hidden_obj: Accepts either a objects name property or |
844 | + a list of names |
845 | + """ |
846 | + if isinstance(hidden_obj, list): |
847 | + for item in hidden_obj: |
848 | + self._check_object(item, False) |
849 | + return |
850 | + if isinstance(hidden_obj, str): |
851 | + self._check_object(hidden_obj, False) |
852 | + return |
853 | + raise ValueError( |
854 | + "Object name must either be a string or list of strings") |
855 | + |
856 | + def _check_object(self, obj_name, obj_visible=True): |
857 | + logger.debug("Checking {0} object.......".format(obj_name)) |
858 | + #select current page object |
859 | + page = self.main_window.select_single(BuilderName=self.current_step) |
860 | + #select object |
861 | + page_object = page.select_single(BuilderName=obj_name) |
862 | + if obj_visible: |
863 | + visible_message = "[Page:'{0}'] Expected {1} object to be " \ |
864 | + "visible but it wasn't".format(self.current_step, |
865 | + page_object.name) |
866 | + else: |
867 | + visible_message = "[Page:'{0}'] Expected {1} object to not be " \ |
868 | + "visible but it was!".format(self.current_step, |
869 | + page_object.name) |
870 | + self.expectThat(page_object.visible, Equals(obj_visible), |
871 | + visible_message) |
872 | + self.expectThat(page_object.label, NotEquals(u''), |
873 | + "[Page:'{0}'] Expected {1} objects label value to " |
874 | + "contain text but it didn't" |
875 | + .format(self.current_step, page_object.name)) |
876 | + self.expectIsInstance(page_object.label, str, |
877 | + "[Page:'{0}'] Expected {1} objects label " |
878 | + "value to be unicode but it wasn't" |
879 | + .format(self.current_step, page_object.name)) |
880 | + #we only want to test visible english values, hidden ones don't matter |
881 | + if (self.current_step in self.english_config) and obj_visible: |
882 | + if self.english_install and ( |
883 | + obj_name in self.english_config[self.current_step]): |
884 | + logger.debug( |
885 | + "Checking {0} object's english label value....".format( |
886 | + obj_name)) |
887 | + #if english install check english values |
888 | + self.expectThat(page_object.label, Equals( |
889 | + self.english_config[self.current_step][obj_name])) |
890 | + |
891 | + def _track_install_progress(self, ): |
892 | + '''Gets the value of the fraction property of the progress bar |
893 | + |
894 | + so we can see when the progress bar is complete |
895 | + |
896 | + ''' |
897 | + logger.debug("_track_install_progress_bar()") |
898 | + progress_bar = self.main_window.select_single( |
899 | + 'GtkProgressBar', name='install_progress' |
900 | + ) |
901 | + progress = 0.0 |
902 | + complete = 1.0 |
903 | + logger.debug('Percentage complete "{0:.0f}%"'.format(progress * 100)) |
904 | + while progress < complete: |
905 | + #keep updating fraction value |
906 | + progress = progress_bar.fraction |
907 | + # lets sleep for longer at early stages then |
908 | + # reduce nearer to complete |
909 | + if progress < 0.5: |
910 | + time.sleep(5) |
911 | + elif progress < 0.7: |
912 | + time.sleep(3) |
913 | + elif progress < 0.8: |
914 | + time.sleep(1) |
915 | + else: |
916 | + pass |
917 | + |
918 | + logger.debug('Percentage complete "{0:.0f}%"' |
919 | + .format(progress * 100)) |
920 | + #check for install errors while waiting |
921 | + self._check_no_visible_dialogs() |
922 | + try: |
923 | + grub_dialog = self.main_window.get_dialog('GtkMessageDialog') |
924 | + if grub_dialog.visible: |
925 | + logger.error("The Grub installation failed dialog " |
926 | + "appeared :-(") |
927 | + self.assertThat(grub_dialog.visible, Equals(True), |
928 | + "The Grub installation failed") |
929 | + progress = 1.0 |
930 | + except Exception: |
931 | + pass |
932 | + |
933 | + def _check_no_visible_dialogs(self): |
934 | + dialogs = ['warning_dialog', 'crash_dialog', |
935 | + 'bootloader_fail_dialog', 'ubi_question_dialog'] |
936 | + # check each dialog is not visible |
937 | + for dialog in dialogs: |
938 | + logger.debug("Checking {0} dialog hasn't " |
939 | + "appeared.......".format(dialog)) |
940 | + dlg = self.main_window.get_dialog( |
941 | + 'GtkDialog', BuilderName=dialog |
942 | + ) |
943 | + self.assertThat(dlg.visible, Equals(False)) |
944 | |
945 | def _add_new_partition(self, ): |
946 | """ adds a new partition """ |
947 | @@ -807,6 +856,14 @@ |
948 | current_page_title = self.main_window.select_single( |
949 | 'GtkLabel', |
950 | BuilderName='page_title') |
951 | + if self.current_step in self.english_config: |
952 | + if self.english_install and ( |
953 | + 'page_title' in self.english_config[self.current_step]): |
954 | + #if english install check english values |
955 | + self.expectThat(current_page_title.label, Equals( |
956 | + self.english_config[self.current_step]['page_title'])) |
957 | + #also lets check it changed from the previous page |
958 | + |
959 | message_one = "Expected %s page title '%s' to not equal the "\ |
960 | "previous %s page title '%s' but it does" % ( |
961 | self.current_step, self.current_page_title, |
962 | @@ -870,49 +927,6 @@ |
963 | "visible but it was" |
964 | .format(self.current_step, stateboxName)) |
965 | |
966 | - def _options_tests(self, visible=[], hidden=[]): |
967 | - |
968 | - install_type_page = self.main_window.select_single( |
969 | - 'GtkAlignment', |
970 | - BuilderName='stepPartAsk') |
971 | - |
972 | - for option in visible: |
973 | - logger.info("selecting Visible object'{0}'".format(option)) |
974 | - opt = install_type_page.select_single(BuilderName=option) |
975 | - self.expectThat(opt.visible, Equals(True), |
976 | - "[Page:'{0}'] Expected {1} object to be visible " |
977 | - "but it wasn't" |
978 | - .format(self.current_step, opt.name)) |
979 | - self.expectThat(opt.label, NotEquals(u''), |
980 | - "[Page:'{0}'] Expected {1} objects label value to " |
981 | - "contain text but it didn't" |
982 | - .format(self.current_step, opt.name)) |
983 | - self.expectIsInstance(opt.label, str, |
984 | - "[Page:'{0}'] Expected {1} objects label " |
985 | - "value to be unicode but it wasn't" |
986 | - .format(self.current_step, opt.name)) |
987 | - if self.english_install: |
988 | - #if english install check english values |
989 | - self.eng_config = eng_label_values.stepPartAsk |
990 | - self.expectThat(opt.label, Equals(self.eng_config[option])) |
991 | - |
992 | - for option in hidden: |
993 | - logger.info("Selecting hidden object '{0}'".format(option)) |
994 | - |
995 | - opt = install_type_page.select_single(BuilderName=option) |
996 | - self.expectThat(opt.visible, Equals(False), |
997 | - "[Page:'{0}'] Expected {1} object to be not " |
998 | - "visible but it was" |
999 | - .format(self.current_step, opt.name)) |
1000 | - self.expectThat(opt.label, NotEquals(u''), |
1001 | - "[Page:'{0}'] Expected {1} objects label value to " |
1002 | - "contain text but it didn't" |
1003 | - .format(self.current_step, opt.name)) |
1004 | - self.expectIsInstance(opt.label, str, |
1005 | - "[Page:'{0}'] Expected {1} objects label " |
1006 | - "value to be unicode but it wasn't" |
1007 | - .format(self.current_step, opt.name)) |
1008 | - |
1009 | def _select_install_type(self, install_type): |
1010 | pass |
1011 | |
1012 | |
1013 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py' |
1014 | --- autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py 2013-11-19 09:07:08 +0000 |
1015 | +++ autopilot/ubiquity_autopilot_tests/tests/test_custom_install.py 2013-11-29 17:06:55 +0000 |
1016 | @@ -63,7 +63,7 @@ |
1017 | else: |
1018 | self.go_to_progress_page() |
1019 | |
1020 | - self.main_window.run_install_progress_page_tests() |
1021 | + self.progress_page_tests() |
1022 | self.assertThat(lambda: self.app.select_single( |
1023 | 'GtkDialog', |
1024 | name='finished_dialog').visible, |
1025 | |
1026 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_english_default.py' |
1027 | --- autopilot/ubiquity_autopilot_tests/tests/test_english_default.py 2013-11-19 09:07:08 +0000 |
1028 | +++ autopilot/ubiquity_autopilot_tests/tests/test_english_default.py 2013-11-29 17:06:55 +0000 |
1029 | @@ -35,7 +35,7 @@ |
1030 | self.preparing_page_tests() |
1031 | self.go_to_next_page() |
1032 | if flavor == 'Edubuntu': |
1033 | - self.edubuntu_addon_window_tests() |
1034 | + self.edubuntu_addon_window_tests(gnome=True) |
1035 | self.go_to_next_page() |
1036 | self.edubuntu_packages_window_tests() |
1037 | self.go_to_next_page() |
1038 | @@ -53,7 +53,7 @@ |
1039 | else: |
1040 | self.go_to_progress_page() |
1041 | |
1042 | - self.main_window.run_install_progress_page_tests() |
1043 | + self.progress_page_tests() |
1044 | self.assertThat(lambda: self.app.select_single( |
1045 | 'GtkDialog', |
1046 | name='finished_dialog').visible, |
1047 | |
1048 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py' |
1049 | --- autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py 2013-11-19 09:07:08 +0000 |
1050 | +++ autopilot/ubiquity_autopilot_tests/tests/test_english_encrypt_lvm.py 2013-11-29 17:06:55 +0000 |
1051 | @@ -54,7 +54,7 @@ |
1052 | else: |
1053 | self.go_to_progress_page() |
1054 | |
1055 | - self.main_window.run_install_progress_page_tests() |
1056 | + self.progress_page_tests() |
1057 | self.assertThat(lambda: self.app.select_single( |
1058 | 'GtkDialog', |
1059 | name='finished_dialog').visible, |
1060 | |
1061 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py' |
1062 | --- autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py 2013-11-19 09:07:08 +0000 |
1063 | +++ autopilot/ubiquity_autopilot_tests/tests/test_english_lvm.py 2013-11-29 17:06:55 +0000 |
1064 | @@ -52,7 +52,7 @@ |
1065 | else: |
1066 | self.go_to_progress_page() |
1067 | |
1068 | - self.main_window.run_install_progress_page_tests() |
1069 | + self.progress_page_tests() |
1070 | self.assertThat(lambda: self.app.select_single( |
1071 | 'GtkDialog', |
1072 | name='finished_dialog').visible, |
1073 | |
1074 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py' |
1075 | --- autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py 2013-11-19 09:07:08 +0000 |
1076 | +++ autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_default.py 2013-11-29 17:06:55 +0000 |
1077 | @@ -35,7 +35,7 @@ |
1078 | self.preparing_page_tests() |
1079 | self.go_to_next_page() |
1080 | if flavor == 'Edubuntu': |
1081 | - self.edubuntu_addon_window_tests() |
1082 | + self.edubuntu_addon_window_tests(ltsp=True) |
1083 | self.go_to_next_page() |
1084 | self.edubuntu_packages_window_tests() |
1085 | self.go_to_next_page() |
1086 | @@ -53,7 +53,7 @@ |
1087 | else: |
1088 | self.go_to_progress_page() |
1089 | |
1090 | - self.main_window.run_install_progress_page_tests() |
1091 | + self.progress_page_tests() |
1092 | self.assertThat(lambda: self.app.select_single( |
1093 | 'GtkDialog', |
1094 | name='finished_dialog').visible, |
1095 | |
1096 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py' |
1097 | --- autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py 2013-11-19 09:07:08 +0000 |
1098 | +++ autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_encrypt_lvm.py 2013-11-29 17:06:55 +0000 |
1099 | @@ -55,7 +55,7 @@ |
1100 | else: |
1101 | self.go_to_progress_page() |
1102 | |
1103 | - self.main_window.run_install_progress_page_tests() |
1104 | + self.progress_page_tests() |
1105 | self.assertThat(lambda: self.app.select_single( |
1106 | 'GtkDialog', |
1107 | name='finished_dialog').visible, |
1108 | |
1109 | === modified file 'autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py' |
1110 | --- autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py 2013-11-19 09:07:08 +0000 |
1111 | +++ autopilot/ubiquity_autopilot_tests/tests/test_nonenglish_lvm.py 2013-11-29 17:06:55 +0000 |
1112 | @@ -52,7 +52,7 @@ |
1113 | else: |
1114 | self.go_to_progress_page() |
1115 | |
1116 | - self.main_window.run_install_progress_page_tests() |
1117 | + self.progress_page_tests() |
1118 | self.assertThat(lambda: self.app.select_single( |
1119 | 'GtkDialog', |
1120 | name='finished_dialog').visible, |
1121 | |
1122 | === removed directory 'autopilot/ubiquity_autopilot_tests/unittests' |
1123 | === removed file 'autopilot/ubiquity_autopilot_tests/unittests/__init__.py' |
1124 | === removed file 'autopilot/ubiquity_autopilot_tests/unittests/test_expects.py' |
1125 | --- autopilot/ubiquity_autopilot_tests/unittests/test_expects.py 2013-11-01 19:36:31 +0000 |
1126 | +++ autopilot/ubiquity_autopilot_tests/unittests/test_expects.py 1970-01-01 00:00:00 +0000 |
1127 | @@ -1,12 +0,0 @@ |
1128 | -__author__ = 'dan' |
1129 | -import unittest |
1130 | -from testtools.testcase import TestCase |
1131 | - |
1132 | - |
1133 | -class ExpectTestCase(TestCase): |
1134 | - def test_something(self): |
1135 | - self.assertEqual(True, True) |
1136 | - |
1137 | - |
1138 | -if __name__ == '__main__': |
1139 | - unittest.main() |
1140 | |
1141 | === removed file 'autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py' |
1142 | --- autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py 2013-11-19 09:07:08 +0000 |
1143 | +++ autopilot/ubiquity_autopilot_tests/unittests/test_matchers.py 1970-01-01 00:00:00 +0000 |
1144 | @@ -1,14 +0,0 @@ |
1145 | -__author__ = 'dan' |
1146 | - |
1147 | -import unittest |
1148 | -from testtools.testcase import TestCase |
1149 | -from testtools.matchers import Equals |
1150 | - |
1151 | - |
1152 | -class MyTestCase(TestCase): |
1153 | - |
1154 | - def test_something(self): |
1155 | - self.assertThat(True, Equals(False)) |
1156 | - |
1157 | -if __name__ == '__main__': |
1158 | - unittest.main() |
Approved, thanks!
I tried with ubuntu english and non-english tests cases. Lubuntu and Xubuntu images seems broken (I tried with the current version too, so at least it is not a regression)
pep8 and pyflakes tests are ok.