[Checkins] SVN: gocept.selenium/trunk/src/gocept/selenium/ fixed the waiting logic when selecting a pop-up window
Thomas Lotze
tl at gocept.com
Thu Mar 18 04:43:36 EDT 2010
Log message for revision 110050:
fixed the waiting logic when selecting a pop-up window
Changed:
U gocept.selenium/trunk/src/gocept/selenium/selenese.py
U gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py
-=-
Modified: gocept.selenium/trunk/src/gocept/selenium/selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/selenese.py 2010-03-18 06:22:52 UTC (rev 110049)
+++ gocept.selenium/trunk/src/gocept/selenium/selenese.py 2010-03-18 08:43:36 UTC (rev 110050)
@@ -72,7 +72,10 @@
def selectPopUp(self, windowID='', wait=True):
if wait:
- self.waitForPopUp(windowID)
+ timeout = self.timeout * 1000
+ else:
+ timeout = 0
+ self.selenium.wait_for_pop_up(windowID, timeout)
self.selenium.select_pop_up(windowID)
@passthrough
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-18 06:22:52 UTC (rev 110049)
+++ gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py 2010-03-18 08:43:36 UTC (rev 110050)
@@ -182,9 +182,14 @@
self.selenium.open('/launch-popup.html')
def tearDown(self):
+ try:
+ self.selenium.selectPopUp(wait=False)
+ except Exception:
+ pass
if self.selenium.getLocation().endswith('/popup.html'):
self.selenium.close()
self.selenium.deselectPopUp()
+ self.selenium.setTimeout(30)
super(PopUpTest, self).tearDown()
def test_wait_for_and_select_popup(self):
@@ -193,9 +198,20 @@
self.selenium.waitForPopUp()
self.selenium.selectPopUp()
- def test_0_select_popup(self):
- # XXX needs to be run first as pop-up windows can apparently be
- # selected even after they have been closed.
+ def test_wait_for_popup_times_out(self):
+ self.selenium.selectPopUp('gocept.selenium-popup')
+ self.selenium.close()
+ self.selenium.deselectPopUp()
+ self.selenium.setTimeout(0)
+ self.assertRaises(Exception, self.selenium.waitForPopUp,
+ 'gocept.selenium-popup')
+ self.assertRaises(Exception, self.selenium.waitForPopUp)
+ self.selenium.setTimeout(1)
+ self.assertRaises(Exception, self.selenium.waitForPopUp,
+ 'gocept.selenium-popup')
+ self.assertRaises(Exception, self.selenium.waitForPopUp)
+
+ def test_select_popup(self):
self.assertRaises(Exception,
self.selenium.selectPopUp,
'gocept.selenium-popup', wait=False)
More information about the checkins
mailing list