Merge lp://qastaging/~danilo/launchpad/bug-430702 into lp://qastaging/launchpad
- bug-430702
- Merge into devel
Proposed by
Данило Шеган
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://qastaging/~danilo/launchpad/bug-430702 |
Merge into: | lp://qastaging/launchpad |
Diff against target: |
587 lines (+165/-219) 8 files modified
lib/canonical/launchpad/javascript/translations/pofile.js (+26/-23) lib/lp/testing/factory.py (+4/-1) lib/lp/translations/templates/translation-import-queue-macros.pt (+2/-1) lib/lp/translations/windmill/testing.py (+18/-0) lib/lp/translations/windmill/tests/test_documentation_links.py (+51/-69) lib/lp/translations/windmill/tests/test_import_queue.py (+30/-56) lib/lp/translations/windmill/tests/test_import_queue_error_output.py.disabled (+14/-29) lib/lp/translations/windmill/tests/test_productseries_templates.py (+20/-40) |
To merge this branch: | bzr merge lp://qastaging/~danilo/launchpad/bug-430702 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | Approve | ||
Review via email: mp+14794@code.qastaging.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote : | # |
Revision history for this message
Abel Deuring (adeuring) wrote : | # |
Nice branch!
One minor issue: As discussed on IRC, please change the "timeout=800000" in test_documentat
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/canonical/launchpad/javascript/translations/pofile.js' |
2 | --- lib/canonical/launchpad/javascript/translations/pofile.js 2009-07-16 15:51:03 +0000 |
3 | +++ lib/canonical/launchpad/javascript/translations/pofile.js 2009-11-13 15:04:11 +0000 |
4 | @@ -14,29 +14,32 @@ |
5 | * for dismission. |
6 | */ |
7 | self.setupSuggestionDismissal = function(e) { |
8 | - Y.all('.dismiss_action').each(function(checkbox) { |
9 | - var classbase = checkbox.get('id'); |
10 | - var current_class = classbase.replace(/dismiss/, 'current'); |
11 | - var current_radios = Y.all('.' + current_class); |
12 | - var dismissables = Y.all('.' + classbase+'able'); |
13 | - // The button and textarea cannot be fetched beforehand |
14 | - // because they are or may be created dynamically. |
15 | - var dismissable_inputs_class = [ |
16 | - '.', classbase, 'able_button input, ', |
17 | - '.', classbase, 'able_button button, ', |
18 | - '.', classbase, 'able_button textarea'].join("") |
19 | - checkbox.on('click', function(e) { |
20 | - if(checkbox.get('checked')) { |
21 | - dismissables.addClass('dismissed'); |
22 | - Y.all(dismissable_inputs_class).set('disabled', true); |
23 | - current_radios.set('checked', true); |
24 | - } else { |
25 | - dismissables.removeClass('dismissed'); |
26 | - Y.all(dismissable_inputs_class).set('disabled', false); |
27 | - } |
28 | - }); |
29 | - }); |
30 | - }; |
31 | + all_dismiss_boxes = Y.all('.dismiss_action'); |
32 | + if (all_dismiss_boxes !== null) { |
33 | + all_dismiss_boxes.each(function(checkbox) { |
34 | + var classbase = checkbox.get('id'); |
35 | + var current_class = classbase.replace(/dismiss/, 'current'); |
36 | + var current_radios = Y.all('.' + current_class); |
37 | + var dismissables = Y.all('.' + classbase+'able'); |
38 | + // The button and textarea cannot be fetched beforehand |
39 | + // because they are or may be created dynamically. |
40 | + var dismissable_inputs_class = [ |
41 | + '.', classbase, 'able_button input, ', |
42 | + '.', classbase, 'able_button button, ', |
43 | + '.', classbase, 'able_button textarea'].join(""); |
44 | + checkbox.on('click', function(e) { |
45 | + if (checkbox.get('checked')) { |
46 | + dismissables.addClass('dismissed'); |
47 | + Y.all(dismissable_inputs_class).set('disabled', true); |
48 | + current_radios.set('checked', true); |
49 | + } else { |
50 | + dismissables.removeClass('dismissed'); |
51 | + Y.all(dismissable_inputs_class).set('disabled', false); |
52 | + } |
53 | + }); |
54 | + }); |
55 | + } |
56 | +}; |
57 | |
58 | }, '0.1', { |
59 | requires: ['event', 'node']}); |
60 | |
61 | === modified file 'lib/lp/testing/factory.py' |
62 | --- lib/lp/testing/factory.py 2009-11-13 05:13:07 +0000 |
63 | +++ lib/lp/testing/factory.py 2009-11-13 15:04:11 +0000 |
64 | @@ -543,7 +543,8 @@ |
65 | def makeProductNoCommit( |
66 | self, name=None, project=None, displayname=None, |
67 | licenses=None, owner=None, registrant=None, |
68 | - title=None, summary=None, official_malone=None): |
69 | + title=None, summary=None, official_malone=None, |
70 | + official_rosetta=None): |
71 | """Create and return a new, arbitrary Product.""" |
72 | if owner is None: |
73 | owner = self.makePersonNoCommit() |
74 | @@ -572,6 +573,8 @@ |
75 | registrant=registrant) |
76 | if official_malone is not None: |
77 | product.official_malone = official_malone |
78 | + if official_rosetta is not None: |
79 | + removeSecurityProxy(product).official_rosetta = official_rosetta |
80 | return product |
81 | |
82 | def makeProductSeries(self, product=None, name=None, owner=None, |
83 | |
84 | === modified file 'lib/lp/translations/templates/translation-import-queue-macros.pt' |
85 | --- lib/lp/translations/templates/translation-import-queue-macros.pt 2009-09-26 07:30:02 +0000 |
86 | +++ lib/lp/translations/templates/translation-import-queue-macros.pt 2009-11-13 15:04:11 +0000 |
87 | @@ -105,7 +105,8 @@ |
88 | </td> |
89 | <td> |
90 | <tal:block condition="entry/required:launchpad.Admin"> |
91 | - <a class="sprite edit" tal:attributes="href entry/fmt:url"> |
92 | + <a class="sprite edit" |
93 | + tal:attributes="href entry/fmt:url"> |
94 | <span class="invisible-link">Change this entry</span> |
95 | </a> |
96 | </tal:block> |
97 | |
98 | === added file 'lib/lp/translations/windmill/__init__.py' |
99 | === added file 'lib/lp/translations/windmill/testing.py' |
100 | --- lib/lp/translations/windmill/testing.py 1970-01-01 00:00:00 +0000 |
101 | +++ lib/lp/translations/windmill/testing.py 2009-11-13 15:04:12 +0000 |
102 | @@ -0,0 +1,18 @@ |
103 | +# Copyright 2009 Canonical Ltd. This software is licensed under the |
104 | +# GNU Affero General Public License version 3 (see the file LICENSE). |
105 | + |
106 | +"""Translations-specific testing infrastructure for Windmill.""" |
107 | + |
108 | +__metaclass__ = type |
109 | +__all__ = [ |
110 | + 'TranslationsWindmillLayer', |
111 | + ] |
112 | + |
113 | + |
114 | +from canonical.testing.layers import BaseWindmillLayer |
115 | + |
116 | + |
117 | +class TranslationsWindmillLayer(BaseWindmillLayer): |
118 | + """Layer for Translations Windmill tests.""" |
119 | + |
120 | + base_url = 'http://translations.launchpad.dev:8085/' |
121 | |
122 | === renamed file 'lib/lp/translations/windmill/tests/test_translations/__init__.py' => 'lib/lp/translations/windmill/tests/__init__.py' |
123 | === renamed file 'lib/lp/translations/windmill/tests/test_translations/test_documentation_links.py' => 'lib/lp/translations/windmill/tests/test_documentation_links.py' |
124 | --- lib/lp/translations/windmill/tests/test_translations/test_documentation_links.py 2009-06-25 05:30:52 +0000 |
125 | +++ lib/lp/translations/windmill/tests/test_documentation_links.py 2009-11-13 15:04:12 +0000 |
126 | @@ -6,80 +6,69 @@ |
127 | __metaclass__ = type |
128 | __all__ = [] |
129 | |
130 | -# Generated by the windmill services transformer |
131 | from windmill.authoring import WindmillTestClient |
132 | |
133 | from canonical.launchpad.windmill.testing import lpuser |
134 | - |
135 | -class DocumentationLinksTest: |
136 | +from lp.translations.windmill.testing import TranslationsWindmillLayer |
137 | +from lp.testing import TestCaseWithFactory |
138 | + |
139 | +from zope.security.proxy import removeSecurityProxy |
140 | + |
141 | +class DocumentationLinksTest(TestCaseWithFactory): |
142 | """Test that the documentation links on translation pages work.""" |
143 | |
144 | - def __init__(self, |
145 | - name=None, |
146 | - url='http://translations.launchpad.net:8085', |
147 | - suite='translations', |
148 | - user=lpuser.TRANSLATIONS_ADMIN): |
149 | - """Create a new DocumentationLinksTest. |
150 | - |
151 | - :param name: Name of the test. |
152 | - :param url: Start at, default http://translation.launchpad.net:8085. |
153 | - :param suite: The suite in which this test is part of. |
154 | - :param user: The user who should be logged in. |
155 | - """ |
156 | - self.url = url |
157 | - if name is None: |
158 | - self.__name__ = 'test_%s_documentation_links' % suite |
159 | - else: |
160 | - self.__name__ = name |
161 | - self.suite = suite |
162 | - self.user = user |
163 | - |
164 | - def __call__(self): |
165 | + layer = TranslationsWindmillLayer |
166 | + |
167 | + def createPOTemplateWithPOTMsgSets(self, productseries, name, |
168 | + number_of_potmsgsets): |
169 | + potemplate = self.factory.makePOTemplate( |
170 | + productseries=productseries, name=name) |
171 | + for sequence in range(number_of_potmsgsets): |
172 | + self.factory.makePOTMsgSet(potemplate, sequence=sequence+1) |
173 | + removeSecurityProxy(potemplate).messagecount = number_of_potmsgsets |
174 | + return potemplate |
175 | + |
176 | + def test_documentation_links(self): |
177 | """Tests that documentation links are shown/hidden properly. |
178 | |
179 | The test: |
180 | - * sets translation instructions link for a translation group; |
181 | * opens a Spanish translation page; |
182 | * tries hiding the notification box; |
183 | * makes sure it's hidden when you stay on the same translation; |
184 | * makes sure it's shown again when you go to a different translation. |
185 | """ |
186 | - client = WindmillTestClient(self.suite) |
187 | + client = WindmillTestClient("Translation documentation links") |
188 | + |
189 | + start_url = 'http://translations.launchpad.dev:8085/' |
190 | + user = lpuser.TRANSLATIONS_ADMIN |
191 | + |
192 | + |
193 | + # Create a translation group with documentation to use in the test. |
194 | + group = self.factory.makeTranslationGroup( |
195 | + name='testing-group', title='Testing group', |
196 | + url=(u'https://help.launchpad.net/Translations/' |
197 | + u'LaunchpadTranslators')) |
198 | + |
199 | + # Create a translatable project with a template containing 15 |
200 | + # messages (so we can go to multiple pages of each translation). |
201 | + project = self.factory.makeProduct( |
202 | + name='test-product', |
203 | + displayname='Test Product', |
204 | + official_rosetta=True) |
205 | + removeSecurityProxy(project).translationgroup = group |
206 | + |
207 | + potemplate = self.createPOTemplateWithPOTMsgSets( |
208 | + productseries=project.development_focus, name='template', |
209 | + number_of_potmsgsets=15) |
210 | + import transaction |
211 | + transaction.commit() |
212 | |
213 | # Go to Evolution translations page logged in as translations admin. |
214 | - self.user.ensure_login(client) |
215 | - client.open(url=self.url) |
216 | - client.waits.forPageLoad(timeout=u'20000') |
217 | - client.waits.forElement(link=u'Evolution', timeout=u'8000') |
218 | - client.click(link=u'Evolution') |
219 | - client.waits.forPageLoad(timeout=u'20000') |
220 | - |
221 | - # Set a 'Just a testing team' documentation link. |
222 | - client.waits.forElement(link=u'Just a testing team', timeout=u'8000') |
223 | - client.click(link=u'Just a testing team') |
224 | - client.waits.forPageLoad(timeout=u'20000') |
225 | - client.waits.forElement(link=u'Edit translation group details', |
226 | - timeout=u'8000') |
227 | - client.click(link=u'Edit translation group details') |
228 | - client.waits.forPageLoad(timeout=u'20000') |
229 | - client.waits.forElement(timeout=u'8000', |
230 | - id=u'field.translation_guide_url') |
231 | - client.click(id=u'field.translation_guide_url') |
232 | - client.type(text=u'https://help.launchpad.net/Translations/' |
233 | - u'LaunchpadTranslators', |
234 | - id=u'field.translation_guide_url') |
235 | - client.click(id=u'field.actions.change') |
236 | - client.waits.forPageLoad(timeout=u'20000') |
237 | - |
238 | - # Go to Evolution Spanish translation. |
239 | - client.waits.forElement(link=u'Evolution', timeout=u'8000') |
240 | - client.click(link=u'Evolution') |
241 | - client.waits.forPageLoad(timeout=u'20000') |
242 | - client.waits.forElement(link=u'Spanish', timeout=u'8000') |
243 | - client.click(link=u'Spanish') |
244 | - client.waits.forPageLoad(timeout=u'20000') |
245 | - client.waits.forElement(link=u'evolution-2.2', timeout=u'8000') |
246 | - client.click(link=u'evolution-2.2') |
247 | + user.ensure_login(client) |
248 | + |
249 | + client.open( |
250 | + url=(u'http://translations.launchpad.dev:8085/test-product/trunk' |
251 | + u'/+pots/template/es/')) |
252 | client.waits.forPageLoad(timeout=u'20000') |
253 | |
254 | # Make sure notification box is shown. |
255 | @@ -105,17 +94,10 @@ |
256 | # Look at Catalan translations page to make sure that the |
257 | # notification box is visible even though user dismissed Spanish |
258 | # translation notification. |
259 | - client.waits.forElement( |
260 | - link=u'Template "evolution-2.2" in Evolution trunk', |
261 | - timeout=u'8000') |
262 | - client.click(link=u'Template "evolution-2.2" in Evolution trunk') |
263 | - client.waits.forPageLoad(timeout=u'20000') |
264 | - client.waits.forElement(link=u'Catalan', timeout=u'8000') |
265 | - client.click(link=u'Catalan') |
266 | + client.open( |
267 | + url=(u'http://translations.launchpad.dev:8085/test-product/trunk' |
268 | + u'/+pots/template/ca/')) |
269 | client.waits.forPageLoad(timeout=u'20000') |
270 | client.asserts.assertNotProperty( |
271 | classname=u'important-notice-container', |
272 | validator=u'style.display|none') |
273 | - |
274 | -test_documentation_links = DocumentationLinksTest( |
275 | - name='test_documentation_links') |
276 | |
277 | === renamed file 'lib/lp/translations/windmill/tests/test_translations/test_import_queue.py' => 'lib/lp/translations/windmill/tests/test_import_queue.py' |
278 | --- lib/lp/translations/windmill/tests/test_translations/test_import_queue.py 2009-06-25 05:30:52 +0000 |
279 | +++ lib/lp/translations/windmill/tests/test_import_queue.py 2009-11-13 15:04:12 +0000 |
280 | @@ -1,37 +1,21 @@ |
281 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
282 | # GNU Affero General Public License version 3 (see the file LICENSE). |
283 | |
284 | -"""Test for translation import queue behaviour.""" |
285 | +"""Test for translation import queue entry approving behaviour.""" |
286 | |
287 | __metaclass__ = type |
288 | __all__ = [] |
289 | |
290 | -# Generated by the windmill services transformer |
291 | from windmill.authoring import WindmillTestClient |
292 | |
293 | from canonical.launchpad.windmill.testing import lpuser |
294 | +from lp.translations.windmill.testing import TranslationsWindmillLayer |
295 | +from lp.testing import TestCaseWithFactory |
296 | |
297 | -class ImportQueueEntryTest: |
298 | +class ImportQueueEntryTest(TestCaseWithFactory): |
299 | """Test that the entries in the import queue can switch types.""" |
300 | |
301 | - def __init__(self, name=None, |
302 | - url='http://translations.launchpad.dev:8085/+imports/1', |
303 | - suite='translations', user=lpuser.TRANSLATIONS_ADMIN): |
304 | - """Create a new ImportQueueEntryTest. |
305 | - |
306 | - :param name: Name of the test. |
307 | - :param url: Start at, default http://translation.launchpad.net:8085. |
308 | - :param suite: The suite in which this test is part of. |
309 | - :param user: The user who should be logged in. |
310 | - """ |
311 | - self.url = url |
312 | - if name is None: |
313 | - self.__name__ = 'test_%s_import_queue_entry' % suite |
314 | - else: |
315 | - self.__name__ = name |
316 | - self.suite = suite |
317 | - self.user = user |
318 | - self.client = None |
319 | + layer = TranslationsWindmillLayer |
320 | |
321 | FIELDS = { |
322 | 'POT': [ |
323 | @@ -59,60 +43,50 @@ |
324 | u"//%s[@id='%s']" % (input_tag, field_id) |
325 | ) |
326 | |
327 | - def _assertAllFieldsVisible(self, groupname): |
328 | + def _assertAllFieldsVisible(self, client, groupname): |
329 | """Assert that all fields in this group are visible. |
330 | |
331 | Fields are visible if they do not have the dont_show_fields |
332 | class set. |
333 | """ |
334 | for field_id in self.FIELDS[groupname]: |
335 | - self.client.asserts.assertNotNode( |
336 | + client.asserts.assertNotNode( |
337 | xpath=self._getHiddenTRXpath(field_id)) |
338 | |
339 | - def _assertAllFieldsHidden(self, groupname): |
340 | + def _assertAllFieldsHidden(self, client, groupname): |
341 | """Assert that all fields in this group are hidden. |
342 | |
343 | Fields are hidden if they have the dont_show_fields class set. |
344 | """ |
345 | for field_id in self.FIELDS[groupname]: |
346 | - self.client.asserts.assertNode( |
347 | + client.asserts.assertNode( |
348 | xpath=self._getHiddenTRXpath(field_id)) |
349 | |
350 | - def __call__(self): |
351 | - """Tests that documentation links are shown/hidden properly. |
352 | - |
353 | - The test: |
354 | - * sets translation instructions link for a translation group; |
355 | - * opens a Spanish translation page; |
356 | - * tries hiding the notification box; |
357 | - * makes sure it's hidden when you stay on the same translation; |
358 | - * makes sure it's shown again when you go to a different translation. |
359 | - """ |
360 | - self.client = WindmillTestClient(self.suite) |
361 | - |
362 | + def test_import_queue_entry(self): |
363 | + """Tests that import queue entry fields behave correctly.""" |
364 | + client = WindmillTestClient('Translations import queue entry') |
365 | + start_url = 'http://translations.launchpad.dev:8085/+imports/1' |
366 | + user = lpuser.TRANSLATIONS_ADMIN |
367 | # Go to import queue page logged in as translations admin. |
368 | - self.user.ensure_login(self.client) |
369 | - self.client.open(url=self.url) |
370 | - self.client.waits.forPageLoad(timeout=u'20000') |
371 | + client.open(url=start_url) |
372 | + client.waits.forPageLoad(timeout=u'20000') |
373 | + user.ensure_login(client) |
374 | |
375 | - # When the page is first called tha file_type is set to POT and |
376 | + # When the page is first called the file_type is set to POT and |
377 | # only the relevant form fields are displayed. When the file type |
378 | # select box is changed to PO, other fields are shown hidden while |
379 | # the first ones are hidden. Finally, all fields are hidden if the |
380 | # file type is unspecified. |
381 | - self.client.waits.forElement(id=u'field.file_type', timeout=u'8000') |
382 | - self.client.asserts.assertSelected(id=u'field.file_type', |
383 | + client.waits.forElement(id=u'field.file_type', timeout=u'8000') |
384 | + client.asserts.assertSelected(id=u'field.file_type', |
385 | validator=u'POT') |
386 | - self._assertAllFieldsVisible('POT') |
387 | - self._assertAllFieldsHidden('PO') |
388 | - |
389 | - self.client.select(id=u'field.file_type', val=u'PO') |
390 | - self._assertAllFieldsVisible('PO') |
391 | - self._assertAllFieldsHidden('POT') |
392 | - |
393 | - self.client.select(id=u'field.file_type', val=u'UNSPEC') |
394 | - self._assertAllFieldsHidden('POT') |
395 | - self._assertAllFieldsHidden('PO') |
396 | - |
397 | -test_import_queue = ImportQueueEntryTest( |
398 | - name='test_import_queue') |
399 | + self._assertAllFieldsVisible(client, 'POT') |
400 | + self._assertAllFieldsHidden(client, 'PO') |
401 | + |
402 | + client.select(id=u'field.file_type', val=u'PO') |
403 | + self._assertAllFieldsVisible(client, 'PO') |
404 | + self._assertAllFieldsHidden(client, 'POT') |
405 | + |
406 | + client.select(id=u'field.file_type', val=u'UNSPEC') |
407 | + self._assertAllFieldsHidden(client, 'POT') |
408 | + self._assertAllFieldsHidden(client, 'PO') |
409 | |
410 | === renamed file 'lib/lp/translations/windmill/tests/test_translations/test_import_queue_error_output.py' => 'lib/lp/translations/windmill/tests/test_import_queue_error_output.py.disabled' |
411 | --- lib/lp/translations/windmill/tests/test_translations/test_import_queue_error_output.py 2009-06-25 05:30:52 +0000 |
412 | +++ lib/lp/translations/windmill/tests/test_import_queue_error_output.py.disabled 2009-11-13 15:04:12 +0000 |
413 | @@ -10,35 +10,21 @@ |
414 | from windmill.authoring import WindmillTestClient |
415 | |
416 | from canonical.launchpad.windmill.testing import lpuser |
417 | - |
418 | -class ImportQueueErrorOutputTest: |
419 | +from lp.translations.windmill.testing import TranslationsWindmillLayer |
420 | +from lp.testing import TestCaseWithFactory |
421 | + |
422 | + |
423 | +class ImportQueueErrorOutputTest(TestCaseWithFactory): |
424 | """Test interactive error output display in the import queue UI.""" |
425 | |
426 | - def __init__(self, name=None, |
427 | - url='http://translations.launchpad.net:8085/+imports', |
428 | - suite='translations', user=lpuser.TRANSLATIONS_ADMIN): |
429 | - """Create a new ImportQueueErrorOutputTest. |
430 | - |
431 | - :param name: Name of the test. |
432 | - :param url: Start at, default |
433 | - http://translation.launchpad.net:8085/+imports. |
434 | - :param suite: The test suite that this test is part of. |
435 | - :param user: The user who should be logged in. |
436 | - """ |
437 | - self.url = url |
438 | - if name is None: |
439 | - self.__name__ = 'test_%s_documentation_links' % suite |
440 | - else: |
441 | - self.__name__ = name |
442 | - self.suite = suite |
443 | - self.user = user |
444 | + layer = TranslationsWindmillLayer |
445 | |
446 | def _checkOutputPanel(self, client, panel_xpath): |
447 | client.waits.forElement(xpath=panel_xpath, timeout=u'5000') |
448 | # XXX JeroenVermeulen 2009-04-21 bug=365176: Check panel |
449 | # contents here! |
450 | |
451 | - def __call__(self): |
452 | + def test_import_queue_error_output(self): |
453 | """Run test. |
454 | |
455 | The test: |
456 | @@ -47,11 +33,14 @@ |
457 | * tests that the error output can be revealed interactively; |
458 | * tests that the error output can be hidden again. |
459 | """ |
460 | - client = WindmillTestClient(self.suite) |
461 | - |
462 | - self.user.ensure_login(client) |
463 | - client.open(url=self.url) |
464 | + client = WindmillTestClient("Translation imports error reporting") |
465 | + |
466 | + start_url = 'http://translations.launchpad.dev:8085/+imports' |
467 | + user = lpuser.TRANSLATIONS_ADMIN |
468 | + |
469 | + client.open(url=start_url) |
470 | client.waits.forPageLoad(timeout=u'20000') |
471 | + user.ensure_login(client) |
472 | |
473 | placeholder = u"//div[@id='1']//div[@class='original show-output']" |
474 | client.waits.forElement(xpath=placeholder, timeout=u'8000') |
475 | @@ -75,7 +64,3 @@ |
476 | client.click(xpath=show_button) |
477 | self._checkOutputPanel(client, output_panel) |
478 | |
479 | - |
480 | -test_import_queue_error_output = ImportQueueErrorOutputTest( |
481 | - name='test_import_queue_error_output') |
482 | - |
483 | |
484 | === renamed file 'lib/lp/translations/windmill/tests/test_translations/test_productseries_templates.py' => 'lib/lp/translations/windmill/tests/test_productseries_templates.py' |
485 | --- lib/lp/translations/windmill/tests/test_translations/test_productseries_templates.py 2009-06-25 05:30:52 +0000 |
486 | +++ lib/lp/translations/windmill/tests/test_productseries_templates.py 2009-11-13 15:04:12 +0000 |
487 | @@ -1,43 +1,24 @@ |
488 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
489 | # GNU Affero General Public License version 3 (see the file LICENSE). |
490 | |
491 | -"""Test for DistroSeries templates listing behaviour.""" |
492 | +"""Test for ProductSeries templates listing behaviour.""" |
493 | |
494 | __metaclass__ = type |
495 | __all__ = [] |
496 | |
497 | -# Generated by the windmill services transformer |
498 | from windmill.authoring import WindmillTestClient |
499 | |
500 | from canonical.launchpad.windmill.testing import lpuser |
501 | +from lp.translations.windmill.testing import TranslationsWindmillLayer |
502 | +from lp.testing import TestCaseWithFactory |
503 | |
504 | -class EnableActionLinksTest: |
505 | +class EnableActionLinksTest(TestCaseWithFactory): |
506 | """Test that action links are enabled on mouseover.""" |
507 | |
508 | + layer = TranslationsWindmillLayer |
509 | + |
510 | MAX_ROW = 2 |
511 | |
512 | - def __init__(self, name=None, |
513 | - url=None, suite='translations', |
514 | - user=lpuser.TRANSLATIONS_ADMIN): |
515 | - """Create a new EnableActionLinksTest. |
516 | - |
517 | - :param name: Name of the test. |
518 | - :param url: Start at, default http://translation.launchpad.net:8085. |
519 | - :param suite: The suite in which this test is part of. |
520 | - :param user: The user who should be logged in. |
521 | - """ |
522 | - if url is None: |
523 | - url = ('http://translations.launchpad.dev:8085/evolution/trunk/' |
524 | - '+templates') |
525 | - self.url = url |
526 | - if name is None: |
527 | - self.__name__ = 'test_%s_productseries_templates' % suite |
528 | - else: |
529 | - self.__name__ = name |
530 | - self.suite = suite |
531 | - self.user = user |
532 | - self.client = None |
533 | - |
534 | def _xpath_action_links(self, row_index, active): |
535 | """Return the xpath to the action links div of the specified row.""" |
536 | # xpath positions are 1-based |
537 | @@ -50,7 +31,7 @@ |
538 | u"/td[contains(@class, 'actions_column')]" |
539 | u"/div[%s]" % (row_pos, inactive_class)) |
540 | |
541 | - def __call__(self): |
542 | + def test_template_listing_admin_links(self): |
543 | """Tests that that action links are disabled and enabled. |
544 | |
545 | The test: |
546 | @@ -62,28 +43,27 @@ |
547 | * simulates moving the mouse cursor off the table row; |
548 | * verifies that the action links of the row are deactivated; |
549 | """ |
550 | - self.client = WindmillTestClient(self.suite) |
551 | - |
552 | + client = WindmillTestClient("Template links activation") |
553 | + url = ('http://translations.launchpad.dev:8085/evolution/trunk/' |
554 | + '+templates') |
555 | + user = lpuser.TRANSLATIONS_ADMIN |
556 | # Go to templates page logged in as translations admin. |
557 | - self.user.ensure_login(self.client) |
558 | - self.client.open(url=self.url) |
559 | - self.client.waits.forPageLoad(timeout=u'20000') |
560 | + client.open(url=url) |
561 | + client.waits.forPageLoad(timeout=u'20000') |
562 | + user.ensure_login(client) |
563 | |
564 | - self.client.waits.forElement(id=u'templates_table', timeout=u'8000') |
565 | + client.waits.forElement(id=u'templates_table', timeout=u'8000') |
566 | # All links are inactive to start with. |
567 | for row_num in range(self.MAX_ROW): |
568 | - self.client.asserts.assertNode( |
569 | + client.asserts.assertNode( |
570 | xpath=self._xpath_action_links(row_num, active=False)) |
571 | |
572 | # Action links are activated when the mouse is over the row. |
573 | for row_num in range(self.MAX_ROW): |
574 | - self.client.mouseOver(classname=('template_row,%d' % row_num)) |
575 | - self.client.asserts.assertNode( |
576 | + client.mouseOver(classname=('template_row,%d' % row_num)) |
577 | + client.asserts.assertNode( |
578 | xpath=self._xpath_action_links(row_num, active=True)) |
579 | |
580 | - self.client.mouseOut(classname=('template_row,%d' % row_num)) |
581 | - self.client.asserts.assertNode( |
582 | + client.mouseOut(classname=('template_row,%d' % row_num)) |
583 | + client.asserts.assertNode( |
584 | xpath=self._xpath_action_links(row_num, active=False)) |
585 | - |
586 | -test_import_queue = EnableActionLinksTest( |
587 | - name='test_productseries_templates') |
= Bug 430702 =
Migrates existing Translations windmill tests to the new setup to run with standard testrunner.
One of the tests causes a weird problem I don't want to hold the entire branch for: it has been disabled and I'll file a separate bug for it.
== Tests ==
bin/test -vv --layer= TranslationsWin dmillLayer