Browser tests
=============
Test the presence of the "title" tag in html page

    >>> from plone.testing.zope import Browser
    >>> from plone.app.testing import SITE_OWNER_NAME
    >>> from plone.app.testing import SITE_OWNER_PASSWORD
    >>> from plone.app.testing import TEST_USER_NAME
    >>> from plone.app.testing import TEST_USER_PASSWORD
    >>> app = layer['app']
    >>> portal = layer['portal']
    >>> browser = Browser(app)

Create object

    >>> browser.open('http://nohost/plone/login_form')
    >>> browser.getControl('Login Name').value = SITE_OWNER_NAME
    >>> browser.getControl('Password').value = SITE_OWNER_PASSWORD
    >>> browser.getControl('Log in').click()

    >>> browser.getLink('Page').click()
    >>> browser.getControl('Title').value = 'Front Page'
    >>> browser.getControl('Save').click()
    >>> browser.getLink('Publish').click()

    >>> browser.open('http://nohost/plone')
    >>> browser.getLink('Collection').click()
    >>> browser.getControl(name='form.widgets.IDublinCore.title').value = 'News'
    >>> browser.getControl('Save').click()
    >>> browser.getLink('Summary view').click()
    >>> browser.getLink('Publish').click()

    >>> browser.getLink('Log out').click()

Test title tag

    >>> browser.open('http://nohost/plone/front-page')
    >>> "<title>%s" % portal['front-page'].Title() in browser.contents
    True

Test for "template id" in <body> tag. See tickets #9111/#8777

    >>> browser.open('http://nohost/plone/front-page')
    >>> browser.contents
    '...<body ...class="...template-document_view...'

    >>> browser.contents
    '...<body ...class="...portaltype-document...'

    >>> browser.contents
    '...<body ...class="...site-plone...'

    >>> browser.contents
    '...<body ...class="...section-front-page...'

    >>> browser.open('http://nohost/plone/news')
    >>> browser.contents
    '...<body ...class="...portaltype-collection...'

    >>> browser.contents
    '...<body ...class="...template-summary_view...'

    >>> browser.contents
    '...<body ...class="...section-news...'

    >>> browser.contents
    '...<body ...class="...site-plone...'

Login

    >>> browser.getLink('Log in').click()
    >>> browser.getControl('Login Name').value = TEST_USER_NAME
    >>> browser.getControl('Password').value = TEST_USER_PASSWORD
    >>> browser.getControl('Log in').click()

Test explicit browser view

    >>> browser.open('http://nohost/plone/@@dashboard')
    >>> browser.contents
    '...<body ...class="...template-dashboard...'

    >>> browser.contents
    '...<body ...class="...portaltype-plone-site...'

    >>> browser.contents
    '...<body ...class="...site-plone...'
