feat(@DesktopApp): Basic Chat Scenario (Squish Test)
Ticket: https://github.com/status-im/status-desktop/issues/5718 Include Basic chat Scenario
This commit is contained in:
parent
3c81a9dcfc
commit
304fe07214
|
@ -1,6 +1,6 @@
|
||||||
#******************************************************************************
|
# ******************************************************************************
|
||||||
# Status.im
|
# Status.im
|
||||||
#*****************************************************************************/
|
# *****************************************************************************/
|
||||||
# /**
|
# /**
|
||||||
# * \file SquishDriver.py
|
# * \file SquishDriver.py
|
||||||
# *
|
# *
|
||||||
|
@ -16,7 +16,6 @@ import object
|
||||||
import names
|
import names
|
||||||
import test
|
import test
|
||||||
|
|
||||||
|
|
||||||
# The default maximum timeout to find ui object
|
# The default maximum timeout to find ui object
|
||||||
_MAX_WAIT_OBJ_TIMEOUT = 5000
|
_MAX_WAIT_OBJ_TIMEOUT = 5000
|
||||||
|
|
||||||
|
@ -34,6 +33,7 @@ def is_loaded_visible_and_enabled(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT):
|
||||||
except LookupError:
|
except LookupError:
|
||||||
return False, obj
|
return False, obj
|
||||||
|
|
||||||
|
|
||||||
# Waits for the given object is loaded and might be not visible and/or not enabled:
|
# Waits for the given object is loaded and might be not visible and/or not enabled:
|
||||||
# It returns a tuple: True in case it is found. Otherwise, false. And the object itself.
|
# It returns a tuple: True in case it is found. Otherwise, false. And the object itself.
|
||||||
def is_loaded(objName):
|
def is_loaded(objName):
|
||||||
|
@ -44,10 +44,12 @@ def is_loaded(objName):
|
||||||
except LookupError:
|
except LookupError:
|
||||||
return False, obj
|
return False, obj
|
||||||
|
|
||||||
|
|
||||||
# It checks if the given object is visible and enabled.
|
# It checks if the given object is visible and enabled.
|
||||||
def is_visible_and_enabled(obj):
|
def is_visible_and_enabled(obj):
|
||||||
return obj.visible and obj.enabled
|
return obj.visible and obj.enabled
|
||||||
|
|
||||||
|
|
||||||
# Given a specific object, get a specific child.
|
# Given a specific object, get a specific child.
|
||||||
def get_child(obj, child_index=None):
|
def get_child(obj, child_index=None):
|
||||||
if None == child_index:
|
if None == child_index:
|
||||||
|
@ -55,6 +57,7 @@ def get_child(obj, child_index=None):
|
||||||
else:
|
else:
|
||||||
return object.children(obj)[child_index]
|
return object.children(obj)[child_index]
|
||||||
|
|
||||||
|
|
||||||
# It executes the click action into the given object:
|
# It executes the click action into the given object:
|
||||||
def click_obj(obj):
|
def click_obj(obj):
|
||||||
try:
|
try:
|
||||||
|
@ -63,6 +66,7 @@ def click_obj(obj):
|
||||||
except LookupError:
|
except LookupError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
# It executes the click action into object with given object name:
|
# It executes the click action into object with given object name:
|
||||||
def click_obj_by_name(objName):
|
def click_obj_by_name(objName):
|
||||||
try:
|
try:
|
||||||
|
@ -90,6 +94,7 @@ def is_text_matching(objName, text):
|
||||||
except LookupError:
|
except LookupError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
# It types the specified text into the given object (as if the user had used the keyboard):
|
# It types the specified text into the given object (as if the user had used the keyboard):
|
||||||
def type(objName, text):
|
def type(objName, text):
|
||||||
try:
|
try:
|
||||||
|
@ -98,3 +103,7 @@ def type(objName, text):
|
||||||
return True
|
return True
|
||||||
except LookupError:
|
except LookupError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def press_enter(objName):
|
||||||
|
type(objName, "<Return>")
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# * \file StatusChatScreen.py
|
# * \file StatusChatScreen.py
|
||||||
# *
|
# *
|
||||||
# * \date June 2022
|
# * \date June 2022
|
||||||
# * \brief Chat Main Screen.
|
# * \brief Chat Screen.
|
||||||
# *****************************************************************************/
|
# *****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,23 +15,17 @@ from drivers.SquishDriverVerification import *
|
||||||
|
|
||||||
|
|
||||||
class ChatComponents(Enum):
|
class ChatComponents(Enum):
|
||||||
StatusIcon = "statusIcon_StatusIcon_2"
|
TYPE_A_MESSAGE_PLACE_HOLDER = "scrollView_Type_a_message_PlaceholderText"
|
||||||
PUBLIC_CHAT_ICON = "mainWindow_dropRectangle_Rectangle"
|
MESSAGE_INPUT = "scrollView_messageInputField_TextArea"
|
||||||
JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate"
|
|
||||||
|
|
||||||
class ChatNamePopUp(Enum):
|
|
||||||
CHAT_NAME_TEXT = "chat_name_PlaceholderText"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class StatusChatScreen:
|
class StatusChatScreen:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
verify_screen_is_loaded(MainScreenComponents.SEARCH_TEXT_FIELD.value)
|
verify_screen_is_loaded(ChatComponents.TYPE_A_MESSAGE_PLACE_HOLDER.value)
|
||||||
|
|
||||||
|
|
||||||
def joinChatRoom(self, room):
|
def sendMessage(self, message):
|
||||||
click_obj_by_name(MainScreenComponents.PUBLIC_CHAT_ICON.value)
|
type(ChatComponents.MESSAGE_INPUT.value, message)
|
||||||
click_obj_by_name(MainScreenComponents.JOIN_PUBLIC_CHAT.value)
|
press_enter(ChatComponents.MESSAGE_INPUT.value)
|
||||||
type(ChatNamePopUp.CHAT_NAME_TEXT.value, room)
|
|
||||||
|
|
||||||
|
|
|
@ -15,25 +15,24 @@ from drivers.SquishDriverVerification import *
|
||||||
|
|
||||||
|
|
||||||
class MainScreenComponents(Enum):
|
class MainScreenComponents(Enum):
|
||||||
SEARCH_TEXT_FIELD = "mainWindow_edit_TextEdit"
|
STATUS_ICON = "mainWindow_statusIcon_StatusIcon_2"
|
||||||
PUBLIC_CHAT_ICON = "mainWindow_dropRectangle_Rectangle"
|
PUBLIC_CHAT_ICON = "mainWindow_dropRectangle_Rectangle"
|
||||||
JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate"
|
JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate"
|
||||||
|
|
||||||
|
|
||||||
class ChatNamePopUp(Enum):
|
class ChatNamePopUp(Enum):
|
||||||
CHAT_NAME_TEXT = "chat_name_PlaceholderText"
|
CHAT_NAME_TEXT = "chat_name_PlaceholderText"
|
||||||
INPUT_ROOM_TOPIC_TEXT = "inputValue_StyledTextField"
|
INPUT_ROOM_TOPIC_TEXT = "inputValue_StyledTextField"
|
||||||
|
START_CHAT = "start_chat_StatusBaseText"
|
||||||
|
|
||||||
|
|
||||||
class StatusMainScreen:
|
class StatusMainScreen:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
verify_screen_is_loaded(MainScreenComponents.SEARCH_TEXT_FIELD.value)
|
verify_screen_is_loaded(MainScreenComponents.STATUS_ICON.value)
|
||||||
|
|
||||||
|
|
||||||
def joinChatRoom(self, room):
|
def joinChatRoom(self, room):
|
||||||
click_obj_by_name(MainScreenComponents.PUBLIC_CHAT_ICON.value)
|
click_obj_by_name(MainScreenComponents.STATUS_ICON.value)
|
||||||
click_obj_by_name(MainScreenComponents.JOIN_PUBLIC_CHAT.value)
|
click_obj_by_name(MainScreenComponents.JOIN_PUBLIC_CHAT.value)
|
||||||
type(ChatNamePopUp.INPUT_ROOM_TOPIC_TEXT.value, room)
|
type(ChatNamePopUp.INPUT_ROOM_TOPIC_TEXT.value, room)
|
||||||
#type(ChatNamePopUp.CHAT_NAME_TEXT.value, room)
|
click_obj_by_name(ChatNamePopUp.START_CHAT.value)
|
||||||
|
|
||||||
|
|
|
@ -54,3 +54,5 @@ start_chat_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "tex
|
||||||
mainWindow_scrollView_ScrollView = {"container": statusDesktop_mainWindow, "id": "scrollView", "type": "ScrollView", "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}
|
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}
|
reactionImage_SVGImage = {"container": statusDesktop_mainWindow_overlay, "id": "reactionImage", "source": "qrc:/imports/assets/icons/emojiReactions/heart.svg", "type": "SVGImage", "unnamed": 1, "visible": True}
|
||||||
|
mainWindow_statusIcon_StatusIcon_2 = {"container": statusDesktop_mainWindow, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "unnamed": 1, "visible": True}
|
||||||
|
scrollView_Type_a_message_PlaceholderText = {"container": mainWindow_scrollView_ScrollView, "text": "Type a message.", "type": "PlaceholderText", "unnamed": 1, "visible": True}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
|
||||||
from screens.StatusMainScreen import StatusMainScreen
|
from screens.StatusMainScreen import StatusMainScreen
|
||||||
|
from screens.StatusChatScreen import StatusChatScreen
|
||||||
|
|
||||||
_statusMain = StatusMainScreen()
|
_statusMain = StatusMainScreen()
|
||||||
|
_statusChat = StatusChatScreen()
|
||||||
|
|
||||||
|
|
||||||
@When("user joins chat room |any|")
|
@When("user joins chat room |any|")
|
||||||
|
@ -9,6 +11,8 @@ def step(context, room):
|
||||||
_statusMain.joinChatRoom(room)
|
_statusMain.joinChatRoom(room)
|
||||||
|
|
||||||
|
|
||||||
@Then("user is able to send chat message |any|")
|
@Then("user is able to send chat message")
|
||||||
def step(context, message):
|
def step(context):
|
||||||
StatusMainScreen()
|
table = context.table
|
||||||
|
for row in table[1:]:
|
||||||
|
_statusChat.sendMessage(row[0])
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
from screens.StatusWelcomeScreen import StatusWelcomeScreen
|
from screens.StatusWelcomeScreen import StatusWelcomeScreen
|
||||||
from screens.StatusMainScreen import StatusMainScreen
|
from screens.StatusMainScreen import StatusMainScreen
|
||||||
|
|
||||||
_welcomeScreen = StatusWelcomeScreen()
|
_welcomeScreen = StatusWelcomeScreen()
|
||||||
|
|
||||||
|
|
||||||
@Given("A first time user lands on the status desktop and generates new key")
|
@Given("A first time user lands on the status desktop and generates new key")
|
||||||
def step(context):
|
def step(context):
|
||||||
_welcomeScreen.agree_terms_conditions_and_generate_new_key()
|
_welcomeScreen.agree_terms_conditions_and_generate_new_key()
|
||||||
|
@ -19,7 +19,6 @@ def step(context, username):
|
||||||
_welcomeScreen.input_username(username)
|
_welcomeScreen.input_username(username)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Then("the user lands on the signed in app")
|
@Then("the user lands on the signed in app")
|
||||||
def step(context):
|
def step(context):
|
||||||
StatusMainScreen()
|
StatusMainScreen()
|
|
@ -10,9 +10,14 @@ Feature: Status Desktop Chat
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given A first time user lands on the status desktop and generates new key
|
Given A first time user lands on the status desktop and generates new key
|
||||||
When user inputs username tester123 and password TesTEr16843/!@00
|
When user inputs username tester123 and password 'TesTEr16843/!@00'
|
||||||
Then the user lands on the signed in app
|
Then the user lands on the signed in app
|
||||||
|
|
||||||
Scenario: User joins a room and chats
|
Scenario: User joins a room and chats
|
||||||
When user joins chat room test
|
When user joins chat room test
|
||||||
Then user is able to send chat message Hello
|
Then user is able to send chat message
|
||||||
|
| message |
|
||||||
|
| Hello |
|
||||||
|
| How are you |
|
||||||
|
| I am from status |
|
||||||
|
| tell me how you do? |
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import names
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
startApplication("nim_status_client")
|
|
||||||
type(waitForObject(names.loginView_passwordInput), "Tester111//")
|
|
||||||
type(waitForObject(names.loginView_passwordInput), "<Return>")
|
|
||||||
type(waitForObject(names.loginView_passwordInput), "Tester111//")
|
|
||||||
type(waitForObject(names.loginView_passwordInput), "<Return>")
|
|
||||||
mouseClick(waitForObject(names.mainWindow_Enter_password_PlaceholderText), Qt.ShiftModifier, Qt.LeftButton)
|
|
||||||
type(waitForObject(names.loginView_passwordInput), "<Ctrl+V>")
|
|
||||||
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")
|
|
Loading…
Reference in New Issue