diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a2abc31 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "StatusQ"] + path = StatusQ + url = https://github.com/status-im/StatusQ +[submodule "status-desktop"] + path = status-desktop + url = https://github.com/status-im/status-desktop.git diff --git a/StatusQ b/StatusQ new file mode 160000 index 0000000..b6a6e22 --- /dev/null +++ b/StatusQ @@ -0,0 +1 @@ +Subproject commit b6a6e220f732ca8c1a16d7bb69d6993c45d7a491 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..b103109 --- /dev/null +++ b/main.cpp @@ -0,0 +1,6 @@ +#include + +#include "setup.h" + +QUICK_TEST_MAIN_WITH_SETUP(ui-tests, Setup) + diff --git a/setup.cpp b/setup.cpp new file mode 100644 index 0000000..b58d961 --- /dev/null +++ b/setup.cpp @@ -0,0 +1,6 @@ +#include "setup.h" + +Setup::Setup(QObject *parent) : QObject(parent) +{ + +} diff --git a/setup.h b/setup.h new file mode 100644 index 0000000..1221bc9 --- /dev/null +++ b/setup.h @@ -0,0 +1,32 @@ +#ifndef SETUP_H +#define SETUP_H + +#include +#include +#include + +#include + +#define STR(x) #x + +#ifdef PROJECT_PATH +#define PWD(x) STR(x) +#endif + +class Setup : public QObject +{ + Q_OBJECT +public: + explicit Setup(QObject *parent = nullptr); + +public slots: + void qmlEngineAvailable(QQmlEngine *engine) + { + engine->rootContext()->setContextProperty("myContextProperty", QVariant(true)); + qDebug() << "StatusQ Path: " << QString(PWD(PROJECT_PATH)); + engine->addImportPath(QString(PWD(PROJECT_PATH)) + "/StatusQ/src"); + engine->addImportPath(QString(PWD(PROJECT_PATH)) + "/status-desktop/ui/imports"); + } +}; + +#endif // SETUP_H diff --git a/status-desktop b/status-desktop new file mode 160000 index 0000000..4b73d68 --- /dev/null +++ b/status-desktop @@ -0,0 +1 @@ +Subproject commit 4b73d6849025c8272c3fc882855f73a0d113ced6 diff --git a/tst_Modals.qml b/tst_Modals.qml new file mode 100644 index 0000000..1815fe1 --- /dev/null +++ b/tst_Modals.qml @@ -0,0 +1,82 @@ +import QtQuick 2.14 +import QtQuick.Window 2.14 +import QtTest 1.14 + +import "status-desktop/ui/app/AppLayouts/Chat/components" as DesktopComponents + + +TestCase { + name: "ProfilePopup" + when: windowShown + + /// TODO: add good test data + QtObject { + id: chatsModel + property var ensView: QtObject { + function isEnsVerified(author) { + return true; + } + } + + function alias(author) { + return "some alias" + } + } + + QtObject { + id: profileModel + property var contacts: QtObject { + function isContactBlocked(author) { + return false; + } + + function isAdded(author) { + return true + } + } + + property var profile: QtObject { + property string pubKey: "Some author" + } + + function qrCode(author) { + return "" + } + } + + Window { + id: tstWindow + width: 800 + height: 600 + DesktopComponents.ProfilePopup { + id: propfilePopup + } + } + /////// + + function initTestCase() { + tstWindow.show() + } + + function cleanupTestCase() { + + } + + function test_case1() { + propfilePopup.openPopup(true, "Test user", "Some author", "", "bla bla test it bitch", "Nickname") + wait(2000) // for show how its works + print(propfilePopup.contentItem, propfilePopup.width - 65) + mouseClick(propfilePopup.background, propfilePopup.width - 65, 20, Qt.LeftButton) + wait(2000) // for show how its works + verify(propfilePopup.contentItem.qrCodePopup.visible, "Qr code should be visible") + propfilePopup.contentItem.qrCodePopup.close() + verify(!propfilePopup.contentItem.qrCodePopup.visible, "Qr code should be visible") + } + + function test_case2() { + mouseClick(propfilePopup.background, propfilePopup.width - 25, 20, Qt.LeftButton) + wait(2000) + verify(!propfilePopup.visible, "Profile popup should be invisible") + } +} + diff --git a/tst_initialtest.qml b/tst_initialtest.qml new file mode 100644 index 0000000..c7cd4a7 --- /dev/null +++ b/tst_initialtest.qml @@ -0,0 +1,18 @@ +import QtQuick 2.14 +import QtTest 1.14 + +import StatusQ.Core.Theme 0.1 + +TestCase { + name: "initialTest" + + function initTestCase() { + } + + function cleanupTestCase() { + } + + function test_case1() { + verify(!!Theme.palette, "Theme available"); + } +} diff --git a/ui-tests.pro b/ui-tests.pro new file mode 100644 index 0000000..f8c983d --- /dev/null +++ b/ui-tests.pro @@ -0,0 +1,21 @@ +CONFIG += warn_on qmltestcase + +TEMPLATE = app + +DESTDIR += $${PWD}/bin + +DEFINES += PROJECT_PATH=\"$${PWD}\" + +DISTFILES += \ + tst_Modals.qml \ + tst_initialtest.qml + +DISTFILES += $$files("StatusQ/src/*", true) +DISTFILES += $$files("status-desktop/ui/app/*", true) + +SOURCES += \ + main.cpp \ + setup.cpp + +HEADERS += \ + setup.h