2022-05-26 15:00:00 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2022-06-07 23:44:48 +00:00
|
|
|
# ******************************************************************************
|
2022-05-26 15:00:00 +00:00
|
|
|
# Status.im
|
2022-06-07 23:44:48 +00:00
|
|
|
# *****************************************************************************/
|
2022-05-26 15:00:00 +00:00
|
|
|
# /**
|
|
|
|
# * \file steps.py
|
|
|
|
# *
|
|
|
|
# * \test Status Desktop - Login
|
|
|
|
# * \date February 2022
|
|
|
|
# * \brief This file contains snippets of script code to be executed as the .feature
|
|
|
|
# * file is processed.
|
|
|
|
# * The decorators Given/When/Then/Step can be used to associate a script snippet
|
|
|
|
# * with a pattern which is matched against the steps being executed.
|
|
|
|
# *****************************************************************************
|
2022-11-17 14:06:36 +00:00
|
|
|
import common.Common as common
|
2022-07-13 13:14:52 +00:00
|
|
|
import time
|
2022-06-07 23:44:48 +00:00
|
|
|
|
2022-11-21 12:56:06 +00:00
|
|
|
import steps.commonInitSteps as init_steps
|
2022-09-29 14:35:16 +00:00
|
|
|
from screens.StatusMainScreen import StatusMainScreen
|
|
|
|
from screens.StatusChatScreen import StatusChatScreen
|
|
|
|
|
|
|
|
_statusMain = StatusMainScreen()
|
|
|
|
_statusChat = StatusChatScreen()
|
|
|
|
|
2022-10-13 16:03:10 +00:00
|
|
|
#########################
|
|
|
|
### PRECONDITIONS region:
|
|
|
|
#########################
|
|
|
|
|
2022-10-19 10:39:48 +00:00
|
|
|
@Given("the user starts the application with a specific data folder \"|any|\"")
|
2022-08-18 17:51:18 +00:00
|
|
|
def step(context, data_folder_path):
|
2022-11-21 12:56:06 +00:00
|
|
|
init_steps.a_user_starts_the_application_with_a_specific_data_folder(context, data_folder_path)
|
2022-07-20 12:14:50 +00:00
|
|
|
|
2022-10-13 16:03:10 +00:00
|
|
|
@Given("the user restarts the app")
|
|
|
|
def step(context):
|
|
|
|
the_user_restarts_the_app(context)
|
|
|
|
|
2022-10-25 12:44:28 +00:00
|
|
|
@Given("the user joins chat room \"|any|\"")
|
|
|
|
def step(context, room):
|
|
|
|
the_user_joins_chat_room(room)
|
2022-10-21 07:17:48 +00:00
|
|
|
|
|
|
|
@Given("the user clicks on escape key")
|
|
|
|
def step(context):
|
2022-11-17 14:06:36 +00:00
|
|
|
_statusMain.click_escape()
|
|
|
|
|
|
|
|
@Given("the user clears input \"|any|\"")
|
|
|
|
def step(context, input_component):
|
|
|
|
common.clear_input_text(input_component)
|
|
|
|
|
|
|
|
@Given("the user inputs the following \"|any|\" with ui-component \"|any|\"")
|
|
|
|
def step(context, text, obj):
|
|
|
|
the_user_inputs_the_following_text_with_uicomponent(text, obj)
|
|
|
|
|
|
|
|
@Given("the user clicks on the following ui-component \"|any|\"")
|
|
|
|
def step(context: any, obj: str):
|
|
|
|
the_user_clicks_on_the_following_ui_component(obj)
|
2022-10-21 07:17:48 +00:00
|
|
|
|
2022-10-13 16:03:10 +00:00
|
|
|
#########################
|
|
|
|
### ACTIONS region:
|
|
|
|
#########################
|
|
|
|
|
2022-06-16 01:46:45 +00:00
|
|
|
@When("the user restarts the app")
|
2022-05-26 15:00:00 +00:00
|
|
|
def step(context):
|
2022-10-13 16:03:10 +00:00
|
|
|
the_user_restarts_the_app(context)
|
2022-07-20 12:14:50 +00:00
|
|
|
|
2022-11-17 14:06:36 +00:00
|
|
|
@When("the user inputs the following \"|any|\" with ui-component \"|any|\"")
|
2022-05-26 15:00:00 +00:00
|
|
|
def step(context, text, obj):
|
2022-11-17 14:06:36 +00:00
|
|
|
the_user_inputs_the_following_text_with_uicomponent(text, obj)
|
2022-06-07 23:44:48 +00:00
|
|
|
|
2022-11-17 14:06:36 +00:00
|
|
|
@When("the user clicks on the following ui-component \"|any|\"")
|
2022-10-21 07:17:48 +00:00
|
|
|
def step(context: any, obj: str):
|
2022-11-18 15:25:47 +00:00
|
|
|
init_steps.the_user_clicks_on_the_following_ui_component(obj)
|
2022-05-26 15:00:00 +00:00
|
|
|
|
2022-10-19 10:39:48 +00:00
|
|
|
@When("the user joins chat room \"|any|\"")
|
2022-09-29 14:35:16 +00:00
|
|
|
def step(context, room):
|
2022-10-25 12:44:28 +00:00
|
|
|
the_user_joins_chat_room(room)
|
2022-09-29 14:35:16 +00:00
|
|
|
|
2022-12-26 21:53:47 +00:00
|
|
|
# TODO remove when we have a reliable local mailserver
|
|
|
|
@When("the user waits |any| seconds")
|
|
|
|
def step(context, amount):
|
|
|
|
time.sleep(2)
|
|
|
|
|
2022-10-13 16:03:10 +00:00
|
|
|
#########################
|
|
|
|
### VERIFICATIONS region:
|
|
|
|
#########################
|
2022-05-26 15:00:00 +00:00
|
|
|
|
2022-11-17 14:06:36 +00:00
|
|
|
@Then("the following ui-component \"|any|\" is not enabled")
|
2022-05-26 15:00:00 +00:00
|
|
|
def step(context, obj):
|
2022-11-17 14:06:36 +00:00
|
|
|
common.object_not_enabled(obj)
|
2022-10-13 16:03:10 +00:00
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
### COMMON methods used in different steps given/when/then region:
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
def the_user_restarts_the_app(context: any):
|
2022-11-24 15:54:41 +00:00
|
|
|
waitFor(lambda: currentApplicationContext().detach(), 500)
|
2022-10-13 16:03:10 +00:00
|
|
|
time.sleep(5)
|
2022-11-24 15:54:41 +00:00
|
|
|
startApplication(context.userData["aut_name"])
|
2022-10-25 12:44:28 +00:00
|
|
|
|
|
|
|
def the_user_joins_chat_room(room: str):
|
2022-11-17 14:06:36 +00:00
|
|
|
init_steps.the_user_joins_chat_room(room)
|
|
|
|
|
|
|
|
def the_user_inputs_the_following_text_with_uicomponent(text: str, obj):
|
|
|
|
common.input_text(text, obj)
|
|
|
|
|
|
|
|
def the_user_clicks_on_the_following_ui_component(obj):
|
|
|
|
init_steps.the_user_clicks_on_the_following_ui_component(obj)
|
2022-11-30 15:31:01 +00:00
|
|
|
|