From aa417019ae6ac8f5ae9ea172f90c26a33efc9755 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 22 Nov 2017 07:58:55 +0100 Subject: [PATCH] Try stabilizing loading about:blank in end2end tests --- tests/end2end/fixtures/quteprocess.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index bfdefbbae..7b9f69d57 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -676,20 +676,26 @@ class QuteProc(testprocess.Process): else: timeout = 5000 - # We really need the same representation that the webview uses in its - # __repr__ qurl = QUrl(url) if not qurl.isValid(): raise ValueError("Invalid URL {}: {}".format(url, qurl.errorString())) - url = utils.elide(qurl.toDisplayString(QUrl.EncodeUnicode), 100) - assert url - pattern = re.compile( - r"(load status for : LoadStatus\.{load_status}|fetch: " - r"PyQt5\.QtCore\.QUrl\('{url}'\) -> .*)".format( - load_status=re.escape(load_status), url=re.escape(url))) + if qurl == QUrl('about:blank'): + # For some reason, we don't get a LoadStatus.success for about:blank + # sometimes. + pattern = "Changing title for idx * to 'about:blank'" + else: + # We really need the same representation that the webview uses in its + # __repr__ + url = utils.elide(qurl.toDisplayString(QUrl.EncodeUnicode), 100) + assert url + + pattern = re.compile( + r"(load status for : LoadStatus\.{load_status}|fetch: " + r"PyQt5\.QtCore\.QUrl\('{url}'\) -> .*)".format( + load_status=re.escape(load_status), url=re.escape(url))) try: self.wait_for(message=pattern, timeout=timeout)