[Checkins] SVN: zc.selenium/branches/wosc-zope2/ - make DemoStorage push/pop work for Zope2

Wolfgang Schnerring wosc at wosc.de
Fri Feb 20 06:25:10 EST 2009


Log message for revision 96813:
   - make DemoStorage push/pop work for Zope2
   - wrote a test for this
  

Changed:
  U   zc.selenium/branches/wosc-zope2/src/zc/selenium/dbs.py
  A   zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope2.zcml
  A   zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope3.zcml
  U   zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.py
  D   zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.zcml
  U   zc.selenium/branches/wosc-zope2/zope2.cfg
  U   zc.selenium/branches/wosc-zope2/zope3.cfg

-=-
Modified: zc.selenium/branches/wosc-zope2/src/zc/selenium/dbs.py
===================================================================
--- zc.selenium/branches/wosc-zope2/src/zc/selenium/dbs.py	2009-02-20 11:19:34 UTC (rev 96812)
+++ zc.selenium/branches/wosc-zope2/src/zc/selenium/dbs.py	2009-02-20 11:25:10 UTC (rev 96813)
@@ -32,7 +32,7 @@
     def get_db(self):
         try:
             import Zope2
-            DB = Zope2.DB
+            DB = Zope2.bobo_application._stuff[0]
         except ImportError:
             DB = self.request.publication.db
         return DB
@@ -40,7 +40,8 @@
     def set_db(self, db):
         try:
             import Zope2
-            Zope2.DB = db
+            old_db, aname, version_support = Zope2.bobo_application._stuff
+            Zope2.bobo_application._stuff = db, aname, version_support
         except ImportError:
             self.request.publication.db = db
         return DB

Copied: zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope2.zcml (from rev 96721, zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.zcml)
===================================================================
--- zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope2.zcml	                        (rev 0)
+++ zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope2.zcml	2009-02-20 11:25:10 UTC (rev 96813)
@@ -0,0 +1,17 @@
+<configure
+  xmlns="http://namespaces.zope.org/zope"
+  xmlns:test="http://namespaces.zope.org/test"
+  >
+
+  <!-- provides is only necessary for zope2 -->
+  <adapter
+    name="zc.selenium.tests.Zope2Test"
+    factory=".tests.Zope2Test"
+    provides="zc.selenium.pytest.ISeleniumTest"
+    permission="zope.Public"
+    />
+
+  <include package="zc.selenium" file="meta.zcml" />
+
+  <test:seleniumTest file="htmltest.html" />
+</configure>


Property changes on: zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope2.zcml
___________________________________________________________________
Added: svn:mergeinfo
   + 

Copied: zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope3.zcml (from rev 96721, zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.zcml)
===================================================================
--- zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope3.zcml	                        (rev 0)
+++ zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope3.zcml	2009-02-20 11:25:10 UTC (rev 96813)
@@ -0,0 +1,15 @@
+<configure
+  xmlns="http://namespaces.zope.org/zope"
+  xmlns:test="http://namespaces.zope.org/test"
+  >
+
+  <adapter
+    name="zc.selenium.tests.Zope3Test"
+    factory=".tests.Zope3Test"
+    permission="zope.Public"
+    />
+
+  <include package="zc.selenium" file="meta.zcml" />
+
+  <test:seleniumTest file="htmltest.html" />
+</configure>


Property changes on: zc.selenium/branches/wosc-zope2/src/zc/selenium/tests-zope3.zcml
___________________________________________________________________
Added: svn:mergeinfo
   + 

Modified: zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.py
===================================================================
--- zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.py	2009-02-20 11:19:34 UTC (rev 96812)
+++ zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.py	2009-02-20 11:25:10 UTC (rev 96813)
@@ -27,15 +27,41 @@
 import zc.selenium.selenium
 
 
-class TestSelenium(zc.selenium.pytest.Test):
+class Zope3Test(zc.selenium.pytest.Test):
+    def test_open(self):
+        self.selenium.open('/')
+        self.selenium.verifyTextPresent('Login')
+
+    # XXX missing
+#     def test_add_foo(self)
+
+#     # should work because of zc.selenium's DemoStorage-Stack
+#     def test_add_foo_again(self):
+#         self.test_add_foo()
+
+# Zope2 requires docstrings on views
+class Zope2Test(zc.selenium.pytest.Test):
     """Selenium self-test."""
 
     def test_open(self):
-        self.selenium.open('http://%s/' % self.selenium.server)
-        # could be zope3 or zope2
-        self.selenium.verifyTextPresent('regexp:Login|Zope Quick Start')
+        self.selenium.open('/')
+        self.selenium.verifyTextPresent('Zope Quick Start')
 
+    def test_add_foo(self):
+        s = self.selenium
+        s.open('http://admin:admin@%s/manage' % self.selenium.server)
+        # XXX: I wish we had some ids to go on...
+        s.select('//form[@method="get"]/select[@name=":action"]', 'Folder')
+        s.type('name=id', 'foo')
+        s.click('//input[@value="Add"]')
+        s.verifyTextNotPresent('it is already in use')
+        s.waitForElementPresent('link=foo')
 
+    # should work because of zc.selenium's DemoStorage-Stack
+    def test_add_foo_again(self):
+        self.test_add_foo()
+
+
 class HTTPTest(unittest.TestCase):
 
     def test_request(self):

Deleted: zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.zcml
===================================================================
--- zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.zcml	2009-02-20 11:19:34 UTC (rev 96812)
+++ zc.selenium/branches/wosc-zope2/src/zc/selenium/tests.zcml	2009-02-20 11:25:10 UTC (rev 96813)
@@ -1,17 +0,0 @@
-<configure
-  xmlns="http://namespaces.zope.org/zope"
-  xmlns:test="http://namespaces.zope.org/test"
-  >
-
-  <!-- provides is only necessary for zope2 -->
-  <adapter
-    name="zc.selenium.tests.TestSelenium"
-    factory=".tests.TestSelenium"
-    provides="zc.selenium.pytest.ISeleniumTest"
-    permission="zope.Public"
-    />
-
-  <include package="zc.selenium" file="meta.zcml" />
-
-  <test:seleniumTest file="htmltest.html" />
-</configure>

Modified: zc.selenium/branches/wosc-zope2/zope2.cfg
===================================================================
--- zc.selenium/branches/wosc-zope2/zope2.cfg	2009-02-20 11:19:34 UTC (rev 96812)
+++ zc.selenium/branches/wosc-zope2/zope2.cfg	2009-02-20 11:25:10 UTC (rev 96813)
@@ -49,7 +49,7 @@
   <five:loadProducts file="meta.zcml"/>
   <include files="package-includes/*-configure.zcml" />
   <include package="zc.selenium" />
-  <include package="zc.selenium" file="tests.zcml" />
+  <include package="zc.selenium" file="tests-zope2.zcml" />
   <five:loadProducts />
   <includeOverrides files="package-includes/*-overrides.zcml" />
   <five:loadProductsOverrides />

Modified: zc.selenium/branches/wosc-zope2/zope3.cfg
===================================================================
--- zc.selenium/branches/wosc-zope2/zope3.cfg	2009-02-20 11:19:34 UTC (rev 96812)
+++ zc.selenium/branches/wosc-zope2/zope3.cfg	2009-02-20 11:25:10 UTC (rev 96813)
@@ -30,8 +30,13 @@
 site.zcml = <include package="zope.app.zcmlfiles" />
             <include package="zope.app.server" />
             <include package="zc.selenium" />
-            <include package="zc.selenium" file="tests.zcml" />
+            <include package="zc.selenium" file="tests-zope3.zcml" />
 
+            <principal id="zope.mgr"
+                  title="Manager"
+                  login="admin"
+                  password="admin" />
+
 [z3instance]
 recipe = zc.zope3recipes:instance
 application = application



More information about the Checkins mailing list