[Checkins] SVN: Sandbox/darrylcousins/tfws.website/ Added Selenium
tests to the package today.
Darryl Cousins
darryl at darrylcousins.net.nz
Wed Aug 15 08:51:07 EDT 2007
Log message for revision 78844:
Added Selenium tests to the package today.
Deploy ini files have been moved to `deploy` directory. `zcml` and `conf` files
have been giving directories. The site server on port 8080 is started with::
bin/paster serve deploy/site.ini
And a selenium server on port 8034 with::
bin/paster serve deploy/selenium.ini
The tests can be run at::
http://localhost:8034/@@/selenium/TestRunner.html
Changed:
U Sandbox/darrylcousins/tfws.website/CHANGES.txt
U Sandbox/darrylcousins/tfws.website/INSTALL.txt
U Sandbox/darrylcousins/tfws.website/buildout.cfg
A Sandbox/darrylcousins/tfws.website/conf/
A Sandbox/darrylcousins/tfws.website/conf/selenium.conf
A Sandbox/darrylcousins/tfws.website/conf/site.conf
A Sandbox/darrylcousins/tfws.website/deploy/
A Sandbox/darrylcousins/tfws.website/deploy/selenium.ini
A Sandbox/darrylcousins/tfws.website/deploy/site.ini
D Sandbox/darrylcousins/tfws.website/deploy.ini
D Sandbox/darrylcousins/tfws.website/site.zcml
U Sandbox/darrylcousins/tfws.website/src/tfws/website/application.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/ftests/test_functional.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py
A Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.txt
A Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.zcml
A Sandbox/darrylcousins/tfws.website/src/tfws/website/seleniumtests.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/testing.py
A Sandbox/darrylcousins/tfws.website/zcml/
A Sandbox/darrylcousins/tfws.website/zcml/selenium.zcml
A Sandbox/darrylcousins/tfws.website/zcml/site.zcml
D Sandbox/darrylcousins/tfws.website/zope.conf
-=-
Modified: Sandbox/darrylcousins/tfws.website/CHANGES.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/CHANGES.txt 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/CHANGES.txt 2007-08-15 12:51:07 UTC (rev 78844)
@@ -6,5 +6,11 @@
------------
* Login and logout working with z3c.authentication.cookie lifetime cookie.
-* Added first simple tool for members
+* Added first simple viewlet for members
+* Added account and account edit view for members
+
+August 15 2007
+--------------
+
+* Implemented a selenium server with paste deploy and began suite of tests.
Modified: Sandbox/darrylcousins/tfws.website/INSTALL.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/INSTALL.txt 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/INSTALL.txt 2007-08-15 12:51:07 UTC (rev 78844)
@@ -48,6 +48,17 @@
(z3c.authentication and z3c.resource) the option ``website`` causes only tests
in the tfws.website package to be run.
+Running the selenium tests
+--------------------------
+
+Start the selenium application::
+
+ $ bin/paster serve selenium.ini
+
+If you now connect to port 8034 and run the suite of selenium tests. Note that
+the test suite creates and installs a test site to run the tests on (as do the
+functional tests).
+
Running the website
-------------------
@@ -56,5 +67,5 @@
$ bin/paster serve deploy.ini
If you now connect to port 8080 and log in with username 'tfws',
-password 'tfws'.
+password 'tfws'. From there you can add a website.
Modified: Sandbox/darrylcousins/tfws.website/buildout.cfg
===================================================================
--- Sandbox/darrylcousins/tfws.website/buildout.cfg 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/buildout.cfg 2007-08-15 12:51:07 UTC (rev 78844)
@@ -1,8 +1,7 @@
[buildout]
-develop = . z3c.authentication z3c.resource
+develop = . z3c.authentication z3c.resource zc.selenium
parts = app test
find-links = http://download.zope.org/distribution/
-eggs-directory = /opt/buildout/eggs
newest = false
[app]
@@ -13,6 +12,7 @@
PasteDeploy
z3c.authentication
z3c.resource
+ zc.selenium
[test]
recipe = zc.recipe.testrunner
@@ -20,3 +20,4 @@
z3c.authentication
z3c.resource
defaults = ['--tests-pattern', '^f?tests$', '-v']
+
Added: Sandbox/darrylcousins/tfws.website/conf/selenium.conf
===================================================================
--- Sandbox/darrylcousins/tfws.website/conf/selenium.conf (rev 0)
+++ Sandbox/darrylcousins/tfws.website/conf/selenium.conf 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,17 @@
+# Identify the component configuration used to define the site:
+site-definition zcml/selenium.zcml
+
+<zodb>
+ <demostorage>
+ </demostorage>
+</zodb>
+
+<eventlog>
+ <logfile>
+ path STDERR
+ </logfile>
+</eventlog>
+#
+# Uncomment this to switch on developer mode (e.g. for APIDoc)
+devmode on
+
Added: Sandbox/darrylcousins/tfws.website/conf/site.conf
===================================================================
--- Sandbox/darrylcousins/tfws.website/conf/site.conf (rev 0)
+++ Sandbox/darrylcousins/tfws.website/conf/site.conf 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,36 @@
+# Identify the component configuration used to define the site:
+site-definition zcml/site.zcml
+
+<zodb>
+ <filestorage>
+ path var/Data.fs
+ </filestorage>
+
+# Uncomment this if you want to connect to a ZEO server instead:
+# <zeoclient>
+# server localhost:8100
+# storage 1
+# # ZEO client cache, in bytes
+# cache-size 20MB
+# # Uncomment to have a persistent disk cache
+# #client zeo1
+# </zeoclient>
+</zodb>
+
+<eventlog>
+ # This sets up logging to both a file and to standard output
+ # (STDOUT). The "path" setting can be a relative or absolute
+ # filesystem path or the tokens STDOUT or STDERR.
+ <logfile>
+ path log/z3.log
+ formatter zope.exceptions.log.Formatter
+ </logfile>
+ <logfile>
+ path STDOUT
+ formatter zope.exceptions.log.Formatter
+ </logfile>
+</eventlog>
+
+# Uncomment this to switch on developer mode (e.g. for APIDoc)
+devmode on
+
Added: Sandbox/darrylcousins/tfws.website/deploy/selenium.ini
===================================================================
--- Sandbox/darrylcousins/tfws.website/deploy/selenium.ini (rev 0)
+++ Sandbox/darrylcousins/tfws.website/deploy/selenium.ini 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,8 @@
+[app:main]
+use = egg:tfws.website
+conf = ../conf/selenium.conf
+
+[server:main]
+use = egg:Paste#http
+host = 127.0.0.1
+port = 8034
Added: Sandbox/darrylcousins/tfws.website/deploy/site.ini
===================================================================
--- Sandbox/darrylcousins/tfws.website/deploy/site.ini (rev 0)
+++ Sandbox/darrylcousins/tfws.website/deploy/site.ini 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,7 @@
+[app:main]
+use = egg:tfws.website
+
+[server:main]
+use = egg:Paste#http
+host = 127.0.0.1
+port = 8080
Deleted: Sandbox/darrylcousins/tfws.website/deploy.ini
===================================================================
--- Sandbox/darrylcousins/tfws.website/deploy.ini 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/deploy.ini 2007-08-15 12:51:07 UTC (rev 78844)
@@ -1,7 +0,0 @@
-[app:main]
-use = egg:tfws.website
-
-[server:main]
-use = egg:Paste#http
-host = 127.0.0.1
-port = 8080
Deleted: Sandbox/darrylcousins/tfws.website/site.zcml
===================================================================
--- Sandbox/darrylcousins/tfws.website/site.zcml 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/site.zcml 2007-08-15 12:51:07 UTC (rev 78844)
@@ -1,36 +0,0 @@
-<configure xmlns="http://namespaces.zope.org/zope"
- i18n_domain="tfws.website">
-
- <include package="tfws.website" />
-
- <securityPolicy
- component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
-
- <unauthenticatedPrincipal id="zope.anybody"
- title="Unauthenticated User" />
- <unauthenticatedGroup id="zope.Anybody"
- title="Unauthenticated Users" />
- <authenticatedGroup id="zope.Authenticated"
- title="Authenticated Users" />
- <everybodyGroup id="zope.Everybody"
- title="All Users" />
- <principal id="zope.manager"
- title="Manager"
- login="tfws"
- password_manager="Plain Text"
- password="tfws"
- />
-
- <!-- Replace the following directive if you don't want public access -->
- <grant permission="zope.View"
- principal="zope.Anybody" />
- <grant permission="zope.app.dublincore.view"
- principal="zope.Anybody" />
-
- <role id="zope.Manager" title="Site Manager" />
- <role id="zope.Member" title="Site Member" />
- <grantAll role="zope.Manager" />
- <grant role="zope.Manager"
- principal="zope.manager" />
-
-</configure>
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/application.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/application.py 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/application.py 2007-08-15 12:51:07 UTC (rev 78844)
@@ -6,7 +6,7 @@
from zope.app.appsetup.appsetup import multi_database
from zope.app.appsetup.interfaces import DatabaseOpened, ProcessStarting
-def application_factory(global_conf, conf='zope.conf'):
+def application_factory(global_conf, conf='../conf/site.conf'):
# load 'zope.conf' configuration
schema_xml = os.path.join(
os.path.dirname(zope.app.appsetup.__file__), 'schema', 'schema.xml')
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/ftests/test_functional.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/ftests/test_functional.py 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/ftests/test_functional.py 2007-08-15 12:51:07 UTC (rev 78844)
@@ -1,11 +1,19 @@
+import os
import unittest
from zope.testing import doctest
from zope.app.testing import setup
+from zope.app.testing.functional import ZCMLLayer
from zope.app.testing.functional import FunctionalTestSetup, getRootFolder
-from tfws.website import testing
+import tfws.website
+ftesting_zcml = os.path.join(
+ os.path.dirname(tfws.website.__file__), 'ftesting.zcml')
+
+TestLayer = ZCMLLayer(ftesting_zcml, __name__, 'TestLayer')
+SeleniumTestLayer = ZCMLLayer(ftesting_zcml, __name__, 'SeleniumLayer')
+
optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
globs = dict(getRootFolder=getRootFolder)
@@ -20,8 +28,12 @@
test = doctest.DocFileSuite(
'../BROWSER.txt', setUp=setUp, globs=globs,
tearDown=tearDown, optionflags=optionflags)
- test.layer = testing.TestLayer
- suite.addTest(test)
+ test.layer = TestLayer
+ seleniumtest = doctest.DocFileSuite(
+ '../selenium.txt', setUp=setUp, globs=globs,
+ tearDown=tearDown, optionflags=optionflags)
+ seleniumtest.layer = SeleniumTestLayer
+ suite.addTest(seleniumtest)
return suite
if __name__ == '__main__':
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py 2007-08-15 12:51:07 UTC (rev 78844)
@@ -4,5 +4,9 @@
import mars.form
class IWebSiteLayer(mars.form.IDivFormLayer, IJQueryJavaScriptBrowserLayer):
-#class IWebSiteLayer(IDefaultBrowserLayer, mars.form.IDivFormLayer, IJQueryJavaScriptBrowserLayer):
pass
+
+class ISeleniumTestLayer(mars.form.IDivFormLayer, IJQueryJavaScriptBrowserLayer):
+ """This layer is used to set up selenium tests, usually run through
+ testbrowser in selenium.txt"""
+ pass
Added: Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.txt (rev 0)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.txt 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,14 @@
+===============================
+Selenium tests for tfws.website
+===============================
+
+This will run the suite of selenium tests from within testbrowser.
+
+ >>> from tfws.website import testing
+ >>> from z3c.etestbrowser.testing import ExtendedTestBrowser
+ >>> browser = ExtendedTestBrowser()
+ >>> #browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+ >>> browser.handleErrors = False
+ >>> browser.open("http://localhost/@@/TestRunner.html")
+ >>> #print browser.contents
+
Property changes on: Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author
Added: Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.zcml
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.zcml (rev 0)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/selenium.zcml 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,54 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ >
+
+ <include package="zc.selenium" />
+ <include file="selenium.zcml" />
+
+ <class class=".seleniumtests.WebSiteTestSuite">
+ <require
+ permission="zope.Public"
+ attributes="__call__"
+ />
+ </class>
+
+ <adapter
+ factory=".seleniumtests.WebSiteTestSuite"
+ name="seleniumtest.html"
+ permission="zope.Public"
+ />
+
+ <configure package="zc.selenium">
+
+ <browser:resourceDirectory
+ name="selenium"
+ directory="resources"
+ layer="tfws.website.layer.IWebSiteLayer"
+ />
+
+ <browser:resource
+ name="selenium_results"
+ factory=".results.Results"
+ permission="zope.Public"
+ layer="tfws.website.layer.IWebSiteLayer"
+ />
+
+ <browser:resource
+ name="selenium-push.html"
+ factory=".dbs.PushDBs"
+ permission="zope.Public"
+ layer="tfws.website.layer.IWebSiteLayer"
+ />
+
+ <browser:resource
+ name="selenium-pop.html"
+ factory=".dbs.PopDBs"
+ permission="zope.Public"
+ layer="tfws.website.layer.IWebSiteLayer"
+ />
+
+
+ </configure>
+</configure>
+
Added: Sandbox/darrylcousins/tfws.website/src/tfws/website/seleniumtests.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/seleniumtests.py (rev 0)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/seleniumtests.py 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,27 @@
+from zc.selenium.pytest import Test
+
+class WebSiteTestSuite(Test):
+
+ def setUp(self):
+ super(WebSiteTestSuite, self).setUp()
+ print self.selenium.server
+ self.baseURL = 'http://%s/' % self.selenium.server
+
+ def reset(self):
+ s = self.selenium
+ s.open(self.baseURL)
+
+ def sharedSetUp(self):
+ super(WebSiteTestSuite, self).sharedSetUp()
+
+ def sharedTearDown(self):
+ super(WebSiteTestSuite, self).sharedTearDown()
+
+ def open(self, path):
+ self.selenium.open(self.baseURL + path)
+
+ def test_base(self):
+ s = self.selenium
+ self.reset()
+ s.verifyTextPresent('Remoteinclude Demo')
+
Property changes on: Sandbox/darrylcousins/tfws.website/src/tfws/website/seleniumtests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/testing.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/testing.py 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/testing.py 2007-08-15 12:51:07 UTC (rev 78844)
@@ -35,10 +35,6 @@
from martian.interfaces import IModuleInfo
import tfws.website
-ftesting_zcml = os.path.join(
- os.path.dirname(tfws.website.__file__), 'ftesting.zcml')
-TestLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')
-
def printElement(browser, xpath, multiple=False, serialize=True):
"""Print method from z3c.form to use with z3c.etestbrowser"""
result = [serialize and lxml.etree.tounicode(elem) or elem
Added: Sandbox/darrylcousins/tfws.website/zcml/selenium.zcml
===================================================================
--- Sandbox/darrylcousins/tfws.website/zcml/selenium.zcml (rev 0)
+++ Sandbox/darrylcousins/tfws.website/zcml/selenium.zcml 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,8 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="tfws.website">
+
+ <include file="./site.zcml" />
+ <include package="tfws.website" file="selenium.zcml" />
+
+
+</configure>
Added: Sandbox/darrylcousins/tfws.website/zcml/site.zcml
===================================================================
--- Sandbox/darrylcousins/tfws.website/zcml/site.zcml (rev 0)
+++ Sandbox/darrylcousins/tfws.website/zcml/site.zcml 2007-08-15 12:51:07 UTC (rev 78844)
@@ -0,0 +1,36 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="tfws.website">
+
+ <include package="tfws.website" />
+
+ <securityPolicy
+ component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+ <unauthenticatedPrincipal id="zope.anybody"
+ title="Unauthenticated User" />
+ <unauthenticatedGroup id="zope.Anybody"
+ title="Unauthenticated Users" />
+ <authenticatedGroup id="zope.Authenticated"
+ title="Authenticated Users" />
+ <everybodyGroup id="zope.Everybody"
+ title="All Users" />
+ <principal id="zope.manager"
+ title="Manager"
+ login="tfws"
+ password_manager="Plain Text"
+ password="tfws"
+ />
+
+ <!-- Replace the following directive if you don't want public access -->
+ <grant permission="zope.View"
+ principal="zope.Anybody" />
+ <grant permission="zope.app.dublincore.view"
+ principal="zope.Anybody" />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <role id="zope.Member" title="Site Member" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager"
+ principal="zope.manager" />
+
+</configure>
Deleted: Sandbox/darrylcousins/tfws.website/zope.conf
===================================================================
--- Sandbox/darrylcousins/tfws.website/zope.conf 2007-08-15 12:33:56 UTC (rev 78843)
+++ Sandbox/darrylcousins/tfws.website/zope.conf 2007-08-15 12:51:07 UTC (rev 78844)
@@ -1,36 +0,0 @@
-# Identify the component configuration used to define the site:
-site-definition site.zcml
-
-<zodb>
- <filestorage>
- path var/Data.fs
- </filestorage>
-
-# Uncomment this if you want to connect to a ZEO server instead:
-# <zeoclient>
-# server localhost:8100
-# storage 1
-# # ZEO client cache, in bytes
-# cache-size 20MB
-# # Uncomment to have a persistent disk cache
-# #client zeo1
-# </zeoclient>
-</zodb>
-
-<eventlog>
- # This sets up logging to both a file and to standard output
- # (STDOUT). The "path" setting can be a relative or absolute
- # filesystem path or the tokens STDOUT or STDERR.
- <logfile>
- path log/z3.log
- formatter zope.exceptions.log.Formatter
- </logfile>
- <logfile>
- path STDOUT
- formatter zope.exceptions.log.Formatter
- </logfile>
-</eventlog>
-
-# Uncomment this to switch on developer mode (e.g. for APIDoc)
-devmode on
-
More information about the Checkins
mailing list