Allow overriding timeout of wizard's setup detection and log during test

This commit is contained in:
Martchus 2023-01-11 19:38:50 +01:00
parent c81bb178a7
commit f04c482538
2 changed files with 7 additions and 2 deletions

View File

@ -33,7 +33,9 @@ SetupDetection::SetupDetection(QObject *parent)
launcher.setEmittingOutput(true);
// configure timeout
timeout.setInterval(2500);
auto hasConfiguredTimeout = false;
auto configuredTimeout = qEnvironmentVariableIntValue(PROJECT_VARNAME_UPPER "_WIZARD_SETUP_DETECTION_TIMEOUT", &hasConfiguredTimeout);
timeout.setInterval(hasConfiguredTimeout ? configuredTimeout : 2500);
timeout.setSingleShot(true);
// connect signals & slots

View File

@ -6,6 +6,8 @@
// use meta-data of syncthingtray application here
#include "resources/../../tray/resources/config.h"
#include <c++utilities/conversion/stringbuilder.h>
#include <QtTest/QtTest>
#include <QApplication>
@ -195,7 +197,8 @@ void WizardTests::testConfiguringLauncher()
qDebug() << "launcher exit code: " << setupDetection.launcherExitCode.value();
}
// -> verify whether the launcher setup detection is in the expected state before checking UI itself
QVERIFY(!setupDetection.timedOut);
const auto timeoutStr = CppUtilities::argsToString("timeout of ", setupDetection.timeout.interval(), " ms not exceeded");
QVERIFY2(!setupDetection.timedOut, timeoutStr.data());
QVERIFY(setupDetection.launcherExitCode.has_value());
QCOMPARE(setupDetection.launcherExitCode.value(), 0);
QVERIFY(!setupDetection.launcherError.has_value());