[Pkg-mozext-commits] [requestpolicy] 117/257: [tst][fix] R21n: use `sleep()` in `is_shown()`

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit ee0f6e6096e08e8247526f0aa48dd0b777aa4676
Author: Martin Kimmerle <dev at 256k.de>
Date:   Wed Oct 28 01:23:20 2015 +0100

    [tst][fix] R21n: use `sleep()` in `is_shown()`
    
    On E10s the `is_shown()` sometimes returns too early, which
    may cause false negatives, or false positives. The latter case
    is worse because the test says everything's ok, but it isn't.
    
    I couldn't find an easy way not to use `time.sleep()`.
---
 tests/marionette/rp_puppeteer/ui/redirect_notification.py   | 7 +++++++
 tests/marionette/tests/redirections/test_inline_redirect.py | 5 -----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/marionette/rp_puppeteer/ui/redirect_notification.py b/tests/marionette/rp_puppeteer/ui/redirect_notification.py
index 7110e8b..ce72a78 100644
--- a/tests/marionette/rp_puppeteer/ui/redirect_notification.py
+++ b/tests/marionette/rp_puppeteer/ui/redirect_notification.py
@@ -5,6 +5,7 @@
 from firefox_puppeteer.base import BaseLib
 from marionette_driver.errors import NoSuchElementException
 from marionette_driver.wait import Wait
+import time
 
 
 class RedirectNotification(BaseLib):
@@ -17,6 +18,12 @@ class RedirectNotification(BaseLib):
     def is_shown(self):
         """Check if the redirection notification bar is present."""
 
+        # Wait some time to make sure the check happens not too early.
+        # In that case `is_shown()` would return `False`, but it should
+        # return `True`.
+        # FIXME: Find a better solution than `sleep()`.
+        time.sleep(0.1)
+
         try:
             self._panel
             return True
diff --git a/tests/marionette/tests/redirections/test_inline_redirect.py b/tests/marionette/tests/redirections/test_inline_redirect.py
index c92f207..74a0cf4 100644
--- a/tests/marionette/tests/redirections/test_inline_redirect.py
+++ b/tests/marionette/tests/redirections/test_inline_redirect.py
@@ -33,11 +33,6 @@ class TestInlineRedirect(RequestPolicyTestCase):
             with self.marionette.using_context("content"):
                 self.marionette.navigate(test_url)
 
-            # Wait some time to be sure the test is not faster than the
-            # redirect notification.
-            # FIXME: Find a better solution than `sleep()`
-            time.sleep(0.1)
-
             self.assertFalse(self.redir.is_shown(),
                              "There's no redirect notification.")
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list