Skip to content

Commit 82a1a68

Browse files
stamphopatricia-gallardo
authored andcommitted
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 <[email protected]>
1 parent 9eb9ecd commit 82a1a68

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ TestWebEngineView {
112112
simulateUserGesture()
113113
webEngineView.triggerWebAction(WebEngineView.RequestClose);
114114
verify(webEngineView.waitForWindowCloseRequested());
115+
116+
// Navigate away from page with onbeforeunload handler,
117+
// otherwise it would trigger an extra dialog request when
118+
// navigating in the subsequent test.
119+
webEngineView.url = Qt.resolvedUrl("about:blank");
120+
verify(webEngineView.waitForLoadSucceeded());
121+
compare(JSDialogParams.dialogCount, 2)
115122
}
116123

117124
function test_rejectClose() {
@@ -123,6 +130,14 @@ TestWebEngineView {
123130
simulateUserGesture()
124131
webEngineView.triggerWebAction(WebEngineView.RequestClose);
125132
verify(webEngineView.testSupport.waitForWindowCloseRejected());
133+
134+
// Navigate away from page with onbeforeunload handler,
135+
// otherwise it would trigger an extra dialog request when
136+
// navigating in the subsequent test.
137+
JSDialogParams.shouldAcceptDialog = true;
138+
webEngineView.url = Qt.resolvedUrl("about:blank");
139+
verify(webEngineView.waitForLoadSucceeded());
140+
compare(JSDialogParams.dialogCount, 2)
126141
}
127142

128143
function test_prompt() {

0 commit comments

Comments
 (0)