desktop-ui-tests/tst_Modals.qml

86 lines
2.1 KiB
QML
Raw Normal View History

import QtQuick 2.14
import QtQuick.Window 2.14
import QtTest 1.14
2021-10-01 08:37:08 +00:00
import "base"
import "status-desktop/ui/app/AppLayouts/Chat/components" as DesktopComponents
TestCase {
name: "ProfilePopup"
when: windowShown
2021-10-01 08:37:08 +00:00
Helpers { id: helpers }
/// 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 {
2021-10-01 08:37:08 +00:00
id: window
width: 800
height: 600
DesktopComponents.ProfilePopup {
id: propfilePopup
}
}
///////
function initTestCase() {
2021-10-01 08:37:08 +00:00
window.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
mouseClick(propfilePopup.background, propfilePopup.width - 65, 20, Qt.LeftButton)
2021-10-01 08:37:08 +00:00
verify(helpers.checkIfItemExists(propfilePopup.background, propfilePopup.width - 65, 20, "StatusFlatRoundButton"))
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")
}
}