From 806d686f9cc6212fda118ce43e4d1574cc587dfd Mon Sep 17 00:00:00 2001 From: Anastasiya S Date: Fri, 22 Oct 2021 13:29:39 +0300 Subject: [PATCH] chore(tst_get_started_modal.qml): add tests --- base/LegacyModalsHelpers.qml | 16 ++++++++-------- tst_get_started_modal.qml | 36 +++++++++++++++++++++--------------- ui-tests.pro | 3 ++- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/base/LegacyModalsHelpers.qml b/base/LegacyModalsHelpers.qml index a58c35a..f36f8a2 100644 --- a/base/LegacyModalsHelpers.qml +++ b/base/LegacyModalsHelpers.qml @@ -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() { diff --git a/tst_get_started_modal.qml b/tst_get_started_modal.qml index 8fcc4e7..86d2995 100644 --- a/tst_get_started_modal.qml +++ b/tst_get_started_modal.qml @@ -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() } +} + diff --git a/ui-tests.pro b/ui-tests.pro index 04cb007..1200d73 100644 --- a/ui-tests.pro +++ b/ui-tests.pro @@ -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