summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2016-09-27 17:09:58 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2016-09-30 05:17:25 +0000
commit25b50de487a34fb8ffcd6d891c833b2f2907c91c (patch)
tree24e0d45df803ff5fdf2a4d8b0b044a61399b60d6 /tests
parent34e3e19a158549c780eb50a9876809c6280ca867 (diff)
Speculative fix of user script QML tests
The sequence of the titleChanged and loadingChanged signals is not guaranteed. Wait for both of them to avoid flaky behavior. Change-Id: I981cd20f6535187fa0f8144db0084c8bb64ab41c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qmltests/data/tst_userScripts.qml21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_userScripts.qml b/tests/auto/quick/qmltests/data/tst_userScripts.qml
index a6249d128..88fa6f6e3 100644
--- a/tests/auto/quick/qmltests/data/tst_userScripts.qml
+++ b/tests/auto/quick/qmltests/data/tst_userScripts.qml
@@ -87,31 +87,31 @@ Item {
function test_oneScript() {
webEngineView.url = Qt.resolvedUrl("test1.html");
webEngineView.waitForLoadSucceeded();
- compare(webEngineView.title, "Test page 1");
+ tryCompare(webEngineView, "title", "Test page 1");
webEngineView.userScripts = [ changeDocumentTitleScript ];
compare(webEngineView.title, "Test page 1");
webEngineView.reload();
webEngineView.waitForLoadSucceeded();
- compare(webEngineView.title, "New title");
+ tryCompare(webEngineView, "title", "New title");
webEngineView.url = Qt.resolvedUrl("test2.html");
webEngineView.waitForLoadSucceeded();
- compare(webEngineView.title, "New title");
+ tryCompare(webEngineView, "title", "New title");
webEngineView.userScripts = [];
compare(webEngineView.title, "New title");
webEngineView.reload();
webEngineView.waitForLoadSucceeded();
- compare(webEngineView.title, "Test page with huge link area");
+ tryCompare(webEngineView, "title", "Test page with huge link area");
}
function test_twoScripts() {
webEngineView.url = Qt.resolvedUrl("test1.html");
webEngineView.waitForLoadSucceeded();
- compare(webEngineView.title, "Test page 1");
+ tryCompare(webEngineView, "title", "Test page 1");
webEngineView.userScripts = [ changeDocumentTitleScript, appendDocumentTitleScript ];
@@ -139,20 +139,21 @@ Item {
function test_setUserScriptsConditionally() {
webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test1.html");
webEngineViewWithConditionalUserScripts.waitForLoadSucceeded();
- compare(webEngineViewWithConditionalUserScripts.title, "New title");
+ tryCompare(webEngineViewWithConditionalUserScripts, "title", "New title");
webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test2.html");
webEngineViewWithConditionalUserScripts.waitForLoadSucceeded();
- compare(webEngineViewWithConditionalUserScripts.title, "Test page with huge link area with appendix");
+ tryCompare(webEngineViewWithConditionalUserScripts, "title", "Test page with huge link area with appendix");
webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test3.html");
webEngineViewWithConditionalUserScripts.waitForLoadSucceeded();
- compare(webEngineViewWithConditionalUserScripts.title, "Test page 3");
+ tryCompare(webEngineViewWithConditionalUserScripts, "title", "Test page 3");
}
function test_bigScript() {
webEngineView.userScripts = [ bigUserScript ];
webEngineView.url = Qt.resolvedUrl("test1.html");
+ webEngineView.waitForLoadSucceeded();
tryCompare(webEngineView , "title", "Big user script changed title");
}
@@ -165,12 +166,12 @@ Item {
// @include *test*.html
webEngineView.url = Qt.resolvedUrl("test1.html");
webEngineView.waitForLoadSucceeded();
- compare(webEngineView.title, "New title");
+ tryCompare(webEngineView, "title", "New title");
// @exclude *test2.html
webEngineView.url = Qt.resolvedUrl("test2.html");
webEngineView.waitForLoadSucceeded();
- compare(webEngineView.title, "Test page with huge link area");
+ tryCompare(webEngineView, "title", "Test page with huge link area");
}
}
}