Use timeout factor also when waiting for GUI startup

This commit is contained in:
Martchus 2018-10-20 22:26:53 +02:00
parent 0e836e939b
commit a2dd7a7e7e
1 changed files with 4 additions and 3 deletions

View File

@ -100,13 +100,14 @@ void ApplicationTests::test()
QByteArray syncthingOutput;
do {
// wait for output
const auto timeout = static_cast<int>(15000 * TestUtilities::timeoutFactor);
if (!syncthingProcess().bytesAvailable()) {
// fail when already waiting for over 15 seconds
const auto waitingTime(DateTime::gmtNow() - m_startTime);
if (waitingTime.seconds() > 15) {
CPPUNIT_FAIL("Syncthing needs longer than 15 seconds to become available.");
if (waitingTime.milliseconds() > timeout) {
CPPUNIT_FAIL(argsToString("Syncthing needs longer than ", (timeout / 1000), " seconds to become available."));
}
syncthingProcess().waitForReadyRead(15000 - waitingTime.milliseconds());
syncthingProcess().waitForReadyRead(timeout - waitingTime.milliseconds());
}
syncthingOutput.append(syncthingProcess().readAll());
} while (!syncthingOutput.contains("Access the GUI via the following URL"));