status-desktop/libs/Onboarding/tests/qml_tests/tst_OnboardingController.qml
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

87 lines
1.9 KiB
QML

import QtQuick
import QtQml
import QtTest
import Status.Onboarding
import Status.TestHelpers
/**!
* \todo use mocked values
*/
Item {
id: root
width: 400
height: 300
Component {
id: onboardingDepsComponent
Item {
OnboardingModule {
id: module
userDataPath: "/tmp/StatusTests/demo"
}
// TODO: fix error "unable to assign Status::Onboarding::OnboardingController to Status::Onboarding::OnboardingController" then enable typed properties
readonly property var /*OnboardingController*/ controller: module.controller
readonly property var /*UserAccountsModel*/ accounts: controller.accounts
}
}
Loader {
id: testLoader
anchors.fill: parent
active: false
}
TestCase {
id: qmlWarningsTest
name: "TestQmlWarnings"
when: windowShown
//
// Test guards
function init() {
qtOuput.restartCapturing()
}
function cleanup() {
testLoader.active = false
}
//
// Tests
function test_moduleInitialization() {
testLoader.sourceComponent = onboardingDepsComponent
testLoader.active = true
verify(waitForRendering(testLoader.item))
testLoader.active = false
verify(qtOuput.qtOuput().length === 0, `No output expected. Found:\n"${qtOuput.qtOuput()}"\n`)
}
}
// TestCase {
// id: qmlBenchmarks
// name: "QmlBenchmarks"
// function benchmark_loadAndUnloadModule() {
// skip("Enable benchmarking after integrating it with reporting in CI")
// testLoader.sourceComponent = onboardingDepsComponent
// testLoader.active = true
// testLoader.active = false
// }
// }
MonitorQtOutput {
id: qtOuput
}
}