summaryrefslogtreecommitdiff
path: root/service/test/functional
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-09-15 09:27:21 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-09-15 09:27:21 +0200
commitfbf0663ed672aff425db09684e7ce1db9b7666e4 (patch)
tree8b0ca42f6e09b277b15fd13733df9b3a5df3fda2 /service/test/functional
parentcedaa0b72507e43de4a3f357957ea4c12b1563ee (diff)
Replace sleep in data_setup.py with wait
- Issue: #456
Diffstat (limited to 'service/test/functional')
-rw-r--r--service/test/functional/features/steps/data_setup.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/service/test/functional/features/steps/data_setup.py b/service/test/functional/features/steps/data_setup.py
index c6eab8c0..fb825aba 100644
--- a/service/test/functional/features/steps/data_setup.py
+++ b/service/test/functional/features/steps/data_setup.py
@@ -13,10 +13,10 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
-from time import sleep
from uuid import uuid4
from test.support.integration import MailBuilder
from behave import given
+from common import wait_for_condition
@given('I have a mail in my inbox')
@@ -25,6 +25,7 @@ def add_mail_impl(context):
input_mail = MailBuilder().with_subject(subject).build_input_mail()
context.client.add_mail_to_inbox(input_mail)
- sleep(5) # we need to wait for the mail to be indexed (3 secs at least)
+
+ wait_for_condition(context, lambda _: context.client.search_engine.search(subject)[1] > 0, poll_frequency=0.1)
context.last_subject = subject