From d0fc2db9bd00e443c3a78e86593bdd7422a6d4c2 Mon Sep 17 00:00:00 2001 From: Noelia Date: Thu, 29 Sep 2022 16:30:25 +0200 Subject: [PATCH] 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). --- test/ui-test/src/screens/SettingsScreen.py | 2 -- .../src/screens/StatusCommunityScreen.py | 4 --- test/ui-test/src/screens/StatusMainScreen.py | 36 ++++++++++++++++--- .../ui-test/src/screens/StatusWalletScreen.py | 6 ---- .../global_shared/scripts/global_names.py | 6 +++- .../shared/steps/signUpSteps.py | 14 +++----- ui/app/mainui/AppMain.qml | 4 +++ ui/imports/shared/panels/ModuleWarning.qml | 1 - ui/main.qml | 1 + 9 files changed, 46 insertions(+), 28 deletions(-) diff --git a/test/ui-test/src/screens/SettingsScreen.py b/test/ui-test/src/screens/SettingsScreen.py index 1e1d0b3dd3..97eaeafa78 100644 --- a/test/ui-test/src/screens/SettingsScreen.py +++ b/test/ui-test/src/screens/SettingsScreen.py @@ -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) diff --git a/test/ui-test/src/screens/StatusCommunityScreen.py b/test/ui-test/src/screens/StatusCommunityScreen.py index ad28a9c480..6a29fa646b 100644 --- a/test/ui-test/src/screens/StatusCommunityScreen.py +++ b/test/ui-test/src/screens/StatusCommunityScreen.py @@ -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) diff --git a/test/ui-test/src/screens/StatusMainScreen.py b/test/ui-test/src/screens/StatusMainScreen.py index a8096a4e30..08702f4283 100644 --- a/test/ui-test/src/screens/StatusMainScreen.py +++ b/test/ui-test/src/screens/StatusMainScreen.py @@ -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): diff --git a/test/ui-test/src/screens/StatusWalletScreen.py b/test/ui-test/src/screens/StatusWalletScreen.py index 2bf0816be7..157d251bda 100644 --- a/test/ui-test/src/screens/StatusWalletScreen.py +++ b/test/ui-test/src/screens/StatusWalletScreen.py @@ -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) diff --git a/test/ui-test/testSuites/global_shared/scripts/global_names.py b/test/ui-test/testSuites/global_shared/scripts/global_names.py index b4f54ac168..f593caac7a 100644 --- a/test/ui-test/testSuites/global_shared/scripts/global_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/global_names.py @@ -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} diff --git a/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py b/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py index a98b64b9cd..53c2a9fcda 100644 --- a/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py +++ b/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py @@ -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() diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index c8e46da5a4..3d9475696d 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -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) diff --git a/ui/imports/shared/panels/ModuleWarning.qml b/ui/imports/shared/panels/ModuleWarning.qml index fa73d1b5b5..1b7eb585b4 100644 --- a/ui/imports/shared/panels/ModuleWarning.qml +++ b/ui/imports/shared/panels/ModuleWarning.qml @@ -12,7 +12,6 @@ import "./" Item { id: root - objectName: "moduleWarningBanner" enum Type { Danger, diff --git a/ui/main.qml b/ui/main.qml index 34cefa24df..0b985ecc32 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -287,6 +287,7 @@ StatusWindow { Component { id: appLoadingAnimation SplashScreen { + objectName: "splashScreen" } }