summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2019-08-30 13:13:24 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2019-09-14 10:46:27 +0200
commit891a1ee6d0e894e49cc79efbdf864dd2fded5501 (patch)
tree12d7a85f48e7d5260c775efa3add6ae42a6f50e2 /tests
parent6017b1d0d39b351affd6c31643b5a1a5abc4c86e (diff)
Fix flaky tst_QWebEnginePage::runJavaScriptFromSlot
Unfortunately, "load finished" doesn't mean "ready to execute JavaScript". Fixes: QTBUG-74718 Change-Id: I611e35cfbb530ff68745d86124679d60ab0b113e Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebenginepage/BLACKLIST3
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp10
2 files changed, 4 insertions, 9 deletions
diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST
index 2000b0260..af47c70f7 100644
--- a/tests/auto/widgets/qwebenginepage/BLACKLIST
+++ b/tests/auto/widgets/qwebenginepage/BLACKLIST
@@ -9,6 +9,3 @@ windows
[getUserMediaRequestDesktopVideoManyRequests]
windows
-
-[runJavaScriptFromSlot]
-osx
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 0fa38f9ef..6373bf2d9 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -1698,24 +1698,22 @@ void tst_QWebEnginePage::runJavaScriptFromSlot()
{
QWebEngineProfile profile;
QWebEnginePage page(&profile);
- page.settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true);
QSignalSpy loadFinishedSpy(&page, &QWebEnginePage::loadFinished);
page.setHtml("<html><body>"
" <input type='text' id='input1' value='QtWebEngine' size='50' />"
"</body></html>");
QTRY_COMPARE(loadFinishedSpy.count(), 1);
- // Workaround for QTBUG-74718
- QTRY_VERIFY(page.action(QWebEnginePage::SelectAll)->isEnabled());
- QVariant result(-1);
+ bool done = false;
connect(&page, &QWebEnginePage::selectionChanged, [&]() {
- result = evaluateJavaScriptSync(&page, QStringLiteral("2+2"));
+ QTRY_COMPARE(evaluateJavaScriptSync(&page, QStringLiteral("2+2")), QVariant(4));
+ done = true;
});
evaluateJavaScriptSync(&page, QStringLiteral("const input = document.getElementById('input1');"
"input.focus();"
"input.select();"));
- QTRY_COMPARE(result, QVariant(4));
+ QTRY_VERIFY(done);
}
void tst_QWebEnginePage::fullScreenRequested()