From b0430ca3e725655e703f81363a9e0424ec92a588 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 5 Nov 2015 08:02:55 +0100 Subject: [PATCH] bdd: Make it possible to wait for messages. --- tests/integration/features/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index f071398d4..a2630417e 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -64,6 +64,14 @@ def wait_until_loaded(quteproc, path): quteproc.wait_for_load_finished(path) +@bdd.when(bdd.parsers.re(r'I wait for (?Pregex )?"' + r'(?P[^"]+)" in the log')) +def wait_in_log(quteproc, is_regex, pattern): + if is_regex: + pattern = re.compile(pattern) + quteproc.wait_for(message=pattern) + + @bdd.then(bdd.parsers.parse("{path} should be loaded")) def path_should_be_loaded(httpbin, path): requests = httpbin.get_requests()