From e8d225db8b7aa5f393cb23f24c1c0f485ad9daa9 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Tue, 26 Dec 2023 19:48:42 +0300 Subject: [PATCH] chore: try to use exists method for modal --- gui/screens/onboarding.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gui/screens/onboarding.py b/gui/screens/onboarding.py index 7948605..535ba2a 100755 --- a/gui/screens/onboarding.py +++ b/gui/screens/onboarding.py @@ -313,8 +313,8 @@ class YourProfileView(OnboardingView): def next(self, attempts: int = 2) -> 'YourEmojihashAndIdenticonRingView': self._next_button.click() try: - return YourEmojihashAndIdenticonRingView().wait_until_appears() - except AssertionError as err: + return YourEmojihashAndIdenticonRingView().wait_to_be_present() + except Exception as err: if attempts: return self.next(attempts - 1) else: @@ -387,7 +387,6 @@ class YourEmojihashAndIdenticonRingView(OnboardingView): ) return self.profile_image.has_text(text, constants.tesseract.text_on_profile_image, crop=crop) - @allure.step @allure.step('Verify: User image background color') def is_user_image_background_white(self): crop = driver.UiTypes.ScreenRectangle( @@ -395,6 +394,15 @@ class YourEmojihashAndIdenticonRingView(OnboardingView): ) return self.profile_image.has_color(constants.Color.WHITE, crop=crop) + @allure.step + def wait_to_be_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + try: + driver.waitForObjectExists(self.real_name, timeout_msec) + LOG.info('%s: is present', self) + return self + except Exception as ex: + raise ex + class CreatePasswordView(OnboardingView):