The Z Contact Application - Functional Tests ============================================ These are functional tests for the Z Contact application. They test the user interface. Creating a Contact Object ------------------------- >>> from zope.testbrowser.testing import Browser Here we set up the browser object and open up to the main ZMI page. >>> browser = Browser() >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw') >>> browser.handleErrors = False >>> browser.open('http://localhost/manage') Under the add menu, we should see a link for Z Contact. Clicking on it takes us to a form where we can enter information for a new contact. >>> browser.getLink('Z Contact').click() >>> browser.getControl('Last Name').value="Carduner" >>> browser.getControl('First Name').value="Paul" >>> browser.getControl(name='add_input_name').value="paulcarduner" >>> browser.getControl('Add').click() After adding the contact, we can click on the newly created object, which takes us to a display page for the contact. This display page shows the information stored in the contact. >>> browser.getLink('paulcarduner').click() >>> print browser.contents ...Z Contact... ...Name:... ...Carduner, Paul... You can edit the information for the contact by clicking on the 'Edit Contact' link in the tabs along the top. Here you can enter information for all the fields you saw in the add form. >>> browser.getLink('Edit Contact').click() >>> browser.getControl('Phone').value = "703-xxx-xxxx" >>> browser.getControl('Email').value = "pcardune@polytope.com" >>> browser.getControl('Address').value = "Career Center, Arlington, VA" >>> browser.getControl('Change').click() Once we have changed the information, we have to click on the 'View' link to get back to the display page. Here we should see the updated information. >>> browser.getLink('View').click() >>> print browser.contents ...Z Contact... ...Name:... ...Carduner, Paul... ...Email:... ...pcardune@polytope.com... ...Phone:... ...703-xxx-xxxx... ...Address:... ...Career Center, Arlington, VA...