From: Claudio Cambra Date: Fri, 21 Oct 2022 16:25:32 +0000 (+0200) Subject: Add a test to check e2e server test setup X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~122^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=55cd79f4ef0f7b407b7ecac56148a534fec96fe5;p=nextcloud-desktop.git Add a test to check e2e server test setup Signed-off-by: Claudio Cambra --- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index cf6599d2b..ecf846513 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -70,6 +70,10 @@ nextcloud_add_test(ShareModel) nextcloud_add_test(ShareeModel) nextcloud_add_test(SortedShareModel) +if(BUILD_E2E_TESTS) + nextcloud_add_test(E2eServerSetup) +endif() + if( UNIX AND NOT APPLE ) nextcloud_add_test(InotifyWatcher) endif(UNIX AND NOT APPLE) diff --git a/test/teste2eserversetup.cpp b/test/teste2eserversetup.cpp new file mode 100644 index 000000000..64ad6da34 --- /dev/null +++ b/test/teste2eserversetup.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) by Claudio Cambra + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include +#include +#include + +#include "gui/accountstate.h" + +#include "endtoendtestutils.h" + +class E2eServerSetupTest : public QObject +{ + Q_OBJECT + +public: + E2eServerSetupTest() = default; + +private: + EndToEndTestHelper _helper; + +private slots: + void initTestCase() + { + QSignalSpy accountReady(&_helper, &EndToEndTestHelper::accountReady); + _helper.startAccountConfig(); + QVERIFY(accountReady.wait(3000)); + + const auto accountState = _helper.accountState(); + QSignalSpy accountConnected(accountState.data(), &OCC::AccountState::isConnectedChanged); + QVERIFY(accountConnected.wait(30000)); + } + + void testBasicPropfind() + { + const auto account = _helper.account(); + auto job = new OCC::PropfindJob(account, "/", this); + QSignalSpy result(job, &OCC::PropfindJob::result); + + job->setProperties(QList() << "getlastmodified"); + job->start(); + + QVERIFY(result.wait(10000)); + } +}; + +QTEST_MAIN(E2eServerSetupTest) +#include "teste2eserversetup.moc"