Browser tests for plone.introspector
=============================

Some setup code

    >>> from Products.Five.testbrowser import Browser
    >>> browser = Browser()
    >>> portal_url = self.portal.absolute_url()
    >>> base_url = 'http://nohost'


The following is useful when writing and debugging testbrowser tests. It lets
us see error messages properly.

    >>> browser.handleErrors = False
    >>> self.portal.error_log._ignored_exceptions = ()


Finally, we need to log in as the portal owner, i.e. an administrator user. We
want to go to the manage screens but the easiest way is to go via the 
Plone portal login screens.

    >>> from Products.PloneTestCase.setup import portal_owner, default_password

    >>> browser.open(portal_url + '/login_form?came_from=' + portal_url)
    >>> browser.getControl(name='__ac_name').value = portal_owner
    >>> browser.getControl(name='__ac_password').value = default_password
    >>> browser.getControl(name='submit').click()
    
	    
Now we are logged in as manager we head over to the zmi manage interface and 
the Component Registry tab.

	>>> browser.open(base_url + '/manage_main')
	>>> browser.getLink('Component Registry').click()
	>>> browser.url
	'http://nohost/@@registry.html'


In the Component Registry tab we get straight to the registry search start by 
trying to search for an adapter with 'Interface' in the name.

	>>> browser.getControl(name='adapters').value = True
	>>> browser.getControl(name='searchQuery').value = 'Interface'
	>>> browser.getControl(name='search').click()
	>>> 'Adapter' in browser.contents
	True
	
Do the same thing for Utilities, Handlers and Subscription Adapters. 
Since the previous search is saved there is no need to re enter the search query:

	>>> browser.getControl(name='adapters').value = False
	>>> browser.getControl(name='utilities').value = True
	>>> browser.getControl(name='search').click()
	>>> 'Utility' in browser.contents
	True

	>>> browser.getControl(name='utilities').value = False
	>>> browser.getControl(name='handlers').value = True
	>>> browser.getControl(name='search').click()
	>>> 'Handler' in browser.contents
	True

There is usually not so many entries in Subscription Adapters so we search for everything '*':
	>>> browser.getControl(name='handlers').value = False
	>>> browser.getControl(name='subscriptionAdapters').value = True
	>>> browser.getControl(name='searchQuery').value = '*'
	>>> browser.getControl(name='search').click()
	>>> 'Subscription Adapter' in browser.contents
	True
	
Now check that search goes over all types:

	>>> browser.getControl(name='adapters').value = True
	>>> browser.getControl(name='utilities').value = True
	>>> browser.getControl(name='handlers').value = True
	>>> browser.getControl(name='subscriptionAdapters').value = True
	>>> browser.getControl(name='searchQuery').value = '*'
	>>> browser.getControl(name='search').click()
	>>> [x in browser.contents for x in ['Adapter','Utility','Handler','Subscription Adapter']] 
	[True, True, True, True]
	 