From 92d8d601e5c88e5e01b797d1ef34bec5851c5350 Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Fri, 4 Oct 2024 18:12:07 +0300 Subject: [PATCH] fix: Enable WebEngineLoader qml tests --- AppRun | 2 +- Makefile | 1 + storybook/main.cpp | 6 +++++- ui/StatusQ/tests/TestComponents/tst_WebEngineLoader.qml | 7 ------- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/AppRun b/AppRun index efd704c431..87a2f47c8d 100755 --- a/AppRun +++ b/AppRun @@ -9,7 +9,7 @@ export LD_LIBRARY_PATH="${APPDIR}/usr/lib/:${APPDIR}/usr/lib/nss:${LD_LIBRARY_PA export QT_QPA_PLATFORM="xcb" # TODO: Remove once qt 5.15.2 support is dropped # Fixing bug: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1944468 -export QTWEBENGINE_CHROMIUM_FLAGS="--disable-seccomp-filter-sandbox" +export QTWEBENGINE_CHROMIUM_FLAGS="${QTWEBENGINE_CHROMIUM_FLAGS} --disable-seccomp-filter-sandbox" DEFAULT_LANG=en_US.UTF-8 if [[ "$LANG" == "C.UTF-8" ]] diff --git a/Makefile b/Makefile index fede925e60..8f94537279 100644 --- a/Makefile +++ b/Makefile @@ -330,6 +330,7 @@ statusq-tests: --build $(STATUSQ_BUILD_PATH) \ $(HANDLE_OUTPUT) +run-statusq-tests: export QTWEBENGINE_CHROMIUM_FLAGS := "${QTWEBENGINE_CHROMIUM_FLAGS} --disable-seccomp-filter-sandbox" run-statusq-tests: statusq-tests echo -e "\033[92mRunning:\033[39m StatusQ Unit Tests" ctest -V --test-dir $(STATUSQ_BUILD_PATH) ${ARGS} diff --git a/storybook/main.cpp b/storybook/main.cpp index 6ff6eca305..5eddacf792 100644 --- a/storybook/main.cpp +++ b/storybook/main.cpp @@ -40,7 +40,11 @@ int main(int argc, char *argv[]) QGuiApplication::setApplicationName(QStringLiteral("Status Desktop Storybook")); qputenv("QT_QUICK_CONTROLS_HOVER_ENABLED", QByteArrayLiteral("1")); - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", QByteArrayLiteral("--disable-seccomp-filter-sandbox")); + auto chromiumFlags = qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"); + if(!chromiumFlags.contains("--disable-seccomp-filter-sandbox")) { + chromiumFlags +=" --disable-seccomp-filter-sandbox"; + } + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromiumFlags); QQmlApplicationEngine engine; diff --git a/ui/StatusQ/tests/TestComponents/tst_WebEngineLoader.qml b/ui/StatusQ/tests/TestComponents/tst_WebEngineLoader.qml index b14c1126b7..8555df8805 100644 --- a/ui/StatusQ/tests/TestComponents/tst_WebEngineLoader.qml +++ b/ui/StatusQ/tests/TestComponents/tst_WebEngineLoader.qml @@ -72,9 +72,6 @@ TestCase { webEngineLoadedSpy.wait(1000) verify(webEngine.instance !== null , "The WebEngineView should be available") - if (Qt.platform.os === "linux") { - skip("fails to load page on linux") - } pageLoadedSpy.wait(1000) webEngine.active = false engineUnloadedSpy.wait(1000); @@ -85,10 +82,6 @@ TestCase { SignalSpy { id: wcInitOkSpy; target: testObject; signalName: "webChannelInitOk" } SignalSpy { id: wcInitErrorSpy; target: testObject; signalName: "webChannelError" } function test_executeCode() { - if (Qt.platform.os === "linux") { - skip("fails to load page on linux") - } - const webEngine = loader.item webEngine.active = true pageLoadedSpy.wait(1000);