From c4efcbd282009411ba0ed319c44f535dfa9bacd8 Mon Sep 17 00:00:00 2001
From: Viktor Engelmann <viktor.engelmann@qt.io>
Date: Fri, 14 Jul 2017 15:12:17 +0200
Subject: [PATCH] Increase timespan for
 WebViewFindText::test_findTextInterruptedByLoad

The timespans here are 5 seconds by default. These are not enough for
this test and make it fail often. We therefore increase the timespans
and un-blacklist the test.

Task-number: QTBUG-61887
Change-Id: I6acc2dee78fb4d589fd87f7557e0d48725b36f08
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
---
 tests/auto/quick/qmltests/BLACKLIST             |  3 ---
 tests/auto/quick/qmltests/data/tst_findText.qml | 12 ++++++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/tests/auto/quick/qmltests/BLACKLIST b/tests/auto/quick/qmltests/BLACKLIST
index 579028850..010b014d7 100644
--- a/tests/auto/quick/qmltests/BLACKLIST
+++ b/tests/auto/quick/qmltests/BLACKLIST
@@ -20,8 +20,5 @@ linux
 [WebEngineViewSingleFileUpload::test_acceptSingleFileSelection]
 *
 
-[WebViewFindText::test_findTextInterruptedByLoad]
-linux
-
 [WebEngineViewLoadProgress::test_loadProgress]
 osx
diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml
index f8730ca7b..dfcfd586f 100644
--- a/tests/auto/quick/qmltests/data/tst_findText.qml
+++ b/tests/auto/quick/qmltests/data/tst_findText.qml
@@ -57,7 +57,7 @@ TestWebEngineView {
             runJavaScript("document.body.innerHTML", function(result) {
                 bodyInnerHTML = result;
             });
-            tryVerify(function() { return bodyInnerHTML != undefined; });
+            tryVerify(function() { return bodyInnerHTML != undefined; }, 20000);
             return bodyInnerHTML;
         }
 
@@ -66,7 +66,7 @@ TestWebEngineView {
             runJavaScript("document.getElementById('list').getElementsByTagName('li')[" + index + "].innerText;", function(result) {
                 listItemText = result;
             });
-            tryVerify(function() { return listItemText != undefined; });
+            tryVerify(function() { return listItemText != undefined; }, 20000);
             return listItemText;
         }
 
@@ -82,9 +82,9 @@ TestWebEngineView {
             var itemIndex;
 
             runJavaScript(script, function(result) { itemIndex = result; });
-            tryVerify(function() { return itemIndex != undefined; });
+            tryVerify(function() { return itemIndex != undefined; }, 20000);
             // Make sure the DOM is up-to-date.
-            tryVerify(function() { return getListItemText(itemIndex).length == text.length; });
+            tryVerify(function() { return getListItemText(itemIndex).length == text.length; }, 20000);
         }
 
         function test_findText() {
@@ -176,7 +176,7 @@ TestWebEngineView {
             verify(findFailed)
 
             runJavaScript("document.body.innerHTML = 'blahellobla'");
-            tryVerify(function() { return getBodyInnerHTML() == "blahellobla"; });
+            tryVerify(function() { return getBodyInnerHTML() == "blahellobla"; }, 20000);
 
             webEngineView.clear()
             webEngineView.findText("hello", findFlags, webEngineView.findTextCallback)
@@ -213,7 +213,7 @@ TestWebEngineView {
 
             // The callback is not supposed to be called, see QTBUG-61506.
             // Check whether the callback was called (-1 = no, other values = yes).
-            tryVerify(function() { return webEngineView.matchCount == -1; });
+            tryVerify(function() { return webEngineView.matchCount == -1; }, 20000);
         }
     }
 }
-- 
GitLab