Browser tests for HelpCenterTutorial
====================================

Sanity checks for TutorialFolder and Tutorials.

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 tutorials to interact with

    >>> CustomSetup.CreateTutorials(self,self.portal)
    'Created 4 PHC Tutorials.'

One of our tutorials is published with several published sub-items.  This is where
we head for testing.

    >>> browser.open(self.portal.absolute_url() + "/" + Data.Hc.Id + '/helpcenter_view')
    >>> browser.getLink('Test Tutorial 4').click()

Now we open the all=pages view of our tutorial and prove that it is not the default 
template for this type (i.e. not aliased with view method) and shows the full 
contents of our published subitems (but not our in "draft" subitems) in the 
correct ordering.

    >>> browser.open("%s/tutorial-all-pages" % browser.url)
    >>> 'tutorial-all-pages' in browser.url
    True
    >>> browser.contents
    '...Sample Tutorial Page1...Section 1...The rest of the content...Sample Tutorial Page2...Initial Checkout...'
    >>> 'Sample Tutorial Page3' not in browser.contents
    True


Next time I'll tackle proving:

- The relevant sub-tutorial pages show up on paginated views (depends upon perms & workflows)
- We can "fake" (we don't have javascript with testbrowser) jumping from appropriate tutorial page to tutorial page
- Next/previous works
- We have the author image floating to the right -- credit where credit is due

