test(chat): add a test to create a one to one chat with a mutual contact
Fixes #6884
This commit is contained in:
parent
250a193f91
commit
794563bfff
|
@ -72,6 +72,8 @@ class ChatComponents(Enum):
|
|||
LINK_PREVIEW_UNFURLED_LINK_IMAGE = "chatView_unfurledLinkComponent_linkImage"
|
||||
LINK_PREVIEW_OPEN_SETTINGS = "chatView_LinksMessageView_enableBtn"
|
||||
|
||||
DELETE_CHANNEL_CONFIRMATION_DIALOG_DELETE_BUTTON = "delete_Channel_ConfirmationDialog_DeleteButton"
|
||||
|
||||
class ChatStickerPopup(Enum):
|
||||
STICKERS_POPUP_GET_STICKERS_BUTTON = "chat_StickersPopup_GetStickers_Button"
|
||||
STICKERS_POPUP_MARKET_GRID_VIEW = "chat_StickersPopup_StickerMarket_GridView"
|
||||
|
@ -140,10 +142,13 @@ class StatusChatScreen:
|
|||
hover_and_click_object_by_name(ChatComponents.EDIT_NAME_AND_IMAGE_MENUITEM.value)
|
||||
|
||||
def leave_chat(self):
|
||||
time.sleep(2)
|
||||
time.sleep(1)
|
||||
hover_and_click_object_by_name(ChatComponents.MORE_OPTIONS_BUTTON.value)
|
||||
time.sleep(2)
|
||||
time.sleep(1)
|
||||
hover_and_click_object_by_name(ChatComponents.LEAVE_CHAT_MENUITEM.value)
|
||||
visible, _ = is_loaded_visible_and_enabled(ChatComponents.DELETE_CHANNEL_CONFIRMATION_DIALOG_DELETE_BUTTON.value, 100)
|
||||
if (visible):
|
||||
click_obj_by_name(ChatComponents.DELETE_CHANNEL_CONFIRMATION_DIALOG_DELETE_BUTTON.value)
|
||||
|
||||
def group_chat_edit_name(self, name):
|
||||
setText(GroupChatEditPopup.GROUP_CHAT_EDIT_NAME.value, name)
|
||||
|
|
|
@ -76,11 +76,11 @@ class StatusWelcomeScreen:
|
|||
verify_screen(AgreementPopUp.OK_GOT_IT_BUTTON.value)
|
||||
|
||||
def agree_terms_conditions_and_generate_new_key(self):
|
||||
self._agree_terms_and_conditions()
|
||||
self.agree_terms_and_conditions()
|
||||
click_obj_by_name(SignUpComponents.GENERATE_NEW_KEYS.value)
|
||||
|
||||
def agree_terms_conditions_and_navigate_to_import_seed_phrase(self):
|
||||
self._agree_terms_and_conditions()
|
||||
self.agree_terms_and_conditions()
|
||||
click_obj_by_name(SeedPhraseComponents.IMPORT_A_SEED_TEXT.value)
|
||||
click_obj_by_name(SeedPhraseComponents.IMPORT_A_SEED_BUTTON.value)
|
||||
|
||||
|
@ -141,7 +141,7 @@ class StatusWelcomeScreen:
|
|||
validation_fn = lambda: not is_loaded_visible_and_enabled(SignUpComponents.FINALIZE_PSW_BUTTON.value, 50)[0],
|
||||
message = 'Try clicking "Finalize" until button not visible (moved to the next screen')
|
||||
|
||||
def _agree_terms_and_conditions(self):
|
||||
def agree_terms_and_conditions(self):
|
||||
if sys.platform == "darwin":
|
||||
click_obj_by_name(AgreementPopUp.OK_GOT_IT_BUTTON.value)
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ userContextMenu_ViewMyProfileAction = {"container": statusDesktop_mainWindow_ove
|
|||
|
||||
# popups
|
||||
modal_Close_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "modalCloseButtonRectangle", "type": "Rectangle", "visible": True}
|
||||
delete_Channel_ConfirmationDialog_DeleteButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "deleteChatConfirmationDialogDeleteButton", "type": "StatusButton"}
|
||||
|
||||
# Main Window - chat related:
|
||||
mainWindow_public_chat_icon_StatusIcon = {"container": statusDesktop_mainWindow, "objectName": "public-chat-icon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "visible": True}
|
||||
|
|
|
@ -8,6 +8,7 @@ from screens.StatusMainScreen import StatusMainScreen
|
|||
from screens.StatusChatScreen import StatusChatScreen
|
||||
from screens.StatusCommunityPortalScreen import StatusCommunityPortalScreen
|
||||
from screens.StatusCommunityScreen import StatusCommunityScreen
|
||||
from screens.StatusLoginScreen import StatusLoginScreen
|
||||
|
||||
# Project settings properties:
|
||||
_status_desktop_app_name = "nim_status_client"
|
||||
|
@ -48,9 +49,17 @@ def context_init(context):
|
|||
|
||||
context.userData[_fixtures_root] = os.path.join(joined_path, "fixtures/")
|
||||
|
||||
def given_a_first_time_user_lands_on_and_generates_new_key(context):
|
||||
def a_first_time_user_lands_on(context):
|
||||
erase_directory(context.userData[_status_data_folder])
|
||||
start_application(context.userData[_aut_name])
|
||||
|
||||
def a_user_starts_the_application_with_a_specific_data_folder(context, data_folder_path):
|
||||
clear_directory(context.userData["status_data_folder_path"])
|
||||
copy_directory(data_folder_path, context.userData["status_data_folder_path"])
|
||||
start_application(context.userData[_aut_name])
|
||||
|
||||
def a_first_time_user_lands_on_and_generates_new_key(context):
|
||||
a_first_time_user_lands_on(context)
|
||||
welcome_screen = StatusWelcomeScreen()
|
||||
welcome_screen.agree_terms_conditions_and_generate_new_key()
|
||||
|
||||
|
@ -69,7 +78,7 @@ def when_the_user_lands_on_the_signed_in_app():
|
|||
main_screen.is_ready()
|
||||
|
||||
def signs_up_process_steps(context, user, password):
|
||||
given_a_first_time_user_lands_on_and_generates_new_key(context)
|
||||
a_first_time_user_lands_on_and_generates_new_key(context)
|
||||
when_the_user_signs_up(user, password)
|
||||
when_the_user_lands_on_the_signed_in_app()
|
||||
|
||||
|
@ -104,4 +113,14 @@ def the_admin_creates_a_community_channel(name: str, description: str, method: s
|
|||
|
||||
def the_channel_is_open(name: str):
|
||||
chat_screen = StatusChatScreen()
|
||||
chat_screen.verify_chat_title(name)
|
||||
chat_screen.verify_chat_title(name)
|
||||
|
||||
def the_user_logs_in(username: str, password: str):
|
||||
loginScreen = StatusLoginScreen()
|
||||
loginScreen.login(username, password)
|
||||
|
||||
def login_process_steps(context, user, password, data_dir_path):
|
||||
a_user_starts_the_application_with_a_specific_data_folder(context, data_dir_path)
|
||||
the_user_logs_in(user, password)
|
||||
when_the_user_lands_on_the_signed_in_app()
|
||||
|
||||
|
|
|
@ -29,9 +29,7 @@ _statusChat = StatusChatScreen()
|
|||
|
||||
@Given("the user starts the application with a specific data folder \"|any|\"")
|
||||
def step(context, data_folder_path):
|
||||
clear_directory(context.userData["status_data_folder_path"])
|
||||
copy_directory(data_folder_path, context.userData["status_data_folder_path"])
|
||||
startApplication(context.userData["aut_name"])
|
||||
a_user_starts_the_application_with_a_specific_data_folder(context, data_folder_path)
|
||||
|
||||
@Given("the user restarts the app")
|
||||
def step(context):
|
||||
|
|
|
@ -14,7 +14,6 @@ chat_moreOptions_menuButton = {"container": statusDesktop_mainWindow, "objectNam
|
|||
edit_Channel_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editChannelMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
delete_Channel_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
mainWindow_communityColumnView_statusChatList = {"container": mainWindow_communityColumnView_CommunityColumnView, "objectName": "statusChatListAndCategoriesChatList", "type": "StatusChatList"}
|
||||
delete_Channel_ConfirmationDialog_DeleteButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "deleteChatConfirmationDialogDeleteButton", "type": "StatusButton"}
|
||||
mainWindow_chatInfoBtnInHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "chatInfoBtnInHeader", "type": "StatusChatInfoButton", "visible": True}
|
||||
communityChatListCategories_Repeater = {"container": statusDesktop_mainWindow, "objectName": "communityChatListCategories", "type": "Repeater"}
|
||||
chatInput_Root = {"container": statusDesktop_mainWindow, "objectName": "statusChatInput", "type": "Rectangle", "visible": True}
|
||||
|
|
|
@ -143,18 +143,23 @@ def step(context):
|
|||
@When("the user switches to \"|any|\" chat")
|
||||
def step(context, chatName):
|
||||
_statusChat.switch_to_chat(chatName)
|
||||
|
||||
|
||||
@When("the user creates a group chat adding users")
|
||||
def step(context):
|
||||
the_user_creates_a_group_chat_adding_users(context)
|
||||
|
||||
@When("the user creates a one to one chat with \"|any|\"")
|
||||
def step(context, username):
|
||||
_statusMain.open_start_chat_view()
|
||||
_statusCreateChatView.create_chat([[username]])
|
||||
|
||||
@When("the user saves changes")
|
||||
def step(context):
|
||||
_statusChat.group_chat_edit_save()
|
||||
|
||||
@When("the user leaves current chat")
|
||||
def step(context):
|
||||
_statusChat.leave_chat()
|
||||
leave_current_chat()
|
||||
|
||||
#########################
|
||||
### VERIFICATIONS region:
|
||||
|
@ -259,4 +264,7 @@ def the_user_sends_a_random_chat_message(context):
|
|||
random_int = randint(0, 10000)
|
||||
message = "random message " + str(random_int)
|
||||
_statusChat.send_message(message)
|
||||
context.userData["randomMessage"] = message
|
||||
context.userData["randomMessage"] = message
|
||||
|
||||
def leave_current_chat():
|
||||
_statusChat.leave_chat()
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/"))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
|
||||
|
||||
from steps.startupSteps import *
|
||||
|
||||
# Global properties for the specific feature
|
||||
_user = "tester123"
|
||||
_password = "TesTEr16843/!@00"
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file contains hook functions to run as the .feature file is executed
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/"))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
|
||||
|
||||
# from steps.chatSteps import *
|
||||
|
||||
# Global properties for the specific feature
|
||||
_user = "tester123"
|
||||
_password = "TesTEr16843/!@00"
|
||||
_data_folder_path = "../../../fixtures/mutual_contacts"
|
||||
|
||||
@OnFeatureStart
|
||||
def hook(context):
|
||||
context_init(context)
|
||||
login_process_steps(context, _user, _password, _data_folder_path)
|
||||
|
||||
@OnFeatureEnd
|
||||
def hook(context):
|
||||
currentApplicationContext().detach()
|
||||
snooze(_app_closure_timeout)
|
||||
|
||||
@OnScenarioStart
|
||||
def hook(context):
|
||||
when_the_user_opens_the_chat_section()
|
||||
|
||||
@OnScenarioEnd
|
||||
def hook(context):
|
||||
leave_current_chat()
|
||||
|
||||
@OnStepEnd
|
||||
def hook(context):
|
||||
context.userData["step_name"] = context._data["text"]
|
|
@ -0,0 +1,22 @@
|
|||
Feature: Status Desktop One to One Chat Flows
|
||||
|
||||
As a user I want to do basic interactions in a one to one chat.
|
||||
|
||||
The following scenarios cover one to one chat flows with mutual contacts
|
||||
|
||||
The feature start sequence is the following (setup on its own `bdd_hooks`):
|
||||
** given A first time user lands on the status desktop with the specific data folder "../../../fixtures/mutual_contacts"
|
||||
** when user logins with username "tester123" and password "TesTEr16843/!@00"
|
||||
** and the user lands on the signed in app
|
||||
|
||||
[Cleanup] Also each scenario starts with:
|
||||
** when the user opens the chat section
|
||||
|
||||
[Cleanup] Also each scenario ends with:
|
||||
** when the user leaves the current chat
|
||||
|
||||
Scenario: The user can create a one to chat
|
||||
When the user creates a one to one chat with "Athletic"
|
||||
Then the chat title is "Athletic"
|
||||
When the user sends a chat message "Test message"
|
||||
Then the last chat message contains "Test message"
|
|
@ -0,0 +1,8 @@
|
|||
source(findFile('scripts', 'python/bdd.py'))
|
||||
|
||||
setupHooks('bdd_hooks.py')
|
||||
collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/')
|
||||
|
||||
def main():
|
||||
testSettings.throwOnFailure = True
|
||||
runFeatureFile('test.feature')
|
|
@ -11,7 +11,7 @@ _mainScreen = StatusMainScreen()
|
|||
|
||||
@Given("A first time user lands on the status desktop and generates new key")
|
||||
def step(context):
|
||||
given_a_first_time_user_lands_on_and_generates_new_key(context)
|
||||
a_first_time_user_lands_on_and_generates_new_key(context)
|
||||
|
||||
@Given("A first time user lands on the status desktop and navigates to import seed phrase")
|
||||
def step(context):
|
||||
|
|
Loading…
Reference in New Issue