Merge pull request #32 from status-im/getstartedmodal_tst_refactor

Getstartedmodal tst refactor
This commit is contained in:
Boris Melnik 2021-10-25 12:35:38 +03:00 committed by GitHub
commit 2b523bbb2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 24 deletions

View File

@ -1,11 +1,13 @@
import QtQuick 2.14
import "../status-desktop/ui/shared" as Shared
import "../status-desktop/ui/shared/popups" as SharedPopups
import "../status-desktop/ui/shared/panels" as SharedPanels
QtObject {
id: root
property Shared.ModalPopup target: null
property SharedPopups.ModalPopup target: null
property var header
property var contentItem
@ -13,10 +15,9 @@ QtObject {
property Helpers __helpers: Helpers {}
Component {
id: headerComp
property var headerComp: Component {
QtObject {
property Shared.StyledText title: null
property SharedPanels.StyledText title: null
property var closeButton: null
}
}
@ -37,11 +38,10 @@ QtObject {
return null
}
Component {
id: cbComponent
property var cbComponent: Component {
QtObject {
property Rectangle background: null
property Shared.SVGImage icon: null
property SharedPanels.SVGImage icon: null
property MouseArea sensor: null
function click() {

View File

@ -5,26 +5,19 @@ import QtTest 1.14
import "base"
import "status-desktop/ui/app/AppLayouts/Onboarding/popups" as DesktopComponents
WindowTestCase {
name: "GetStartedModal"
when: windowShown
name: "GetStartedModal tests"
Helpers { id: helpers }
ChatsModelData {
id: chatsModel
}
LegacyModalsHelpers { id: legacyHelpers }
Component {
id: popupComponent
DesktopComponents.BeforeGetStartedModal {
id: beforeGetStartedModal
}
}
}
function test_case1_BeforeGetStartedModal_height_width() {
@ -38,19 +31,32 @@ WindowTestCase {
}
function test_case2_BeforeGetStartedModal_button() {
function test_case2_BeforeGetStartedModal_button_disabled() {
var beforeGetStartedModal = popupComponent.createObject(window)
beforeGetStartedModal.open()
beforeGetStartedModal.title = "Before you get started ..."
wait(2000)
var getStartedButtonExists = helpers.checkIfItemExists(beforeGetStartedModal, 340, 260)
verify(getStartedButtonExists, true)
var getStartedButton = legacyHelpers.findInContent("getStartedStatusButton")
mouseClick(getStartedButton, 2, 2, Qt.LeftButton)
verify(getStartedButton.enabled = false, "Get Started Button is enabled")
beforeGetStartedModal.destroy()
}
function test_case3_BeforeGetStartedModal_button_enabled() {
var beforeGetStartedModal = popupComponent.createObject(window)
beforeGetStartedModal.open()
wait(2000)
var acknowledgeCheckBox = legacyHelpers.findInContent("acknowledgeCheckBox")
mouseClick(acknowledgeCheckBox, 2, 2, Qt.LeftButton)
var termsOfUseCheckBox = legacyHelpers.findInContent("termsOfUseCheckBox")
mouseClick(termsOfUseCheckBox, 2, 2, Qt.LeftButton)
var getStartedButton = legacyHelpers.findInContent("getStartedStatusButton")
verify(getStartedButton.enabled = false, "Get Started Button is enabled")
mouseClick(getStartedButton, 2, 2, Qt.LeftButton)
beforeGetStartedModal.destroy()
}
}

View File

@ -8,7 +8,8 @@ DEFINES += PROJECT_PATH=\"$${PWD}\"
#DISTFILES += $$
DISTFILES += $$files("$$PWD/*.qml", true)
DISTFILES += $$files("$$PWD/*.qml", true) \
tst_statusChatListCategoryItemButton.qml
QML_IMPORT_PATH += status-desktop/ui/StatusQ/src