[Checkins] SVN: gocept.selenium/trunk/ - assertXpathCount now also takes ints (fixes #7681).

Christian Zagrodnick cz at gocept.com
Thu Aug 5 02:37:54 EDT 2010


Log message for revision 115465:
  - assertXpathCount now also takes ints (fixes #7681).
  
  

Changed:
  U   gocept.selenium/trunk/CHANGES.txt
  U   gocept.selenium/trunk/src/gocept/selenium/selenese.py
  U   gocept.selenium/trunk/src/gocept/selenium/tests/fixture/configure.zcml
  U   gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py

-=-
Modified: gocept.selenium/trunk/CHANGES.txt
===================================================================
--- gocept.selenium/trunk/CHANGES.txt	2010-08-05 06:18:56 UTC (rev 115464)
+++ gocept.selenium/trunk/CHANGES.txt	2010-08-05 06:37:54 UTC (rev 115465)
@@ -4,7 +4,7 @@
 0.6 (unreleased)
 ----------------
 
-- Nothing changed yet.
+- assertXpathCount now also takes ints (#7681).
 
 
 0.5 (2010-08-03)

Modified: gocept.selenium/trunk/src/gocept/selenium/selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/selenese.py	2010-08-05 06:18:56 UTC (rev 115464)
+++ gocept.selenium/trunk/src/gocept/selenium/selenese.py	2010-08-05 06:37:54 UTC (rev 115465)
@@ -310,7 +310,7 @@
 
     def assertXpathCount(self, xpath, count):
         result = self.selenium.get_xpath_count(xpath)
-        if result != count:
+        if int(result) != int(count):
             raise self.failureException(
                 'Actual count of XPath %r is %s, expected %s'
                 % (xpath, result, count))

Modified: gocept.selenium/trunk/src/gocept/selenium/tests/fixture/configure.zcml
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/tests/fixture/configure.zcml	2010-08-05 06:18:56 UTC (rev 115464)
+++ gocept.selenium/trunk/src/gocept/selenium/tests/fixture/configure.zcml	2010-08-05 06:37:54 UTC (rev 115465)
@@ -52,4 +52,11 @@
      permission="zope.Public"
      />
 
+  <browser:page
+     for="*"
+     name="divs.html"
+     template="divs.pt"
+     permission="zope.Public"
+     />
+
 </configure>

Modified: gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py	2010-08-05 06:18:56 UTC (rev 115464)
+++ gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py	2010-08-05 06:37:54 UTC (rev 115465)
@@ -179,7 +179,14 @@
         self.selenium.waitForAlertPresent()
         self.selenium.getAlert()
 
+    def test_xpathcount_should_convert_to_ints(self):
+        self.selenium.open('/divs.html')
+        self.selenium.assertXpathCount("//div[@class='countable']", 3)
+        self.selenium.assertXpathCount("//div[@class='countable']", '3')
+        self.selenium.assertXpathCount("//div", 4)
+        self.selenium.assertXpathCount("//div", '4')
 
+
 class PopUpTest(gocept.selenium.ztk.testing.TestCase):
 
     def setUp(self):



More information about the checkins mailing list