[Checkins] SVN: gocept.selenium/trunk/ added AlertPresent-related methods to the selenese API
Thomas Lotze
tl at gocept.com
Mon Mar 15 10:37:25 EDT 2010
Log message for revision 109977:
added AlertPresent-related methods to the selenese API
Changed:
U gocept.selenium/trunk/CHANGES.txt
U gocept.selenium/trunk/src/gocept/selenium/selenese.py
A gocept.selenium/trunk/src/gocept/selenium/tests/fixture/alert.pt
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-03-15 14:06:07 UTC (rev 109976)
+++ gocept.selenium/trunk/CHANGES.txt 2010-03-15 14:37:25 UTC (rev 109977)
@@ -10,6 +10,9 @@
- API expansion: added ``waitForPopUp``, ``selectPopUp``, ``deselectPopUp``
and ``close``.
+- API expansion: added ``verifyAlertPresent``, ``verifyAlertNotPresent`` and
+ ``waitForAlertPresent``.
+
- Usability: raise a better readable exception when an unimplemented selenese
method is called.
Modified: gocept.selenium/trunk/src/gocept/selenium/selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/selenese.py 2010-03-15 14:06:07 UTC (rev 109976)
+++ gocept.selenium/trunk/src/gocept/selenium/selenese.py 2010-03-15 14:37:25 UTC (rev 109977)
@@ -212,6 +212,11 @@
def getValue(self, locator):
pass
+ @assert_type(None)
+ @passthrough
+ def isAlertPresent(self):
+ pass
+
@assert_type('locator')
@passthrough
def isElementPresent(self, locator):
@@ -302,6 +307,8 @@
elif getter.assert_type == 'locator_pattern':
return lambda locator, pattern: \
self._assert_pattern(getter, pattern, locator)
+ elif getter.assert_type is None:
+ return lambda: self._assert(getter)
raise AttributeError(requested_name)
Added: gocept.selenium/trunk/src/gocept/selenium/tests/fixture/alert.pt
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/tests/fixture/alert.pt (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/tests/fixture/alert.pt 2010-03-15 14:37:25 UTC (rev 109977)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+<head>
+</head>
+
+<body onload="window.setTimeout(function(){alert('foo');}, 500)">
+</body>
+</html>
Property changes on: gocept.selenium/trunk/src/gocept/selenium/tests/fixture/alert.pt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Date
Added: svn:eol-style
+ native
Modified: gocept.selenium/trunk/src/gocept/selenium/tests/fixture/configure.zcml
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/tests/fixture/configure.zcml 2010-03-15 14:06:07 UTC (rev 109976)
+++ gocept.selenium/trunk/src/gocept/selenium/tests/fixture/configure.zcml 2010-03-15 14:37:25 UTC (rev 109977)
@@ -38,4 +38,11 @@
permission="zope.Public"
/>
+ <browser:page
+ for="*"
+ name="alert.html"
+ template="alert.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-03-15 14:06:07 UTC (rev 109976)
+++ gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py 2010-03-15 14:37:25 UTC (rev 109977)
@@ -108,7 +108,23 @@
'http://localhost:8087/',
self.selenium.getLocation())
+ def test_alert_not_present(self):
+ self.selenium.open('/')
+ self.selenium.verifyAlertNotPresent()
+ def test_alert_present(self):
+ self.selenium.open('/alert.html')
+ time.sleep(0.6)
+ self.selenium.verifyAlertPresent()
+ self.selenium.getAlert()
+
+ def test_wait_for_alert(self):
+ self.selenium.open('/alert.html')
+ self.selenium.verifyAlertNotPresent()
+ self.selenium.waitForAlertPresent()
+ self.selenium.getAlert()
+
+
class PopUpTest(gocept.selenium.ztk.testing.TestCase):
def setUp(self):
More information about the checkins
mailing list