summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2021-01-08 18:10:23 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2021-01-13 16:12:13 +0100
commit1bc8826b7a73e104d1aa1de663114f077f129f35 (patch)
treed1985fe5254f19dada8a035fa0370d30e0695d07 /tests/auto/quick
parentc9d902ca6ca3b1aa2e2762329d18c226d26520af (diff)
Fix WebEngineViewJavaScriptDialogs qml auto tests after Chromium 87
onbeforeunload event is fired when navigating to another page since: d51e7703e747 Remove InterstitialPage https://chromium-review.googlesource.com/c/chromium/src/+/2146137 Navigate away from pages with onbeforeunload handler at the end of the tests. Change-Id: I79b306620e202e1466a8125c8f8f60a7218b2969 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml
index 658071005..a521ea0d6 100644
--- a/tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml
+++ b/tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml
@@ -112,6 +112,13 @@ TestWebEngineView {
simulateUserGesture()
webEngineView.triggerWebAction(WebEngineView.RequestClose);
verify(webEngineView.waitForWindowCloseRequested());
+
+ // Navigate away from page with onbeforeunload handler,
+ // otherwise it would trigger an extra dialog request when
+ // navigating in the subsequent test.
+ webEngineView.url = Qt.resolvedUrl("about:blank");
+ verify(webEngineView.waitForLoadSucceeded());
+ compare(JSDialogParams.dialogCount, 2)
}
function test_rejectClose() {
@@ -123,6 +130,14 @@ TestWebEngineView {
simulateUserGesture()
webEngineView.triggerWebAction(WebEngineView.RequestClose);
verify(webEngineView.testSupport.waitForWindowCloseRejected());
+
+ // Navigate away from page with onbeforeunload handler,
+ // otherwise it would trigger an extra dialog request when
+ // navigating in the subsequent test.
+ JSDialogParams.shouldAcceptDialog = true;
+ webEngineView.url = Qt.resolvedUrl("about:blank");
+ verify(webEngineView.waitForLoadSucceeded());
+ compare(JSDialogParams.dialogCount, 2)
}
function test_prompt() {