Trying to fix the comments viewlet functional tests on Plone 3.x.
svn path=/plone.app.discussion/trunk/; revision=39932
This commit is contained in:
parent
7502abe032
commit
087efab54a
@ -183,36 +183,43 @@ class TestCommentsViewletIntegration(FunctionalTestCase):
|
|||||||
layer = DiscussionLayer
|
layer = DiscussionLayer
|
||||||
|
|
||||||
def testCommentsViewlet(self):
|
def testCommentsViewlet(self):
|
||||||
|
# Fetch testbrowser
|
||||||
browser = Browser()
|
browser = Browser()
|
||||||
portal_url = self.portal.absolute_url()
|
portal_url = self.portal.absolute_url()
|
||||||
browser.handleErrors = False
|
browser.handleErrors = False
|
||||||
|
|
||||||
|
# Login
|
||||||
browser.open(portal_url + '/login_form')
|
browser.open(portal_url + '/login_form')
|
||||||
browser.getControl(name='__ac_name').value = portal_owner
|
browser.getControl(name='__ac_name').value = portal_owner
|
||||||
browser.getControl(name='__ac_password').value = default_password
|
browser.getControl(name='__ac_password').value = default_password
|
||||||
browser.getControl(name='submit').click()
|
browser.getControl(name='submit').click()
|
||||||
|
|
||||||
|
# Create page with comments allowed
|
||||||
browser.open(portal_url)
|
browser.open(portal_url)
|
||||||
browser.getLink(id='document').click()
|
browser.getLink(id='document').click()
|
||||||
browser.getControl(name='title').value = "Doc1"
|
browser.getControl(name='title').value = "Doc1"
|
||||||
browser.getControl(name='allowDiscussion:boolean').value = True
|
browser.getControl(name='allowDiscussion:boolean').value = True
|
||||||
browser.getControl(name='form.button.save').click()
|
browser.getControl(name='form.button.save').click()
|
||||||
|
|
||||||
doc1 = self.portal['doc1']
|
# Check that the form has been properly submitted
|
||||||
doc1_url = doc1.absolute_url()
|
self.assertEquals(browser.url, 'http://nohost/plone/doc1')
|
||||||
browser.open(doc1_url)
|
|
||||||
# Do not show the old comment viewlet
|
# Check that the old comments viewlet does not show up
|
||||||
self.failIf('discussion_reply_form' in browser.contents)
|
self.failIf('discussion_reply_form' in browser.contents)
|
||||||
# Show the new comment viewlet
|
|
||||||
|
# Check that the comment form/viewlet shows up
|
||||||
self.failUnless('formfield-form-widgets-in_reply_to' in
|
self.failUnless('formfield-form-widgets-in_reply_to' in
|
||||||
browser.contents)
|
browser.contents)
|
||||||
self.failUnless('formfield-form-widgets-title' in browser.contents)
|
self.failUnless('formfield-form-widgets-title' in browser.contents)
|
||||||
self.failUnless('formfield-form-widgets-text' in browser.contents)
|
self.failUnless('formfield-form-widgets-text' in browser.contents)
|
||||||
|
|
||||||
|
# Submit the comment form
|
||||||
browser.getControl(name='form.widgets.title').value = "My Comment"
|
browser.getControl(name='form.widgets.title').value = "My Comment"
|
||||||
browser.getControl(name='form.widgets.text').value = "Lorem ipsum"
|
browser.getControl(name='form.widgets.text').value = "Lorem ipsum"
|
||||||
browser.getControl(name='form.buttons.comment').click()
|
submit = browser.getControl(name='form.buttons.comment')
|
||||||
|
submit.click()
|
||||||
|
|
||||||
|
# Check that the comment has been posted
|
||||||
self.failUnless("My Comment" in browser.contents)
|
self.failUnless("My Comment" in browser.contents)
|
||||||
self.failUnless("Lorem ipsum" in browser.contents)
|
self.failUnless("Lorem ipsum" in browser.contents)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user