[tests] Fix web test for windmill and forms
authorJulien Jehannet <julien.jehannet@logilab.fr>
Fri, 18 Feb 2011 15:26:00 +0100
changeset 7059 1d65b235549f
parent 7049 f2ae6202754c
child 7061 bb2080547722
[tests] Fix web test for windmill and forms - new component 'inout' needed to be clicked (windmill) - renamed id will fail html tests (windmill and unittest_forms.py)
devtools/cwwindmill.py
devtools/httptest.py
web/test/data/schema.py
web/test/test_windmill.py
web/test/windmill/test_creation.py
web/test/windmill/test_edit_relation.py
--- a/devtools/cwwindmill.py	Mon Mar 07 23:16:22 2011 +0100
+++ b/devtools/cwwindmill.py	Fri Feb 18 15:26:00 2011 +0100
@@ -77,10 +77,10 @@
 
         test_dir = __file__
 
-    Instead of toggle `edit_test` value, try `pytest -i`
+    Instead of toggle `edit_test` value, try `python <test script> -f`
     """
     browser = 'firefox'
-    edit_test = "-i" in sys.argv # detection for pytest invocation
+    edit_test = "-f" in sys.argv or "-i" in sys.argv # XXX pytest
     # Windmill use case are written with no anonymous user
     anonymous_logged = False
 
@@ -99,7 +99,7 @@
 
     def setUp(self):
         # Start CubicWeb session before running the server to populate self.vreg
-        CubicWebServerTC.setUp(self)
+        super(CubicWebWindmillUseCase, self).setUp()
         # XXX reduce log output (should be done in a cleaner way)
         # windmill fu** up our logging configuration
         for logkey in ('windmill', 'logilab', 'cubicweb'):
@@ -118,7 +118,7 @@
 
     def tearDown(self):
         teardown(self.windmill_shell_objects)
-        CubicWebServerTC.tearDown(self)
+        super(CubicWebWindmillUseCase, self).tearDown()
 
     def testWindmill(self):
         if self.edit_test:
--- a/devtools/httptest.py	Mon Mar 07 23:16:22 2011 +0100
+++ b/devtools/httptest.py	Fri Feb 18 15:26:00 2011 +0100
@@ -176,7 +176,7 @@
         return response
 
     def setUp(self):
-        CubicWebTC.setUp(self)
+        super(CubicWebServerTC, self).setUp()
         self.start_server()
 
     def tearDown(self):
@@ -185,7 +185,7 @@
         except error.ReactorNotRunning, err:
             # Server could be launched manually
             print err
-        CubicWebTC.tearDown(self)
+        super(CubicWebServerTC, self).teardown()
 
     @classmethod
     def init_config(cls, config):
--- a/web/test/data/schema.py	Mon Mar 07 23:16:22 2011 +0100
+++ b/web/test/data/schema.py	Fri Feb 18 15:26:00 2011 +0100
@@ -91,3 +91,5 @@
     title = String(maxsize=32, required=True, fulltextindexed=True)
     concerns = SubjectRelation('Project', composite='object')
 
+# used by windmill for `test_edit_relation`
+from cubes.folder.schema import Folder
--- a/web/test/test_windmill.py	Mon Mar 07 23:16:22 2011 +0100
+++ b/web/test/test_windmill.py	Fri Feb 18 15:26:00 2011 +0100
@@ -1,8 +1,12 @@
 # Run all scenarii found in windmill directory
+from os.path import join, dirname
 from cubicweb.devtools.cwwindmill import (CubicWebWindmillUseCase,
                                           unittest_main)
 
-class CubicWebWindmillUseCase(CubicWebWindmillUseCase): pass
+class CubicWebWindmillUseCase(CubicWebWindmillUseCase):
+    #test_dir = join(dirname(__file__), "windmill/test_edit_relation.py")
+    pass
+
 
 if __name__ == '__main__':
     unittest_main()
--- a/web/test/windmill/test_creation.py	Mon Mar 07 23:16:22 2011 +0100
+++ b/web/test/windmill/test_creation.py	Fri Feb 18 15:26:00 2011 +0100
@@ -26,7 +26,8 @@
     client.type(text=u'myuser', id=u'upassword-subject:A')
     client.type(text=u'myuser', name=u'upassword-subject-confirm:A')
     client.type(text=u'myuser', id=u'firstname-subject:A')
-    client.select(option=u'managers', id=u'in_group-subject:A')
+    client.select(option=u'managers', id=u'from_in_group-subject:A')
+    client.click(id=u'cwinoutadd')
     client.waits.forPageLoad(timeout=u'20000')
     client.click(id=u'adduse_email:Alink')
     client.waits.forPageLoad(timeout=u'20000')
--- a/web/test/windmill/test_edit_relation.py	Mon Mar 07 23:16:22 2011 +0100
+++ b/web/test/windmill/test_edit_relation.py	Fri Feb 18 15:26:00 2011 +0100
@@ -22,8 +22,8 @@
     client.type(text=u'folder1', id=u'name-subject:A')
     client.click(value=u'button_ok')
     client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'add Folder filed_under Folder object', timeout=u'8000')
-    client.click(link=u'add Folder filed_under Folder object')
+    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
+    client.click(link=u'add add Folder filed_under Folder object')
     client.waits.forPageLoad(timeout=u'20000')
     client.waits.forElement(timeout=u'8000', id=u'name-subject:A')
     client.click(id=u'name-subject:A')
@@ -44,8 +44,8 @@
     client.click(link=u'x')
     client.click(value=u'button_ok')
     client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'add Folder filed_under Folder object', timeout=u'8000')
-    client.click(link=u'add Folder filed_under Folder object')
+    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
+    client.click(link=u'add add Folder filed_under Folder object')
     client.waits.forPageLoad(timeout=u'20000')
     client.type(text=u'subfolder2', id=u'name-subject:A')
     client.click(value=u'button_ok')