2022-06-08 00:17:02 +00:00
|
|
|
|
2022-08-12 18:42:06 +00:00
|
|
|
|
2022-08-05 19:52:34 +00:00
|
|
|
from random import randint
|
2022-08-02 20:04:29 +00:00
|
|
|
from drivers.SquishDriver import *
|
2022-06-07 15:19:52 +00:00
|
|
|
from screens.StatusMainScreen import StatusMainScreen
|
2022-06-07 23:37:11 +00:00
|
|
|
from screens.StatusChatScreen import StatusChatScreen
|
2022-07-20 12:14:50 +00:00
|
|
|
from screens.StatusCreateChatScreen import StatusCreateChatScreen
|
|
|
|
|
2022-06-07 15:19:52 +00:00
|
|
|
|
|
|
|
_statusMain = StatusMainScreen()
|
2022-06-07 23:37:11 +00:00
|
|
|
_statusChat = StatusChatScreen()
|
2022-07-20 12:14:50 +00:00
|
|
|
_statusCreateChatView = StatusCreateChatScreen()
|
2022-06-07 15:19:52 +00:00
|
|
|
|
2022-08-15 21:01:12 +00:00
|
|
|
@When("the user opens the chat section")
|
|
|
|
def step(context):
|
|
|
|
_statusMain.open_chat_section()
|
|
|
|
|
2022-06-07 15:19:52 +00:00
|
|
|
@When("user joins chat room |any|")
|
|
|
|
def step(context, room):
|
2022-07-20 12:14:50 +00:00
|
|
|
_statusMain.join_chat_room(room)
|
2022-08-12 18:55:06 +00:00
|
|
|
_statusChat.verify_chat_title(room)
|
2022-07-20 12:14:50 +00:00
|
|
|
|
|
|
|
@When("the user creates a group chat adding users")
|
|
|
|
def step(context):
|
|
|
|
_statusMain.open_start_chat_view()
|
|
|
|
_statusCreateChatView.create_chat(context.table)
|
|
|
|
|
|
|
|
@When("the user clicks on |any| chat")
|
|
|
|
def step(context, chatName):
|
|
|
|
_statusMain.open_chat(chatName)
|
2022-08-10 06:57:34 +00:00
|
|
|
|
|
|
|
@When("the user inputs a mention to |any| with message |any|")
|
|
|
|
def step(context,displayName,message):
|
2022-08-15 17:16:01 +00:00
|
|
|
_statusChat.send_message_with_mention(displayName, message)
|
|
|
|
|
|
|
|
@When("the user clears chat history")
|
|
|
|
def step(context):
|
2022-08-17 14:47:06 +00:00
|
|
|
_statusChat.clear_history()
|
|
|
|
|
|
|
|
@When("the user types \"|any|\"")
|
|
|
|
def step(context, message):
|
|
|
|
_statusChat.type_message_in_chat_input(message)
|
|
|
|
|
|
|
|
@When("the user pressed enter")
|
|
|
|
def step(context):
|
|
|
|
_statusChat.press_enter_in_chat_input()
|
2022-06-07 15:19:52 +00:00
|
|
|
|
2022-06-07 23:37:11 +00:00
|
|
|
@Then("user is able to send chat message")
|
|
|
|
def step(context):
|
|
|
|
table = context.table
|
|
|
|
for row in table[1:]:
|
2022-07-20 12:14:50 +00:00
|
|
|
_statusChat.send_message(row[0])
|
|
|
|
_statusChat.verify_last_message_sent(row[0])
|
2022-08-12 12:11:57 +00:00
|
|
|
|
|
|
|
@Then("The user is able to send a gif message")
|
|
|
|
def step(context):
|
|
|
|
_statusChat.send_gif()
|
|
|
|
_statusChat.verify_last_message_sent("tenor.gif")
|
2022-08-17 14:47:06 +00:00
|
|
|
|
|
|
|
@Then("the user selects emoji in the suggestion list")
|
|
|
|
def step(contenxt):
|
|
|
|
_statusChat.select_the_emoji_in_suggestion_list()
|
2022-08-19 11:54:20 +00:00
|
|
|
|
|
|
|
@Then("the user is able to send chat message \"|any|\"")
|
|
|
|
def step(context, message):
|
|
|
|
_statusChat.send_message(message)
|
2022-07-20 12:14:50 +00:00
|
|
|
|
2022-08-22 21:12:35 +00:00
|
|
|
@When("the user sends the chat message |any|")
|
|
|
|
def step(context, message):
|
|
|
|
_statusChat.send_message(message)
|
|
|
|
_statusChat.verify_last_message_sent(message)
|
|
|
|
|
2022-08-19 14:57:09 +00:00
|
|
|
@Then("the user is able to send a random chat message")
|
2022-08-05 19:52:34 +00:00
|
|
|
def step(context):
|
|
|
|
random_int = randint(0, 10000)
|
|
|
|
message = "random message " + str(random_int)
|
|
|
|
_statusChat.send_message(message)
|
|
|
|
_statusChat.verify_last_message_sent(message)
|
|
|
|
context.userData["randomMessage"] = message
|
2022-08-15 17:16:01 +00:00
|
|
|
|
|
|
|
@Then("the chat is cleared")
|
|
|
|
def step(context):
|
|
|
|
_statusChat.verify_last_message_is_not_loaded()
|
2022-08-05 19:52:34 +00:00
|
|
|
|
2022-07-20 12:14:50 +00:00
|
|
|
@Then("the group chat is created")
|
|
|
|
def step(context):
|
|
|
|
_statusChat = StatusChatScreen()
|
|
|
|
|
|
|
|
@Then("the group chat history contains \"|any|\" message")
|
|
|
|
def step(context, createdTxt):
|
|
|
|
_statusChat.verify_chat_created_message_is_displayed_in_history(createdTxt)
|
|
|
|
|
2022-08-15 21:01:12 +00:00
|
|
|
@Then("the chat title is |any|")
|
2022-07-20 12:14:50 +00:00
|
|
|
def step(context, title):
|
|
|
|
_statusChat.verify_chat_title(title)
|
|
|
|
|
|
|
|
@Then("the group chat contains the following members")
|
|
|
|
def step(context):
|
|
|
|
_statusChat.verify_members_added(context.table)
|
|
|
|
|
|
|
|
@Then("the group chat is up to chat sending \"|any|\" message")
|
|
|
|
def step(context, message):
|
|
|
|
_statusChat.send_message(message)
|
2022-07-28 18:58:19 +00:00
|
|
|
_statusChat.verify_last_message_sent(message)
|
|
|
|
|
|
|
|
@Then("the user can reply to the message at index |any| with \"|any|\"")
|
|
|
|
def step(context, message_index, message):
|
|
|
|
_statusChat.reply_to_message_at_index(message_index, message)
|
2022-07-28 20:14:29 +00:00
|
|
|
_statusChat.verify_last_message_sent(message)
|
2022-08-12 13:10:20 +00:00
|
|
|
|
|
|
|
@When("the user edits the message at index |any| and changes it to \"|any|\"" )
|
|
|
|
def step(context, message_index, message):
|
|
|
|
_statusChat.edit_message_at_index(message_index, message)
|
|
|
|
_statusChat.verify_last_message_sent(message)
|
2022-07-28 20:14:29 +00:00
|
|
|
|
|
|
|
@Then("the user can mark the channel |any| as read")
|
|
|
|
def step(context, channel):
|
2022-08-02 20:04:29 +00:00
|
|
|
_statusMain.mark_as_read(channel)
|
|
|
|
|
|
|
|
@Then("the user can delete the message at index |any|")
|
|
|
|
def step(context, message_index):
|
|
|
|
_statusChat.delete_message_at_index(message_index)
|
2022-08-05 19:52:34 +00:00
|
|
|
time.sleep(1)
|
2022-08-02 20:04:29 +00:00
|
|
|
|
|
|
|
@Then("the user cannot delete the last message")
|
|
|
|
def step(context):
|
|
|
|
_statusChat.cannot_delete_last_message()
|
|
|
|
|
|
|
|
@Then("the last message is not \"|any|\"")
|
|
|
|
def step(context, message):
|
|
|
|
_statusChat.verify_last_message_sent_is_not(message)
|
|
|
|
|
2022-08-05 19:52:34 +00:00
|
|
|
@Then("the last message is not the random message")
|
|
|
|
def step(context):
|
|
|
|
_statusChat.verify_last_message_sent_is_not(context.userData["randomMessage"])
|
2022-08-12 18:42:06 +00:00
|
|
|
|
|
|
|
@When("user sends the emoji |any| as a message")
|
|
|
|
def step(context, emoji_short_name):
|
|
|
|
_statusChat.send_emoji(emoji_short_name, "")
|
|
|
|
|
|
|
|
@When("user sends the emoji |any| with message |any|")
|
|
|
|
def step(context, emoji_short_name, message):
|
|
|
|
_statusChat.send_emoji(emoji_short_name, message)
|
|
|
|
|
|
|
|
@Then("the emoji |any| is displayed in the last message")
|
|
|
|
def step(context, emoji):
|
2022-08-19 11:54:20 +00:00
|
|
|
_statusChat.verify_last_message_sent(emoji)
|
2022-08-12 18:42:06 +00:00
|
|
|
|
|
|
|
@Then("the message |any| is displayed in the last message")
|
|
|
|
def step(context, message):
|
|
|
|
_statusChat.verify_last_message_sent(message)
|
|
|
|
|
2022-08-11 19:16:59 +00:00
|
|
|
|
|
|
|
@Then("the user can install the sticker pack at position |any|")
|
|
|
|
def step(context, pack_index):
|
|
|
|
_statusChat.install_sticker_pack(pack_index)
|
|
|
|
|
|
|
|
# Using position of sticker because stickers don't have ids, only hashes and it feels weird to type hashes in Gherkin
|
|
|
|
@Then("the user can send the sticker at position |any| in the list")
|
|
|
|
def step(context, sticker_index):
|
|
|
|
_statusChat.send_sticker(sticker_index)
|
|
|
|
|
2022-08-10 06:57:34 +00:00
|
|
|
@Then("the user cannot input a mention to a not existing user |any|")
|
|
|
|
def step(context, displayName):
|
|
|
|
_statusChat.cannot_do_mention(displayName)
|
|
|
|
|
|
|
|
@Then("the |any| mention with message |any| have been sent")
|
|
|
|
def step(context,displayName,message):
|
|
|
|
_statusChat.verify_last_message_sent_contains_mention(displayName, message)
|
2022-08-18 07:27:57 +00:00
|
|
|
|
|
|
|
@Then("user chats are sorted accordingly")
|
|
|
|
def step(context):
|
|
|
|
table = context.table
|
|
|
|
for i, row in enumerate(table):
|
|
|
|
chatName = row[0]
|
|
|
|
_statusChat.verify_chat_order(i, chatName)
|
|
|
|
|
|
|
|
@When("user switches to |any| chat")
|
|
|
|
def step(context, chatName):
|
|
|
|
_statusChat.switch_to_chat(chatName)
|