status-desktop/test/libs/StatusGoQt/test_messaging.cpp
Stefan a710558c6b chore(CPP): foundation for user onboarding
Contains minimal account creation and login

Considerations:

- migrated status-go wrapper and login code from the fix/cpp-structure (241eec)
- Minimal refactoring and changes at the moment. Expect further refactoring
follow up to reach the desired state.
- Fix missing keychain initialization
- Fix accounts DB initialization call done by startup -> Controller.openedAccounts -> status-go.OpenAccounts calls
- Small refactoring and todos for other steps
- fix SignalsManager
- fix async access to dereferenced status-go memory from SignalsManager
- fix SignalsManager not starting when registering
- finish dev end to end test for create account and login
- small improvements and added TODOs for future work
- add onboarding test helpers and start messaging test
- Refactoring towards Login UI integration

Closes: #5909
Closes: #6028
2022-07-07 23:23:09 +02:00

43 lines
1.2 KiB
C++

#include <StatusGo/Messenger/Service.h>
#include <Onboarding/Accounts/AccountsService.h>
#include <StatusGo/SignalsManager.h>
#include <ScopedTestAccount.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
namespace fs = std::filesystem;
namespace Status::Testing {
/// This is an integration test to check that status-go doesn't crash on apple silicon when starting Me
/// \warning the test depends on IO and it is not deterministic, fast, focused or reliable. It is here for validation only
/// \todo fin a way to test the integration within a test environment. Also how about reusing an existing account
TEST(OnboardingModule, TestStartMessaging)
{
bool nodeReady = false;
QObject::connect(StatusGo::SignalsManager::instance(), &StatusGo::SignalsManager::nodeReady, [&nodeReady](const QString& error) {
if(error.isEmpty()) {
if(nodeReady) {
nodeReady = false;
} else
nodeReady = true;
}
});
ScopedTestAccount testAccount(test_info_->name());
ASSERT_TRUE(StatusGo::Messenger::startMessenger());
testAccount.processMessages(1000, [nodeReady]() {
return !nodeReady;
});
ASSERT_TRUE(nodeReady);
}
} // namespace