Add test for qr code opening in ProfilePopup
This commit is contained in:
parent
707adb46a4
commit
3c12e8b242
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
Subproject commit b6a6e220f732ca8c1a16d7bb69d6993c45d7a491
|
|
@ -0,0 +1,6 @@
|
|||
#include <QtQuickTest/quicktest.h>
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
QUICK_TEST_MAIN_WITH_SETUP(ui-tests, Setup)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#include "setup.h"
|
||||
|
||||
Setup::Setup(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef SETUP_H
|
||||
#define SETUP_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#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
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 4b73d6849025c8272c3fc882855f73a0d113ced6
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -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
|
Loading…
Reference in New Issue