Changeset 4869 for waeup/trunk/src


Ignore:
Timestamp:
21 Jan 2010, 09:02:35 (15 years ago)
Author:
uli
Message:

Fix nasty weirdness in browser tests: on fast machines CSV files are
uploaded too fast by testbrowser to get a correctly sorted list of
available import files. CSV file selection therefore has to lookup
the correct 'Select' button by examining the button values.

The desired behaviour is implemented by a little function defined at
top of browser.txt as stock zope.testbrowser does not support it yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/trunk/src/waeup/browser/batchprocessing.txt

    r4868 r4869  
    33
    44:test-layer: functional
     5
     6Preliminaries:
     7
     8We define a function that looks up a form with several submit buttons
     9for the one with a given value (this functionality is missing in
     10zope.testbrowser):
     11
     12    >>> def lookup_submit_value(name, value, browser):
     13    ...   """Find a button with a certain value."""
     14    ...   for num in range(0, 100):
     15    ...     try:
     16    ...       button = browser.getControl(name=name, index=num)
     17    ...       if button.value == value:
     18    ...         return button
     19    ...     except IndexError:
     20    ...       break
     21    ...   return None
    522
    623Create a site:
     
    6077
    6178    >>> browser.getLink('Batch processing').click()
    62     >>> browser.getControl(name='select', index=0).click()
     79    >>> button = lookup_submit_value(
     80    ...   'select', 'faculties_zope.mgr.csv', browser)
     81    >>> button.click()
    6382
    6483Step 2: select a processor and mode:
     
    160179
    161180    >>> browser.getLink('Batch processing').click()
    162     >>> browser.getControl(name='select', index=0).click()
     181    >>> button = lookup_submit_value(
     182    ...   'select', 'departments_zope.mgr.csv', browser)
     183    >>> button.click()
    163184
    164185Step 2: select a processor and mode:
     
    223244
    224245    >>> browser.getLink('Batch processing').click()
    225     >>> browser.getControl(name='select', index=0).click()
     246    >>> button = lookup_submit_value(
     247    ...   'select', 'courses_zope.mgr.csv', browser)
     248    >>> button.click()
    226249
    227250Step 2: select a processor and mode:
     
    286309
    287310    >>> browser.getLink('Batch processing').click()
    288     >>> browser.getControl(name='select', index=0).click()
     311    >>> button = lookup_submit_value(
     312    ...   'select', 'certificates_zope.mgr.csv', browser)
     313    >>> button.click()
     314
    289315
    290316Step 2: select a processor and mode:
     
    349375
    350376    >>> browser.getLink('Batch processing').click()
    351     >>> browser.getControl(name='select', index=0).click()
     377    >>> button = lookup_submit_value(
     378    ...   'select', 'mycertcourses_zope.mgr.csv', browser)
     379    >>> button.click()
    352380
    353381Step 2: select a processor and mode:
Note: See TracChangeset for help on using the changeset viewer.