Browser tests for HowTos
========================

Sanity checks for FAQFolder and FAQ

First, some set-up:
    
    >>> from Products.Five import zcml
    >>> import Products    
    >>> from Products.Five.testbrowser import Browser
    >>> browser = Browser()
    >>> browser.handleErrors = False
    
Let us log all exceptions, which is useful for debugging. Also, clear portlet
slots, to make the test browser less confused by things like the recent portlet
and the navtree.

    >>> self.portal.error_log._ignored_exceptions = ()
    >>> self.portal.left_slots = self.portal.right_slots = []

Setup our site with a PHC instance data provided in Data.py and utilities in CustomSetup.py

    >>> from Products.PloneHelpCenter.tests import CustomSetup
    >>> from Products.PloneHelpCenter.tests import Data
    >>> CustomSetup.CreateRootPHC(self,self.portal)
    'Created a PHC instance in the root of your Plone site.'

Setup some sample FAQs to interact with

    >>> CustomSetup.CreateFaqs(self,self.portal)
    'Created 4 PHC FAQs.'

Check to see if the new FAQs are visible. Only two are published.

    >>> browser.open(self.portal.absolute_url() + "/" + Data.Hc.Id + '/helpcenter_view')
    >>> browser.contents
    '...All <span>2</span>...<span>FAQs</span>...'

Let's follow the link to the FAQ page and see if the FAQs are there.

    >>> browser.getLink('All 2 FAQs').click()
    >>> browser.contents
    '...FAQ Section1...What is Test FAQ 1?...FAQ - \xc3\xa1 - Section2...What is Test FAQ 4?...'

Follow the link to one of the FAQs. Check content.

    >>> browser.getLink('What is Test FAQ 1?').click()
    >>> browser.contents
    '...What is Test FAQ 1?...This would be a long form of the question...Bogus answer here...'