source: products/quintagroup.quills.extras/trunk/quintagroup/quills/extras/tests/extras_browser.rst @ 1227

Last change on this file since 1227 was 1225, checked in by mylan, 15 years ago

Merged revisions 2250-2256,2258 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.quills.extras/branches/no_webresults

........

r2250 | mylan | 2009-08-05 17:50:46 +0300 (Wed, 05 Aug 2009) | 2 lines


moved webresults site cusomizations into elaw.quills.webresults package (#37)

........

r2251 | mylan | 2009-08-05 21:25:35 +0300 (Wed, 05 Aug 2009) | 1 line


Bind off from 4webresults theme skin: rebind resources to IQuillsExtrasLayer (browser layer), change QuillsLinks? portlet registration

........

r2252 | mylan | 2009-08-05 22:28:15 +0300 (Wed, 05 Aug 2009) | 1 line


Fix bug with quills_header_macros

........

r2253 | mylan | 2009-08-06 17:45:39 +0300 (Thu, 06 Aug 2009) | 1 line


Added tests for quills

........

r2254 | mylan | 2009-08-06 17:48:25 +0300 (Thu, 06 Aug 2009) | 1 line


Added support of both qPloneComments or quintagroup.plonecomments products

........

r2255 | mylan | 2009-08-06 19:26:31 +0300 (Thu, 06 Aug 2009) | 1 line


Move entry & weblog macroses from skins to /browser (acording to quills.app v.1.7.3)

........

r2256 | mylan | 2009-08-06 20:18:07 +0300 (Thu, 06 Aug 2009) | 1 line


Debug macroses refactoring, #37

........

r2258 | mylan | 2009-08-07 15:15:54 +0300 (Fri, 07 Aug 2009) | 1 line


Update tests because of integration quills with quintagroup.plonecomments (#37)

........

File size: 3.7 KB

Quills browser tests

N.B. Much of the generic browser testing has been factored out into quills/app/tests/browser.rst. Only browser tests that are specific to the Products.QuillsEnabled implementation (as opposed to Products.Quills) should be in this file.

Here we click ourselves through a Quills instance and check that everything is in order. First some boilerplate to get our browser up and running:

>>> self.setRoles(("Contributor",))
>>> browser = self.getBrowser(logged_in=True)
>>> browser.handleErrors = False

adding content

>>> browser.open('http://nohost/plone/weblog/')
>>> browser.getLink(url='http://nohost/plone/weblog/createObject?type_name=Document').click()
>>> browser.getControl('Title').value = "New entry"
>>> browser.getControl('Description').value = "A new entry"
>>> browser.getControl('Text').value = "This is a new entry."
>>> browser.getControl(name='allowDiscussion:boolean').value = True

We'd like to set the subjects, but they are on a different 'tab' for standard 'Document'/'Page' types in plone, so we skip it for now.

#>>> browser.getControl(name='subject_existing_keywords:list').value = ["fishslapping",] >>> browser.getControl('Save').click()

Having filled out the form and saved it we should now be viewing our newly baked entry:

>>> browser.url
'http://nohost/plone/weblog/new-entry'

However, since we only have the Contributor role, we are not allowed to publish the item:

>>> browser.getLink('Publish')
Traceback (most recent call last):
...
LinkNotFoundError

But we can submit the entry for publication:

>>> browser.getLink('Submit').click()

If we additionally grant the Reviewer role we can publish the new entry:

>>> self.setRoles(("Contributor", "Reviewer"))
>>> browser.reload()
>>> browser.getLink('Publish').click()

comments

By default we even need the Manager role to add comments:

>>> self.setRoles(("Contributor", "Reviewer", "Manager"))

We also need to enable comments for the 'Document' portal type:

>>> dtype = self.portal.portal_types['Document']
>>> dtype.manage_changeProperties(allow_discussion=1)
>>> entry_content = self.weblog.context['new-entry']
>>> entry_content.allowDiscussion = 1
>>> entry_content.reindexObject()

Now we open the page in a browser:

>>> browser.open('http://nohost/plone/weblog/new-entry')

The non-archive view has a button to add a comment:

#XXX: quintagroup.quills.extras fix (because of using quintagorup.plonecomments)
>>> browser.getControl('Subject')
<Control name='subject' type='text'>

When viewing an entry via its archive url, we still should be able to add a comment, as well:

>>> entry = self.weblog.getEntry('new-entry')
>>> date = entry.getPublicationDate()
>>> year = str(date.year())
>>> month = str(date.month()).zfill(2)
>>> day = str(date.day()).zfill(2)
>>> browser.open('http://nohost/plone/weblog/%s/%s/%s/new-entry' % (year, month, day))
#XXX: quintagroup.quills.extras fix (because of using quintagorup.plonecomments)
>>> browser.getControl('Subject')
<Control name='subject' type='text'>
>>> browser.getControl('Subject').value = "Parrot"
>>> browser.getControl('Comment').value = "Is dead. Is deceased."

However, currently this still raises an error (eventhough the comment is actually created). The problem seems to be that zope.testbrowser cannot handle urls that have anchors (e.g. 'foo/bar#anchor') at the end. The comment machinery tries to redirect to such a url after the 'click', so this next call fails. See issue http://plone.org/products/quills/issues/105 for more details of why this test exists.

>> browser.getControl('Save').click()
Note: See TracBrowser for help on using the repository browser.