chore(tst_get_started_modal.qml): add tests

This commit is contained in:
Anastasiya S 2021-10-22 13:29:39 +03:00
parent 0da479783a
commit 806d686f9c
3 changed files with 31 additions and 24 deletions

View File

@ -1,11 +1,13 @@
import QtQuick 2.14 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 { QtObject {
id: root id: root
property Shared.ModalPopup target: null property SharedPopups.ModalPopup target: null
property var header property var header
property var contentItem property var contentItem
@ -13,10 +15,9 @@ QtObject {
property Helpers __helpers: Helpers {} property Helpers __helpers: Helpers {}
Component { property var headerComp: Component {
id: headerComp
QtObject { QtObject {
property Shared.StyledText title: null property SharedPanels.StyledText title: null
property var closeButton: null property var closeButton: null
} }
} }
@ -37,11 +38,10 @@ QtObject {
return null return null
} }
Component { property var cbComponent: Component {
id: cbComponent
QtObject { QtObject {
property Rectangle background: null property Rectangle background: null
property Shared.SVGImage icon: null property SharedPanels.SVGImage icon: null
property MouseArea sensor: null property MouseArea sensor: null
function click() { function click() {

View File

@ -5,26 +5,19 @@ import QtTest 1.14
import "base" import "base"
import "status-desktop/ui/app/AppLayouts/Onboarding/popups" as DesktopComponents import "status-desktop/ui/app/AppLayouts/Onboarding/popups" as DesktopComponents
WindowTestCase { WindowTestCase {
name: "GetStartedModal" name: "GetStartedModal tests"
when: windowShown
Helpers { id: helpers } LegacyModalsHelpers { id: legacyHelpers }
ChatsModelData {
id: chatsModel
}
Component { Component {
id: popupComponent id: popupComponent
DesktopComponents.BeforeGetStartedModal { DesktopComponents.BeforeGetStartedModal {
id: beforeGetStartedModal id: beforeGetStartedModal
}
} }
}
function test_case1_BeforeGetStartedModal_height_width() { 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) var beforeGetStartedModal = popupComponent.createObject(window)
beforeGetStartedModal.open() beforeGetStartedModal.open()
beforeGetStartedModal.title = "Before you get started ..." beforeGetStartedModal.title = "Before you get started ..."
wait(2000) wait(2000)
var getStartedButtonExists = helpers.checkIfItemExists(beforeGetStartedModal, 340, 260) var getStartedButton = legacyHelpers.findInContent("getStartedStatusButton")
verify(getStartedButtonExists, true) mouseClick(getStartedButton, 2, 2, Qt.LeftButton)
verify(getStartedButton.enabled = false, "Get Started Button is enabled")
beforeGetStartedModal.destroy() 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 += $$
DISTFILES += $$files("$$PWD/*.qml", true) DISTFILES += $$files("$$PWD/*.qml", true) \
tst_statusChatListCategoryItemButton.qml
QML_IMPORT_PATH += status-desktop/ui/StatusQ/src QML_IMPORT_PATH += status-desktop/ui/StatusQ/src