diff --git a/test/ui-test/src/screens/StatusChatScreen.py b/test/ui-test/src/screens/StatusChatScreen.py index 897770e6ae..d1ac75b05b 100644 --- a/test/ui-test/src/screens/StatusChatScreen.py +++ b/test/ui-test/src/screens/StatusChatScreen.py @@ -1,7 +1,37 @@ +# ****************************************************************************** +# Status.im +# *****************************************************************************/ +# /** +# * \file StatusChatScreen.py +# * +# * \date June 2022 +# * \brief Chat Main Screen. +# *****************************************************************************/ + + +from enum import Enum +from drivers.SquishDriver import * +from drivers.SquishDriverVerification import * + + +class ChatComponents(Enum): + StatusIcon = "statusIcon_StatusIcon_2" + PUBLIC_CHAT_ICON = "mainWindow_dropRectangle_Rectangle" + JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate" + +class ChatNamePopUp(Enum): + CHAT_NAME_TEXT = "chat_name_PlaceholderText" + class StatusChatScreen: - + def __init__(self): - pass - + verify_screen_is_loaded(MainScreenComponents.SEARCH_TEXT_FIELD.value) + + + def joinChatRoom(self, room): + click_obj_by_name(MainScreenComponents.PUBLIC_CHAT_ICON.value) + click_obj_by_name(MainScreenComponents.JOIN_PUBLIC_CHAT.value) + type(ChatNamePopUp.CHAT_NAME_TEXT.value, room) + diff --git a/test/ui-test/src/screens/StatusMainScreen.py b/test/ui-test/src/screens/StatusMainScreen.py new file mode 100644 index 0000000000..d721efd5a2 --- /dev/null +++ b/test/ui-test/src/screens/StatusMainScreen.py @@ -0,0 +1,39 @@ +# ****************************************************************************** +# Status.im +# *****************************************************************************/ +# /** +# * \file StatusMainScreen.py +# * +# * \date June 2022 +# * \brief Home Screen. +# *****************************************************************************/ + + +from enum import Enum +from drivers.SquishDriver import * +from drivers.SquishDriverVerification import * + + +class MainScreenComponents(Enum): + SEARCH_TEXT_FIELD = "mainWindow_edit_TextEdit" + PUBLIC_CHAT_ICON = "mainWindow_dropRectangle_Rectangle" + JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate" + +class ChatNamePopUp(Enum): + CHAT_NAME_TEXT = "chat_name_PlaceholderText" + INPUT_ROOM_TOPIC_TEXT = "inputValue_StyledTextField" + + + +class StatusMainScreen: + + def __init__(self): + verify_screen_is_loaded(MainScreenComponents.SEARCH_TEXT_FIELD.value) + + + def joinChatRoom(self, room): + click_obj_by_name(MainScreenComponents.PUBLIC_CHAT_ICON.value) + click_obj_by_name(MainScreenComponents.JOIN_PUBLIC_CHAT.value) + type(ChatNamePopUp.INPUT_ROOM_TOPIC_TEXT.value, room) + #type(ChatNamePopUp.CHAT_NAME_TEXT.value, room) + diff --git a/test/ui-test/src/screens/StatusWelcomeScreen.py b/test/ui-test/src/screens/StatusWelcomeScreen.py index 23a8e58d6e..5424d646f0 100644 --- a/test/ui-test/src/screens/StatusWelcomeScreen.py +++ b/test/ui-test/src/screens/StatusWelcomeScreen.py @@ -7,12 +7,14 @@ # * \date May 2022 # * \brief Sign Up and Login for new users to the app. # *****************************************************************************/ + from enum import Enum from drivers.SquishDriver import * from drivers.SquishDriverVerification import * class AgreementPopUp(Enum): + OK_GOT_IT_BUTTON = "mainWindow_Ok_got_it_StatusBaseText" ACKNOWLEDGE_CHECKBOX = "acknowledge_checkbox" TERMS_OF_USE_CHECK_BOX = "termsOfUseCheckBox_StatusCheckBox" GET_STARTED_BUTTON = "getStartedStatusButton_StatusButton" @@ -37,9 +39,10 @@ class SignUpComponents(Enum): class StatusWelcomeScreen: def __init__(self): - verify_screen_is_loaded(AgreementPopUp.ACKNOWLEDGE_CHECKBOX.value) + verify_screen_is_loaded(AgreementPopUp.OK_GOT_IT_BUTTON.value) def agree_terms_conditions_and_generate_new_key(self): + click_obj_by_name(AgreementPopUp.OK_GOT_IT_BUTTON.value) click_obj_by_name(AgreementPopUp.ACKNOWLEDGE_CHECKBOX.value) check_obj_by_name(AgreementPopUp.TERMS_OF_USE_CHECK_BOX.value) click_obj_by_name(AgreementPopUp.GET_STARTED_BUTTON.value) diff --git a/test/ui-test/testSuites/suite_status/shared/scripts/names.py b/test/ui-test/testSuites/suite_status/shared/scripts/names.py index f269231a0d..62c3de8b45 100644 --- a/test/ui-test/testSuites/suite_status/shared/scripts/names.py +++ b/test/ui-test/testSuites/suite_status/shared/scripts/names.py @@ -38,3 +38,19 @@ mainWindow_Passwords_don_t_match_StatusBaseText = {"container": statusDesktop_ma mainWindow_inputRectangle_Rectangle = {"container": statusDesktop_mainWindow, "id": "inputRectangle", "occurrence": 2, "type": "Rectangle", "unnamed": 1, "visible": True} mainWindow_inputRectangle_Rectangle_2 = {"container": statusDesktop_mainWindow, "id": "inputRectangle", "type": "Rectangle", "unnamed": 1, "visible": True} mainWindow_You_will_not_be_able_to_recover_this_password_if_it_is_lost_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "You will not be able to recover this password if it is lost.", "type": "StatusBaseText", "unnamed": 1, "visible": True} +mainWindow_Ok_got_it_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Ok, got it", "type": "StatusBaseText", "unnamed": 1, "visible": True} +mainWindow_background_Rectangle = {"container": statusDesktop_mainWindow, "id": "background", "type": "Rectangle", "unnamed": 1, "visible": True} +o_Rectangle = {"container": statusDesktop_mainWindow_overlay, "occurrence": 2, "type": "Rectangle", "unnamed": 1, "visible": True} +edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} +background_Rectangle = {"container": statusDesktop_mainWindow_overlay, "id": "background", "type": "Rectangle", "unnamed": 1, "visible": True} +statusIcon_StatusIcon = {"container": statusDesktop_mainWindow_overlay, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/clear.svg", "type": "StatusIcon", "unnamed": 1, "visible": True} +statusIcon_StatusIcon_2 = {"container": statusDesktop_mainWindow_overlay, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/close.svg", "type": "StatusIcon", "unnamed": 1, "visible": True} +o_Rectangle_2 = {"container": statusDesktop_mainWindow_overlay, "type": "Rectangle", "unnamed": 1, "visible": True} +mainWindow_statusIcon_StatusIcon = {"container": statusDesktop_mainWindow, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/arrow-right.svg", "type": "StatusIcon", "unnamed": 1, "visible": True} +join_public_chat_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "text": "Join public chat", "type": "StatusMenuItemDelegate", "unnamed": 1, "visible": True} +chat_name_PlaceholderText = {"container": statusDesktop_mainWindow_overlay, "text": "chat-name", "type": "PlaceholderText", "unnamed": 1, "visible": True} +inputValue_StyledTextField = {"container": statusDesktop_mainWindow_overlay, "echoMode": 0, "id": "inputValue", "type": "StyledTextField", "unnamed": 1, "visible": True} +start_chat_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "text": "Start chat", "type": "StatusBaseText", "unnamed": 1, "visible": True} +mainWindow_scrollView_ScrollView = {"container": statusDesktop_mainWindow, "id": "scrollView", "type": "ScrollView", "unnamed": 1, "visible": True} +scrollView_messageInputField_TextArea = {"container": mainWindow_scrollView_ScrollView, "id": "messageInputField", "type": "TextArea", "unnamed": 1, "visible": True} +reactionImage_SVGImage = {"container": statusDesktop_mainWindow_overlay, "id": "reactionImage", "source": "qrc:/imports/assets/icons/emojiReactions/heart.svg", "type": "SVGImage", "unnamed": 1, "visible": True} diff --git a/test/ui-test/testSuites/suite_status/shared/steps/chatSteps.py b/test/ui-test/testSuites/suite_status/shared/steps/chatSteps.py new file mode 100644 index 0000000000..12ae276db5 --- /dev/null +++ b/test/ui-test/testSuites/suite_status/shared/steps/chatSteps.py @@ -0,0 +1,14 @@ + +from screens.StatusMainScreen import StatusMainScreen + +_statusMain = StatusMainScreen() + + +@When("user joins chat room |any|") +def step(context, room): + _statusMain.joinChatRoom(room) + + +@Then("user is able to send chat message |any|") +def step(context, message): + StatusMainScreen() \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py b/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py index c3302829e5..d51efd67ad 100644 --- a/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py +++ b/test/ui-test/testSuites/suite_status/shared/steps/signUpSteps.py @@ -1,6 +1,6 @@ from screens.StatusWelcomeScreen import StatusWelcomeScreen -from screens.StatusChatScreen import StatusChatScreen +from screens.StatusMainScreen import StatusMainScreen _welcomeScreen = StatusWelcomeScreen() @@ -22,4 +22,4 @@ def step(context, username): @Then("the user lands on the signed in app") def step(context): - StatusChatScreen() \ No newline at end of file + StatusMainScreen() \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_status/suite.conf b/test/ui-test/testSuites/suite_status/suite.conf index 31c1a54bef..ae4f99a443 100644 --- a/test/ui-test/testSuites/suite_status/suite.conf +++ b/test/ui-test/testSuites/suite_status/suite.conf @@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_statusLoginPassword +TEST_CASES=tst_statusLoginPassword tst_basicChatFlow VERSION=3 WRAPPERS=Qt diff --git a/test/ui-test/testSuites/suite_status/tst_ChatFlow/test.feature b/test/ui-test/testSuites/suite_status/tst_ChatFlow/test.feature new file mode 100644 index 0000000000..149fff9a2a --- /dev/null +++ b/test/ui-test/testSuites/suite_status/tst_ChatFlow/test.feature @@ -0,0 +1,18 @@ +# This is a sample .feature file +# Squish feature files use the Gherkin language for describing features, a short example +# is given below. You can find a more extensive introduction to the Gherkin format at +# https://cucumber.io/docs/gherkin/reference/ +Feature: Status Desktop Chat + + As a user I want to join a room and chat. + + The following scenarios cover basic chat flows. + + Background: + Given A first time user lands on the status desktop and generates new key + When user inputs username tester123 and password TesTEr16843/!@00 + Then the user lands on the signed in app + + Scenario: User joins a room and chats + When user joins chat room test + Then user is able to send chat message Hello diff --git a/test/ui-test/testSuites/suite_status/tst_ChatFlow/test.py b/test/ui-test/testSuites/suite_status/tst_ChatFlow/test.py new file mode 100644 index 0000000000..48d4d5c01c --- /dev/null +++ b/test/ui-test/testSuites/suite_status/tst_ChatFlow/test.py @@ -0,0 +1,8 @@ +source(findFile('scripts', 'python/bdd.py')) + +setupHooks('../shared/scripts/bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps', '../shared/chatSteps') + +def main(): + testSettings.throwOnFailure = True + runFeatureFile('test.feature') diff --git a/test/ui-test/testSuites/suite_status/tst_case1/test.py b/test/ui-test/testSuites/suite_status/tst_case1/test.py new file mode 100644 index 0000000000..18630346fd --- /dev/null +++ b/test/ui-test/testSuites/suite_status/tst_case1/test.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import names + + +def main(): + startApplication("nim_status_client") + type(waitForObject(names.loginView_passwordInput), "Tester111//") + type(waitForObject(names.loginView_passwordInput), "") + type(waitForObject(names.loginView_passwordInput), "Tester111//") + type(waitForObject(names.loginView_passwordInput), "") + mouseClick(waitForObject(names.mainWindow_Enter_password_PlaceholderText), Qt.ShiftModifier, Qt.LeftButton) + type(waitForObject(names.loginView_passwordInput), "") + mouseClick(waitForObject(names.mainWindow_dropRectangle_Rectangle), 309, 75, Qt.ShiftModifier + Qt.ControlModifier, Qt.LeftButton) + mouseClick(waitForObject(names.join_public_chat_StatusMenuItemDelegate), 45, 11, Qt.ShiftModifier + Qt.ControlModifier, Qt.LeftButton) + type(waitForObject(names.inputValue_StyledTextField), "test") + mouseClick(waitForObject(names.start_chat_StatusBaseText), Qt.ShiftModifier + Qt.ControlModifier, Qt.LeftButton) + mouseClick(waitForObject(names.mainWindow_dropRectangle_Rectangle), 144, 69, Qt.ShiftModifier + Qt.ControlModifier, Qt.LeftButton) + type(waitForObject(names.edit_TextEdit), "test")