test(chore): Added splash screen animation recognition and general banners management

"the user lands on the signed in app" step incorporates the following verifications (main screen is ready):
- Splash screen animation is loaded and ended.
- Banners that appear in the main screen are closed before starting other actions (secure seed phrase, connection information and update app information banners).
This commit is contained in:
Noelia 2022-09-29 16:30:25 +02:00 committed by Noelia
parent 4452574c24
commit d0fc2db9bd
9 changed files with 46 additions and 28 deletions

View File

@ -115,7 +115,6 @@ class SettingsScreen:
verify_screen(SidebarComponents.ADVANCED_OPTION.value)
def open_wallet_settings(self):
StatusMainScreen.wait_for_banner_to_disappear()
click_obj_by_name(SidebarComponents.WALLET_OPTION.value)
def activate_wallet_option(self):
@ -241,7 +240,6 @@ class SettingsScreen:
click_obj_by_name(SidebarComponents.COMMUNITIES_OPTION.value)
def leave_community(self):
StatusMainScreen.wait_for_banner_to_disappear()
# In our case we have only one visible community and only one button
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_BUTTONS.value)
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_POPUP_LEAVE_BUTTON.value)

View File

@ -119,8 +119,6 @@ class StatusCommunityScreen:
return result
def _open_edit_channel_popup(self):
StatusMainScreen.wait_for_banner_to_disappear()
click_obj_by_name(CommunityScreenComponents.CHAT_MORE_OPTIONS_BUTTON.value)
click_obj_by_name(CommunityScreenComponents.EDIT_CHANNEL_MENU_ITEM.value)
@ -252,8 +250,6 @@ class StatusCommunityScreen:
click_obj_by_name(CommunitySettingsComponents.BACK_TO_COMMUNITY_BUTTON.value)
def delete_current_community_channel(self):
StatusMainScreen.wait_for_banner_to_disappear()
click_obj_by_name(CommunityScreenComponents.CHAT_MORE_OPTIONS_BUTTON.value)
click_obj_by_name(CommunityScreenComponents.DELETE_CHANNEL_MENU_ITEM.value)
click_obj_by_name(CommunityScreenComponents.DELETE_CHANNEL_CONFIRMATION_DIALOG_DELETE_BUTTON.value)

View File

@ -27,12 +27,16 @@ class MainScreenComponents(Enum):
CHAT_LIST = "chatList"
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItemDelegate"
COMMUNITY_NAVBAR_BUTTONS = "navBarListView_All_Community_Buttons"
MODULE_WARNING_BANNER = "moduleWarning_Banner"
SECURE_SEEDPHRASE_BANNER = "secureSeedPhrase_Banner"
CONNECTION_INFO_BANNER = "connectionInfo_Banner"
UPDATE_APP_BANNER = "updateAppInfo_Banner"
TESTNET_INFO_BANNER = "testnetInfo_Banner"
PROFILE_NAVBAR_BUTTON = "mainWindow_ProfileNavBarButton"
USERSTATUSMENU_ALWAYS_ACTIVE_ACTION = "userContextmenu_AlwaysActiveButton"
USERSTATUSMENU_INACTIVE_ACTION = "userContextmenu_InActiveButton"
USERSTATUSMENU_AUTOMATIC_ACTION = "userContextmenu_AutomaticButton"
USERSTATUSMENU_OPEN_PROFILE_POPUP = "userContextMenu_ViewMyProfileAction"
SPLASH_SCREEN = "splashScreen"
class ProfilePopup(Enum):
USER_IMAGE = "ProfileHeader_userImage"
@ -53,20 +57,42 @@ class StatusMainScreen:
def __init__(self):
verify_screen(MainScreenComponents.PUBLIC_CHAT_ICON.value)
# Main screen is ready to interact with it (Splash screen animation not present and no banners on top of the screen)
def is_ready(self):
self.wait_for_splash_animation_ends()
self.close_banners()
def wait_for_splash_animation_ends(self, timeoutMSec: int = 5000):
start = time.time()
[loaded, obj] = is_loaded_visible_and_enabled(MainScreenComponents.SPLASH_SCREEN.value)
while loaded and (start + timeoutMSec / 1000 > time.time()):
log("Splash screen animation present!")
[loaded, obj] = is_loaded_visible_and_enabled(MainScreenComponents.SPLASH_SCREEN.value)
sleep_test(0.5)
verify_equal(loaded, False, "Checking splash screen animation has ended.")
# It closes all existing banner and waits them to disappear
def close_banners(self):
self.wait_for_banner_to_disappear(MainScreenComponents.CONNECTION_INFO_BANNER.value)
self.wait_for_banner_to_disappear(MainScreenComponents.UPDATE_APP_BANNER.value)
self.wait_for_banner_to_disappear(MainScreenComponents.SECURE_SEEDPHRASE_BANNER.value)
# Close banner and wait to disappear otherwise the click might land badly
@staticmethod
def wait_for_banner_to_disappear(timeoutMSec: int = 3000):
def wait_for_banner_to_disappear(self, banner_type: str, timeoutMSec: int = 3000):
start = time.time()
while(start + timeoutMSec / 1000 > time.time()):
try:
obj = wait_and_get_obj(MainScreenComponents.MODULE_WARNING_BANNER.value, 100)
obj = get_obj(banner_type)
if not obj.visible:
log("Banner object not visible")
return
obj.close()
log("Closed banner: " + banner_type)
except:
log("Banner object not found")
return
sleep_test(0.1)
sleep_test(0.5)
verify_failure(f"Banner is still visible after {timeoutMSec}ms")
def join_chat_room(self, room: str):

View File

@ -244,8 +244,6 @@ class StatusWalletScreen:
click_obj(obj)
def edit_saved_address(self, name: str, new_name: str):
StatusMainScreen.wait_for_banner_to_disappear()
self._find_saved_address_and_open_menu(name)
click_obj_by_name(SavedAddressesScreen.EDIT.value)
@ -253,16 +251,12 @@ class StatusWalletScreen:
click_obj_by_name(AddSavedAddressPopup.ADD_BUTTON.value)
def delete_saved_address(self, name: str):
StatusMainScreen.wait_for_banner_to_disappear()
self._find_saved_address_and_open_menu(name)
click_obj_by_name(SavedAddressesScreen.DELETE.value)
click_obj_by_name(SavedAddressesScreen.CONFIRM_DELETE.value)
def toggle_favourite_for_saved_address(self, name: str):
StatusMainScreen.wait_for_banner_to_disappear()
# Find the saved address and click favourite to toggle
item = self._get_saved_address_delegate_item(name)
favouriteButton = get_child_item_with_object_name(item, SavedAddressesScreen.DELEGATE_FAVOURITE_BUTTON_OBJECT_NAME.value)

View File

@ -4,12 +4,16 @@ statusDesktop_mainWindow_overlay = {"container": statusDesktop_mainWindow, "type
mainWindow_navBarListView_ListView = {"container": statusDesktop_mainWindow, "objectName": "statusMainNavBarListView", "type": "ListView", "visible": True}
chatView_log = {"container": statusDesktop_mainWindow, "objectName": "chatLogView", "type": "StatusListView", "visible": True}
chatMessageListView_msgDelegate_MessageView = {"container": chatView_log, "objectName": "chatMessageViewDelegate", "index": 1, "type": "MessageView", "visible": True}
moduleWarning_Banner = {"container": statusDesktop_mainWindow, "objectName": "moduleWarningBanner", "type": "ModuleWarning", "visible": True}
secureSeedPhrase_Banner = {"container": statusDesktop_mainWindow, "objectName": "secureYourSeedPhraseBanner", "type": "ModuleWarning"}
connectionInfo_Banner = {"container": statusDesktop_mainWindow, "objectName": "connectionInfoBanner", "type": "ModuleWarning"}
updateAppInfo_Banner = {"container": statusDesktop_mainWindow, "objectName": "updateAppInfoBanner", "type": "ModuleWarning"}
testnetInfo_Banner = {"container": statusDesktop_mainWindow, "objectName": "testnetBanner", "type": "ModuleWarning"}
statusDesktop_mainWindow_AppMain_EmojiPopup_SearchTextInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "StatusEmojiPopup_searchBox", "type": "TextEdit", "visible": True}
mainWindow_ScrollView = {"container": statusDesktop_mainWindow, "type": "StatusScrollView", "unnamed": 1, "visible": True}
mainWindow_ScrollView_2 = {"container": statusDesktop_mainWindow, "occurrence": 2, "type": "StatusScrollView", "unnamed": 1, "visible": True}
mainWindow_ProfileNavBarButton = {"container": statusDesktop_mainWindow, "objectName": "statusProfileNavBarTabButton", "type": "StatusNavBarTabButton", "visible": True}
settings_navbar_settings_icon_StatusIcon = {"container": mainWindow_navBarListView_ListView, "objectName": "settings-icon", "type": "StatusIcon", "visible": True}
splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "SplashScreen"}
# main right panel
mainWindow_RighPanel= {"container": statusDesktop_mainWindow, "type": "ColumnLayout", "objectName": "mainRightView", "visible": True}

View File

@ -27,20 +27,16 @@ def step(context, username, password):
@When("the user inputs username |any|")
def step(context, username):
_welcomeScreen.input_username(username)
@Then("the user lands on the signed in app")
def step(context):
_mainScreen
time.sleep(2)
_welcomeScreen.input_username(username)
@When("The user inputs the seed phrase |any|")
def step(context, seed_phrase):
_welcomeScreen.input_seed_phrase(seed_phrase)
@Then("the user lands on the signed in app")
def step(context):
_mainScreen.is_ready()
@Then("the invalid seed text is visible")
def step(context):
_welcomeScreen.seed_phrase_visible()

View File

@ -437,6 +437,7 @@ Item {
ModuleWarning {
id: testnetBanner
objectName: "testnetBanner"
Layout.fillWidth: true
text: qsTr("Testnet mode is enabled. All balances, transactions and dApp interactions will be on testnets.")
buttonText: qsTr("Turn off")
@ -481,6 +482,7 @@ Item {
ModuleWarning {
id: secureYourSeedPhrase
objectName: "secureYourSeedPhraseBanner"
Layout.fillWidth: true
active: !appMain.rootStore.profileSectionStore.profileStore.userDeclinedBackupBanner
&& !appMain.rootStore.profileSectionStore.profileStore.privacyStore.mnemonicBackedUp
@ -503,6 +505,7 @@ Item {
ModuleWarning {
readonly property bool isConnected: bannersLayout.isConnected
objectName: "connectionInfoBanner"
Layout.fillWidth: true
text: isConnected ? qsTr("Connected") : qsTr("Disconnected")
type: isConnected ? ModuleWarning.Success : ModuleWarning.Danger
@ -539,6 +542,7 @@ Item {
readonly property string version: appMain.rootStore.latestVersion
readonly property bool updateAvailable: appMain.rootStore.newVersionAvailable
objectName: "updateAppInfoBanner"
Layout.fillWidth: true
type: ModuleWarning.Success
text: updateAvailable ? qsTr("A new version of Status (%1) is available").arg(version)

View File

@ -12,7 +12,6 @@ import "./"
Item {
id: root
objectName: "moduleWarningBanner"
enum Type {
Danger,

View File

@ -287,6 +287,7 @@ StatusWindow {
Component {
id: appLoadingAnimation
SplashScreen {
objectName: "splashScreen"
}
}