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

Last change on this file since 1577 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
RevLine 
[1219]1Quills browser tests
2====================
3
4N.B. Much of the generic browser testing has been factored out into
5quills/app/tests/browser.rst.  *Only* browser tests that are *specific* to the
6Products.QuillsEnabled implementation (as opposed to Products.Quills) should be
7in this file.
8
9
10Here we click ourselves through a Quills instance and check that everything is
11in order. First some boilerplate to get our browser up and running:
12
13    >>> self.setRoles(("Contributor",))
14    >>> browser = self.getBrowser(logged_in=True)
15    >>> browser.handleErrors = False
16
17
18adding content
19**************
20
21    >>> browser.open('http://nohost/plone/weblog/')
22    >>> browser.getLink(url='http://nohost/plone/weblog/createObject?type_name=Document').click()
23    >>> browser.getControl('Title').value = "New entry"
24    >>> browser.getControl('Description').value = "A new entry"
25    >>> browser.getControl('Text').value = "This is a new entry."
26    >>> browser.getControl(name='allowDiscussion:boolean').value = True
27   
28    We'd like to set the subjects, but they are on a different 'tab' for
29    standard 'Document'/'Page' types in plone, so we skip it for now.
30   
31    #>>> browser.getControl(name='subject_existing_keywords:list').value = ["fishslapping",]
32    >>> browser.getControl('Save').click()
33
34Having filled out the form and saved it we should now be viewing our newly baked
35entry:
36
37    >>> browser.url
38    'http://nohost/plone/weblog/new-entry'
39
40However, since we only have the Contributor role, we are not allowed to publish
41the item:
42
43    >>> browser.getLink('Publish')
44    Traceback (most recent call last):
45    ...
46    LinkNotFoundError
47
48But we can submit the entry for publication:
49
50    >>> browser.getLink('Submit').click()
51
52If we additionally grant the `Reviewer` role we can publish the new entry:
53
54    >>> self.setRoles(("Contributor", "Reviewer"))
55    >>> browser.reload()
56    >>> browser.getLink('Publish').click()
57
58
59comments
60********
61
62By default we even need the `Manager` role to add comments:
63
64    >>> self.setRoles(("Contributor", "Reviewer", "Manager"))
65
66We also need to enable comments for the 'Document' portal type:
67
68    >>> dtype = self.portal.portal_types['Document']
69    >>> dtype.manage_changeProperties(allow_discussion=1)
70    >>> entry_content = self.weblog.context['new-entry']
71    >>> entry_content.allowDiscussion = 1
72    >>> entry_content.reindexObject()
73
74Now we open the page in a browser:
75
76    >>> browser.open('http://nohost/plone/weblog/new-entry')
77
78The non-archive view has a button to add a comment:
79
80#XXX: quintagroup.quills.extras fix (because of using quintagorup.plonecomments)
81    >>> browser.getControl('Subject')
82    <Control name='subject' type='text'>
83
84When viewing an entry via its archive url, we still should be able to add a
85comment, as well:
86
87    >>> entry = self.weblog.getEntry('new-entry')
88    >>> date = entry.getPublicationDate()
89    >>> year = str(date.year())
90    >>> month = str(date.month()).zfill(2)
91    >>> day = str(date.day()).zfill(2)
92
93    >>> browser.open('http://nohost/plone/weblog/%s/%s/%s/new-entry' % (year, month, day))
94
95#XXX: quintagroup.quills.extras fix (because of using quintagorup.plonecomments)
96    >>> browser.getControl('Subject')
97    <Control name='subject' type='text'>
98
99    >>> browser.getControl('Subject').value = "Parrot"
100    >>> browser.getControl('Comment').value = "Is dead. Is deceased."
101
102However, currently this still raises an error (eventhough the comment is
103actually created). The problem seems to be that zope.testbrowser cannot handle
104urls that have anchors (e.g. 'foo/bar#anchor') at the end. The comment machinery
105tries to redirect to such a url after the 'click', so this next call fails. See
106issue http://plone.org/products/quills/issues/105 for more details of why this
107test exists.
108
109    >> browser.getControl('Save').click()
Note: See TracBrowser for help on using the repository browser.