From 58476a43da17cd853e40b5e7b9e0e7cf01b50cbb Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Tue, 19 Nov 2024 19:38:52 +0200 Subject: [PATCH] e2e: removed notifications button in tests --- test/appium/views/profile_view.py | 5 ++- test/appium/views/sign_in_view.py | 67 ++++++++----------------------- 2 files changed, 19 insertions(+), 53 deletions(-) diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 4280ff9024..0c36c8c0c7 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -237,7 +237,8 @@ class ProfileView(BaseView): self.delete_profile_button = Button(self.driver, accessibility_id="delete-profile-confirm") # Notifications - self.profile_notifications_button = Button(self.driver, accessibility_id="notifications-settings-button") + self.profile_notifications_button = Button(self.driver, + accessibility_id="icon, Notifications, label-component, icon") self.profile_notifications_toggle_button = Button(self.driver, accessibility_id="local-notifications-settings-button") self.push_notification_toggle = Button( @@ -389,7 +390,7 @@ class ProfileView(BaseView): self.driver.info("Enabling push notifications via Profile") self.profile_notifications_button.scroll_and_click() self.profile_notifications_toggle_button.click() - self.navigate_back_to_home_view() + self.allow_button.click_if_shown() def add_custom_network(self, rpc_url: str, name: str, symbol: str, netwrok_id: str): self.driver.info("## Add custom network", device=False) diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index 21565cf545..769bac5374 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -214,8 +214,6 @@ class SignInView(BaseView): self.profile_confirm_password_button = Button(self.driver, translation_id="password-creation-confirm") self.enable_biometric_maybe_later_button = Button(self.driver, translation_id="maybe-later") self.identifiers_button = Button(self.driver, accessibility_id="skip-identifiers") - self.enable_notifications_button = Button(self.driver, accessibility_id="enable-notifications-button") - self.maybe_later_button = Button(self.driver, accessibility_id="enable-notifications-later-button") self.start_button = Button(self.driver, accessibility_id="welcome-button") self.use_recovery_phrase_button = Button(self.driver, accessibility_id="use-recovery-phrase-option-card") self.passphrase_edit_box = EditBox(self.driver, accessibility_id="passphrase-input") @@ -240,10 +238,8 @@ class SignInView(BaseView): if set_image: pass - def create_user(self, password=common_password, keycard=False, enable_notifications=False, - username="test user", first_user=True): - self.driver.info("## Creating new multiaccount (password:'%s', keycard:'%s', enable_notification: '%s')" % - (password, str(keycard), str(enable_notifications)), device=False) + def create_user(self, password=common_password, username="test user", first_user=True, enable_notifications=False): + self.driver.info("## Creating new multiaccount with password:'%s'" % password, device=False) if first_user: self.create_profile_button.click_until_presence_of_element(self.generate_keys_button) self.not_now_button.wait_and_click() @@ -255,40 +251,18 @@ class SignInView(BaseView): self.generate_keys_button.click_until_presence_of_element(self.profile_title_input) self.set_profile(username) self.set_password(password) - # if self.enable_biometric_maybe_later_button.is_element_displayed(10): - # self.enable_biometric_maybe_later_button.click() - # self.next_button.click_until_absense_of_element(self.element_by_translation_id("intro-wizard-title2")) - # if keycard: - # keycard_flow = self.keycard_storage_button.click() - # keycard_flow.confirm_pin_and_proceed() - # keycard_flow.backup_seed_phrase() - # else: - # self.next_button.click() - # self.create_password_input.send_keys(password) - # self.confirm_your_password_input.send_keys(password) - # self.next_button.click() - # self.identifiers_button.wait_and_click(30) - if enable_notifications: - self.enable_notifications_button.wait_and_click() - for _ in range(3): - self.allow_button.click_if_shown(sec=10) - self.enable_notifications_button.click_if_shown() - if self.chats_tab.is_element_displayed(): - break - else: - self.maybe_later_button.wait_and_click() - for _ in range(3): - self.maybe_later_button.click_if_shown() - if self.chats_tab.is_element_displayed(): - break self.chats_tab.wait_for_visibility_of_element(30) self.driver.info("## New multiaccount is created successfully!", device=False) - return self.get_home_view() + home_view = self.get_home_view() + if enable_notifications: + profile_view = home_view.profile_button.click() + profile_view.switch_push_notifications() + profile_view.click_system_back_button(times=2) + return home_view - def recover_access(self, passphrase: str, password: str = common_password, keycard=False, - enable_notifications=False, second_user=False, username='Restore user', set_image=False, - after_sync_code=False): - self.driver.info("## Recover access(password:%s, keycard:%s)" % (password, str(keycard)), device=False) + def recover_access(self, passphrase: str, password: str = common_password, enable_notifications=False, + second_user=False, username='Restore user', set_image=False, after_sync_code=False): + self.driver.info("## Recover access (password:%s)" % password, device=False) if not after_sync_code: if not second_user: @@ -304,22 +278,13 @@ class SignInView(BaseView): if not after_sync_code: self.set_profile(username, set_image) self.set_password(password) - if enable_notifications: - self.enable_notifications_button.wait_and_click() - for _ in range(3): - self.allow_button.click_if_shown(sec=10) - self.enable_notifications_button.click_if_shown() - if self.chats_tab.is_element_displayed(): - break - else: - self.maybe_later_button.wait_and_click() - for _ in range(3): - self.maybe_later_button.click_if_shown() - if self.chats_tab.is_element_displayed(): - break self.chats_tab.wait_for_visibility_of_element(30) self.driver.info("## Multiaccount is recovered successfully!", device=False) - return self.get_home_view() + home_view = self.get_home_view() + if enable_notifications: + profile_view = home_view.profile_button.click() + profile_view.switch_push_notifications() + return home_view def sync_profile(self, sync_code: str, first_user: bool = True): if first_user: