From: RaFromBRC <raf...@us...> - 2005-02-26 23:25:25
|
Update of /cvsroot/collective/CMFMember/ftests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv638 Added Files: Tag: v1_0_branch CMFMemberFTestCase.py testJoin.py Removed Files: Tag: v1_0_branch testFuncMemberManagement.py testRegistration.py Log Message: * brand-spanking new Selenium based functional tests! very very cool. --- NEW FILE: testJoin.py --- import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) import CMFMemberFTestCase class TestRegistration(CMFMemberFTestCase.CMFMemberFTestCase): def testJoinValidation(self): self.selenium.open('/portal/createMember') self.selenium.clickAndWait('form.button.register') res = self.selenium.verifyTextPresent('You did not enter a login name.','') self.failUnless(res == 'PASSED') res = self.selenium.verifyTextPresent('E-mail is required, please correct.','') self.failUnless(res == 'PASSED') res = self.selenium.verifyTextPresent('You did not enter a password.','') self.failUnless(res == 'PASSED') # XXX more coming soon self.selenium.testComplete() if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) framework() else: from unittest import TestSuite, makeSuite def test_suite(): suite = TestSuite() suite.addTest(makeSuite(TestRegistration)) return suite --- testRegistration.py DELETED --- --- testFuncMemberManagement.py DELETED --- --- NEW FILE: CMFMemberFTestCase.py --- """ This is the functional test case base class for CMFMember. It depends on the very excellent Selenium product; Selenium MUST be installed in your Zope instance or these tests will NOT run correctly. If you DO have Selenium installed, however, then try these out and be amazed. Selenium is available at http://jrandolph.com/selenium-plone/ """ import os, sys, re, xmlrpclib, time if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log') os.environ['EVENT_LOG_SEVERITY'] = '-300' from Testing import ZopeTestCase from Products.CMFPlone.tests import PloneTestCase from Products.CMFMember.tests import CMFMemberTestCase from Acquisition import aq_base from Products.CMFPlone.Portal import default_frontpage from urllib import urlencode from urlparse import urlparse ZopeTestCase.installProduct('Selenium') ZopeTestCase.utils.startZServer(4) default_user = PloneTestCase.default_user _d = {'__ac_name': default_user, '__ac_password': 'secret'} import xmlrpclib class CMFMemberFTestCase(ZopeTestCase.Functional, CMFMemberTestCase.CMFMemberTestCase): def afterSetUp(self): self.portal_url = self.portal.absolute_url() self.folder_url = self.folder.absolute_url() CMFMemberTestCase.CMFMemberTestCase.afterSetUp(self) self.qi.installProduct('Selenium') self.qi.installProduct('CMFMember') self.portal.cmfmember_control.upgrade(swallow_errors=0) self._refreshSkinData() driver_url = "%s/selenium_driver" % self.portal_url self.selenium = xmlrpclib.ServerProxy(driver_url) runner_url = "%s/SeleneseRunner.html" % driver_url get_transaction().commit(1) # creates app._p_jar self.launchBrowser(runner_url) time.sleep(5) def launchBrowser(self, url): # XXX MAKE THIS SMARTER; IS CURRENTLY MAC SPECIFIC!!! os.system('open %s' % url) |