Merge lp:~udt-contributors/mago/class-constants into lp:~mago-contributors/mago/mago-1.0
- class-constants
- Merge into mago-1.0
Proposed by
Javier Collado
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~udt-contributors/mago/class-constants |
Merge into: | lp:~mago-contributors/mago/mago-1.0 |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~udt-contributors/mago/class-constants |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ara Pulido | Approve | ||
Javier Collado (community) | Approve | ||
Eitan Isaacson | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Javier Collado (javier.collado) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ara Pulido (ara) wrote : | # |
I did some minor changes to the branch (default window name and using some setters in the clean up method).
I will ask Eitan to also review this.
Cheers,
Ara.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Eitan Isaacson (eeejay) wrote : | # |
This looks great. I like the idea.
One thing: You don't need to use __class__ to access class fields.
Instead of self.__
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Eitan Isaacson (eeejay) wrote : | # |
On Javier's approval I removed the __class__ prefix, script developers don't need to know/understand the distinction between class and instance variables, it will work as expected.
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Javier Collado (javier.collado) : | # |
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ara Pulido (ara) : | # |
review:
Approve
- 62. By Eitan Isaacson
-
Comment out server.hide(), it is broken (bug #351537).
- 63. By Eitan Isaacson
-
Merge from trunk.
- 64. By Eitan Isaacson
-
Added a server display test.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'desktoptesting/gnome.py' |
2 | --- desktoptesting/gnome.py 2009-03-19 10:47:43 +0000 |
3 | +++ desktoptesting/gnome.py 2009-03-30 10:11:44 +0000 |
4 | @@ -5,23 +5,46 @@ |
5 | """ |
6 | import ooldtp |
7 | import ldtp |
8 | -import gnome_constants |
9 | |
10 | class Application: |
11 | """ |
12 | - Supperclass for the rest of the applications |
13 | + Superclass for the rest of the applications |
14 | + |
15 | + Constants that should be defined in the classes that inherit from this class |
16 | + LAUNCHER: Argument to be passed when launching the application through ldtp.launchapp |
17 | + WINDOW: Top application frame pattern using ldtp syntax |
18 | + CLOSE_TYPE: Close object type (one of 'menu' or 'button') |
19 | + CLOSE_NAME: Close object name |
20 | """ |
21 | - def __init__(self, name = '', close_type='menu', close_name='mnuQuit'): |
22 | + CLOSE_TYPE = 'menu' |
23 | + CLOSE_NAME = 'mnuQuit' |
24 | + |
25 | + TOP_PANEL = 'frmTopExpandedEdgePanel' |
26 | + |
27 | + |
28 | + def __init__(self, name = None, close_type= None, close_name= None): |
29 | """ |
30 | @type close_type: string |
31 | @param close_type: The type of close widget of the application. Types: menu, button. |
32 | @type close_name: string |
33 | - @param close_name: The name of the exit widget of the application. If not mentioned the default will be used ("Quit"). |
34 | + @param close_name: The name of the exit widget of the application. If not mentioned the default will be used ("Quit") |
35 | """ |
36 | - self.name = name |
37 | - self.close_type = close_type |
38 | - self.close_name = close_name |
39 | - |
40 | + if name: |
41 | + self.name = name |
42 | + else: |
43 | + self.name = self.__class__.WINDOW |
44 | + |
45 | + if close_type: |
46 | + self.close_type = close_type |
47 | + else: |
48 | + self.close_type = self.__class__.CLOSE_TYPE |
49 | + |
50 | + if close_name: |
51 | + self.close_name = close_name |
52 | + else: |
53 | + self.close_name = self.__class__.CLOSE_NAME |
54 | + |
55 | + |
56 | def setup(self): |
57 | pass |
58 | |
59 | @@ -29,9 +52,9 @@ |
60 | pass |
61 | |
62 | def cleanup(self): |
63 | - self.set_name('') |
64 | - self.set_close_type('menu') |
65 | - self.set_close_name('mnuQuit') |
66 | + self.name = self.__class__.WINDOW |
67 | + self.close_type = self.__class__.CLOSE_TYPE |
68 | + self.close_name = self.__class__.CLOSE_NAME |
69 | |
70 | def recover(self): |
71 | self.teardown() |
72 | @@ -56,15 +79,14 @@ |
73 | """ |
74 | ldtp.remap(self.name) |
75 | |
76 | - def open_and_check_app(self, app_name): |
77 | + def open_and_check_app(self): |
78 | """ |
79 | Given an application, it tries to open it. |
80 | |
81 | @type app_name: string |
82 | @param app_name: The command to start the application. |
83 | """ |
84 | - |
85 | - ldtp.launchapp(app_name) |
86 | + ldtp.launchapp(self.__class__.LAUNCHER) |
87 | |
88 | ldtp.wait(2) |
89 | response = ldtp.waittillguiexist(self.name, '', 20) |
90 | @@ -135,13 +157,40 @@ |
91 | except ldtp.LdtpExecutionError: |
92 | raise ldtp.LdtpExecutionError, "We couldn't write text." |
93 | |
94 | + |
95 | class Seahorse(Application): |
96 | """ |
97 | Seahorse manages the Seahorse application. |
98 | """ |
99 | - |
100 | + WINDOW = "frmPasswordsandEncryptionKeys" |
101 | + LAUNCHER = "seahorse" |
102 | + MNU_NEWKEY = "mnuNew" |
103 | + NEWKEY_DLG = "Create New ..." |
104 | + BTN_CONTINUE = "btnContinue" |
105 | + TYPE_PGP = "PGP Key" |
106 | + NEWPGP_DLG = "dlgCreateaPGPKey" |
107 | + DLG_NEWPGP_FULLNAME = "txtFullName" |
108 | + DLG_NEWPGP_EMAIL = "txtEmailAddress" |
109 | + DLG_NEWPGP_COMMENT = "txtComment" |
110 | + BTN_NEWPGP_CREATE = "btnCreate" |
111 | + DLG_NEWKEY_PASS = "dlgPassphrasefor*" |
112 | + BTN_PASS_OK = "btnOK" |
113 | + DLG_GENERATING_KEY = "dlgGeneratingkey" |
114 | + DLG_CREATING_SSH = "dlgCreatingSecureShellKey" |
115 | + TYPE_SSH = "Secure Shell Key" |
116 | + NEWSSH_DLG = "New Secure Shell Key" |
117 | + DLG_NEWSSH_DESC = "txtKeyDescription" |
118 | + BTN_NEWSSH_CREATE_AND_SETUP = "Create and Set Up" |
119 | + DLG_SET_UP = "Set Up Computer for SSH Connection" |
120 | + TXT_SET_UP_COMPUTER = "txtThehostnameoraddressoftheserver." |
121 | + TXT_SET_UP_LOGIN = "txtLoginName" |
122 | + BTN_SET_UP = "btnSetUp" |
123 | + BTN_NEWSSH_CREATE = "Just Create Key" |
124 | + TAB_PERSONAL_KEYS = "My Personal Keys" |
125 | + TAB_LIST = "ptl0" |
126 | + |
127 | def __init__(self): |
128 | - Application.__init__(self, gnome_constants.SH_WINDOW) |
129 | + Application.__init__(self) |
130 | |
131 | def setup(self): |
132 | self.open() |
133 | @@ -154,7 +203,7 @@ |
134 | pass |
135 | |
136 | def open(self): |
137 | - Application.open_and_check_app(self, gnome_constants.SH_LAUNCHER) |
138 | + self.open_and_check_app() |
139 | |
140 | def new_key(self, key_type): |
141 | """ |
142 | @@ -167,7 +216,7 @@ |
143 | seahorse = ooldtp.context(self.name) |
144 | |
145 | try: |
146 | - mnu_new_key = seahorse.getchild(gnome_constants.SH_MNU_NEWKEY) |
147 | + mnu_new_key = seahorse.getchild(self.__class__.MNU_NEWKEY) |
148 | except ldtp.LdtpExecutionError: |
149 | raise ldtp.LdtpExecutionError, "The new key menu was not found." |
150 | |
151 | @@ -177,8 +226,8 @@ |
152 | raise ldtp.LdtpExecutionError, "There was a problem when selecting new key menu item." |
153 | |
154 | try: |
155 | - ldtp.waittillguiexist(gnome_constants.SH_NEWKEY_DLG) |
156 | - dlg_new_key = ooldtp.context(gnome_constants.SH_NEWKEY_DLG) |
157 | + ldtp.waittillguiexist(self.__class__.NEWKEY_DLG) |
158 | + dlg_new_key = ooldtp.context(self.__class__.NEWKEY_DLG) |
159 | except ldtp.LdtpExecutionError: |
160 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." |
161 | |
162 | @@ -197,7 +246,7 @@ |
163 | raise ldtp.LdtpExecutionError, "Error getting the key types table." |
164 | |
165 | try: |
166 | - btn_continue = dlg_new_key.getchild(gnome_constants.SH_BTN_CONTINUE) |
167 | + btn_continue = dlg_new_key.getchild(self.__class__.BTN_CONTINUE) |
168 | except ldtp.LdtpExecutionError: |
169 | raise ldtp.LdtpExecutionError, "The continue button at the new key dialog was not found." |
170 | |
171 | @@ -226,16 +275,16 @@ |
172 | @param passphrase: Passphrase to type for the PGP key |
173 | """ |
174 | |
175 | - self.new_key(gnome_constants.SH_TYPE_PGP) |
176 | + self.new_key(self.__class__.TYPE_PGP) |
177 | |
178 | try: |
179 | - ldtp.waittillguiexist(gnome_constants.SH_NEWPGP_DLG) |
180 | - dlg_new_pgp = ooldtp.context(gnome_constants.SH_NEWPGP_DLG) |
181 | + ldtp.waittillguiexist(self.__class__.NEWPGP_DLG) |
182 | + dlg_new_pgp = ooldtp.context(self.__class__.NEWPGP_DLG) |
183 | except ldtp.LdtpExecutionError: |
184 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." |
185 | |
186 | try: |
187 | - txt_field = dlg_new_pgp.getchild(gnome_constants.SH_DLG_NEWPGP_FULLNAME) |
188 | + txt_field = dlg_new_pgp.getchild(self.__class__.DLG_NEWPGP_FULLNAME) |
189 | except ldtp.LdtpExecutionError: |
190 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." |
191 | try: |
192 | @@ -244,7 +293,7 @@ |
193 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." |
194 | |
195 | try: |
196 | - txt_field = dlg_new_pgp.getchild(gnome_constants.SH_DLG_NEWPGP_EMAIL) |
197 | + txt_field = dlg_new_pgp.getchild(self.__class__.DLG_NEWPGP_EMAIL) |
198 | except ldtp.LdtpExecutionError: |
199 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." |
200 | try: |
201 | @@ -253,7 +302,7 @@ |
202 | raise ldtp.LdtpExecutionError, "There was a problem when writing the text." |
203 | |
204 | try: |
205 | - txt_field = dlg_new_pgp.getchild(gnome_constants.SH_DLG_NEWPGP_COMMENT) |
206 | + txt_field = dlg_new_pgp.getchild(self.__class__.DLG_NEWPGP_COMMENT) |
207 | except ldtp.LdtpExecutionError: |
208 | raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found." |
209 | try: |
210 | @@ -262,7 +311,7 @@ |
211 | raise ldtp.LdtpExecutionError, "There was a problem when writing the text." |
212 | |
213 | try: |
214 | - btn_create = dlg_new_pgp.getchild(gnome_constants.SH_BTN_NEWPGP_CREATE) |
215 | + btn_create = dlg_new_pgp.getchild(self.__class__.BTN_NEWPGP_CREATE) |
216 | except ldtp.LdtpExecutionError: |
217 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." |
218 | |
219 | @@ -272,8 +321,8 @@ |
220 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the create button." |
221 | |
222 | try: |
223 | - ldtp.waittillguiexist(gnome_constants.SH_DLG_NEWKEY_PASS) |
224 | - dlg_new_pgp_pass = ooldtp.context(gnome_constants.SH_DLG_NEWKEY_PASS) |
225 | + ldtp.waittillguiexist(self.__class__.DLG_NEWKEY_PASS) |
226 | + dlg_new_pgp_pass = ooldtp.context(self.__class__.DLG_NEWKEY_PASS) |
227 | except ldtp.LdtpExecutionError: |
228 | raise ldtp.LdtpExecutionError, "The new pgp key passphrase dialog was not found." |
229 | |
230 | @@ -285,7 +334,7 @@ |
231 | raise ldtp.LdtpExecutionError, "Error entering passphrase." |
232 | |
233 | try: |
234 | - btn_pass_ok = dlg_new_pgp_pass.getchild(gnome_constants.SH_BTN_PASS_OK) |
235 | + btn_pass_ok = dlg_new_pgp_pass.getchild(self.__class__.BTN_PASS_OK) |
236 | except ldtp.LdtpExecutionError: |
237 | raise ldtp.LdtpExecutionError, "The OK button at the new PGP key passphrase dialog was not found." |
238 | |
239 | @@ -295,8 +344,8 @@ |
240 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the OK button." |
241 | |
242 | try: |
243 | - ldtp.waittillguiexist(gnome_constants.SH_DLG_GENERATING_KEY) |
244 | - while ldtp.guiexist(gnome_constants.SH_DLG_GENERATING_KEY) == 1: |
245 | + ldtp.waittillguiexist(self.__class__.DLG_GENERATING_KEY) |
246 | + while ldtp.guiexist(self.__class__.DLG_GENERATING_KEY) == 1: |
247 | ldtp.wait(1) |
248 | except ldtp.LdtpExecutionError: |
249 | raise ldtp.LdtpExecutionError, "The new pgp generating key dialog was not found." |
250 | @@ -324,18 +373,18 @@ |
251 | @param login: Login to use in the remote computer |
252 | """ |
253 | |
254 | - self.new_key(gnome_constants.SH_TYPE_SSH) |
255 | + self.new_key(self.__class__.TYPE_SSH) |
256 | |
257 | try: |
258 | - ldtp.waittillguiexist(gnome_constants.SH_NEWSSH_DLG) |
259 | - dlg_new_ssh = ooldtp.context(gnome_constants.SH_NEWSSH_DLG) |
260 | + ldtp.waittillguiexist(self.__class__.NEWSSH_DLG) |
261 | + dlg_new_ssh = ooldtp.context(self.__class__.NEWSSH_DLG) |
262 | except ldtp.LdtpExecutionError: |
263 | raise ldtp.LdtpExecutionError, "The new key dialog was not found." |
264 | |
265 | try: |
266 | - txt_field = dlg_new_ssh.getchild(gnome_constants.SH_DLG_NEWSSH_DESC) |
267 | + txt_field = dlg_new_ssh.getchild(self.__class__.DLG_NEWSSH_DESC) |
268 | except ldtp.LdtpExecutionError: |
269 | - raise ldtp.LdtpExecutionError, "The " + gnome_constants.SH_DLG_NEWSSH_DESC + " text field was not found." |
270 | + raise ldtp.LdtpExecutionError, "The " + self.__class__.DLG_NEWSSH_DESC + " text field was not found." |
271 | try: |
272 | txt_field.settextvalue(description) |
273 | except ldtp.LdtpExecutionError: |
274 | @@ -343,13 +392,13 @@ |
275 | |
276 | if set_up == True: |
277 | try: |
278 | - btn_create = dlg_new_ssh.getchild(gnome_constants.SH_BTN_NEWSSH_CREATE_AND_SETUP) |
279 | + btn_create = dlg_new_ssh.getchild(self.__class__.BTN_NEWSSH_CREATE_AND_SETUP) |
280 | except ldtp.LdtpExecutionError: |
281 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." |
282 | |
283 | else: |
284 | try: |
285 | - btn_create = dlg_new_ssh.getchild(gnome_constants.SH_BTN_NEWSSH_CREATE) |
286 | + btn_create = dlg_new_ssh.getchild(self.__class__.BTN_NEWSSH_CREATE) |
287 | except ldtp.LdtpExecutionError: |
288 | raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found." |
289 | |
290 | @@ -360,8 +409,8 @@ |
291 | |
292 | |
293 | try: |
294 | - ldtp.waittillguiexist(gnome_constants.SH_DLG_NEWKEY_PASS) |
295 | - dlg_new_key_pass = ooldtp.context(gnome_constants.SH_DLG_NEWKEY_PASS) |
296 | + ldtp.waittillguiexist(self.__class__.DLG_NEWKEY_PASS) |
297 | + dlg_new_key_pass = ooldtp.context(self.__class__.DLG_NEWKEY_PASS) |
298 | except ldtp.LdtpExecutionError: |
299 | raise ldtp.LdtpExecutionError, "The new key passphrase dialog was not found." |
300 | |
301 | @@ -373,7 +422,7 @@ |
302 | raise ldtp.LdtpExecutionError, "Error entering passphrase." |
303 | |
304 | try: |
305 | - btn_pass_ok = dlg_new_key_pass.getchild(gnome_constants.SH_BTN_PASS_OK) |
306 | + btn_pass_ok = dlg_new_key_pass.getchild(self.__class__.BTN_PASS_OK) |
307 | except ldtp.LdtpExecutionError: |
308 | raise ldtp.LdtpExecutionError, "The OK button at the new key passphrase dialog was not found." |
309 | |
310 | @@ -385,15 +434,15 @@ |
311 | if set_up == True and login is not None: |
312 | |
313 | try: |
314 | - ldtp.waittillguiexist(gnome_constants.SH_DLG_SET_UP) |
315 | - dlg_set_up_computer = ooldtp.context(gnome_constants.SH_DLG_SET_UP) |
316 | + ldtp.waittillguiexist(self.__class__.DLG_SET_UP) |
317 | + dlg_set_up_computer = ooldtp.context(self.__class__.DLG_SET_UP) |
318 | except ldtp.LdtpExecutionError: |
319 | raise ldtp.LdtpExecutionError, "The set up computer dialog was not found." |
320 | |
321 | try: |
322 | - txt_field = dlg_set_up_computer.getchild(gnome_constants.SH_TXT_SET_UP_LOGIN) |
323 | + txt_field = dlg_set_up_computer.getchild(self.__class__.TXT_SET_UP_LOGIN) |
324 | except ldtp.LdtpExecutionError: |
325 | - raise ldtp.LdtpExecutionError, "The " + gnome_constants.SH_TXT_SET_UP_LOGIN + " text field was not found." |
326 | + raise ldtp.LdtpExecutionError, "The " + self.__class__.TXT_SET_UP_LOGIN + " text field was not found." |
327 | try: |
328 | txt_field.settextvalue(login) |
329 | except ldtp.LdtpExecutionError: |
330 | @@ -401,16 +450,16 @@ |
331 | |
332 | if set_up == True: |
333 | try: |
334 | - txt_field = dlg_set_up_computer.getchild(gnome_constants.SH_TXT_SET_UP_COMPUTER) |
335 | + txt_field = dlg_set_up_computer.getchild(self.__class__.TXT_SET_UP_COMPUTER) |
336 | except ldtp.LdtpExecutionError: |
337 | - raise ldtp.LdtpExecutionError, "The " + gnome_constants.SH_TXT_SET_UP_COMPUTER + " text field was not found." |
338 | + raise ldtp.LdtpExecutionError, "The " + self.__class__.TXT_SET_UP_COMPUTER + " text field was not found." |
339 | try: |
340 | txt_field.settextvalue(computer) |
341 | except ldtp.LdtpExecutionError: |
342 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." |
343 | |
344 | try: |
345 | - btn_set_up = dlg_set_up_computer.getchild(gnome_constants.SH_BTN_SET_UP) |
346 | + btn_set_up = dlg_set_up_computer.getchild(self.__class__.BTN_SET_UP) |
347 | except ldtp.LdtpExecutionError: |
348 | raise ldtp.LdtpExecutionError, "The set up button was not found." |
349 | |
350 | @@ -420,7 +469,7 @@ |
351 | raise ldtp.LdtpExecutionError, "There was a problem when clicking the set up button." |
352 | |
353 | try: |
354 | - while ldtp.guiexist(gnome_constants.SH_DLG_CREATING_SSH) == 1: |
355 | + while ldtp.guiexist(self.__class__.DLG_CREATING_SSH) == 1: |
356 | ldtp.wait(1) |
357 | |
358 | except ldtp.LdtpExecutionError: |
359 | @@ -429,7 +478,7 @@ |
360 | # It is too fast to grab the main window afterwards |
361 | ldtp.wait(3) |
362 | |
363 | - def assert_exists_key(self, name, tab_name = gnome_constants.SH_TAB_PERSONAL_KEYS): |
364 | + def assert_exists_key(self, name, tab_name = None): |
365 | """ |
366 | It checks that the KEY with description 'description' is |
367 | part of the keys of the current user |
368 | @@ -440,12 +489,14 @@ |
369 | @type tab_name: string |
370 | @param tab_name: The tab name to search for the key. |
371 | """ |
372 | + if not tab_name: |
373 | + tab_name = self.__class__.TAB_PERSONAL_KEYS |
374 | |
375 | seahorse = ooldtp.context(self.name) |
376 | try: |
377 | |
378 | - page_list = seahorse.getchild(gnome_constants.SH_TAB_LIST) |
379 | - page_list.selecttab(gnome_constants.SH_TAB_PERSONAL_KEYS) |
380 | + page_list = seahorse.getchild(self.__class__.TAB_LIST) |
381 | + page_list.selecttab(self.__class__.TAB_PERSONAL_KEYS) |
382 | scroll_pane = ldtp.getobjectproperty(self.name, tab_name, 'children') |
383 | list_keys = ldtp.getobjectproperty(self.name, scroll_pane, 'children') |
384 | list_keys = list_keys.split(' ')[0] |
385 | @@ -464,9 +515,22 @@ |
386 | """ |
387 | GEdit manages the Gedit application. |
388 | """ |
389 | - |
390 | + WINDOW = "frm*gedit" |
391 | + TXT_FIELD = "txt1" |
392 | + LAUNCHER = "gedit" |
393 | + SAVE_DLG = "dlgSave*" |
394 | + SAVE_DLG_TXT_NAME = "txtName" |
395 | + SAVE_DLG_BTN_SAVE = "btnSave" |
396 | + QUESTION_DLG = "dlgQuestion" |
397 | + QUESTION_DLG_BTN_SAVE = "btnSave" |
398 | + QUESTION_DLG_BTN_SAVE_AS = "btnSaveAs" |
399 | + QUESTION_DLG_BTN_CLOSE = "btnClosewithoutSaving" |
400 | + MNU_QUIT = "mnuQuit" |
401 | + MNU_CLOSE = "mnuClose" |
402 | + MNU_NEW = "mnuNew" |
403 | + |
404 | def __init__(self): |
405 | - Application.__init__(self, gnome_constants.GE_WINDOW) |
406 | + Application.__init__(self) |
407 | |
408 | def setup(self): |
409 | self.open() |
410 | @@ -479,30 +543,30 @@ |
411 | try: |
412 | try: |
413 | gedit = ooldtp.context(self.name) |
414 | - quit_menu = gedit.getchild(gnome_constants.GE_MNU_CLOSE) |
415 | + quit_menu = gedit.getchild(self.__class__.MNU_CLOSE) |
416 | except ldtp.LdtpExecutionError: |
417 | raise ldtp.LdtpExecutionError, "The quit menu was not found." |
418 | quit_menu.selectmenuitem() |
419 | except ldtp.LdtpExecutionError: |
420 | raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application." |
421 | |
422 | - result = ldtp.waittillguiexist(gnome_constants.GE_QUESTION_DLG, |
423 | + result = ldtp.waittillguiexist(self.__class__.QUESTION_DLG, |
424 | guiTimeOut = 2) |
425 | |
426 | if result == 1: |
427 | - question_dialog = ooldtp.context(gnome_constants.GE_QUESTION_DLG) |
428 | - question_dlg_btn_close = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_CLOSE) |
429 | + question_dialog = ooldtp.context(self.__class__.QUESTION_DLG) |
430 | + question_dlg_btn_close = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_CLOSE) |
431 | question_dlg_btn_close.click() |
432 | |
433 | try: |
434 | gedit = ooldtp.context(self.name) |
435 | - new_menu = gedit.getchild(gnome_constants.GE_MNU_NEW) |
436 | + new_menu = gedit.getchild(self.__class__.MNU_NEW) |
437 | except ldtp.LdtpExecutionError: |
438 | raise ldtp.LdtpExecutionError, "The new menu was not found." |
439 | new_menu.selectmenuitem() |
440 | |
441 | result = ldtp.waittillguiexist( |
442 | - self.name, gnome_constants.GE_TXT_FIELD) |
443 | + self.name, self.__class__.TXT_FIELD) |
444 | if result != 1: |
445 | raise ldtp.LdtpExecutionError, "Failed to set up new document." |
446 | |
447 | @@ -514,7 +578,7 @@ |
448 | @type text: string |
449 | @param text: The text string to be written to the current buffer. |
450 | """ |
451 | - Application.write_text(self, text, gnome_constants.GE_TXT_FIELD) |
452 | + Application.write_text(self, text, self.__class__.TXT_FIELD) |
453 | |
454 | def save(self, filename): |
455 | """ |
456 | @@ -529,12 +593,12 @@ |
457 | ooldtp.context(self.name) |
458 | |
459 | try: |
460 | - ldtp.waittillguiexist(gnome_constants.GE_SAVE_DLG) |
461 | - save_dialog = ooldtp.context(gnome_constants.GE_SAVE_DLG) |
462 | + ldtp.waittillguiexist(self.__class__.SAVE_DLG) |
463 | + save_dialog = ooldtp.context(self.__class__.SAVE_DLG) |
464 | except ldtp.LdtpExecutionError: |
465 | raise ldtp.LdtpExecutionError, "The Gedit save dialog was not found." |
466 | try: |
467 | - save_dlg_txt_filename = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_TXT_NAME) |
468 | + save_dlg_txt_filename = save_dialog.getchild(self.__class__.SAVE_DLG_TXT_NAME) |
469 | except ldtp.LdtpExecutionError: |
470 | raise ldtp.LdtpExecutionError, "The filename txt field in Gedit save dialog was not found." |
471 | try: |
472 | @@ -544,7 +608,7 @@ |
473 | raise ldtp.LdtpExecutionError, "We couldn't write text." |
474 | |
475 | try: |
476 | - save_dlg_btn_save = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_BTN_SAVE) |
477 | + save_dlg_btn_save = save_dialog.getchild(self.__class__.SAVE_DLG_BTN_SAVE) |
478 | except ldtp.LdtpExecutionError: |
479 | raise ldtp.LdtpExecutionError, "The button Save in Gedit save dialog was not found." |
480 | |
481 | @@ -553,7 +617,7 @@ |
482 | except ldtp.LdtpExecutionError: |
483 | raise ldtp.LdtpExecutionError, "There was an error when pushing the Save button." |
484 | |
485 | - ldtp.waittillguinotexist(gnome_constants.GE_SAVE_DLG) |
486 | + ldtp.waittillguinotexist(self.__class__.SAVE_DLG) |
487 | |
488 | def open(self): |
489 | """ |
490 | @@ -561,7 +625,7 @@ |
491 | didn't start properly. |
492 | |
493 | """ |
494 | - Application.open_and_check_app(self, gnome_constants.GE_LAUNCHER) |
495 | + self.open_and_check_app() |
496 | |
497 | def exit(self, save=False, filename=''): |
498 | """ |
499 | @@ -579,42 +643,42 @@ |
500 | try: |
501 | gedit = ooldtp.context(self.name) |
502 | try: |
503 | - quit_menu = gedit.getchild(gnome_constants.GE_MNU_QUIT) |
504 | + quit_menu = gedit.getchild(self.__class__.MNU_QUIT) |
505 | except ldtp.LdtpExecutionError: |
506 | raise ldtp.LdtpExecutionError, "The quit menu was not found." |
507 | quit_menu.selectmenuitem() |
508 | except ldtp.LdtpExecutionError: |
509 | raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application." |
510 | |
511 | - response = ldtp.waittillguiexist(gnome_constants.GE_QUESTION_DLG, '', 20) |
512 | + response = ldtp.waittillguiexist(self.__class__.QUESTION_DLG, '', 20) |
513 | |
514 | # If the text has changed, the save dialog will appear |
515 | if response == 1: |
516 | try: |
517 | - question_dialog = ooldtp.context(gnome_constants.GE_QUESTION_DLG) |
518 | + question_dialog = ooldtp.context(self.__class__.QUESTION_DLG) |
519 | except ldtp.LdtpExecutionError: |
520 | raise ldtp.LdtpExecutionError, "The Gedit question dialog was not found." |
521 | |
522 | # Test if the file needs to be saved |
523 | if save: |
524 | try: |
525 | - question_dlg_btn_save = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_SAVE) |
526 | + question_dlg_btn_save = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_SAVE) |
527 | question_dlg_btn_save.click() |
528 | except ldtp.LdtpExecutionError: |
529 | # If the Save button was not found, we will try to find the Save As |
530 | try: |
531 | - question_dlg_btn_save = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_SAVE_AS) |
532 | + question_dlg_btn_save = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_SAVE_AS) |
533 | question_dlg_btn_save.click() |
534 | except ldtp.LdtpExecutionError: |
535 | raise ldtp.LdtpExecutionError, "The save or save as buttons in Gedit question dialog were not found." |
536 | |
537 | try: |
538 | - ldtp.waittillguiexist(gnome_constants.GE_SAVE_DLG) |
539 | - save_dialog = ooldtp.context(gnome_constants.GE_SAVE_DLG) |
540 | + ldtp.waittillguiexist(self.__class__.SAVE_DLG) |
541 | + save_dialog = ooldtp.context(self.__class__.SAVE_DLG) |
542 | except ldtp.LdtpExecutionError: |
543 | raise ldtp.LdtpExecutionError, "The Gedit save dialog was not found." |
544 | try: |
545 | - save_dlg_txt_filename = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_TXT_NAME) |
546 | + save_dlg_txt_filename = save_dialog.getchild(self.__class__.SAVE_DLG_TXT_NAME) |
547 | except ldtp.LdtpExecutionError: |
548 | raise ldtp.LdtpExecutionError, "The filename txt field in Gedit save dialog was not found." |
549 | try: |
550 | @@ -624,7 +688,7 @@ |
551 | raise ldtp.LdtpExecutionError, "There was an error when writing the text." |
552 | |
553 | try: |
554 | - save_dlg_btn_save = save_dialog.getchild(gnome_constants.GE_SAVE_DLG_BTN_SAVE) |
555 | + save_dlg_btn_save = save_dialog.getchild(self.__class__.SAVE_DLG_BTN_SAVE) |
556 | except ldtp.LdtpExecutionError: |
557 | raise ldtp.LdtpExecutionError, "The save button in Gedit save dialog was not found." |
558 | |
559 | @@ -633,11 +697,11 @@ |
560 | except ldtp.LdtpExecutionError: |
561 | raise ldtp.LdtpExecutionError, "There was an error when pushing the Save button." |
562 | |
563 | - ldtp.waittillguinotexist(gnome_constants.GE_SAVE_DLG) |
564 | + ldtp.waittillguinotexist(self.__class__.SAVE_DLG) |
565 | |
566 | else: |
567 | try: |
568 | - question_dlg_btn_close = question_dialog.getchild(gnome_constants.GE_QUESTION_DLG_BTN_CLOSE) |
569 | + question_dlg_btn_close = question_dialog.getchild(self.__class__.QUESTION_DLG_BTN_CLOSE) |
570 | question_dlg_btn_close.click() |
571 | except ldtp.LdtpExecutionError: |
572 | raise ldtp.LdtpExecutionError, "It was not possible to click the close button." |
573 | @@ -648,7 +712,12 @@ |
574 | """ |
575 | PolicyKit class manages the GNOME pop up that ask for password for admin activities. |
576 | """ |
577 | - |
578 | + WINDOW = "dlg0" |
579 | + TXT_PASS = "txtPassword" |
580 | + BTN_OK = "btnOK" |
581 | + BTN_CANCEL = "btnCancel" |
582 | + |
583 | + |
584 | def __init__(self, password): |
585 | """ |
586 | UpdateManager class main constructor |
587 | @@ -657,7 +726,7 @@ |
588 | @param password: User's password for administrative tasks. |
589 | |
590 | """ |
591 | - Application.__init__(self, gnome_constants.SU_WINDOW) |
592 | + Application.__init__(self) |
593 | self.password = password |
594 | |
595 | def wait(self): |
596 | @@ -666,14 +735,14 @@ |
597 | |
598 | @return 1, if the gksu window exists, 0 otherwise. |
599 | """ |
600 | - return ldtp.waittillguiexist(gnome_constants.SU_WINDOW) |
601 | + return ldtp.waittillguiexist(self.name) |
602 | |
603 | def set_password(self): |
604 | """ |
605 | It enters the password in the text field and clicks enter. |
606 | """ |
607 | |
608 | - ooldtp.context(gnome_constants.SU_WINDOW) |
609 | + ooldtp.context(self.name) |
610 | |
611 | try: |
612 | ldtp.enterstring (self.password) |
613 | @@ -684,25 +753,25 @@ |
614 | |
615 | # TODO: Change this to use ooldtp |
616 | # try: |
617 | -# btnOK = polKit.getchild(gnome_constants.SU_BTN_OK) |
618 | +# btnOK = polKit.getchild(self.__class__.BTN_OK) |
619 | # except ldtp.LdtpExecutionError, msg: |
620 | # raise ldtp.LdtpExecutionError, "The GtkSudo OK button was not found." |
621 | # |
622 | # btnOK.click() |
623 | |
624 | #This also have problems because of the lack of accesibiliy information |
625 | - #ldtp.waittillguinotexist (gnome_constants.SU_WINDOW) |
626 | + #ldtp.waittillguinotexist (self.name) |
627 | |
628 | def cancel(self): |
629 | - polKit = ooldtp.context(gnome_constants.SU_WINDOW) |
630 | + polKit = ooldtp.context(self.name) |
631 | |
632 | try: |
633 | - cancelButton = polKit.getchild(gnome_constants.SU_BTN_CANCEL) |
634 | + cancelButton = polKit.getchild(self.__class__.BTN_CANCEL) |
635 | except ldtp.LdtpExecutionError: |
636 | raise ldtp.LdtpExecutionError, "The PolicyKit cancel button was not found." |
637 | |
638 | cancelButton.click() |
639 | - ldtp.waittillguinotexist (gnome_constants.SU_WINDOW) |
640 | + ldtp.waittillguinotexist (self.name) |
641 | |
642 | |
643 | |
644 | |
645 | === removed file 'desktoptesting/gnome_constants.py' |
646 | --- desktoptesting/gnome_constants.py 2009-03-19 10:47:43 +0000 |
647 | +++ desktoptesting/gnome_constants.py 1970-01-01 00:00:00 +0000 |
648 | @@ -1,58 +0,0 @@ |
649 | -""" |
650 | -This is the "gnome_constants" module. |
651 | - |
652 | -The gnome_constants provides the "object map" to be used in gnome.py |
653 | -""" |
654 | - |
655 | -TOP_PANEL = 'frmTopExpandedEdgePanel' |
656 | - |
657 | - |
658 | -# GtkSudo Popup (prefix = SU) |
659 | -SU_WINDOW = "dlg0" |
660 | -SU_TXT_PASS = "txtPassword" |
661 | -SU_BTN_OK = "btnOK" |
662 | -SU_BTN_CANCEL = "btnCancel" |
663 | - |
664 | -# GEdit constants (prefix = GE) |
665 | -GE_WINDOW = "frm*gedit" |
666 | -GE_TXT_FIELD = "txt1" |
667 | -GE_LAUNCHER = "gedit" |
668 | -GE_SAVE_DLG = "dlgSave*" |
669 | -GE_SAVE_DLG_TXT_NAME = "txtName" |
670 | -GE_SAVE_DLG_BTN_SAVE = "btnSave" |
671 | -GE_QUESTION_DLG = "dlgQuestion" |
672 | -GE_QUESTION_DLG_BTN_SAVE = "btnSave" |
673 | -GE_QUESTION_DLG_BTN_SAVE_AS = "btnSaveAs" |
674 | -GE_QUESTION_DLG_BTN_CLOSE = "btnClosewithoutSaving" |
675 | -GE_MNU_QUIT = "mnuQuit" |
676 | -GE_MNU_CLOSE = "mnuClose" |
677 | -GE_MNU_NEW = "mnuNew" |
678 | - |
679 | -# Seahorse contants (prefix = SH) |
680 | -SH_WINDOW = "frmPasswordsandEncryptionKeys" |
681 | -SH_LAUNCHER = "seahorse" |
682 | -SH_MNU_NEWKEY = "mnuNew" |
683 | -SH_NEWKEY_DLG = "Create New ..." |
684 | -SH_BTN_CONTINUE = "btnContinue" |
685 | -SH_TYPE_PGP = "PGP Key" |
686 | -SH_NEWPGP_DLG = "dlgCreateaPGPKey" |
687 | -SH_DLG_NEWPGP_FULLNAME = "txtFullName" |
688 | -SH_DLG_NEWPGP_EMAIL = "txtEmailAddress" |
689 | -SH_DLG_NEWPGP_COMMENT = "txtComment" |
690 | -SH_BTN_NEWPGP_CREATE = "btnCreate" |
691 | -SH_DLG_NEWKEY_PASS = "dlgPassphrasefor*" |
692 | -SH_BTN_PASS_OK = "btnOK" |
693 | -SH_DLG_GENERATING_KEY = "dlgGeneratingkey" |
694 | -SH_DLG_CREATING_SSH = "dlgCreatingSecureShellKey" |
695 | -SH_TYPE_SSH = "Secure Shell Key" |
696 | -SH_NEWSSH_DLG = "New Secure Shell Key" |
697 | -SH_DLG_NEWSSH_DESC = "txtKeyDescription" |
698 | -SH_BTN_NEWSSH_CREATE_AND_SETUP = "Create and Set Up" |
699 | -SH_DLG_SET_UP = "Set Up Computer for SSH Connection" |
700 | -SH_TXT_SET_UP_COMPUTER = "txtThehostnameoraddressoftheserver." |
701 | -SH_TXT_SET_UP_LOGIN = "txtLoginName" |
702 | -SH_BTN_SET_UP = "btnSetUp" |
703 | -SH_BTN_NEWSSH_CREATE = "Just Create Key" |
704 | -SH_TAB_PERSONAL_KEYS = "My Personal Keys" |
705 | -SH_TAB_LIST = "ptl0" |
706 | - |
707 | |
708 | === modified file 'desktoptesting/ubuntu.py' |
709 | --- desktoptesting/ubuntu.py 2009-03-25 10:23:04 +0000 |
710 | +++ desktoptesting/ubuntu.py 2009-03-30 10:11:44 +0000 |
711 | @@ -5,7 +5,6 @@ |
712 | """ |
713 | import ooldtp |
714 | import ldtp |
715 | -import ubuntu_constants |
716 | from desktoptesting.gnome import Application, PolicyKit |
717 | import re |
718 | |
719 | @@ -13,6 +12,7 @@ |
720 | |
721 | def setup(self): |
722 | pass |
723 | + |
724 | def teardown(self): |
725 | self.cleanup() |
726 | |
727 | @@ -48,7 +48,7 @@ |
728 | |
729 | """ |
730 | |
731 | - topPanel = ooldtp.context(ubuntu_constants.TOP_PANEL) |
732 | + topPanel = ooldtp.context(self.__class__.TOP_PANEL) |
733 | |
734 | try: |
735 | actualMenu = topPanel.getchild(menu_item_txt) |
736 | @@ -73,6 +73,22 @@ |
737 | |
738 | i.e. C{updateManager = UpdateManager("my_password")} |
739 | """ |
740 | + MNU_ITEM = "mnuUpdateManager" |
741 | + WINDOW = "frmUpdateManager" |
742 | + LAUNCHER = "update-manager" |
743 | + BTN_CLOSE = "btnClose" |
744 | + BTN_CHECK = "btnCheck" |
745 | + BTN_INSTALL = "btnInstallUpdates" |
746 | + TBL_UPDATES = "updates" |
747 | + BAN_LIST = " updates" |
748 | + TAB_CHANGES = "Changes" |
749 | + TXT_DESCRIPTION = "Description" |
750 | + LBL_WAIT = "lblKeepyoursystemup-to-date" |
751 | + LBL_UPTODATE = "lblYoursystemisup-to-date" |
752 | + LBL_N_UPDATES = r'lblYoucaninstall(\d+)updates?' |
753 | + LBL_DOWNLOADSIZE = r'lblDownloadsize((\d+)((\.)(\d+))?)(.*)' |
754 | + |
755 | + |
756 | |
757 | def __init__(self, password = ""): |
758 | """ |
759 | @@ -87,7 +103,7 @@ |
760 | @param password: User's password for administrative tasks. |
761 | |
762 | """ |
763 | - Application.__init__(self, ubuntu_constants.UM_WINDOW) |
764 | + Application.__init__(self) |
765 | self.password = password |
766 | |
767 | def setup(self): |
768 | @@ -110,17 +126,17 @@ |
769 | """ |
770 | |
771 | if dist_upgrade: |
772 | - ldtp.launchapp(ubuntu_constants.UM_LAUNCHER, ['-d'], 0) |
773 | - response = ldtp.waittillguiexist(ubuntu_constants.UM_WINDOW, '', 20) |
774 | + ldtp.launchapp(self.__class__.LAUNCHER, ['-d'], 0) |
775 | + response = ldtp.waittillguiexist(self.name, '', 20) |
776 | |
777 | if response == 0: |
778 | - raise ldtp.LdtpExecutionError, "The " + ubuntu_constants.UM_WINDOW + " window was not found." |
779 | + raise ldtp.LdtpExecutionError, "The " + self.name + " window was not found." |
780 | |
781 | else: |
782 | - self.open_and_check_app(ubuntu_constants.UM_LAUNCHER) |
783 | + self.open_and_check_app() |
784 | |
785 | # Wait the population of the list |
786 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
787 | + updateManager = ooldtp.context(self.name) |
788 | |
789 | populating = True |
790 | |
791 | @@ -132,7 +148,7 @@ |
792 | label = updateManager.getchild(role = 'label') |
793 | for i in label: |
794 | label_name = i.getName() |
795 | - if label_name == ubuntu_constants.UM_LBL_WAIT: |
796 | + if label_name == self.__class__.LBL_WAIT: |
797 | populating = True |
798 | |
799 | except ldtp.LdtpExecutionError: |
800 | @@ -143,15 +159,15 @@ |
801 | It closes the update-manager window using the close button. |
802 | """ |
803 | |
804 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
805 | + updateManager = ooldtp.context(self.name) |
806 | |
807 | try: |
808 | - closeButton = updateManager.getchild(ubuntu_constants.UM_BTN_CLOSE) |
809 | + closeButton = updateManager.getchild(self.__class__.BTN_CLOSE) |
810 | except ldtp.LdtpExecutionError: |
811 | raise ldtp.LdtpExecutionError, "The Update Manager Close button was not found." |
812 | |
813 | closeButton.click() |
814 | - ldtp.waittillguinotexist (ubuntu_constants.UM_WINDOW) |
815 | + ldtp.waittillguinotexist (self.name) |
816 | |
817 | def number_updates(self): |
818 | """ |
819 | @@ -161,16 +177,16 @@ |
820 | @return: An integer with the number of available updates. |
821 | |
822 | """ |
823 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
824 | + updateManager = ooldtp.context(self.name) |
825 | |
826 | try: |
827 | label = updateManager.getchild(role = 'label') |
828 | for i in label: |
829 | label_name = i.getName() |
830 | - if label_name == ubuntu_constants.UM_LBL_UPTODATE: |
831 | + if label_name == self.__class__.LBL_UPTODATE: |
832 | return 0 |
833 | else: |
834 | - groups = re.match(ubuntu_constants.UM_LBL_N_UPDATES, label_name) |
835 | + groups = re.match(self.__class__.LBL_N_UPDATES, label_name) |
836 | if groups: |
837 | number = groups.group(1) |
838 | return int(number) |
839 | @@ -186,13 +202,13 @@ |
840 | |
841 | @return: A float with the download size in bytes |
842 | """ |
843 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
844 | + updateManager = ooldtp.context(self.name) |
845 | |
846 | try: |
847 | label = updateManager.getchild(role = 'label') |
848 | for i in label: |
849 | label_name = i.getName() |
850 | - groups = re.match(ubuntu_constants.UM_LBL_DOWNLOADSIZE, label_name) |
851 | + groups = re.match(self.__class__.LBL_DOWNLOADSIZE, label_name) |
852 | |
853 | if groups: |
854 | # Calculate size based on the tag after the number |
855 | @@ -220,10 +236,10 @@ |
856 | """ |
857 | It selects all the available updates |
858 | """ |
859 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
860 | + updateManager = ooldtp.context(self.name) |
861 | |
862 | try: |
863 | - table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') |
864 | + table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
865 | updates_table = table[0] |
866 | |
867 | for i in range(0, updates_table.getrowcount(), 1): |
868 | @@ -238,10 +254,10 @@ |
869 | """ |
870 | It unselects all the available updates |
871 | """ |
872 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
873 | + updateManager = ooldtp.context(self.name) |
874 | |
875 | try: |
876 | - table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') |
877 | + table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
878 | updates_table = table[0] |
879 | |
880 | # TODO: When table admits right click, use the context menu |
881 | @@ -266,18 +282,18 @@ |
882 | @return: A list with the available updates |
883 | """ |
884 | |
885 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
886 | + updateManager = ooldtp.context(self.name) |
887 | |
888 | available_updates = [] |
889 | |
890 | try: |
891 | - table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') |
892 | + table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
893 | updates_table = table[0] |
894 | |
895 | for i in range(0, updates_table.getrowcount(), 1): |
896 | text = updates_table.getcellvalue(i, 1) |
897 | candidate = text.split('\n')[0] |
898 | - if candidate.find(ubuntu_constants.UM_BAN_LIST) == -1: |
899 | + if candidate.find(self.__class__.BAN_LIST) == -1: |
900 | available_updates.append(candidate) |
901 | ldtp.wait(1) |
902 | except ldtp.LdtpExecutionError: |
903 | @@ -293,10 +309,10 @@ |
904 | @param name: The name of the package to select |
905 | """ |
906 | |
907 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
908 | + updateManager = ooldtp.context(self.name) |
909 | |
910 | try: |
911 | - table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') |
912 | + table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
913 | updates_table = table[0] |
914 | |
915 | for i in range(0, updates_table.getrowcount(), 1): |
916 | @@ -317,10 +333,10 @@ |
917 | @param name: The name of the package to select |
918 | """ |
919 | |
920 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
921 | + updateManager = ooldtp.context(self.name) |
922 | |
923 | try: |
924 | - table = updateManager.getchild(ubuntu_constants.UM_TBL_UPDATES, role = 'table') |
925 | + table = updateManager.getchild(self.__class__.TBL_UPDATES, role = 'table') |
926 | updates_table = table[0] |
927 | |
928 | for i in range(0, updates_table.getrowcount(), 1): |
929 | @@ -342,7 +358,7 @@ |
930 | """ |
931 | |
932 | try: |
933 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
934 | + updateManager = ooldtp.context(self.name) |
935 | except ldtp.LdtpExecutionError: |
936 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
937 | |
938 | @@ -354,7 +370,7 @@ |
939 | polKit = PolicyKit(self.password) |
940 | |
941 | try: |
942 | - checkButton = updateManager.getchild(ubuntu_constants.UM_BTN_CHECK) |
943 | + checkButton = updateManager.getchild(self.__class__.BTN_CHECK) |
944 | except ldtp.LdtpExecutionError: |
945 | raise ldtp.LdtpExecutionError, "The Update Manager Check button was not found." |
946 | |
947 | @@ -377,7 +393,7 @@ |
948 | """ |
949 | |
950 | try: |
951 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
952 | + updateManager = ooldtp.context(self.name) |
953 | except ldtp.LdtpExecutionError: |
954 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
955 | |
956 | @@ -385,7 +401,7 @@ |
957 | if self.number_updates() > 0: |
958 | |
959 | try: |
960 | - btnInstall = updateManager.getchild(ubuntu_constants.UM_BTN_INSTALL) |
961 | + btnInstall = updateManager.getchild(self.__class__.BTN_INSTALL) |
962 | except ldtp.LdtpExecutionError: |
963 | raise ldtp.LdtpExecutionError, "The Update Manager install button was not found." |
964 | |
965 | @@ -403,7 +419,7 @@ |
966 | |
967 | # Wait for the the close button to be ready |
968 | try: |
969 | - btnClose = updateManager.getchild(ubuntu_constants.UM_BTN_CLOSE) |
970 | + btnClose = updateManager.getchild(self.__class__.BTN_CLOSE) |
971 | except ldtp.LdtpExecutionError: |
972 | raise ldtp.LdtpExecutionError, "The Update Manager Close button was not found." |
973 | |
974 | @@ -418,12 +434,12 @@ |
975 | """ |
976 | |
977 | try: |
978 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
979 | + updateManager = ooldtp.context(self.name) |
980 | except ldtp.LdtpExecutionError: |
981 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
982 | |
983 | try: |
984 | - btnTest = updateManager.getchild(ubuntu_constants.UM_BTN_INSTALL) |
985 | + btnTest = updateManager.getchild(self.__class__.BTN_INSTALL) |
986 | state = btnTest.stateenabled() |
987 | except ldtp.LdtpExecutionError: |
988 | raise ldtp.LdtpExecutionError, "The install button was not found." |
989 | @@ -455,7 +471,7 @@ |
990 | @return: The decription of the packages, as shown in the application |
991 | """ |
992 | try: |
993 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
994 | + updateManager = ooldtp.context(self.name) |
995 | except ldtp.LdtpExecutionError: |
996 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
997 | |
998 | @@ -464,9 +480,9 @@ |
999 | self.select_update(name) |
1000 | |
1001 | # Get the description text field |
1002 | - text_field = updateManager.getchild(ubuntu_constants.UM_TXT_DESCRIPTION, role='text') |
1003 | + text_field = updateManager.getchild(self.__class__.TXT_DESCRIPTION, role='text') |
1004 | # Get the text |
1005 | - text = ldtp.gettextvalue(ubuntu_constants.UM_WINDOW, text_field[0].getName()) |
1006 | + text = ldtp.gettextvalue(self.name, text_field[0].getName()) |
1007 | return text |
1008 | except ldtp.LdtpExecutionError: |
1009 | raise ldtp.LdtpExecutionError, "The description text was not found." |
1010 | @@ -486,7 +502,7 @@ |
1011 | @return: The decription of the changes |
1012 | """ |
1013 | try: |
1014 | - ooldtp.context(ubuntu_constants.UM_WINDOW) |
1015 | + ooldtp.context(self.name) |
1016 | except ldtp.LdtpExecutionError: |
1017 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
1018 | |
1019 | @@ -495,14 +511,14 @@ |
1020 | self.select_update(name) |
1021 | |
1022 | # Get the filler tab |
1023 | - filler = ldtp.getobjectproperty(ubuntu_constants.UM_WINDOW , ubuntu_constants.UM_TAB_CHANGES, 'children') |
1024 | + filler = ldtp.getobjectproperty(self.name , self.__class__.TAB_CHANGES, 'children') |
1025 | # Get the scroll pane |
1026 | - scroll_pane = ldtp.getobjectproperty(ubuntu_constants.UM_WINDOW , filler, 'children') |
1027 | + scroll_pane = ldtp.getobjectproperty(self.name , filler, 'children') |
1028 | # Get the text field |
1029 | - text_field = ldtp.getobjectproperty(ubuntu_constants.UM_WINDOW , scroll_pane, 'children') |
1030 | + text_field = ldtp.getobjectproperty(self.name , scroll_pane, 'children') |
1031 | text_field = text_field.split(' ')[0] |
1032 | # Get the text |
1033 | - text = ldtp.gettextvalue(ubuntu_constants.UM_WINDOW, text_field) |
1034 | + text = ldtp.gettextvalue(self.name, text_field) |
1035 | return text |
1036 | except ldtp.LdtpExecutionError: |
1037 | raise ldtp.LdtpExecutionError, "The Changes tab was not found." |
1038 | @@ -517,7 +533,7 @@ |
1039 | @param show: True, to show the description; False, to hide the description. |
1040 | """ |
1041 | try: |
1042 | - updateManager = ooldtp.context(ubuntu_constants.UM_WINDOW) |
1043 | + updateManager = ooldtp.context(self.name) |
1044 | except ldtp.LdtpExecutionError: |
1045 | raise ldtp.LdtpExecutionError, "The Update Manager window was not found." |
1046 | |
1047 | @@ -531,5 +547,3 @@ |
1048 | raise ldtp.LdtpExecutionError, "The description button was not found." |
1049 | |
1050 | return state |
1051 | - |
1052 | - |
1053 | |
1054 | === removed file 'desktoptesting/ubuntu_constants.py' |
1055 | --- desktoptesting/ubuntu_constants.py 2009-03-18 16:04:17 +0000 |
1056 | +++ desktoptesting/ubuntu_constants.py 1970-01-01 00:00:00 +0000 |
1057 | @@ -1,32 +0,0 @@ |
1058 | -""" |
1059 | -This is the "ubuntu_constants" module. |
1060 | - |
1061 | -The ubuntu_constants provides the "object map" to be used in ubuntu.py |
1062 | -""" |
1063 | - |
1064 | -TOP_PANEL = 'frmTopExpandedEdgePanel' |
1065 | - |
1066 | - |
1067 | -# Update Manager constants (prefix = UM) |
1068 | -UM_MNU_ITEM = "mnuUpdateManager" |
1069 | -UM_WINDOW = "frmUpdateManager" |
1070 | -UM_LAUNCHER = "update-manager" |
1071 | -UM_BTN_CLOSE = "btnClose" |
1072 | -UM_BTN_CHECK = "btnCheck" |
1073 | -UM_BTN_INSTALL = "btnInstallUpdates" |
1074 | -UM_TBL_UPDATES = "updates" |
1075 | -UM_BAN_LIST = " updates" |
1076 | -UM_TAB_CHANGES = "Changes" |
1077 | -UM_TXT_DESCRIPTION = "Description" |
1078 | -UM_LBL_WAIT = "lblKeepyoursystemup-to-date" |
1079 | -UM_LBL_UPTODATE = "lblYoursystemisup-to-date" |
1080 | -UM_LBL_N_UPDATES = r'lblYoucaninstall(\d+)updates?' |
1081 | -UM_LBL_DOWNLOADSIZE = r'lblDownloadsize((\d+)((\.)(\d+))?)(.*)' |
1082 | - |
1083 | -# GtkSudo Popup (prefix = SU) |
1084 | -SU_WINDOW = "dlg0" |
1085 | -SU_TXT_PASS = "txtPassword" |
1086 | -SU_BTN_OK = "btnOK" |
1087 | -SU_BTN_CANCEL = "btnCancel" |
1088 | - |
1089 | - |
Constants moved from modules to classes to prevent name clashes from happening without adding prefixes to constant names.
Code takes advantage of using standard constants such as LAUNCHER, WINDOW, etc.